diff options
-rw-r--r-- | doc/log.txt | 7 | ||||
-rw-r--r-- | src/rng/hmac_rng/hmac_rng.cpp | 11 | ||||
-rw-r--r-- | src/rng/randpool/randpool.cpp | 11 |
3 files changed, 18 insertions, 11 deletions
diff --git a/doc/log.txt b/doc/log.txt index 9ca274ff4..d29f00f36 100644 --- a/doc/log.txt +++ b/doc/log.txt @@ -1,8 +1,9 @@ * 1.8.3-pre, 2009-??-?? - - Add the Skein-512 hash function - - Add XTS mode from IEEE P1619 - - Use a default value for AutoSeeded_RNG::reseed + - Improve handling of low-entropy situations during PRNG seeding + - Add the Skein-512 SHA-3 candidate hash function + - Add the XTS block cipher mode from IEEE P1619 + - Provide a default value for AutoSeeded_RNG::reseed - Fix Gentoo bug 272242 * 1.8.2, 2009-04-07 diff --git a/src/rng/hmac_rng/hmac_rng.cpp b/src/rng/hmac_rng/hmac_rng.cpp index 757f59037..113489db3 100644 --- a/src/rng/hmac_rng/hmac_rng.cpp +++ b/src/rng/hmac_rng/hmac_rng.cpp @@ -72,12 +72,15 @@ void HMAC_RNG::reseed_with_input(u32bit poll_bits, Entropy_Accumulator_BufferedComputation accum(*extractor, poll_bits); - for(u32bit i = 0; i < entropy_sources.size(); ++i) + if(!entropy_sources.empty()) { - if(accum.polling_goal_achieved()) - break; + u32bit poll_attempt = 0; - entropy_sources[i]->poll(accum); + while(!accum.polling_goal_achieved() && poll_attempt < poll_bits) + { + entropy_sources[poll_attempt % entropy_sources.size()]->poll(accum); + ++poll_attempt; + } } // And now add the user-provided input, if any diff --git a/src/rng/randpool/randpool.cpp b/src/rng/randpool/randpool.cpp index f9e05c246..77a5228c6 100644 --- a/src/rng/randpool/randpool.cpp +++ b/src/rng/randpool/randpool.cpp @@ -105,12 +105,15 @@ void Randpool::reseed(u32bit poll_bits) { Entropy_Accumulator_BufferedComputation accum(*mac, poll_bits); - for(u32bit i = 0; i != entropy_sources.size(); ++i) + if(!entropy_sources.empty()) { - entropy_sources[i]->poll(accum); + u32bit poll_attempt = 0; - if(accum.polling_goal_achieved()) - break; + while(!accum.polling_goal_achieved() && poll_attempt < poll_bits) + { + entropy_sources[poll_attempt % entropy_sources.size()]->poll(accum); + ++poll_attempt; + } } SecureVector<byte> mac_val = mac->final(); |