From 03c9d4b724f1ab00af4fd8c61bfa35881cdaecf4 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Mon, 11 Nov 2024 09:20:06 -0500 Subject: [PATCH 1/4] Add unified state enum class to utility --- include/boost/crypt/hash/hasher_state.hpp | 24 ------------------- include/boost/crypt/utility/state.hpp | 29 +++++++++++++++++++++++ 2 files changed, 29 insertions(+), 24 deletions(-) delete mode 100644 include/boost/crypt/hash/hasher_state.hpp create mode 100644 include/boost/crypt/utility/state.hpp diff --git a/include/boost/crypt/hash/hasher_state.hpp b/include/boost/crypt/hash/hasher_state.hpp deleted file mode 100644 index 21814096..00000000 --- a/include/boost/crypt/hash/hasher_state.hpp +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2024 Matt Borland -// Distributed under the Boost Software License, Version 1.0. -// https://www.boost.org/LICENSE_1_0.txt - -#ifndef BOOST_CRYPT_HASH_HASHER_STATE_HPP -#define BOOST_CRYPT_HASH_HASHER_STATE_HPP - -#include - -namespace boost { -namespace crypt { - -BOOST_CRYPT_EXPORT enum class hasher_state : boost::crypt::uint8_t -{ - success, // no issues - null, // nullptr as parameter - input_too_long, // input data too long (exceeded size_t) - state_error // added more input after get_digest without re-init -}; - -} // namespace crypt -} // namespace boost - -#endif // BOOST_CRYPT_HASH_HASHER_STATE_HPP diff --git a/include/boost/crypt/utility/state.hpp b/include/boost/crypt/utility/state.hpp new file mode 100644 index 00000000..0cefee5b --- /dev/null +++ b/include/boost/crypt/utility/state.hpp @@ -0,0 +1,29 @@ +// Copyright 2024 Matt Borland +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + +#ifndef BOOST_CRYPT_HASH_HASHER_STATE_HPP +#define BOOST_CRYPT_HASH_HASHER_STATE_HPP + +#include + +namespace boost { +namespace crypt { + +BOOST_CRYPT_EXPORT enum class state : boost::crypt::uint8_t +{ + success, // no issues + null, // nullptr as parameter + input_too_long, // input data too long (exceeded size_t) + insufficient_entropy, // Entropy + Nonce length was not at least 3/2 security strength + out_of_memory, // Memory exhaustion reported by a function + requires_reseed, // The number of cycles has exceeded the specified amount + uninitialized, // Random bits can not be provided since the generator is uninitialized + requested_too_many_bits, // 2^19 bits is all that's allowed per request + state_error // added more input after get_digest without re-init +}; + +} // namespace crypt +} // namespace boost + +#endif // BOOST_CRYPT_HASH_HASHER_STATE_HPP From f108f9be733203f83b926a0eb8d798d4b87525b8 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Mon, 11 Nov 2024 09:25:54 -0500 Subject: [PATCH 2/4] Add state to docs --- doc/crypt/hasher_state.adoc | 37 ----------------------------- doc/crypt/state.adoc | 46 +++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 37 deletions(-) delete mode 100644 doc/crypt/hasher_state.adoc create mode 100644 doc/crypt/state.adoc diff --git a/doc/crypt/hasher_state.adoc b/doc/crypt/hasher_state.adoc deleted file mode 100644 index 483644d3..00000000 --- a/doc/crypt/hasher_state.adoc +++ /dev/null @@ -1,37 +0,0 @@ -//// -Copyright 2024 Matt Borland -Distributed under the Boost Software License, Version 1.0. -https://www.boost.org/LICENSE_1_0.txt -//// - -[#hasher_state] -:idprefix: hasher_state_ - -= Hasher State - -The hasher state `enum class` allows you to verify the validity of the state of a hasher object. -The following are the possible states: - -- `success` - The hasher is proceeding without issue -- `null` - A null pointer was passed to hasher -- `input_too_long` - The number of bytes passed to the hasher object has exceeded the range of `size_t` -- `state_error` - This occurs if hasher object was not reinitialized after calling `.get_digest()`. The simple solution is to call `.init()` and try again. - -[source, c++] ----- - -namespace boost { -namespace crypt { - -enum class hasher_state : boost::crypt::uint8_t -{ - success, // no issues - null, // nullptr as parameter - input_too_long, // input data too long (exceeded size_t) - state_error // added more input after get_digest without re-init -}; - -} // namespace crypt -} // namespace boost - ----- diff --git a/doc/crypt/state.adoc b/doc/crypt/state.adoc new file mode 100644 index 00000000..e2e7f1f3 --- /dev/null +++ b/doc/crypt/state.adoc @@ -0,0 +1,46 @@ +//// +Copyright 2024 Matt Borland +Distributed under the Boost Software License, Version 1.0. +https://www.boost.org/LICENSE_1_0.txt +//// + +[#state] +:idprefix: state_ + += State + +The state `enum class` allows you to verify the validity of the state of an object. +The following are the possible states: + +- `success` - The hasher is proceeding without issue +- `null` - A null pointer was passed to hasher +- `input_too_long` - The number of bytes passed to the hasher object has exceeded the range of `size_t` +- `insufficient_entropy` - The input entropy + nonce length is not at least 3/2 security strength +- `out_of_memory` - `ENOMEM` returned by memory allocation +- `requires_reseed` - The number of cycles an object has been used exceeded the design amount +- `uninitialized` - An object has not been initialized properly before use +- `state_error` - A misuse has occurred such as a hasher object was not reinitialized after calling `.get_digest()`. The simple solution is to call `.init()` and try again. + +[source, c++] +---- + +namespace boost { +namespace crypt { + +enum class state : boost::crypt::uint8_t +{ + success, // no issues + null, // nullptr as parameter + input_too_long, // input data too long (exceeded size_t) + insufficient_entropy, // Entropy + Nonce length was not at least 3/2 security strength + out_of_memory, // Memory exhaustion reported by a function + requires_reseed, // The number of cycles has exceeded the specified amount + uninitialized, // Random bits can not be provided since the generator is uninitialized + requested_too_many_bits, // 2^19 bits is all that's allowed per request + state_error // added more input after get_digest without re-init +}; + +} // namespace crypt +} // namespace boost + +---- From e3683436a5783d2b6cd3077e48897a711590c1a9 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Mon, 11 Nov 2024 09:26:13 -0500 Subject: [PATCH 3/4] Update useage of new states --- include/boost/crypt/drbg/hmac_drbg.hpp | 84 ++++++++----------- .../crypt/hash/detail/hasher_base_512.hpp | 64 +++++++------- .../crypt/hash/detail/sha224_256_hasher.hpp | 2 +- include/boost/crypt/hash/detail/sha3_base.hpp | 62 +++++++------- .../boost/crypt/hash/detail/sha512_base.hpp | 64 +++++++------- include/boost/crypt/hash/hmac.hpp | 48 +++++------ include/boost/crypt/hash/md5.hpp | 2 +- include/boost/crypt/hash/sha1.hpp | 2 +- test/test_hmac.cpp | 16 ++-- test/test_hmac_drbg.cpp | 16 ++-- test/test_md5.cpp | 14 ++-- test/test_sha1.cpp | 14 ++-- test/test_sha224.cpp | 20 ++--- test/test_sha256.cpp | 20 ++--- test/test_sha384.cpp | 20 ++--- test/test_sha3_224.cpp | 20 ++--- test/test_sha3_256.cpp | 20 ++--- test/test_sha3_384.cpp | 20 ++--- test/test_sha3_512.cpp | 20 ++--- test/test_sha512.cpp | 20 ++--- test/test_sha512_224.cpp | 20 ++--- test/test_sha512_256.cpp | 20 ++--- test/test_shake128.cpp | 20 ++--- test/test_shake256.cpp | 20 ++--- 24 files changed, 309 insertions(+), 319 deletions(-) diff --git a/include/boost/crypt/drbg/hmac_drbg.hpp b/include/boost/crypt/drbg/hmac_drbg.hpp index 4639f825..d6033b7c 100644 --- a/include/boost/crypt/drbg/hmac_drbg.hpp +++ b/include/boost/crypt/drbg/hmac_drbg.hpp @@ -7,7 +7,7 @@ #include #include -#include +#include #include #include #include @@ -59,10 +59,10 @@ class hmac_drbg template BOOST_CRYPT_GPU_ENABLED inline auto update_impl(ForwardIter1 provided_data, boost::crypt::size_t provided_data_size, - ForwardIter2 storage, boost::crypt::size_t storage_size) noexcept -> drbg_state; + ForwardIter2 storage, boost::crypt::size_t storage_size) noexcept -> state; template - BOOST_CRYPT_GPU_ENABLED inline auto update(ForwardIter provided_data, boost::crypt::size_t size) noexcept -> drbg_state; + BOOST_CRYPT_GPU_ENABLED inline auto update(ForwardIter provided_data, boost::crypt::size_t size) noexcept -> state; public: @@ -71,22 +71,22 @@ class hmac_drbg template BOOST_CRYPT_GPU_ENABLED inline auto init(ForwardIter1 entropy, boost::crypt::size_t entropy_size, ForwardIter2 nonce = nullptr, boost::crypt::size_t nonce_size = 0, - ForwardIter3 personalization = nullptr, boost::crypt::size_t personalization_size = 0) noexcept -> drbg_state; + ForwardIter3 personalization = nullptr, boost::crypt::size_t personalization_size = 0) noexcept -> state; template BOOST_CRYPT_GPU_ENABLED inline auto reseed(ForwardIter1 entropy, boost::crypt::size_t entropy_size, - ForwardIter2 additional_input = nullptr, boost::crypt::size_t additional_input_size = 0) noexcept -> drbg_state; + ForwardIter2 additional_input = nullptr, boost::crypt::size_t additional_input_size = 0) noexcept -> state; template = true> BOOST_CRYPT_GPU_ENABLED inline auto generate(ForwardIter1 data, boost::crypt::size_t requested_bits, - ForwardIter2 additional_data = nullptr, boost::crypt::size_t additional_data_size = 0) noexcept -> drbg_state; + ForwardIter2 additional_data = nullptr, boost::crypt::size_t additional_data_size = 0) noexcept -> state; }; template template auto hmac_drbg::update_impl( ForwardIter1 provided_data, boost::crypt::size_t provided_data_size, - ForwardIter2 storage, boost::crypt::size_t storage_size) noexcept -> drbg_state + ForwardIter2 storage, boost::crypt::size_t storage_size) noexcept -> state { BOOST_CRYPT_ASSERT(value_.size() + 1U + provided_data_size <= storage_size); static_cast(storage_size); @@ -128,13 +128,13 @@ auto hmac_drbg::up value_ = hmac.get_digest(); } - return drbg_state::success; + return state::success; } template template inline auto hmac_drbg::update( - ForwardIter provided_data, boost::crypt::size_t size) noexcept -> drbg_state + ForwardIter provided_data, boost::crypt::size_t size) noexcept -> state { // Still need to process even with null pointer if (utility::is_null(provided_data)) @@ -172,7 +172,7 @@ inline auto hmac_drbg inline auto hmac_drbg::init( ForwardIter1 entropy, boost::crypt::size_t entropy_size, ForwardIter2 nonce, boost::crypt::size_t nonce_size, - ForwardIter3 personalization, boost::crypt::size_t personalization_size) noexcept -> drbg_state + ForwardIter3 personalization, boost::crypt::size_t personalization_size) noexcept -> state { // Nonce is to be at least >= 0.5 * max_hasher_security // Unless entropy + nonce >= 1.5 * max_hasher_security if (utility::is_null(entropy) || entropy_size == 0U) { - return drbg_state::null; + return state::null; } if (utility::is_null(nonce) || nonce_size == 0U) @@ -205,7 +205,7 @@ inline auto hmac_drbg max_length) + else if (BOOST_CRYPT_UNLIKELY(entropy_size > max_length || + nonce_size > max_length || + personalization_size > max_length)) { - return drbg_state::entropy_too_long; // LCOV_EXCL_LINE - } - else if (nonce_size > max_length) - { - return drbg_state::nonce_too_long; // LCOV_EXCL_LINE - } - else if (personalization_size > max_length) - { - return drbg_state::personalization_too_long; // LCOV_EXCL_LINE + return state::input_too_long; // LCOV_EXCL_LINE } else { @@ -277,7 +271,7 @@ inline auto hmac_drbg template auto hmac_drbg::reseed( ForwardIter1 entropy, boost::crypt::size_t entropy_size, - ForwardIter2 additional_input, boost::crypt::size_t additional_input_size) noexcept -> drbg_state + ForwardIter2 additional_input, boost::crypt::size_t additional_input_size) noexcept -> state { constexpr auto min_reseed_entropy {max_hasher_security / 8U}; if (utility::is_null(entropy) || entropy_size == 0U) { - return drbg_state::null; + return state::null; } if (entropy_size < min_reseed_entropy) { - return drbg_state::insufficient_entropy; + return state::insufficient_entropy; } if (utility::is_null(additional_input)) { @@ -351,18 +345,14 @@ auto hmac_drbg::re BOOST_CRYPT_ASSERT(offset == seed_material_size); const auto update_result {update(seed_material, seed_material_size)}; - if (update_result != drbg_state::success) + if (update_result != state::success) { return update_result; } } - else if (entropy_size > max_length) - { - return drbg_state::entropy_too_long; - } - else if (additional_input_size > max_length) + else if (entropy_size > max_length || additional_input_size > max_length) { - return drbg_state::personalization_too_long; + return state::input_too_long; } else { @@ -376,7 +366,7 @@ auto hmac_drbg::re if (seed_material == nullptr) { - return drbg_state::out_of_memory; // LCOV_EXCL_LINE + return state::out_of_memory; // LCOV_EXCL_LINE } boost::crypt::size_t offset {}; @@ -396,39 +386,39 @@ auto hmac_drbg::re cudaFree(seed_material); #endif - if (update_return != drbg_state::success) + if (update_return != state::success) { return update_return; } } reseed_counter_ = 1U; - return drbg_state::success; + return state::success; } template template > auto hmac_drbg::generate( ForwardIter1 data, boost::crypt::size_t requested_bits, - ForwardIter2 additional_data, boost::crypt::size_t additional_data_size) noexcept -> drbg_state + ForwardIter2 additional_data, boost::crypt::size_t additional_data_size) noexcept -> state { if (reseed_counter_ > reseed_interval) { - return drbg_state::requires_reseed; + return state::requires_reseed; } if (utility::is_null(data)) { - return drbg_state::null; + return state::null; } if (!initialized_) { - return drbg_state::uninitialized; + return state::uninitialized; } const boost::crypt::size_t requested_bytes {requested_bits / 8U}; if (requested_bytes > max_bytes_per_request) { - return drbg_state::requested_too_many_bits; + return state::requested_too_many_bits; } if (utility::is_null(additional_data)) @@ -439,7 +429,7 @@ auto hmac_drbg::ge { if (additional_data_size > max_length) { - return drbg_state::personalization_too_long; + return state::input_too_long; } update(additional_data, additional_data_size); } @@ -474,7 +464,7 @@ auto hmac_drbg::ge update(additional_data, additional_data_size); ++reseed_counter_; - return drbg_state::success; + return state::success; } template diff --git a/include/boost/crypt/hash/detail/hasher_base_512.hpp b/include/boost/crypt/hash/detail/hasher_base_512.hpp index 4b2ac5ec..50aef653 100644 --- a/include/boost/crypt/hash/detail/hasher_base_512.hpp +++ b/include/boost/crypt/hash/detail/hasher_base_512.hpp @@ -5,7 +5,7 @@ #ifndef BOOST_CRYPT_HASH_DETAIL_HASHER_BASE_512_HPP #define BOOST_CRYPT_HASH_DETAIL_HASHER_BASE_512_HPP -#include +#include #include #include #include @@ -46,7 +46,7 @@ class hasher_base_512 BOOST_CRYPT_GPU_ENABLED constexpr auto pad_message() noexcept -> void; template - BOOST_CRYPT_GPU_ENABLED constexpr auto update(ForwardIter data, boost::crypt::size_t size) noexcept -> hasher_state; + BOOST_CRYPT_GPU_ENABLED constexpr auto update(ForwardIter data, boost::crypt::size_t size) noexcept -> state; boost::crypt::array intermediate_hash_ {}; boost::crypt::array buffer_ {}; @@ -63,40 +63,40 @@ class hasher_base_512 BOOST_CRYPT_GPU_ENABLED constexpr auto base_init() noexcept -> void; template - BOOST_CRYPT_GPU_ENABLED constexpr auto process_byte(ByteType byte) noexcept -> hasher_state; + BOOST_CRYPT_GPU_ENABLED constexpr auto process_byte(ByteType byte) noexcept -> state; template ::value_type) == 1, bool> = true> - BOOST_CRYPT_GPU_ENABLED constexpr auto process_bytes(ForwardIter buffer, boost::crypt::size_t byte_count) noexcept -> hasher_state; + BOOST_CRYPT_GPU_ENABLED constexpr auto process_bytes(ForwardIter buffer, boost::crypt::size_t byte_count) noexcept -> state; template ::value_type) == 2, bool> = true> - BOOST_CRYPT_GPU_ENABLED constexpr auto process_bytes(ForwardIter buffer, boost::crypt::size_t byte_count) noexcept -> hasher_state; + BOOST_CRYPT_GPU_ENABLED constexpr auto process_bytes(ForwardIter buffer, boost::crypt::size_t byte_count) noexcept -> state; template ::value_type) == 4, bool> = true> - BOOST_CRYPT_GPU_ENABLED constexpr auto process_bytes(ForwardIter buffer, boost::crypt::size_t byte_count) noexcept -> hasher_state; + BOOST_CRYPT_GPU_ENABLED constexpr auto process_bytes(ForwardIter buffer, boost::crypt::size_t byte_count) noexcept -> state; #ifdef BOOST_CRYPT_HAS_STRING_VIEW - constexpr auto process_bytes(std::string_view str) noexcept -> hasher_state; + constexpr auto process_bytes(std::string_view str) noexcept -> state; - constexpr auto process_bytes(std::u16string_view str) noexcept -> hasher_state; + constexpr auto process_bytes(std::u16string_view str) noexcept -> state; - constexpr auto process_bytes(std::u32string_view str) noexcept -> hasher_state; + constexpr auto process_bytes(std::u32string_view str) noexcept -> state; - constexpr auto process_bytes(std::wstring_view str) noexcept -> hasher_state; + constexpr auto process_bytes(std::wstring_view str) noexcept -> state; #endif // BOOST_CRYPT_HAS_STRING_VIEW #ifdef BOOST_CRYPT_HAS_SPAN template - constexpr auto process_bytes(std::span data) noexcept -> hasher_state; + constexpr auto process_bytes(std::span data) noexcept -> state; #endif // BOOST_CRYPT_HAS_SPAN #ifdef BOOST_CRYPT_HAS_CUDA template - BOOST_CRYPT_GPU_ENABLED constexpr auto process_bytes(cuda::std::span data) noexcept -> hasher_state; + BOOST_CRYPT_GPU_ENABLED constexpr auto process_bytes(cuda::std::span data) noexcept -> state; #endif // BOOST_CRYPT_HAS_CUDA @@ -116,7 +116,7 @@ BOOST_CRYPT_GPU_ENABLED constexpr auto hasher_base_512 template -BOOST_CRYPT_GPU_ENABLED constexpr auto hasher_base_512::process_byte(ByteType byte) noexcept -> hasher_state +BOOST_CRYPT_GPU_ENABLED constexpr auto hasher_base_512::process_byte(ByteType byte) noexcept -> state { static_assert(boost::crypt::is_convertible_v, "Byte must be convertible to uint8_t"); const auto value {static_cast(byte)}; @@ -125,7 +125,7 @@ BOOST_CRYPT_GPU_ENABLED constexpr auto hasher_base_512 template ::value_type) == 1, bool>> -BOOST_CRYPT_GPU_ENABLED constexpr auto hasher_base_512::process_bytes(ForwardIter buffer, boost::crypt::size_t byte_count) noexcept -> hasher_state +BOOST_CRYPT_GPU_ENABLED constexpr auto hasher_base_512::process_bytes(ForwardIter buffer, boost::crypt::size_t byte_count) noexcept -> state { if (!utility::is_null(buffer)) { @@ -133,13 +133,13 @@ BOOST_CRYPT_GPU_ENABLED constexpr auto hasher_base_512 template ::value_type) == 2, bool>> -BOOST_CRYPT_GPU_ENABLED constexpr auto hasher_base_512::process_bytes(ForwardIter buffer, boost::crypt::size_t byte_count) noexcept -> hasher_state +BOOST_CRYPT_GPU_ENABLED constexpr auto hasher_base_512::process_bytes(ForwardIter buffer, boost::crypt::size_t byte_count) noexcept -> state { #ifndef BOOST_CRYPT_HAS_CUDA @@ -151,7 +151,7 @@ BOOST_CRYPT_GPU_ENABLED constexpr auto hasher_base_512 template ::value_type) == 4, bool>> -BOOST_CRYPT_GPU_ENABLED constexpr auto hasher_base_512::process_bytes(ForwardIter buffer, boost::crypt::size_t byte_count) noexcept -> hasher_state +BOOST_CRYPT_GPU_ENABLED constexpr auto hasher_base_512::process_bytes(ForwardIter buffer, boost::crypt::size_t byte_count) noexcept -> state { #ifndef BOOST_CRYPT_HAS_CUDA @@ -183,7 +183,7 @@ BOOST_CRYPT_GPU_ENABLED constexpr auto hasher_base_512 template -BOOST_CRYPT_GPU_ENABLED constexpr auto hasher_base_512::update(ForwardIter data, boost::crypt::size_t size) noexcept -> hasher_state +BOOST_CRYPT_GPU_ENABLED constexpr auto hasher_base_512::update(ForwardIter data, boost::crypt::size_t size) noexcept -> state { if (size == 0U) { - return hasher_state::success; + return state::success; } if (computed) { @@ -290,7 +290,7 @@ BOOST_CRYPT_GPU_ENABLED constexpr auto hasher_base_512 -constexpr auto hasher_base_512::process_bytes(std::string_view str) noexcept -> hasher_state +constexpr auto hasher_base_512::process_bytes(std::string_view str) noexcept -> state { return process_bytes(str.begin(), str.size()); } template -constexpr auto hasher_base_512::process_bytes(std::u16string_view str) noexcept -> hasher_state +constexpr auto hasher_base_512::process_bytes(std::u16string_view str) noexcept -> state { return process_bytes(str.begin(), str.size()); } template -constexpr auto hasher_base_512::process_bytes(std::u32string_view str) noexcept -> hasher_state +constexpr auto hasher_base_512::process_bytes(std::u32string_view str) noexcept -> state { return process_bytes(str.begin(), str.size()); } template -constexpr auto hasher_base_512::process_bytes(std::wstring_view str) noexcept -> hasher_state +constexpr auto hasher_base_512::process_bytes(std::wstring_view str) noexcept -> state { return process_bytes(str.begin(), str.size()); } @@ -355,7 +355,7 @@ constexpr auto hasher_base_512::pr template template -constexpr auto hasher_base_512::process_bytes(std::span data) noexcept -> hasher_state +constexpr auto hasher_base_512::process_bytes(std::span data) noexcept -> state { return process_bytes(data.begin(), data.size()); } @@ -366,7 +366,7 @@ constexpr auto hasher_base_512::pr template template -BOOST_CRYPT_GPU_ENABLED constexpr auto hasher_base_512::process_bytes(cuda::std::span data) noexcept -> hasher_state +BOOST_CRYPT_GPU_ENABLED constexpr auto hasher_base_512::process_bytes(cuda::std::span data) noexcept -> state { return process_bytes(data.begin(), data.size()); } diff --git a/include/boost/crypt/hash/detail/sha224_256_hasher.hpp b/include/boost/crypt/hash/detail/sha224_256_hasher.hpp index 7840bd31..df368a5d 100644 --- a/include/boost/crypt/hash/detail/sha224_256_hasher.hpp +++ b/include/boost/crypt/hash/detail/sha224_256_hasher.hpp @@ -9,7 +9,7 @@ #define BOOST_CRYPT_HASH_DETAIL_SHA224_256_HASHER_HPP #include -#include +#include #include #include #include diff --git a/include/boost/crypt/hash/detail/sha3_base.hpp b/include/boost/crypt/hash/detail/sha3_base.hpp index 6e4a4659..a6fd9c53 100644 --- a/include/boost/crypt/hash/detail/sha3_base.hpp +++ b/include/boost/crypt/hash/detail/sha3_base.hpp @@ -7,7 +7,7 @@ #ifndef BOOST_CRYPT_HASH_DETAIL_SHA3_BASE_HPP #define BOOST_CRYPT_HASH_DETAIL_SHA3_BASE_HPP -#include +#include #include #include #include @@ -52,7 +52,7 @@ class sha3_base bool corrupted_ {}; template - BOOST_CRYPT_GPU_ENABLED constexpr auto update(ForwardIterator data, boost::crypt::size_t size) noexcept -> hasher_state; + BOOST_CRYPT_GPU_ENABLED constexpr auto update(ForwardIterator data, boost::crypt::size_t size) noexcept -> state; BOOST_CRYPT_GPU_ENABLED constexpr auto process_message_block() noexcept -> void; @@ -68,40 +68,40 @@ class sha3_base BOOST_CRYPT_GPU_ENABLED constexpr auto init() noexcept -> void; template - BOOST_CRYPT_GPU_ENABLED constexpr auto process_byte(ByteType byte) noexcept -> hasher_state; + BOOST_CRYPT_GPU_ENABLED constexpr auto process_byte(ByteType byte) noexcept -> state; template ::value_type) == 1, bool> = true> - BOOST_CRYPT_GPU_ENABLED constexpr auto process_bytes(ForwardIter buffer, boost::crypt::size_t byte_count) noexcept -> hasher_state; + BOOST_CRYPT_GPU_ENABLED constexpr auto process_bytes(ForwardIter buffer, boost::crypt::size_t byte_count) noexcept -> state; template ::value_type) == 2, bool> = true> - BOOST_CRYPT_GPU_ENABLED constexpr auto process_bytes(ForwardIter buffer, boost::crypt::size_t byte_count) noexcept -> hasher_state; + BOOST_CRYPT_GPU_ENABLED constexpr auto process_bytes(ForwardIter buffer, boost::crypt::size_t byte_count) noexcept -> state; template ::value_type) == 4, bool> = true> - BOOST_CRYPT_GPU_ENABLED constexpr auto process_bytes(ForwardIter buffer, boost::crypt::size_t byte_count) noexcept -> hasher_state; + BOOST_CRYPT_GPU_ENABLED constexpr auto process_bytes(ForwardIter buffer, boost::crypt::size_t byte_count) noexcept -> state; #ifdef BOOST_CRYPT_HAS_STRING_VIEW - constexpr auto process_bytes(std::string_view str) noexcept -> hasher_state; + constexpr auto process_bytes(std::string_view str) noexcept -> state; - constexpr auto process_bytes(std::u16string_view str) noexcept -> hasher_state; + constexpr auto process_bytes(std::u16string_view str) noexcept -> state; - constexpr auto process_bytes(std::u32string_view str) noexcept -> hasher_state; + constexpr auto process_bytes(std::u32string_view str) noexcept -> state; - constexpr auto process_bytes(std::wstring_view str) noexcept -> hasher_state; + constexpr auto process_bytes(std::wstring_view str) noexcept -> state; #endif // BOOST_CRYPT_HAS_STRING_VIEW #ifdef BOOST_CRYPT_HAS_SPAN template - constexpr auto process_bytes(std::span data) noexcept -> hasher_state; + constexpr auto process_bytes(std::span data) noexcept -> state; #endif // BOOST_CRYPT_HAS_SPAN #ifdef BOOST_CRYPT_HAS_CUDA template - BOOST_CRYPT_GPU_ENABLED constexpr auto process_bytes(cuda::std::span data) noexcept -> hasher_state; + BOOST_CRYPT_GPU_ENABLED constexpr auto process_bytes(cuda::std::span data) noexcept -> state; #endif // BOOST_CRYPT_HAS_CUDA @@ -126,11 +126,11 @@ BOOST_CRYPT_GPU_ENABLED constexpr auto sha3_base::init() no template template -BOOST_CRYPT_GPU_ENABLED constexpr auto sha3_base::update(ForwardIterator data, boost::crypt::size_t size) noexcept -> hasher_state +BOOST_CRYPT_GPU_ENABLED constexpr auto sha3_base::update(ForwardIterator data, boost::crypt::size_t size) noexcept -> state { if (size == 0U) { - return hasher_state::success; + return state::success; } if (computed_) { @@ -138,7 +138,7 @@ BOOST_CRYPT_GPU_ENABLED constexpr auto sha3_base::update(Fo } if (corrupted_) { - return hasher_state::state_error; + return state::state_error; } while (size--) @@ -162,7 +162,7 @@ BOOST_CRYPT_GPU_ENABLED constexpr auto sha3_base::update(Fo ++data; } - return hasher_state::success; + return state::success; } namespace sha3_detail { @@ -457,7 +457,7 @@ BOOST_CRYPT_GPU_ENABLED constexpr auto sha3_base::get_diges template template -constexpr auto sha3_base::process_byte(ByteType byte) noexcept -> hasher_state +constexpr auto sha3_base::process_byte(ByteType byte) noexcept -> state { static_assert(boost::crypt::is_convertible_v, "Byte must be convertible to uint8_t"); const auto value {static_cast(byte)}; @@ -466,7 +466,7 @@ constexpr auto sha3_base::process_byte(ByteType byte) noexc template template ::value_type) == 1, bool>> -constexpr auto sha3_base::process_bytes(ForwardIter buffer, boost::crypt::size_t byte_count) noexcept -> hasher_state +constexpr auto sha3_base::process_bytes(ForwardIter buffer, boost::crypt::size_t byte_count) noexcept -> state { if (!utility::is_null(buffer)) { @@ -474,13 +474,13 @@ constexpr auto sha3_base::process_bytes(ForwardIter buffer, } else { - return hasher_state::null; + return state::null; } } template template ::value_type) == 2, bool>> -constexpr auto sha3_base::process_bytes(ForwardIter buffer, boost::crypt::size_t byte_count) noexcept -> hasher_state +constexpr auto sha3_base::process_bytes(ForwardIter buffer, boost::crypt::size_t byte_count) noexcept -> state { #ifndef BOOST_CRYPT_HAS_CUDA @@ -492,7 +492,7 @@ constexpr auto sha3_base::process_bytes(ForwardIter buffer, } else { - return hasher_state::null; + return state::null; } #else @@ -504,7 +504,7 @@ constexpr auto sha3_base::process_bytes(ForwardIter buffer, } else { - return hasher_state::null; + return state::null; } #endif @@ -512,7 +512,7 @@ constexpr auto sha3_base::process_bytes(ForwardIter buffer, template template ::value_type) == 4, bool>> -constexpr auto sha3_base::process_bytes(ForwardIter buffer, boost::crypt::size_t byte_count) noexcept -> hasher_state +constexpr auto sha3_base::process_bytes(ForwardIter buffer, boost::crypt::size_t byte_count) noexcept -> state { #ifndef BOOST_CRYPT_HAS_CUDA @@ -524,7 +524,7 @@ constexpr auto sha3_base::process_bytes(ForwardIter buffer, } else { - return hasher_state::null; + return state::null; } #else @@ -536,7 +536,7 @@ constexpr auto sha3_base::process_bytes(ForwardIter buffer, } else { - return hasher_state::null; + return state::null; } #endif @@ -545,25 +545,25 @@ constexpr auto sha3_base::process_bytes(ForwardIter buffer, #ifdef BOOST_CRYPT_HAS_STRING_VIEW template -constexpr auto sha3_base::process_bytes(std::string_view str) noexcept -> hasher_state +constexpr auto sha3_base::process_bytes(std::string_view str) noexcept -> state { return process_bytes(str.begin(), str.size()); } template -constexpr auto sha3_base::process_bytes(std::u16string_view str) noexcept -> hasher_state +constexpr auto sha3_base::process_bytes(std::u16string_view str) noexcept -> state { return process_bytes(str.begin(), str.size()); } template -constexpr auto sha3_base::process_bytes(std::u32string_view str) noexcept -> hasher_state +constexpr auto sha3_base::process_bytes(std::u32string_view str) noexcept -> state { return process_bytes(str.begin(), str.size()); } template -constexpr auto sha3_base::process_bytes(std::wstring_view str) noexcept -> hasher_state +constexpr auto sha3_base::process_bytes(std::wstring_view str) noexcept -> state { return process_bytes(str.begin(), str.size()); } @@ -574,7 +574,7 @@ constexpr auto sha3_base::process_bytes(std::wstring_view s template template -constexpr auto sha3_base::process_bytes(std::span data) noexcept -> hasher_state +constexpr auto sha3_base::process_bytes(std::span data) noexcept -> state { return process_bytes(data.begin(), data.size()); } @@ -585,7 +585,7 @@ constexpr auto sha3_base::process_bytes(std::span template -BOOST_CRYPT_GPU_ENABLED constexpr auto sha3_base::process_bytes(cuda::std::span data) noexcept -> hasher_state +BOOST_CRYPT_GPU_ENABLED constexpr auto sha3_base::process_bytes(cuda::std::span data) noexcept -> state { return process_bytes(data.begin(), data.size()); } diff --git a/include/boost/crypt/hash/detail/sha512_base.hpp b/include/boost/crypt/hash/detail/sha512_base.hpp index 0f403371..fa122152 100644 --- a/include/boost/crypt/hash/detail/sha512_base.hpp +++ b/include/boost/crypt/hash/detail/sha512_base.hpp @@ -8,7 +8,7 @@ #ifndef BOOST_CRYPT_HASH_DETAIL_SHA512_BASE_HPP #define BOOST_CRYPT_HASH_DETAIL_SHA512_BASE_HPP -#include +#include #include #include #include @@ -67,7 +67,7 @@ class sha512_base final BOOST_CRYPT_GPU_ENABLED constexpr auto pad_message() noexcept -> void; template - BOOST_CRYPT_GPU_ENABLED constexpr auto update(ForwardIter data, boost::crypt::size_t size) noexcept -> hasher_state; + BOOST_CRYPT_GPU_ENABLED constexpr auto update(ForwardIter data, boost::crypt::size_t size) noexcept -> state; public: @@ -78,40 +78,40 @@ class sha512_base final BOOST_CRYPT_GPU_ENABLED constexpr auto init() noexcept -> void; template - BOOST_CRYPT_GPU_ENABLED constexpr auto process_byte(ByteType byte) noexcept -> hasher_state; + BOOST_CRYPT_GPU_ENABLED constexpr auto process_byte(ByteType byte) noexcept -> state; template ::value_type) == 1, bool> = true> - BOOST_CRYPT_GPU_ENABLED constexpr auto process_bytes(ForwardIter buffer, boost::crypt::size_t byte_count) noexcept -> hasher_state; + BOOST_CRYPT_GPU_ENABLED constexpr auto process_bytes(ForwardIter buffer, boost::crypt::size_t byte_count) noexcept -> state; template ::value_type) == 2, bool> = true> - BOOST_CRYPT_GPU_ENABLED constexpr auto process_bytes(ForwardIter buffer, boost::crypt::size_t byte_count) noexcept -> hasher_state; + BOOST_CRYPT_GPU_ENABLED constexpr auto process_bytes(ForwardIter buffer, boost::crypt::size_t byte_count) noexcept -> state; template ::value_type) == 4, bool> = true> - BOOST_CRYPT_GPU_ENABLED constexpr auto process_bytes(ForwardIter buffer, boost::crypt::size_t byte_count) noexcept -> hasher_state; + BOOST_CRYPT_GPU_ENABLED constexpr auto process_bytes(ForwardIter buffer, boost::crypt::size_t byte_count) noexcept -> state; #ifdef BOOST_CRYPT_HAS_STRING_VIEW - constexpr auto process_bytes(std::string_view str) noexcept -> hasher_state; + constexpr auto process_bytes(std::string_view str) noexcept -> state; - constexpr auto process_bytes(std::u16string_view str) noexcept -> hasher_state; + constexpr auto process_bytes(std::u16string_view str) noexcept -> state; - constexpr auto process_bytes(std::u32string_view str) noexcept -> hasher_state; + constexpr auto process_bytes(std::u32string_view str) noexcept -> state; - constexpr auto process_bytes(std::wstring_view str) noexcept -> hasher_state; + constexpr auto process_bytes(std::wstring_view str) noexcept -> state; #endif // BOOST_CRYPT_HAS_STRING_VIEW #ifdef BOOST_CRYPT_HAS_SPAN template - constexpr auto process_bytes(std::span data) noexcept -> hasher_state; + constexpr auto process_bytes(std::span data) noexcept -> state; #endif // BOOST_CRYPT_HAS_SPAN #ifdef BOOST_CRYPT_HAS_CUDA template - BOOST_CRYPT_GPU_ENABLED constexpr auto process_bytes(cuda::std::span data) noexcept -> hasher_state; + BOOST_CRYPT_GPU_ENABLED constexpr auto process_bytes(cuda::std::span data) noexcept -> state; #endif // BOOST_CRYPT_HAS_CUDA @@ -120,7 +120,7 @@ class sha512_base final template template -constexpr auto sha512_base::process_byte(ByteType byte) noexcept -> hasher_state +constexpr auto sha512_base::process_byte(ByteType byte) noexcept -> state { static_assert(boost::crypt::is_convertible_v, "Byte must be convertible to uint8_t"); const auto value {static_cast(byte)}; @@ -129,7 +129,7 @@ constexpr auto sha512_base::process_byte(ByteType byte) noexcept -> template template ::value_type) == 1, bool>> -constexpr auto sha512_base::process_bytes(ForwardIter buffer, boost::crypt::size_t byte_count) noexcept -> hasher_state +constexpr auto sha512_base::process_bytes(ForwardIter buffer, boost::crypt::size_t byte_count) noexcept -> state { if (!utility::is_null(buffer)) { @@ -137,13 +137,13 @@ constexpr auto sha512_base::process_bytes(ForwardIter buffer, boost } else { - return hasher_state::null; + return state::null; } } template template ::value_type) == 2, bool>> -constexpr auto sha512_base::process_bytes(ForwardIter buffer, boost::crypt::size_t byte_count) noexcept -> hasher_state +constexpr auto sha512_base::process_bytes(ForwardIter buffer, boost::crypt::size_t byte_count) noexcept -> state { #ifndef BOOST_CRYPT_HAS_CUDA @@ -155,7 +155,7 @@ constexpr auto sha512_base::process_bytes(ForwardIter buffer, boost } else { - return hasher_state::null; + return state::null; } #else @@ -167,7 +167,7 @@ constexpr auto sha512_base::process_bytes(ForwardIter buffer, boost } else { - return hasher_state::null; + return state::null; } #endif @@ -175,7 +175,7 @@ constexpr auto sha512_base::process_bytes(ForwardIter buffer, boost template template ::value_type) == 4, bool>> -constexpr auto sha512_base::process_bytes(ForwardIter buffer, boost::crypt::size_t byte_count) noexcept -> hasher_state +constexpr auto sha512_base::process_bytes(ForwardIter buffer, boost::crypt::size_t byte_count) noexcept -> state { #ifndef BOOST_CRYPT_HAS_CUDA @@ -187,7 +187,7 @@ constexpr auto sha512_base::process_bytes(ForwardIter buffer, boost } else { - return hasher_state::null; + return state::null; } #else @@ -199,7 +199,7 @@ constexpr auto sha512_base::process_bytes(ForwardIter buffer, boost } else { - return hasher_state::null; + return state::null; } #endif @@ -456,11 +456,11 @@ constexpr auto sha512_base::process_message_block() noexcept -> voi template template -constexpr auto sha512_base::update(ForwardIter data, boost::crypt::size_t size) noexcept -> hasher_state +constexpr auto sha512_base::update(ForwardIter data, boost::crypt::size_t size) noexcept -> state { if (size == 0U) { - return hasher_state::success; + return state::success; } if (computed_) { @@ -468,7 +468,7 @@ constexpr auto sha512_base::update(ForwardIter data, boost::crypt:: } if (corrupted_) { - return hasher_state::state_error; + return state::state_error; } while (size--) @@ -485,7 +485,7 @@ constexpr auto sha512_base::update(ForwardIter data, boost::crypt:: if (BOOST_CRYPT_UNLIKELY(high_ == 0)) { corrupted_ = true; - return hasher_state::input_too_long; + return state::input_too_long; } // LCOV_EXCL_STOP } @@ -498,7 +498,7 @@ constexpr auto sha512_base::update(ForwardIter data, boost::crypt:: ++data; } - return hasher_state::success; + return state::success; } // SHA512/224 @@ -573,25 +573,25 @@ constexpr auto sha512_base::init() noexcept -> void #ifdef BOOST_CRYPT_HAS_STRING_VIEW template -constexpr auto sha512_base::process_bytes(std::string_view str) noexcept -> hasher_state +constexpr auto sha512_base::process_bytes(std::string_view str) noexcept -> state { return process_bytes(str.begin(), str.size()); } template -constexpr auto sha512_base::process_bytes(std::u16string_view str) noexcept -> hasher_state +constexpr auto sha512_base::process_bytes(std::u16string_view str) noexcept -> state { return process_bytes(str.begin(), str.size()); } template -constexpr auto sha512_base::process_bytes(std::u32string_view str) noexcept -> hasher_state +constexpr auto sha512_base::process_bytes(std::u32string_view str) noexcept -> state { return process_bytes(str.begin(), str.size()); } template -constexpr auto sha512_base::process_bytes(std::wstring_view str) noexcept -> hasher_state +constexpr auto sha512_base::process_bytes(std::wstring_view str) noexcept -> state { return process_bytes(str.begin(), str.size()); } @@ -602,7 +602,7 @@ constexpr auto sha512_base::process_bytes(std::wstring_view str) no template template -constexpr auto sha512_base::process_bytes(std::span data) noexcept -> hasher_state +constexpr auto sha512_base::process_bytes(std::span data) noexcept -> state { return process_bytes(data.begin(), data.size()); } @@ -613,7 +613,7 @@ constexpr auto sha512_base::process_bytes(std::span data template template -BOOST_CRYPT_GPU_ENABLED constexpr auto sha512_base::process_bytes(cuda::std::span data) noexcept -> hasher_state +BOOST_CRYPT_GPU_ENABLED constexpr auto sha512_base::process_bytes(cuda::std::span data) noexcept -> state { return process_bytes(data.begin(), data.size()); } diff --git a/include/boost/crypt/hash/hmac.hpp b/include/boost/crypt/hash/hmac.hpp index 149f8936..febc5177 100644 --- a/include/boost/crypt/hash/hmac.hpp +++ b/include/boost/crypt/hash/hmac.hpp @@ -5,7 +5,7 @@ #ifndef BOOST_CRYPT_HASH_HMAC_HPP #define BOOST_CRYPT_HASH_HMAC_HPP -#include +#include #include #include #include @@ -47,20 +47,20 @@ class hmac BOOST_CRYPT_GPU_ENABLED constexpr hmac(const key_type& inner_key, const key_type& outer_key) noexcept { init_from_keys(inner_key, outer_key); } template - BOOST_CRYPT_GPU_ENABLED constexpr auto init(ForwardIter key, boost::crypt::size_t size) noexcept -> hasher_state; + BOOST_CRYPT_GPU_ENABLED constexpr auto init(ForwardIter key, boost::crypt::size_t size) noexcept -> state; template - BOOST_CRYPT_GPU_ENABLED constexpr auto init(const Container& c) noexcept -> hasher_state { return init(c.begin(), c.size()); } + BOOST_CRYPT_GPU_ENABLED constexpr auto init(const Container& c) noexcept -> state { return init(c.begin(), c.size()); } template BOOST_CRYPT_GPU_ENABLED constexpr auto init_from_keys(const Container& inner_key, - const Container& outer_key) noexcept -> hasher_state; + const Container& outer_key) noexcept -> state; template - BOOST_CRYPT_GPU_ENABLED constexpr auto process_bytes(ForwardIter data, boost::crypt::size_t size) noexcept -> hasher_state; + BOOST_CRYPT_GPU_ENABLED constexpr auto process_bytes(ForwardIter data, boost::crypt::size_t size) noexcept -> state; template - BOOST_CRYPT_GPU_ENABLED constexpr auto process_bytes(const Container& c) noexcept -> hasher_state { return process_bytes(c.begin(), c.size()); } + BOOST_CRYPT_GPU_ENABLED constexpr auto process_bytes(const Container& c) noexcept -> state { return process_bytes(c.begin(), c.size()); } BOOST_CRYPT_GPU_ENABLED constexpr auto get_digest() noexcept -> return_type; @@ -84,7 +84,7 @@ constexpr auto hmac::get_outer_key() noexcept -> key_type template template constexpr auto hmac::init_from_keys(const Container &inner_key, - const Container &outer_key) noexcept -> hasher_state + const Container &outer_key) noexcept -> state { computed_ = false; corrupted_ = false; @@ -97,16 +97,16 @@ constexpr auto hmac::init_from_keys(const Container &inner_key, const auto inner_result {inner_hash_.process_bytes(inner_key_.begin(), inner_key_.size())}; const auto outer_result {outer_hash_.process_bytes(outer_key_.begin(), outer_key_.size())}; - if (BOOST_CRYPT_LIKELY(inner_result == hasher_state::success && outer_result == hasher_state::success)) + if (BOOST_CRYPT_LIKELY(inner_result == state::success && outer_result == state::success)) { initialized_ = true; - return hasher_state::success; + return state::success; } else { // If we have some weird OOM result // LCOV_EXCL_START - if (inner_result != hasher_state::success) + if (inner_result != state::success) { return inner_result; } @@ -138,21 +138,21 @@ constexpr auto hmac::get_digest() noexcept -> return_type template template -constexpr auto hmac::process_bytes(ForwardIter data, boost::crypt::size_t size) noexcept -> hasher_state +constexpr auto hmac::process_bytes(ForwardIter data, boost::crypt::size_t size) noexcept -> state { if (utility::is_null(data) || size == 0U) { - return hasher_state::null; + return state::null; } else if (!initialized_ || corrupted_) { - return hasher_state::state_error; + return state::state_error; } const auto status_code {inner_hash_.process_bytes(data, size)}; - if (BOOST_CRYPT_LIKELY(status_code == hasher_state::success)) + if (BOOST_CRYPT_LIKELY(status_code == state::success)) { - return hasher_state::success; + return state::success; } else { @@ -160,12 +160,12 @@ constexpr auto hmac::process_bytes(ForwardIter data, boost::crypt::s // LCOV_EXCL_START switch (status_code) { - case hasher_state::state_error: + case state::state_error: corrupted_ = true; - return hasher_state::state_error; - case hasher_state::input_too_long: + return state::state_error; + case state::input_too_long: corrupted_ = true; - return hasher_state::input_too_long; + return state::input_too_long; default: BOOST_CRYPT_UNREACHABLE; } @@ -175,7 +175,7 @@ constexpr auto hmac::process_bytes(ForwardIter data, boost::crypt::s template template -constexpr auto hmac::init(ForwardIter key, boost::crypt::size_t size) noexcept -> hasher_state +constexpr auto hmac::init(ForwardIter key, boost::crypt::size_t size) noexcept -> state { computed_ = false; corrupted_ = false; @@ -186,7 +186,7 @@ constexpr auto hmac::init(ForwardIter key, boost::crypt::size_t size if (utility::is_null(key) || size == 0U) { - return hasher_state::null; + return state::null; } // Step 1: If the length of K = B set K0 = K. Go to step 4 @@ -226,16 +226,16 @@ constexpr auto hmac::init(ForwardIter key, boost::crypt::size_t size const auto inner_result {inner_hash_.process_bytes(inner_key_.begin(), inner_key_.size())}; const auto outer_result {outer_hash_.process_bytes(outer_key_.begin(), outer_key_.size())}; - if (BOOST_CRYPT_LIKELY(inner_result == hasher_state::success && outer_result == hasher_state::success)) + if (BOOST_CRYPT_LIKELY(inner_result == state::success && outer_result == state::success)) { initialized_ = true; - return hasher_state::success; + return state::success; } else { // If we have some weird OOM result // LCOV_EXCL_START - if (inner_result != hasher_state::success) + if (inner_result != state::success) { return inner_result; } diff --git a/include/boost/crypt/hash/md5.hpp b/include/boost/crypt/hash/md5.hpp index e70cfc68..6276f73a 100644 --- a/include/boost/crypt/hash/md5.hpp +++ b/include/boost/crypt/hash/md5.hpp @@ -10,7 +10,7 @@ #ifdef BOOST_CRYPT_ENABLE_MD5 #include -#include +#include #include #include #include diff --git a/include/boost/crypt/hash/sha1.hpp b/include/boost/crypt/hash/sha1.hpp index b47016b6..069fd7f9 100644 --- a/include/boost/crypt/hash/sha1.hpp +++ b/include/boost/crypt/hash/sha1.hpp @@ -8,7 +8,7 @@ #define BOOST_CRYPT_HASH_SHA1_HPP #include -#include +#include #include #include #include diff --git a/test/test_hmac.cpp b/test/test_hmac.cpp index 93da74f0..df9cfbd4 100644 --- a/test/test_hmac.cpp +++ b/test/test_hmac.cpp @@ -16,11 +16,11 @@ void basic_tests() { boost::crypt::hmac hmac_tester; const auto state_1 {hmac_tester.init("key", 3)}; - BOOST_TEST(state_1 == boost::crypt::hasher_state::success); + BOOST_TEST(state_1 == boost::crypt::state::success); const char* msg {"The quick brown fox jumps over the lazy dog"}; const auto state_2 {hmac_tester.process_bytes(msg, std::strlen(msg))}; - BOOST_TEST(state_2 == boost::crypt::hasher_state::success); + BOOST_TEST(state_2 == boost::crypt::state::success); const auto res {hmac_tester.get_digest()}; @@ -89,23 +89,23 @@ void test_edges() // Usage before init const auto state1 {hmac_tester.process_bytes(msg, std::strlen(msg))}; - BOOST_TEST(state1 == boost::crypt::hasher_state::state_error); + BOOST_TEST(state1 == boost::crypt::state::state_error); // Init with nullptr const auto state2 {hmac_tester.init("nullptr", 0)}; - BOOST_TEST(state2 == boost::crypt::hasher_state::null); + BOOST_TEST(state2 == boost::crypt::state::null); // Good init const auto state3 {hmac_tester.init("key", 3)}; - BOOST_TEST(state3 == boost::crypt::hasher_state::success); + BOOST_TEST(state3 == boost::crypt::state::success); // Pass in nullptr const auto state4 {hmac_tester.process_bytes("msg", 0)}; - BOOST_TEST(state4 == boost::crypt::hasher_state::null); + BOOST_TEST(state4 == boost::crypt::state::null); // Good pass const auto state5 {hmac_tester.process_bytes(msg, std::strlen(msg))}; - BOOST_TEST(state5 == boost::crypt::hasher_state::success); + BOOST_TEST(state5 == boost::crypt::state::success); // Get digest twice hmac_tester.get_digest(); @@ -129,7 +129,7 @@ void test_edges() " long key"}; const auto state6 {hmac_tester.init(big_key, std::strlen(big_key))}; - BOOST_TEST(state6 == boost::crypt::hasher_state::success); + BOOST_TEST(state6 == boost::crypt::state::success); // Init from keys const auto outer_key {hmac_tester.get_outer_key()}; diff --git a/test/test_hmac_drbg.cpp b/test/test_hmac_drbg.cpp index 62ce80c0..88c35e09 100644 --- a/test/test_hmac_drbg.cpp +++ b/test/test_hmac_drbg.cpp @@ -27,17 +27,17 @@ void sha1_basic_correctness() // 2) Generate bits, do not compare // 3) Generate bits, compare // 4) Destroy drbg - BOOST_TEST(rng.init(entropy, entropy.size(), nonce, nonce.size()) == boost::crypt::drbg::drbg_state::success); + BOOST_TEST(rng.init(entropy, entropy.size(), nonce, nonce.size()) == boost::crypt::state::success); // ** INSTANTIATE: // V = 7ea45af5f8fcba082fa40bcbea2748dfe7e09f6a // Key = be3976a33f77e0155b7ca84a5732d44f319e5f3a - BOOST_TEST(rng.generate(return_bits.begin(), 640U) == boost::crypt::drbg::drbg_state::success); + BOOST_TEST(rng.generate(return_bits.begin(), 640U) == boost::crypt::state::success); // ** GENERATE (FIRST CALL): // V = 0e28fe04dd16482f8e4b048675318adcd5e6e6cf // Key = 764d4f1fb7b04624bcb14642acb24d70eff3c0c8 - BOOST_TEST(rng.generate(return_bits.begin(), 640U) == boost::crypt::drbg::drbg_state::success); + BOOST_TEST(rng.generate(return_bits.begin(), 640U) == boost::crypt::state::success); // ** GENERATE (SECOND CALL): // V = 749a95f0882e0179d66d8ae2697802f8f568ce2f // Key = bfcd86fcb4c2efce22f6e9b69742751a17b0056c @@ -68,9 +68,9 @@ void sha1_basic_correctness() const char* big_additional_input = "749a95f0882e0179d66d8ae2697802f8f568ce2fbfcd86fcb4c2efce22f6e9b69742751a17b0056c"; BOOST_TEST(rng.init(entropy.begin(), entropy.size(), nonce.begin(), nonce.size(), - big_additional_input, std::strlen(big_additional_input)) == boost::crypt::drbg::drbg_state::success); + big_additional_input, std::strlen(big_additional_input)) == boost::crypt::state::success); - BOOST_TEST(rng.generate(return_bits.begin(), 640U, big_additional_input, std::strlen(big_additional_input)) == boost::crypt::drbg::drbg_state::success); + BOOST_TEST(rng.generate(return_bits.begin(), 640U, big_additional_input, std::strlen(big_additional_input)) == boost::crypt::state::success); } void sha1_additional_input() @@ -88,19 +88,19 @@ void sha1_additional_input() BOOST_TEST(rng.init(entropy.begin(), entropy.size(), nonce.begin(), nonce.size(), - personalization.begin(), personalization.size()) == boost::crypt::drbg::drbg_state::success); + personalization.begin(), personalization.size()) == boost::crypt::state::success); // ** INSTANTIATE: // V = 9c530ef5f1e277aab4e1e129091a273f0342d5c9 // Key = 7006c1c0c03c4ca267b19c50928f35891d8d8807 boost::crypt::array return_bits {}; - BOOST_TEST(rng.generate(return_bits.begin(), 640U) == boost::crypt::drbg::drbg_state::success); + BOOST_TEST(rng.generate(return_bits.begin(), 640U) == boost::crypt::state::success); // ** GENERATE (FIRST CALL): // V = 5b1508d16daad5aff52273cd549ce6bd9e259b0d // Key = b7e28116a16856b9e81bda776d421bb56e8f902f - BOOST_TEST(rng.generate(return_bits.begin(), 640U) == boost::crypt::drbg::drbg_state::success); + BOOST_TEST(rng.generate(return_bits.begin(), 640U) == boost::crypt::state::success); // ** GENERATE (SECOND CALL): // V = 71fa823bc53bfd307d6438edd7e5c581fffc27cc // Key = cfccf80b126cea770b468fb8652abbd5eeea2a5e diff --git a/test/test_md5.cpp b/test/test_md5.cpp index 1de03502..e36f8aee 100644 --- a/test/test_md5.cpp +++ b/test/test_md5.cpp @@ -427,12 +427,12 @@ void test_invalid_state() { boost::crypt::md5_hasher hasher; auto current_state = hasher.process_bytes("test", 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::success); + BOOST_TEST(current_state == boost::crypt::state::success); hasher.get_digest(); const auto bad_state = hasher.process_bytes("test", 4); - BOOST_TEST(bad_state == boost::crypt::hasher_state::state_error); + BOOST_TEST(bad_state == boost::crypt::state::state_error); const auto digest = hasher.get_digest(); @@ -444,22 +444,22 @@ void test_invalid_state() hasher.init(); current_state = hasher.process_bytes("test", 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::success); + BOOST_TEST(current_state == boost::crypt::state::success); const char* ptr = nullptr; current_state = hasher.process_bytes(ptr, 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::null); + BOOST_TEST(current_state == boost::crypt::state::null); const char16_t* ptr16 = nullptr; current_state = hasher.process_bytes(ptr16, 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::null); + BOOST_TEST(current_state == boost::crypt::state::null); const char32_t* ptr32 = nullptr; current_state = hasher.process_bytes(ptr32, 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::null); + BOOST_TEST(current_state == boost::crypt::state::null); const wchar_t* wptr = nullptr; current_state = hasher.process_bytes(wptr, 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::null); + BOOST_TEST(current_state == boost::crypt::state::null); } // This ends up being completely calculated in a constexpr fashion so Codecov complains diff --git a/test/test_sha1.cpp b/test/test_sha1.cpp index ac5316b3..b1241b33 100644 --- a/test/test_sha1.cpp +++ b/test/test_sha1.cpp @@ -418,12 +418,12 @@ void test_invalid_state() { boost::crypt::sha1_hasher hasher; auto current_state = hasher.process_bytes("test", 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::success); + BOOST_TEST(current_state == boost::crypt::state::success); hasher.get_digest(); const auto bad_state = hasher.process_bytes("test", 4); - BOOST_TEST(bad_state == boost::crypt::hasher_state::state_error); + BOOST_TEST(bad_state == boost::crypt::state::state_error); const auto digest = hasher.get_digest(); @@ -435,22 +435,22 @@ void test_invalid_state() hasher.init(); current_state = hasher.process_bytes("test", 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::success); + BOOST_TEST(current_state == boost::crypt::state::success); const char* ptr = nullptr; current_state = hasher.process_bytes(ptr, 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::null); + BOOST_TEST(current_state == boost::crypt::state::null); const char16_t* ptr16 = nullptr; current_state = hasher.process_bytes(ptr16, 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::null); + BOOST_TEST(current_state == boost::crypt::state::null); const char32_t* ptr32 = nullptr; current_state = hasher.process_bytes(ptr32, 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::null); + BOOST_TEST(current_state == boost::crypt::state::null); const wchar_t* wptr = nullptr; current_state = hasher.process_bytes(wptr, 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::null); + BOOST_TEST(current_state == boost::crypt::state::null); } // This ends up being completely calculated in a constexpr fashion so Codecov complains diff --git a/test/test_sha224.cpp b/test/test_sha224.cpp index ccbc9873..506892a3 100644 --- a/test/test_sha224.cpp +++ b/test/test_sha224.cpp @@ -88,7 +88,7 @@ void string_view_test() boost::crypt::sha224_hasher hasher; const auto current_state = hasher.process_bytes(string_view_message); - BOOST_TEST(current_state == boost::crypt::hasher_state::success); + BOOST_TEST(current_state == boost::crypt::state::success); const auto result2 = hasher.get_digest(); for (std::size_t i {}; i < message_result.size(); ++i) { @@ -288,12 +288,12 @@ void test_invalid_state() { boost::crypt::sha224_hasher hasher; auto current_state = hasher.process_bytes("test", 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::success); + BOOST_TEST(current_state == boost::crypt::state::success); hasher.get_digest(); const auto bad_state = hasher.process_bytes("test", 4); - BOOST_TEST(bad_state == boost::crypt::hasher_state::state_error); + BOOST_TEST(bad_state == boost::crypt::state::state_error); const auto digest = hasher.get_digest(); @@ -305,24 +305,24 @@ void test_invalid_state() hasher.init(); current_state = hasher.process_bytes("test", 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::success); + BOOST_TEST(current_state == boost::crypt::state::success); current_state = hasher.process_byte(0x03); - BOOST_TEST(current_state == boost::crypt::hasher_state::success); + BOOST_TEST(current_state == boost::crypt::state::success); const char* ptr = nullptr; current_state = hasher.process_bytes(ptr, 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::null); + BOOST_TEST(current_state == boost::crypt::state::null); const char16_t* ptr16 = nullptr; current_state = hasher.process_bytes(ptr16, 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::null); + BOOST_TEST(current_state == boost::crypt::state::null); const char32_t* ptr32 = nullptr; current_state = hasher.process_bytes(ptr32, 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::null); + BOOST_TEST(current_state == boost::crypt::state::null); const wchar_t* wptr = nullptr; current_state = hasher.process_bytes(wptr, 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::null); + BOOST_TEST(current_state == boost::crypt::state::null); } // This ends up being completely calculated in a constexpr fashion so Codecov complains @@ -344,7 +344,7 @@ void test_span() boost::crypt::sha224_hasher hasher; auto current_state = hasher.process_bytes(byte_span); - BOOST_TEST(current_state == boost::crypt::hasher_state::success); + BOOST_TEST(current_state == boost::crypt::state::success); const auto res_2 = hasher.get_digest(); for (std::size_t i {}; i < res.size(); ++i) diff --git a/test/test_sha256.cpp b/test/test_sha256.cpp index 092e7337..296b5b3b 100644 --- a/test/test_sha256.cpp +++ b/test/test_sha256.cpp @@ -93,7 +93,7 @@ void string_view_test() boost::crypt::sha256_hasher hasher; const auto current_state = hasher.process_bytes(string_view_message); - BOOST_TEST(current_state == boost::crypt::hasher_state::success); + BOOST_TEST(current_state == boost::crypt::state::success); const auto result2 = hasher.get_digest(); for (std::size_t i {}; i < message_result.size(); ++i) { @@ -294,12 +294,12 @@ void test_invalid_state() { boost::crypt::sha256_hasher hasher; auto current_state = hasher.process_bytes("test", 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::success); + BOOST_TEST(current_state == boost::crypt::state::success); hasher.get_digest(); const auto bad_state = hasher.process_bytes("test", 4); - BOOST_TEST(bad_state == boost::crypt::hasher_state::state_error); + BOOST_TEST(bad_state == boost::crypt::state::state_error); const auto digest = hasher.get_digest(); @@ -311,24 +311,24 @@ void test_invalid_state() hasher.init(); current_state = hasher.process_bytes("test", 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::success); + BOOST_TEST(current_state == boost::crypt::state::success); current_state = hasher.process_byte(0x03); - BOOST_TEST(current_state == boost::crypt::hasher_state::success); + BOOST_TEST(current_state == boost::crypt::state::success); const char* ptr = nullptr; current_state = hasher.process_bytes(ptr, 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::null); + BOOST_TEST(current_state == boost::crypt::state::null); const char16_t* ptr16 = nullptr; current_state = hasher.process_bytes(ptr16, 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::null); + BOOST_TEST(current_state == boost::crypt::state::null); const char32_t* ptr32 = nullptr; current_state = hasher.process_bytes(ptr32, 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::null); + BOOST_TEST(current_state == boost::crypt::state::null); const wchar_t* wptr = nullptr; current_state = hasher.process_bytes(wptr, 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::null); + BOOST_TEST(current_state == boost::crypt::state::null); } // This ends up being completely calculated in a constexpr fashion so Codecov complains @@ -350,7 +350,7 @@ void test_span() boost::crypt::sha256_hasher hasher; auto current_state = hasher.process_bytes(byte_span); - BOOST_TEST(current_state == boost::crypt::hasher_state::success); + BOOST_TEST(current_state == boost::crypt::state::success); const auto res_2 = hasher.get_digest(); for (std::size_t i {}; i < res.size(); ++i) diff --git a/test/test_sha384.cpp b/test/test_sha384.cpp index 80061de2..1465f7a5 100644 --- a/test/test_sha384.cpp +++ b/test/test_sha384.cpp @@ -107,7 +107,7 @@ void string_view_test() boost::crypt::sha384_hasher hasher; const auto current_state = hasher.process_bytes(string_view_message); - BOOST_TEST(current_state == boost::crypt::hasher_state::success); + BOOST_TEST(current_state == boost::crypt::state::success); const auto result2 = hasher.get_digest(); for (std::size_t i {}; i < message_result.size(); ++i) { @@ -307,12 +307,12 @@ void test_invalid_state() { boost::crypt::sha384_hasher hasher; auto current_state = hasher.process_bytes("test", 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::success); + BOOST_TEST(current_state == boost::crypt::state::success); hasher.get_digest(); const auto bad_state = hasher.process_bytes("test", 4); - BOOST_TEST(bad_state == boost::crypt::hasher_state::state_error); + BOOST_TEST(bad_state == boost::crypt::state::state_error); const auto digest = hasher.get_digest(); @@ -324,24 +324,24 @@ void test_invalid_state() hasher.init(); current_state = hasher.process_bytes("test", 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::success); + BOOST_TEST(current_state == boost::crypt::state::success); current_state = hasher.process_byte(0x03); - BOOST_TEST(current_state == boost::crypt::hasher_state::success); + BOOST_TEST(current_state == boost::crypt::state::success); const char* ptr = nullptr; current_state = hasher.process_bytes(ptr, 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::null); + BOOST_TEST(current_state == boost::crypt::state::null); const char16_t* ptr16 = nullptr; current_state = hasher.process_bytes(ptr16, 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::null); + BOOST_TEST(current_state == boost::crypt::state::null); const char32_t* ptr32 = nullptr; current_state = hasher.process_bytes(ptr32, 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::null); + BOOST_TEST(current_state == boost::crypt::state::null); const wchar_t* wptr = nullptr; current_state = hasher.process_bytes(wptr, 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::null); + BOOST_TEST(current_state == boost::crypt::state::null); } // This ends up being completely calculated in a constexpr fashion so Codecov complains @@ -363,7 +363,7 @@ void test_span() boost::crypt::sha384_hasher hasher; auto current_state = hasher.process_bytes(byte_span); - BOOST_TEST(current_state == boost::crypt::hasher_state::success); + BOOST_TEST(current_state == boost::crypt::state::success); const auto res_2 = hasher.get_digest(); for (std::size_t i {}; i < res.size(); ++i) diff --git a/test/test_sha3_224.cpp b/test/test_sha3_224.cpp index 9e04b47b..f227a3ec 100644 --- a/test/test_sha3_224.cpp +++ b/test/test_sha3_224.cpp @@ -101,7 +101,7 @@ void string_view_test() boost::crypt::sha3_224_hasher hasher; const auto current_state = hasher.process_bytes(string_view_message); - BOOST_TEST(current_state == boost::crypt::hasher_state::success); + BOOST_TEST(current_state == boost::crypt::state::success); const auto result2 = hasher.get_digest(); for (std::size_t i {}; i < message_result.size(); ++i) { @@ -301,12 +301,12 @@ void test_invalid_state() { boost::crypt::sha3_224_hasher hasher; auto current_state = hasher.process_bytes("test", 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::success); + BOOST_TEST(current_state == boost::crypt::state::success); hasher.get_digest(); const auto bad_state = hasher.process_bytes("test", 4); - BOOST_TEST(bad_state == boost::crypt::hasher_state::state_error); + BOOST_TEST(bad_state == boost::crypt::state::state_error); const auto digest = hasher.get_digest(); @@ -318,24 +318,24 @@ void test_invalid_state() hasher.init(); current_state = hasher.process_bytes("test", 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::success); + BOOST_TEST(current_state == boost::crypt::state::success); current_state = hasher.process_byte(0x03); - BOOST_TEST(current_state == boost::crypt::hasher_state::success); + BOOST_TEST(current_state == boost::crypt::state::success); const char* ptr = nullptr; current_state = hasher.process_bytes(ptr, 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::null); + BOOST_TEST(current_state == boost::crypt::state::null); const char16_t* ptr16 = nullptr; current_state = hasher.process_bytes(ptr16, 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::null); + BOOST_TEST(current_state == boost::crypt::state::null); const char32_t* ptr32 = nullptr; current_state = hasher.process_bytes(ptr32, 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::null); + BOOST_TEST(current_state == boost::crypt::state::null); const wchar_t* wptr = nullptr; current_state = hasher.process_bytes(wptr, 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::null); + BOOST_TEST(current_state == boost::crypt::state::null); } // This ends up being completely calculated in a constexpr fashion so Codecov complains @@ -357,7 +357,7 @@ void test_span() boost::crypt::sha3_224_hasher hasher; auto current_state = hasher.process_bytes(byte_span); - BOOST_TEST(current_state == boost::crypt::hasher_state::success); + BOOST_TEST(current_state == boost::crypt::state::success); const auto res_2 = hasher.get_digest(); for (std::size_t i {}; i < res.size(); ++i) diff --git a/test/test_sha3_256.cpp b/test/test_sha3_256.cpp index 15a8af33..f881497b 100644 --- a/test/test_sha3_256.cpp +++ b/test/test_sha3_256.cpp @@ -101,7 +101,7 @@ void string_view_test() boost::crypt::sha3_256_hasher hasher; const auto current_state = hasher.process_bytes(string_view_message); - BOOST_TEST(current_state == boost::crypt::hasher_state::success); + BOOST_TEST(current_state == boost::crypt::state::success); const auto result2 = hasher.get_digest(); for (std::size_t i {}; i < message_result.size(); ++i) { @@ -301,12 +301,12 @@ void test_invalid_state() { boost::crypt::sha3_256_hasher hasher; auto current_state = hasher.process_bytes("test", 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::success); + BOOST_TEST(current_state == boost::crypt::state::success); hasher.get_digest(); const auto bad_state = hasher.process_bytes("test", 4); - BOOST_TEST(bad_state == boost::crypt::hasher_state::state_error); + BOOST_TEST(bad_state == boost::crypt::state::state_error); const auto digest = hasher.get_digest(); @@ -318,24 +318,24 @@ void test_invalid_state() hasher.init(); current_state = hasher.process_bytes("test", 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::success); + BOOST_TEST(current_state == boost::crypt::state::success); current_state = hasher.process_byte(0x03); - BOOST_TEST(current_state == boost::crypt::hasher_state::success); + BOOST_TEST(current_state == boost::crypt::state::success); const char* ptr = nullptr; current_state = hasher.process_bytes(ptr, 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::null); + BOOST_TEST(current_state == boost::crypt::state::null); const char16_t* ptr16 = nullptr; current_state = hasher.process_bytes(ptr16, 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::null); + BOOST_TEST(current_state == boost::crypt::state::null); const char32_t* ptr32 = nullptr; current_state = hasher.process_bytes(ptr32, 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::null); + BOOST_TEST(current_state == boost::crypt::state::null); const wchar_t* wptr = nullptr; current_state = hasher.process_bytes(wptr, 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::null); + BOOST_TEST(current_state == boost::crypt::state::null); } // This ends up being completely calculated in a constexpr fashion so Codecov complains @@ -357,7 +357,7 @@ void test_span() boost::crypt::sha3_256_hasher hasher; auto current_state = hasher.process_bytes(byte_span); - BOOST_TEST(current_state == boost::crypt::hasher_state::success); + BOOST_TEST(current_state == boost::crypt::state::success); const auto res_2 = hasher.get_digest(); for (std::size_t i {}; i < res.size(); ++i) diff --git a/test/test_sha3_384.cpp b/test/test_sha3_384.cpp index 7042c05d..64f5fc64 100644 --- a/test/test_sha3_384.cpp +++ b/test/test_sha3_384.cpp @@ -107,7 +107,7 @@ void string_view_test() boost::crypt::sha3_384_hasher hasher; const auto current_state = hasher.process_bytes(string_view_message); - BOOST_TEST(current_state == boost::crypt::hasher_state::success); + BOOST_TEST(current_state == boost::crypt::state::success); const auto result2 = hasher.get_digest(); for (std::size_t i {}; i < message_result.size(); ++i) { @@ -307,12 +307,12 @@ void test_invalid_state() { boost::crypt::sha3_384_hasher hasher; auto current_state = hasher.process_bytes("test", 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::success); + BOOST_TEST(current_state == boost::crypt::state::success); hasher.get_digest(); const auto bad_state = hasher.process_bytes("test", 4); - BOOST_TEST(bad_state == boost::crypt::hasher_state::state_error); + BOOST_TEST(bad_state == boost::crypt::state::state_error); const auto digest = hasher.get_digest(); @@ -324,24 +324,24 @@ void test_invalid_state() hasher.init(); current_state = hasher.process_bytes("test", 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::success); + BOOST_TEST(current_state == boost::crypt::state::success); current_state = hasher.process_byte(0x03); - BOOST_TEST(current_state == boost::crypt::hasher_state::success); + BOOST_TEST(current_state == boost::crypt::state::success); const char* ptr = nullptr; current_state = hasher.process_bytes(ptr, 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::null); + BOOST_TEST(current_state == boost::crypt::state::null); const char16_t* ptr16 = nullptr; current_state = hasher.process_bytes(ptr16, 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::null); + BOOST_TEST(current_state == boost::crypt::state::null); const char32_t* ptr32 = nullptr; current_state = hasher.process_bytes(ptr32, 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::null); + BOOST_TEST(current_state == boost::crypt::state::null); const wchar_t* wptr = nullptr; current_state = hasher.process_bytes(wptr, 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::null); + BOOST_TEST(current_state == boost::crypt::state::null); } // This ends up being completely calculated in a constexpr fashion so Codecov complains @@ -363,7 +363,7 @@ void test_span() boost::crypt::sha3_384_hasher hasher; auto current_state = hasher.process_bytes(byte_span); - BOOST_TEST(current_state == boost::crypt::hasher_state::success); + BOOST_TEST(current_state == boost::crypt::state::success); const auto res_2 = hasher.get_digest(); for (std::size_t i {}; i < res.size(); ++i) diff --git a/test/test_sha3_512.cpp b/test/test_sha3_512.cpp index 03597e23..46a9c0d1 100644 --- a/test/test_sha3_512.cpp +++ b/test/test_sha3_512.cpp @@ -92,7 +92,7 @@ void string_view_test() boost::crypt::sha3_512_hasher hasher; const auto current_state = hasher.process_bytes(string_view_message); - BOOST_TEST(current_state == boost::crypt::hasher_state::success); + BOOST_TEST(current_state == boost::crypt::state::success); const auto result2 = hasher.get_digest(); for (std::size_t i {}; i < message_result.size(); ++i) { @@ -292,12 +292,12 @@ void test_invalid_state() { boost::crypt::sha3_512_hasher hasher; auto current_state = hasher.process_bytes("test", 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::success); + BOOST_TEST(current_state == boost::crypt::state::success); hasher.get_digest(); const auto bad_state = hasher.process_bytes("test", 4); - BOOST_TEST(bad_state == boost::crypt::hasher_state::state_error); + BOOST_TEST(bad_state == boost::crypt::state::state_error); const auto digest = hasher.get_digest(); @@ -309,24 +309,24 @@ void test_invalid_state() hasher.init(); current_state = hasher.process_bytes("test", 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::success); + BOOST_TEST(current_state == boost::crypt::state::success); current_state = hasher.process_byte(0x03); - BOOST_TEST(current_state == boost::crypt::hasher_state::success); + BOOST_TEST(current_state == boost::crypt::state::success); const char* ptr = nullptr; current_state = hasher.process_bytes(ptr, 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::null); + BOOST_TEST(current_state == boost::crypt::state::null); const char16_t* ptr16 = nullptr; current_state = hasher.process_bytes(ptr16, 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::null); + BOOST_TEST(current_state == boost::crypt::state::null); const char32_t* ptr32 = nullptr; current_state = hasher.process_bytes(ptr32, 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::null); + BOOST_TEST(current_state == boost::crypt::state::null); const wchar_t* wptr = nullptr; current_state = hasher.process_bytes(wptr, 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::null); + BOOST_TEST(current_state == boost::crypt::state::null); } // This ends up being completely calculated in a constexpr fashion so Codecov complains @@ -348,7 +348,7 @@ void test_span() boost::crypt::sha3_512_hasher hasher; auto current_state = hasher.process_bytes(byte_span); - BOOST_TEST(current_state == boost::crypt::hasher_state::success); + BOOST_TEST(current_state == boost::crypt::state::success); const auto res_2 = hasher.get_digest(); for (std::size_t i {}; i < res.size(); ++i) diff --git a/test/test_sha512.cpp b/test/test_sha512.cpp index 159f57d9..3c83a6d6 100644 --- a/test/test_sha512.cpp +++ b/test/test_sha512.cpp @@ -113,7 +113,7 @@ void string_view_test() boost::crypt::sha512_hasher hasher; const auto current_state = hasher.process_bytes(string_view_message); - BOOST_TEST(current_state == boost::crypt::hasher_state::success); + BOOST_TEST(current_state == boost::crypt::state::success); const auto result2 = hasher.get_digest(); for (std::size_t i {}; i < message_result.size(); ++i) { @@ -313,12 +313,12 @@ void test_invalid_state() { boost::crypt::sha512_hasher hasher; auto current_state = hasher.process_bytes("test", 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::success); + BOOST_TEST(current_state == boost::crypt::state::success); hasher.get_digest(); const auto bad_state = hasher.process_bytes("test", 4); - BOOST_TEST(bad_state == boost::crypt::hasher_state::state_error); + BOOST_TEST(bad_state == boost::crypt::state::state_error); const auto digest = hasher.get_digest(); @@ -330,24 +330,24 @@ void test_invalid_state() hasher.init(); current_state = hasher.process_bytes("test", 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::success); + BOOST_TEST(current_state == boost::crypt::state::success); current_state = hasher.process_byte(0x03); - BOOST_TEST(current_state == boost::crypt::hasher_state::success); + BOOST_TEST(current_state == boost::crypt::state::success); const char* ptr = nullptr; current_state = hasher.process_bytes(ptr, 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::null); + BOOST_TEST(current_state == boost::crypt::state::null); const char16_t* ptr16 = nullptr; current_state = hasher.process_bytes(ptr16, 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::null); + BOOST_TEST(current_state == boost::crypt::state::null); const char32_t* ptr32 = nullptr; current_state = hasher.process_bytes(ptr32, 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::null); + BOOST_TEST(current_state == boost::crypt::state::null); const wchar_t* wptr = nullptr; current_state = hasher.process_bytes(wptr, 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::null); + BOOST_TEST(current_state == boost::crypt::state::null); } // This ends up being completely calculated in a constexpr fashion so Codecov complains @@ -369,7 +369,7 @@ void test_span() boost::crypt::sha512_hasher hasher; auto current_state = hasher.process_bytes(byte_span); - BOOST_TEST(current_state == boost::crypt::hasher_state::success); + BOOST_TEST(current_state == boost::crypt::state::success); const auto res_2 = hasher.get_digest(); for (std::size_t i {}; i < res.size(); ++i) diff --git a/test/test_sha512_224.cpp b/test/test_sha512_224.cpp index 441b4349..2d09c6a2 100644 --- a/test/test_sha512_224.cpp +++ b/test/test_sha512_224.cpp @@ -101,7 +101,7 @@ void string_view_test() boost::crypt::sha512_224_hasher hasher; const auto current_state = hasher.process_bytes(string_view_message); - BOOST_TEST(current_state == boost::crypt::hasher_state::success); + BOOST_TEST(current_state == boost::crypt::state::success); const auto result2 = hasher.get_digest(); for (std::size_t i {}; i < message_result.size(); ++i) { @@ -301,12 +301,12 @@ void test_invalid_state() { boost::crypt::sha512_224_hasher hasher; auto current_state = hasher.process_bytes("test", 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::success); + BOOST_TEST(current_state == boost::crypt::state::success); hasher.get_digest(); const auto bad_state = hasher.process_bytes("test", 4); - BOOST_TEST(bad_state == boost::crypt::hasher_state::state_error); + BOOST_TEST(bad_state == boost::crypt::state::state_error); const auto digest = hasher.get_digest(); @@ -318,24 +318,24 @@ void test_invalid_state() hasher.init(); current_state = hasher.process_bytes("test", 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::success); + BOOST_TEST(current_state == boost::crypt::state::success); current_state = hasher.process_byte(0x03); - BOOST_TEST(current_state == boost::crypt::hasher_state::success); + BOOST_TEST(current_state == boost::crypt::state::success); const char* ptr = nullptr; current_state = hasher.process_bytes(ptr, 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::null); + BOOST_TEST(current_state == boost::crypt::state::null); const char16_t* ptr16 = nullptr; current_state = hasher.process_bytes(ptr16, 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::null); + BOOST_TEST(current_state == boost::crypt::state::null); const char32_t* ptr32 = nullptr; current_state = hasher.process_bytes(ptr32, 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::null); + BOOST_TEST(current_state == boost::crypt::state::null); const wchar_t* wptr = nullptr; current_state = hasher.process_bytes(wptr, 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::null); + BOOST_TEST(current_state == boost::crypt::state::null); } // This ends up being completely calculated in a constexpr fashion so Codecov complains @@ -357,7 +357,7 @@ void test_span() boost::crypt::sha512_224_hasher hasher; auto current_state = hasher.process_bytes(byte_span); - BOOST_TEST(current_state == boost::crypt::hasher_state::success); + BOOST_TEST(current_state == boost::crypt::state::success); const auto res_2 = hasher.get_digest(); for (std::size_t i {}; i < res.size(); ++i) diff --git a/test/test_sha512_256.cpp b/test/test_sha512_256.cpp index 8dab2dee..f9b39602 100644 --- a/test/test_sha512_256.cpp +++ b/test/test_sha512_256.cpp @@ -101,7 +101,7 @@ void string_view_test() boost::crypt::sha512_256_hasher hasher; const auto current_state = hasher.process_bytes(string_view_message); - BOOST_TEST(current_state == boost::crypt::hasher_state::success); + BOOST_TEST(current_state == boost::crypt::state::success); const auto result2 = hasher.get_digest(); for (std::size_t i {}; i < message_result.size(); ++i) { @@ -301,12 +301,12 @@ void test_invalid_state() { boost::crypt::sha512_256_hasher hasher; auto current_state = hasher.process_bytes("test", 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::success); + BOOST_TEST(current_state == boost::crypt::state::success); hasher.get_digest(); const auto bad_state = hasher.process_bytes("test", 4); - BOOST_TEST(bad_state == boost::crypt::hasher_state::state_error); + BOOST_TEST(bad_state == boost::crypt::state::state_error); const auto digest = hasher.get_digest(); @@ -318,24 +318,24 @@ void test_invalid_state() hasher.init(); current_state = hasher.process_bytes("test", 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::success); + BOOST_TEST(current_state == boost::crypt::state::success); current_state = hasher.process_byte(0x03); - BOOST_TEST(current_state == boost::crypt::hasher_state::success); + BOOST_TEST(current_state == boost::crypt::state::success); const char* ptr = nullptr; current_state = hasher.process_bytes(ptr, 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::null); + BOOST_TEST(current_state == boost::crypt::state::null); const char16_t* ptr16 = nullptr; current_state = hasher.process_bytes(ptr16, 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::null); + BOOST_TEST(current_state == boost::crypt::state::null); const char32_t* ptr32 = nullptr; current_state = hasher.process_bytes(ptr32, 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::null); + BOOST_TEST(current_state == boost::crypt::state::null); const wchar_t* wptr = nullptr; current_state = hasher.process_bytes(wptr, 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::null); + BOOST_TEST(current_state == boost::crypt::state::null); } // This ends up being completely calculated in a constexpr fashion so Codecov complains @@ -357,7 +357,7 @@ void test_span() boost::crypt::sha512_256_hasher hasher; auto current_state = hasher.process_bytes(byte_span); - BOOST_TEST(current_state == boost::crypt::hasher_state::success); + BOOST_TEST(current_state == boost::crypt::state::success); const auto res_2 = hasher.get_digest(); for (std::size_t i {}; i < res.size(); ++i) diff --git a/test/test_shake128.cpp b/test/test_shake128.cpp index 39a98f67..76c17798 100644 --- a/test/test_shake128.cpp +++ b/test/test_shake128.cpp @@ -92,7 +92,7 @@ void string_view_test() boost::crypt::shake128_hasher hasher; const auto current_state = hasher.process_bytes(string_view_message); - BOOST_TEST(current_state == boost::crypt::hasher_state::success); + BOOST_TEST(current_state == boost::crypt::state::success); const auto result2 = hasher.get_digest(); for (std::size_t i {}; i < message_result.size(); ++i) { @@ -381,12 +381,12 @@ void test_invalid_state() { boost::crypt::shake128_hasher hasher; auto current_state = hasher.process_bytes("test", 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::success); + BOOST_TEST(current_state == boost::crypt::state::success); hasher.get_digest(); const auto bad_state = hasher.process_bytes("test", 4); - BOOST_TEST(bad_state == boost::crypt::hasher_state::state_error); + BOOST_TEST(bad_state == boost::crypt::state::state_error); const auto digest = hasher.get_digest(); @@ -398,24 +398,24 @@ void test_invalid_state() hasher.init(); current_state = hasher.process_bytes("test", 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::success); + BOOST_TEST(current_state == boost::crypt::state::success); current_state = hasher.process_byte(0x03); - BOOST_TEST(current_state == boost::crypt::hasher_state::success); + BOOST_TEST(current_state == boost::crypt::state::success); const char* ptr = nullptr; current_state = hasher.process_bytes(ptr, 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::null); + BOOST_TEST(current_state == boost::crypt::state::null); const char16_t* ptr16 = nullptr; current_state = hasher.process_bytes(ptr16, 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::null); + BOOST_TEST(current_state == boost::crypt::state::null); const char32_t* ptr32 = nullptr; current_state = hasher.process_bytes(ptr32, 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::null); + BOOST_TEST(current_state == boost::crypt::state::null); const wchar_t* wptr = nullptr; current_state = hasher.process_bytes(wptr, 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::null); + BOOST_TEST(current_state == boost::crypt::state::null); } // This ends up being completely calculated in a constexpr fashion so Codecov complains @@ -437,7 +437,7 @@ void test_span() boost::crypt::shake128_hasher hasher; auto current_state = hasher.process_bytes(byte_span); - BOOST_TEST(current_state == boost::crypt::hasher_state::success); + BOOST_TEST(current_state == boost::crypt::state::success); const auto res_2 = hasher.get_digest(); for (std::size_t i {}; i < res.size(); ++i) diff --git a/test/test_shake256.cpp b/test/test_shake256.cpp index 8a389357..6e5d2a58 100644 --- a/test/test_shake256.cpp +++ b/test/test_shake256.cpp @@ -101,7 +101,7 @@ void string_view_test() boost::crypt::shake256_hasher hasher; const auto current_state = hasher.process_bytes(string_view_message); - BOOST_TEST(current_state == boost::crypt::hasher_state::success); + BOOST_TEST(current_state == boost::crypt::state::success); const auto result2 = hasher.get_digest(); for (std::size_t i {}; i < message_result.size(); ++i) { @@ -390,12 +390,12 @@ void test_invalid_state() { boost::crypt::shake256_hasher hasher; auto current_state = hasher.process_bytes("test", 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::success); + BOOST_TEST(current_state == boost::crypt::state::success); hasher.get_digest(); const auto bad_state = hasher.process_bytes("test", 4); - BOOST_TEST(bad_state == boost::crypt::hasher_state::state_error); + BOOST_TEST(bad_state == boost::crypt::state::state_error); const auto digest = hasher.get_digest(); @@ -407,24 +407,24 @@ void test_invalid_state() hasher.init(); current_state = hasher.process_bytes("test", 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::success); + BOOST_TEST(current_state == boost::crypt::state::success); current_state = hasher.process_byte(0x03); - BOOST_TEST(current_state == boost::crypt::hasher_state::success); + BOOST_TEST(current_state == boost::crypt::state::success); const char* ptr = nullptr; current_state = hasher.process_bytes(ptr, 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::null); + BOOST_TEST(current_state == boost::crypt::state::null); const char16_t* ptr16 = nullptr; current_state = hasher.process_bytes(ptr16, 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::null); + BOOST_TEST(current_state == boost::crypt::state::null); const char32_t* ptr32 = nullptr; current_state = hasher.process_bytes(ptr32, 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::null); + BOOST_TEST(current_state == boost::crypt::state::null); const wchar_t* wptr = nullptr; current_state = hasher.process_bytes(wptr, 4); - BOOST_TEST(current_state == boost::crypt::hasher_state::null); + BOOST_TEST(current_state == boost::crypt::state::null); } // This ends up being completely calculated in a constexpr fashion so Codecov complains @@ -446,7 +446,7 @@ void test_span() boost::crypt::shake256_hasher hasher; auto current_state = hasher.process_bytes(byte_span); - BOOST_TEST(current_state == boost::crypt::hasher_state::success); + BOOST_TEST(current_state == boost::crypt::state::success); const auto res_2 = hasher.get_digest(); for (std::size_t i {}; i < res.size(); ++i) From bb076b489b9276adc691c356021b43cd3e1dffb7 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Mon, 11 Nov 2024 09:26:21 -0500 Subject: [PATCH 4/4] Update docs --- doc/crypt.adoc | 2 +- doc/crypt/api_reference.adoc | 2 +- doc/crypt/md5.adoc | 16 ++++++++-------- doc/crypt/sha1.adoc | 16 ++++++++-------- doc/crypt/sha224.adoc | 16 ++++++++-------- doc/crypt/sha256.adoc | 16 ++++++++-------- doc/crypt/sha384.adoc | 16 ++++++++-------- doc/crypt/sha3_224.adoc | 16 ++++++++-------- doc/crypt/sha3_256.adoc | 16 ++++++++-------- doc/crypt/sha3_384.adoc | 16 ++++++++-------- doc/crypt/sha3_512.adoc | 16 ++++++++-------- doc/crypt/sha512.adoc | 16 ++++++++-------- doc/crypt/sha512_224.adoc | 16 ++++++++-------- doc/crypt/sha512_256.adoc | 16 ++++++++-------- 14 files changed, 98 insertions(+), 98 deletions(-) diff --git a/doc/crypt.adoc b/doc/crypt.adoc index f3379e51..fbe7938a 100644 --- a/doc/crypt.adoc +++ b/doc/crypt.adoc @@ -19,7 +19,7 @@ include::crypt/overview.adoc[] include::crypt/api_reference.adoc[] -include::crypt/hasher_state.adoc[] +include::crypt/state.adoc[] include::crypt/md5.adoc[] diff --git a/doc/crypt/api_reference.adoc b/doc/crypt/api_reference.adoc index e36dac27..2aaa77c6 100644 --- a/doc/crypt/api_reference.adoc +++ b/doc/crypt/api_reference.adoc @@ -34,7 +34,7 @@ https://www.boost.org/LICENSE_1_0.txt == Enums -- <> +- <> == Constants diff --git a/doc/crypt/md5.adoc b/doc/crypt/md5.adoc index 86f2720c..c738cf7a 100644 --- a/doc/crypt/md5.adoc +++ b/doc/crypt/md5.adoc @@ -120,34 +120,34 @@ class md5_hasher void init(); template - BOOST_CRYPT_GPU_ENABLED inline auto process_byte(ByteType byte) noexcept -> hasher_state; + BOOST_CRYPT_GPU_ENABLED inline auto process_byte(ByteType byte) noexcept -> state; template - BOOST_CRYPT_GPU_ENABLED inline auto process_bytes(ForwardIter buffer, size_t byte_count) noexcept -> hasher_state; + BOOST_CRYPT_GPU_ENABLED inline auto process_bytes(ForwardIter buffer, size_t byte_count) noexcept -> state; #ifdef BOOST_CRYPT_HAS_STRING_VIEW - inline auto process_bytes(std::string_view str) noexcept -> hasher_state; + inline auto process_bytes(std::string_view str) noexcept -> state; - inline auto process_bytes(std::u16string_view str) noexcept -> hasher_state; + inline auto process_bytes(std::u16string_view str) noexcept -> state; - inline auto process_bytes(std::u32string_view str) noexcept -> hasher_state; + inline auto process_bytes(std::u32string_view str) noexcept -> state; - inline auto process_bytes(std::wstring_view str) noexcept -> hasher_state; + inline auto process_bytes(std::wstring_view str) noexcept -> state; #endif // BOOST_CRYPT_HAS_STRING_VIEW #ifdef BOOST_CRYPT_HAS_SPAN template - inline auto process_bytes(std::span data) noexcept -> hasher_state; + inline auto process_bytes(std::span data) noexcept -> state; #endif // BOOST_CRYPT_HAS_SPAN #ifdef BOOST_CRYPT_HAS_CUDA template - BOOST_CRYPT_GPU_ENABLED inline auto process_bytes(cuda::std::span data) noexcept -> hasher_state; + BOOST_CRYPT_GPU_ENABLED inline auto process_bytes(cuda::std::span data) noexcept -> state; #endif // BOOST_CRYPT_HAS_CUDA diff --git a/doc/crypt/sha1.adoc b/doc/crypt/sha1.adoc index a8d221f2..f89de79d 100644 --- a/doc/crypt/sha1.adoc +++ b/doc/crypt/sha1.adoc @@ -118,34 +118,34 @@ class sha1_hasher void init(); template - BOOST_CRYPT_GPU_ENABLED inline auto process_byte(ByteType byte) noexcept -> hasher_state; + BOOST_CRYPT_GPU_ENABLED inline auto process_byte(ByteType byte) noexcept -> state; template - BOOST_CRYPT_GPU_ENABLED inline auto process_bytes(ForwardIter buffer, size_t byte_count) noexcept -> hasher_state; + BOOST_CRYPT_GPU_ENABLED inline auto process_bytes(ForwardIter buffer, size_t byte_count) noexcept -> state; #ifdef BOOST_CRYPT_HAS_STRING_VIEW - inline auto process_bytes(std::string_view str) noexcept -> hasher_state; + inline auto process_bytes(std::string_view str) noexcept -> state; - inline auto process_bytes(std::u16string_view str) noexcept -> hasher_state; + inline auto process_bytes(std::u16string_view str) noexcept -> state; - inline auto process_bytes(std::u32string_view str) noexcept -> hasher_state; + inline auto process_bytes(std::u32string_view str) noexcept -> state; - inline auto process_bytes(std::wstring_view str) noexcept -> hasher_state; + inline auto process_bytes(std::wstring_view str) noexcept -> state; #endif // BOOST_CRYPT_HAS_STRING_VIEW #ifdef BOOST_CRYPT_HAS_SPAN template - inline auto process_bytes(std::span data) noexcept -> hasher_state; + inline auto process_bytes(std::span data) noexcept -> state; #endif // BOOST_CRYPT_HAS_SPAN #ifdef BOOST_CRYPT_HAS_CUDA template - BOOST_CRYPT_GPU_ENABLED inline auto process_bytes(cuda::std::span data) noexcept -> hasher_state; + BOOST_CRYPT_GPU_ENABLED inline auto process_bytes(cuda::std::span data) noexcept -> state; #endif // BOOST_CRYPT_HAS_CUDA diff --git a/doc/crypt/sha224.adoc b/doc/crypt/sha224.adoc index a8eca1a5..dce76f9f 100644 --- a/doc/crypt/sha224.adoc +++ b/doc/crypt/sha224.adoc @@ -118,34 +118,34 @@ class sha224_hasher void init(); template - BOOST_CRYPT_GPU_ENABLED inline auto process_byte(ByteType byte) noexcept -> hasher_state; + BOOST_CRYPT_GPU_ENABLED inline auto process_byte(ByteType byte) noexcept -> state; template - BOOST_CRYPT_GPU_ENABLED inline auto process_bytes(ForwardIter buffer, size_t byte_count) noexcept -> hasher_state; + BOOST_CRYPT_GPU_ENABLED inline auto process_bytes(ForwardIter buffer, size_t byte_count) noexcept -> state; #ifdef BOOST_CRYPT_HAS_STRING_VIEW - inline auto process_bytes(std::string_view str) noexcept -> hasher_state; + inline auto process_bytes(std::string_view str) noexcept -> state; - inline auto process_bytes(std::u16string_view str) noexcept -> hasher_state; + inline auto process_bytes(std::u16string_view str) noexcept -> state; - inline auto process_bytes(std::u32string_view str) noexcept -> hasher_state; + inline auto process_bytes(std::u32string_view str) noexcept -> state; - inline auto process_bytes(std::wstring_view str) noexcept -> hasher_state; + inline auto process_bytes(std::wstring_view str) noexcept -> state; #endif // BOOST_CRYPT_HAS_STRING_VIEW #ifdef BOOST_CRYPT_HAS_SPAN template - inline auto process_bytes(std::span data) noexcept -> hasher_state; + inline auto process_bytes(std::span data) noexcept -> state; #endif // BOOST_CRYPT_HAS_SPAN #ifdef BOOST_CRYPT_HAS_CUDA template - BOOST_CRYPT_GPU_ENABLED inline auto process_bytes(cuda::std::span data) noexcept -> hasher_state; + BOOST_CRYPT_GPU_ENABLED inline auto process_bytes(cuda::std::span data) noexcept -> state; #endif // BOOST_CRYPT_HAS_CUDA diff --git a/doc/crypt/sha256.adoc b/doc/crypt/sha256.adoc index b87f7f74..b595301e 100644 --- a/doc/crypt/sha256.adoc +++ b/doc/crypt/sha256.adoc @@ -118,34 +118,34 @@ class sha256_hasher void init(); template - BOOST_CRYPT_GPU_ENABLED inline auto process_byte(ByteType byte) noexcept -> hasher_state; + BOOST_CRYPT_GPU_ENABLED inline auto process_byte(ByteType byte) noexcept -> state; template - BOOST_CRYPT_GPU_ENABLED inline auto process_bytes(ForwardIter buffer, size_t byte_count) noexcept -> hasher_state; + BOOST_CRYPT_GPU_ENABLED inline auto process_bytes(ForwardIter buffer, size_t byte_count) noexcept -> state; #ifdef BOOST_CRYPT_HAS_STRING_VIEW - inline auto process_bytes(std::string_view str) noexcept -> hasher_state; + inline auto process_bytes(std::string_view str) noexcept -> state; - inline auto process_bytes(std::u16string_view str) noexcept -> hasher_state; + inline auto process_bytes(std::u16string_view str) noexcept -> state; - inline auto process_bytes(std::u32string_view str) noexcept -> hasher_state; + inline auto process_bytes(std::u32string_view str) noexcept -> state; - inline auto process_bytes(std::wstring_view str) noexcept -> hasher_state; + inline auto process_bytes(std::wstring_view str) noexcept -> state; #endif // BOOST_CRYPT_HAS_STRING_VIEW #ifdef BOOST_CRYPT_HAS_SPAN template - inline auto process_bytes(std::span data) noexcept -> hasher_state; + inline auto process_bytes(std::span data) noexcept -> state; #endif // BOOST_CRYPT_HAS_SPAN #ifdef BOOST_CRYPT_HAS_CUDA template - BOOST_CRYPT_GPU_ENABLED inline auto process_bytes(cuda::std::span data) noexcept -> hasher_state; + BOOST_CRYPT_GPU_ENABLED inline auto process_bytes(cuda::std::span data) noexcept -> state; #endif // BOOST_CRYPT_HAS_CUDA diff --git a/doc/crypt/sha384.adoc b/doc/crypt/sha384.adoc index 7d7da5e5..3c918842 100644 --- a/doc/crypt/sha384.adoc +++ b/doc/crypt/sha384.adoc @@ -118,34 +118,34 @@ class sha384_hasher void init(); template - BOOST_CRYPT_GPU_ENABLED inline auto process_byte(ByteType byte) noexcept -> hasher_state; + BOOST_CRYPT_GPU_ENABLED inline auto process_byte(ByteType byte) noexcept -> state; template - BOOST_CRYPT_GPU_ENABLED inline auto process_bytes(ForwardIter buffer, size_t byte_count) noexcept -> hasher_state; + BOOST_CRYPT_GPU_ENABLED inline auto process_bytes(ForwardIter buffer, size_t byte_count) noexcept -> state; #ifdef BOOST_CRYPT_HAS_STRING_VIEW - inline auto process_bytes(std::string_view str) noexcept -> hasher_state; + inline auto process_bytes(std::string_view str) noexcept -> state; - inline auto process_bytes(std::u16string_view str) noexcept -> hasher_state; + inline auto process_bytes(std::u16string_view str) noexcept -> state; - inline auto process_bytes(std::u32string_view str) noexcept -> hasher_state; + inline auto process_bytes(std::u32string_view str) noexcept -> state; - inline auto process_bytes(std::wstring_view str) noexcept -> hasher_state; + inline auto process_bytes(std::wstring_view str) noexcept -> state; #endif // BOOST_CRYPT_HAS_STRING_VIEW #ifdef BOOST_CRYPT_HAS_SPAN template - inline auto process_bytes(std::span data) noexcept -> hasher_state; + inline auto process_bytes(std::span data) noexcept -> state; #endif // BOOST_CRYPT_HAS_SPAN #ifdef BOOST_CRYPT_HAS_CUDA template - BOOST_CRYPT_GPU_ENABLED inline auto process_bytes(cuda::std::span data) noexcept -> hasher_state; + BOOST_CRYPT_GPU_ENABLED inline auto process_bytes(cuda::std::span data) noexcept -> state; #endif // BOOST_CRYPT_HAS_CUDA diff --git a/doc/crypt/sha3_224.adoc b/doc/crypt/sha3_224.adoc index a893ad49..3d45c677 100644 --- a/doc/crypt/sha3_224.adoc +++ b/doc/crypt/sha3_224.adoc @@ -118,34 +118,34 @@ class sha3_224_hasher void init(); template - BOOST_CRYPT_GPU_ENABLED inline auto process_byte(ByteType byte) noexcept -> hasher_state; + BOOST_CRYPT_GPU_ENABLED inline auto process_byte(ByteType byte) noexcept -> state; template - BOOST_CRYPT_GPU_ENABLED inline auto process_bytes(ForwardIter buffer, size_t byte_count) noexcept -> hasher_state; + BOOST_CRYPT_GPU_ENABLED inline auto process_bytes(ForwardIter buffer, size_t byte_count) noexcept -> state; #ifdef BOOST_CRYPT_HAS_STRING_VIEW - inline auto process_bytes(std::string_view str) noexcept -> hasher_state; + inline auto process_bytes(std::string_view str) noexcept -> state; - inline auto process_bytes(std::u16string_view str) noexcept -> hasher_state; + inline auto process_bytes(std::u16string_view str) noexcept -> state; - inline auto process_bytes(std::u32string_view str) noexcept -> hasher_state; + inline auto process_bytes(std::u32string_view str) noexcept -> state; - inline auto process_bytes(std::wstring_view str) noexcept -> hasher_state; + inline auto process_bytes(std::wstring_view str) noexcept -> state; #endif // BOOST_CRYPT_HAS_STRING_VIEW #ifdef BOOST_CRYPT_HAS_SPAN template - inline auto process_bytes(std::span data) noexcept -> hasher_state; + inline auto process_bytes(std::span data) noexcept -> state; #endif // BOOST_CRYPT_HAS_SPAN #ifdef BOOST_CRYPT_HAS_CUDA template - BOOST_CRYPT_GPU_ENABLED inline auto process_bytes(cuda::std::span data) noexcept -> hasher_state; + BOOST_CRYPT_GPU_ENABLED inline auto process_bytes(cuda::std::span data) noexcept -> state; #endif // BOOST_CRYPT_HAS_CUDA diff --git a/doc/crypt/sha3_256.adoc b/doc/crypt/sha3_256.adoc index e972c3c8..8409e505 100644 --- a/doc/crypt/sha3_256.adoc +++ b/doc/crypt/sha3_256.adoc @@ -118,34 +118,34 @@ class sha3_256_hasher void init(); template - BOOST_CRYPT_GPU_ENABLED inline auto process_byte(ByteType byte) noexcept -> hasher_state; + BOOST_CRYPT_GPU_ENABLED inline auto process_byte(ByteType byte) noexcept -> state; template - BOOST_CRYPT_GPU_ENABLED inline auto process_bytes(ForwardIter buffer, size_t byte_count) noexcept -> hasher_state; + BOOST_CRYPT_GPU_ENABLED inline auto process_bytes(ForwardIter buffer, size_t byte_count) noexcept -> state; #ifdef BOOST_CRYPT_HAS_STRING_VIEW - inline auto process_bytes(std::string_view str) noexcept -> hasher_state; + inline auto process_bytes(std::string_view str) noexcept -> state; - inline auto process_bytes(std::u16string_view str) noexcept -> hasher_state; + inline auto process_bytes(std::u16string_view str) noexcept -> state; - inline auto process_bytes(std::u32string_view str) noexcept -> hasher_state; + inline auto process_bytes(std::u32string_view str) noexcept -> state; - inline auto process_bytes(std::wstring_view str) noexcept -> hasher_state; + inline auto process_bytes(std::wstring_view str) noexcept -> state; #endif // BOOST_CRYPT_HAS_STRING_VIEW #ifdef BOOST_CRYPT_HAS_SPAN template - inline auto process_bytes(std::span data) noexcept -> hasher_state; + inline auto process_bytes(std::span data) noexcept -> state; #endif // BOOST_CRYPT_HAS_SPAN #ifdef BOOST_CRYPT_HAS_CUDA template - BOOST_CRYPT_GPU_ENABLED inline auto process_bytes(cuda::std::span data) noexcept -> hasher_state; + BOOST_CRYPT_GPU_ENABLED inline auto process_bytes(cuda::std::span data) noexcept -> state; #endif // BOOST_CRYPT_HAS_CUDA diff --git a/doc/crypt/sha3_384.adoc b/doc/crypt/sha3_384.adoc index f151bf47..98a442e7 100644 --- a/doc/crypt/sha3_384.adoc +++ b/doc/crypt/sha3_384.adoc @@ -118,34 +118,34 @@ class sha3_384_hasher void init(); template - BOOST_CRYPT_GPU_ENABLED inline auto process_byte(ByteType byte) noexcept -> hasher_state; + BOOST_CRYPT_GPU_ENABLED inline auto process_byte(ByteType byte) noexcept -> state; template - BOOST_CRYPT_GPU_ENABLED inline auto process_bytes(ForwardIter buffer, size_t byte_count) noexcept -> hasher_state; + BOOST_CRYPT_GPU_ENABLED inline auto process_bytes(ForwardIter buffer, size_t byte_count) noexcept -> state; #ifdef BOOST_CRYPT_HAS_STRING_VIEW - inline auto process_bytes(std::string_view str) noexcept -> hasher_state; + inline auto process_bytes(std::string_view str) noexcept -> state; - inline auto process_bytes(std::u16string_view str) noexcept -> hasher_state; + inline auto process_bytes(std::u16string_view str) noexcept -> state; - inline auto process_bytes(std::u32string_view str) noexcept -> hasher_state; + inline auto process_bytes(std::u32string_view str) noexcept -> state; - inline auto process_bytes(std::wstring_view str) noexcept -> hasher_state; + inline auto process_bytes(std::wstring_view str) noexcept -> state; #endif // BOOST_CRYPT_HAS_STRING_VIEW #ifdef BOOST_CRYPT_HAS_SPAN template - inline auto process_bytes(std::span data) noexcept -> hasher_state; + inline auto process_bytes(std::span data) noexcept -> state; #endif // BOOST_CRYPT_HAS_SPAN #ifdef BOOST_CRYPT_HAS_CUDA template - BOOST_CRYPT_GPU_ENABLED inline auto process_bytes(cuda::std::span data) noexcept -> hasher_state; + BOOST_CRYPT_GPU_ENABLED inline auto process_bytes(cuda::std::span data) noexcept -> state; #endif // BOOST_CRYPT_HAS_CUDA diff --git a/doc/crypt/sha3_512.adoc b/doc/crypt/sha3_512.adoc index 2865bc15..75fe781a 100644 --- a/doc/crypt/sha3_512.adoc +++ b/doc/crypt/sha3_512.adoc @@ -118,34 +118,34 @@ class sha3_512_hasher void init(); template - BOOST_CRYPT_GPU_ENABLED inline auto process_byte(ByteType byte) noexcept -> hasher_state; + BOOST_CRYPT_GPU_ENABLED inline auto process_byte(ByteType byte) noexcept -> state; template - BOOST_CRYPT_GPU_ENABLED inline auto process_bytes(ForwardIter buffer, size_t byte_count) noexcept -> hasher_state; + BOOST_CRYPT_GPU_ENABLED inline auto process_bytes(ForwardIter buffer, size_t byte_count) noexcept -> state; #ifdef BOOST_CRYPT_HAS_STRING_VIEW - inline auto process_bytes(std::string_view str) noexcept -> hasher_state; + inline auto process_bytes(std::string_view str) noexcept -> state; - inline auto process_bytes(std::u16string_view str) noexcept -> hasher_state; + inline auto process_bytes(std::u16string_view str) noexcept -> state; - inline auto process_bytes(std::u32string_view str) noexcept -> hasher_state; + inline auto process_bytes(std::u32string_view str) noexcept -> state; - inline auto process_bytes(std::wstring_view str) noexcept -> hasher_state; + inline auto process_bytes(std::wstring_view str) noexcept -> state; #endif // BOOST_CRYPT_HAS_STRING_VIEW #ifdef BOOST_CRYPT_HAS_SPAN template - inline auto process_bytes(std::span data) noexcept -> hasher_state; + inline auto process_bytes(std::span data) noexcept -> state; #endif // BOOST_CRYPT_HAS_SPAN #ifdef BOOST_CRYPT_HAS_CUDA template - BOOST_CRYPT_GPU_ENABLED inline auto process_bytes(cuda::std::span data) noexcept -> hasher_state; + BOOST_CRYPT_GPU_ENABLED inline auto process_bytes(cuda::std::span data) noexcept -> state; #endif // BOOST_CRYPT_HAS_CUDA diff --git a/doc/crypt/sha512.adoc b/doc/crypt/sha512.adoc index 476ef1cd..85ead58c 100644 --- a/doc/crypt/sha512.adoc +++ b/doc/crypt/sha512.adoc @@ -118,34 +118,34 @@ class sha512_hasher void init(); template - BOOST_CRYPT_GPU_ENABLED inline auto process_byte(ByteType byte) noexcept -> hasher_state; + BOOST_CRYPT_GPU_ENABLED inline auto process_byte(ByteType byte) noexcept -> state; template - BOOST_CRYPT_GPU_ENABLED inline auto process_bytes(ForwardIter buffer, size_t byte_count) noexcept -> hasher_state; + BOOST_CRYPT_GPU_ENABLED inline auto process_bytes(ForwardIter buffer, size_t byte_count) noexcept -> state; #ifdef BOOST_CRYPT_HAS_STRING_VIEW - inline auto process_bytes(std::string_view str) noexcept -> hasher_state; + inline auto process_bytes(std::string_view str) noexcept -> state; - inline auto process_bytes(std::u16string_view str) noexcept -> hasher_state; + inline auto process_bytes(std::u16string_view str) noexcept -> state; - inline auto process_bytes(std::u32string_view str) noexcept -> hasher_state; + inline auto process_bytes(std::u32string_view str) noexcept -> state; - inline auto process_bytes(std::wstring_view str) noexcept -> hasher_state; + inline auto process_bytes(std::wstring_view str) noexcept -> state; #endif // BOOST_CRYPT_HAS_STRING_VIEW #ifdef BOOST_CRYPT_HAS_SPAN template - inline auto process_bytes(std::span data) noexcept -> hasher_state; + inline auto process_bytes(std::span data) noexcept -> state; #endif // BOOST_CRYPT_HAS_SPAN #ifdef BOOST_CRYPT_HAS_CUDA template - BOOST_CRYPT_GPU_ENABLED inline auto process_bytes(cuda::std::span data) noexcept -> hasher_state; + BOOST_CRYPT_GPU_ENABLED inline auto process_bytes(cuda::std::span data) noexcept -> state; #endif // BOOST_CRYPT_HAS_CUDA diff --git a/doc/crypt/sha512_224.adoc b/doc/crypt/sha512_224.adoc index 2378cdca..c875b93f 100644 --- a/doc/crypt/sha512_224.adoc +++ b/doc/crypt/sha512_224.adoc @@ -118,34 +118,34 @@ class sha512_224_hasher void init(); template - BOOST_CRYPT_GPU_ENABLED inline auto process_byte(ByteType byte) noexcept -> hasher_state; + BOOST_CRYPT_GPU_ENABLED inline auto process_byte(ByteType byte) noexcept -> state; template - BOOST_CRYPT_GPU_ENABLED inline auto process_bytes(ForwardIter buffer, size_t byte_count) noexcept -> hasher_state; + BOOST_CRYPT_GPU_ENABLED inline auto process_bytes(ForwardIter buffer, size_t byte_count) noexcept -> state; #ifdef BOOST_CRYPT_HAS_STRING_VIEW - inline auto process_bytes(std::string_view str) noexcept -> hasher_state; + inline auto process_bytes(std::string_view str) noexcept -> state; - inline auto process_bytes(std::u16string_view str) noexcept -> hasher_state; + inline auto process_bytes(std::u16string_view str) noexcept -> state; - inline auto process_bytes(std::u32string_view str) noexcept -> hasher_state; + inline auto process_bytes(std::u32string_view str) noexcept -> state; - inline auto process_bytes(std::wstring_view str) noexcept -> hasher_state; + inline auto process_bytes(std::wstring_view str) noexcept -> state; #endif // BOOST_CRYPT_HAS_STRING_VIEW #ifdef BOOST_CRYPT_HAS_SPAN template - inline auto process_bytes(std::span data) noexcept -> hasher_state; + inline auto process_bytes(std::span data) noexcept -> state; #endif // BOOST_CRYPT_HAS_SPAN #ifdef BOOST_CRYPT_HAS_CUDA template - BOOST_CRYPT_GPU_ENABLED inline auto process_bytes(cuda::std::span data) noexcept -> hasher_state; + BOOST_CRYPT_GPU_ENABLED inline auto process_bytes(cuda::std::span data) noexcept -> state; #endif // BOOST_CRYPT_HAS_CUDA diff --git a/doc/crypt/sha512_256.adoc b/doc/crypt/sha512_256.adoc index 49f60cba..30bc3465 100644 --- a/doc/crypt/sha512_256.adoc +++ b/doc/crypt/sha512_256.adoc @@ -118,34 +118,34 @@ class sha512_256_hasher void init(); template - BOOST_CRYPT_GPU_ENABLED inline auto process_byte(ByteType byte) noexcept -> hasher_state; + BOOST_CRYPT_GPU_ENABLED inline auto process_byte(ByteType byte) noexcept -> state; template - BOOST_CRYPT_GPU_ENABLED inline auto process_bytes(ForwardIter buffer, size_t byte_count) noexcept -> hasher_state; + BOOST_CRYPT_GPU_ENABLED inline auto process_bytes(ForwardIter buffer, size_t byte_count) noexcept -> state; #ifdef BOOST_CRYPT_HAS_STRING_VIEW - inline auto process_bytes(std::string_view str) noexcept -> hasher_state; + inline auto process_bytes(std::string_view str) noexcept -> state; - inline auto process_bytes(std::u16string_view str) noexcept -> hasher_state; + inline auto process_bytes(std::u16string_view str) noexcept -> state; - inline auto process_bytes(std::u32string_view str) noexcept -> hasher_state; + inline auto process_bytes(std::u32string_view str) noexcept -> state; - inline auto process_bytes(std::wstring_view str) noexcept -> hasher_state; + inline auto process_bytes(std::wstring_view str) noexcept -> state; #endif // BOOST_CRYPT_HAS_STRING_VIEW #ifdef BOOST_CRYPT_HAS_SPAN template - inline auto process_bytes(std::span data) noexcept -> hasher_state; + inline auto process_bytes(std::span data) noexcept -> state; #endif // BOOST_CRYPT_HAS_SPAN #ifdef BOOST_CRYPT_HAS_CUDA template - BOOST_CRYPT_GPU_ENABLED inline auto process_bytes(cuda::std::span data) noexcept -> hasher_state; + BOOST_CRYPT_GPU_ENABLED inline auto process_bytes(cuda::std::span data) noexcept -> state; #endif // BOOST_CRYPT_HAS_CUDA