From 8f2f800c7ea841fa5ab963349178ac3a9f56a513 Mon Sep 17 00:00:00 2001 From: Jack Lloyd Date: Wed, 6 Jul 2016 14:09:55 -0400 Subject: 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. --- src/lib/rng/hmac_rng/hmac_rng.cpp | 9 +++++---- src/lib/rng/hmac_rng/hmac_rng.h | 5 +++-- 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'src/lib/rng/hmac_rng') 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 m_extractor; std::unique_ptr m_prf; -- cgit v1.2.3