diff options
author | Jack Lloyd <[email protected]> | 2016-07-06 14:09:55 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2016-07-17 10:43:42 -0400 |
commit | 8f2f800c7ea841fa5ab963349178ac3a9f56a513 (patch) | |
tree | 6bfd690f9add2e5196f5c2cb4556407332091329 /src/lib/rng/hmac_rng | |
parent | d7864303e89a5e04294f8efd1d0e4ac26a1491e5 (diff) |
Address some review comments from @cordney
Use consistent naming for the max output before reseed
parameter. The constant (default) value is renamed to
BOTAN_RNG_DEFAULT_MAX_OUTPUT_BEFORE_RESEED, since without
the DEFAULT_ it reads like a compile time maximum instead.
Use uint8_t instead of byte.
Diffstat (limited to 'src/lib/rng/hmac_rng')
-rw-r--r-- | src/lib/rng/hmac_rng/hmac_rng.cpp | 9 | ||||
-rw-r--r-- | src/lib/rng/hmac_rng/hmac_rng.h | 5 |
2 files changed, 8 insertions, 6 deletions
diff --git a/src/lib/rng/hmac_rng/hmac_rng.cpp b/src/lib/rng/hmac_rng/hmac_rng.cpp index 410e3040a..c100cf70f 100644 --- a/src/lib/rng/hmac_rng/hmac_rng.cpp +++ b/src/lib/rng/hmac_rng/hmac_rng.cpp @@ -12,8 +12,8 @@ namespace Botan { -HMAC_RNG::HMAC_RNG(const std::string& hash, size_t max_before_reseed) : - Stateful_RNG(max_before_reseed) +HMAC_RNG::HMAC_RNG(const std::string& hash, size_t max_output_before_reseed) : + Stateful_RNG(max_output_before_reseed) { m_extractor = MAC::create("HMAC(" + hash + ")"); if(!m_extractor) @@ -36,8 +36,9 @@ HMAC_RNG::HMAC_RNG(const std::string& hash, size_t max_before_reseed) : * HMAC_RNG Constructor */ HMAC_RNG::HMAC_RNG(MessageAuthenticationCode* extractor, - MessageAuthenticationCode* prf) : - Stateful_RNG(BOTAN_RNG_MAX_OUTPUT_BEFORE_RESEED), + MessageAuthenticationCode* prf, + size_t max_output_before_reseed) : + Stateful_RNG(max_output_before_reseed), m_extractor(extractor), m_prf(prf) { if(!m_prf->valid_keylength(m_extractor->output_length()) || diff --git a/src/lib/rng/hmac_rng/hmac_rng.h b/src/lib/rng/hmac_rng/hmac_rng.h index f2f8a610d..a2538a83a 100644 --- a/src/lib/rng/hmac_rng/hmac_rng.h +++ b/src/lib/rng/hmac_rng/hmac_rng.h @@ -42,13 +42,14 @@ class BOTAN_DLL HMAC_RNG : public Stateful_RNG * @param prf a MAC used as a PRF using HKDF construction */ HMAC_RNG(MessageAuthenticationCode* extractor, - MessageAuthenticationCode* prf); + MessageAuthenticationCode* prf, + size_t max_output_before_reseed = BOTAN_RNG_DEFAULT_MAX_OUTPUT_BEFORE_RESEED); /** * Use the specified hash for both the extractor and PRF functions */ HMAC_RNG(const std::string& hash, - size_t max_before_reseed = BOTAN_RNG_MAX_OUTPUT_BEFORE_RESEED); + size_t max_output_before_reseed = BOTAN_RNG_DEFAULT_MAX_OUTPUT_BEFORE_RESEED); private: std::unique_ptr<MessageAuthenticationCode> m_extractor; std::unique_ptr<MessageAuthenticationCode> m_prf; |