diff options
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/rng/chacha_rng/chacha_rng.cpp | 2 | ||||
-rw-r--r-- | src/lib/rng/hmac_drbg/hmac_drbg.cpp | 2 | ||||
-rw-r--r-- | src/lib/rng/stateful_rng/stateful_rng.h | 7 |
3 files changed, 7 insertions, 4 deletions
diff --git a/src/lib/rng/chacha_rng/chacha_rng.cpp b/src/lib/rng/chacha_rng/chacha_rng.cpp index ceccfef2c..ade92aa14 100644 --- a/src/lib/rng/chacha_rng/chacha_rng.cpp +++ b/src/lib/rng/chacha_rng/chacha_rng.cpp @@ -94,7 +94,7 @@ void ChaCha_RNG::add_entropy(const uint8_t input[], size_t input_len) if(8*input_len >= security_level()) { - m_reseed_counter = 1; + reset_reseed_counter(); } } diff --git a/src/lib/rng/hmac_drbg/hmac_drbg.cpp b/src/lib/rng/hmac_drbg/hmac_drbg.cpp index 4f19b5256..a01b761d9 100644 --- a/src/lib/rng/hmac_drbg/hmac_drbg.cpp +++ b/src/lib/rng/hmac_drbg/hmac_drbg.cpp @@ -161,7 +161,7 @@ void HMAC_DRBG::add_entropy(const uint8_t input[], size_t input_len) if(8*input_len >= security_level()) { - m_reseed_counter = 1; + reset_reseed_counter(); } } diff --git a/src/lib/rng/stateful_rng/stateful_rng.h b/src/lib/rng/stateful_rng/stateful_rng.h index 0d59d396b..d02be5659 100644 --- a/src/lib/rng/stateful_rng/stateful_rng.h +++ b/src/lib/rng/stateful_rng/stateful_rng.h @@ -122,7 +122,11 @@ class BOTAN_DLL Stateful_RNG : public RandomNumberGenerator protected: void reseed_check(); - uint32_t last_pid() const { return m_last_pid; } + /** + * Called by a subclass to notify that a reseed has been + * successfully performed. + */ + void reset_reseed_counter() { m_reseed_counter = 1; } private: // A non-owned and possibly null pointer to shared RNG @@ -134,7 +138,6 @@ class BOTAN_DLL Stateful_RNG : public RandomNumberGenerator const size_t m_reseed_interval; uint32_t m_last_pid = 0; - protected: /* * Set to 1 after a successful seeding, then incremented. Reset * to 0 by clear() or a fork. This logic is used even if |