[Botan-devel] "PRNG not seeded" error when laptop heats up

Jack Lloyd lloyd at randombit.net
Mon Jun 22 08:39:49 EDT 2009


On Mon, Jun 22, 2009 at 12:23:49AM -0400, Z. S. O. wrote:
> I may need to do more testing but after installing Botan on another mac
> (with the patch applied) I am still getting the "not seeded" error, and in
> fact is happening 100% of the time rather than sometimes. auto_rng.cpp has
> the same sha1 hash listed in the patch (4adc...3f0a) so it's not that I
> applied it incorrectly. I seem to be the only one perpetually dealing with
> this error so I'm assuming it's something I am doing wrong personally. I'll
> update here if I make any progress in figuring it out.

Could you try the attached patch? I commited it to the tree yesterday
to help deal with some of these problems, it would be good to know if
it actually helps or not.

-Jack
-------------- next part --------------
#
#
# patch "src/rng/hmac_rng/hmac_rng.cpp"
#  from [0666c868e4caac338a0bbc2b81c972ad26d7a560]
#    to [cf25dc08bffae237a52279995ed7a6fb838f53f7]
# 
# patch "src/rng/randpool/randpool.cpp"
#  from [73bc1a8bfe7b268b91d4c1cf82178f995efc2ce0]
#    to [b91702a64aa3b9c89d2510a6ac044ac9ade4de4c]
#
============================================================
--- src/rng/hmac_rng/hmac_rng.cpp	0666c868e4caac338a0bbc2b81c972ad26d7a560
+++ src/rng/hmac_rng/hmac_rng.cpp	cf25dc08bffae237a52279995ed7a6fb838f53f7
@@ -72,12 +72,15 @@ void HMAC_RNG::reseed_with_input(u32bit 
 
    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
============================================================
--- src/rng/randpool/randpool.cpp	73bc1a8bfe7b268b91d4c1cf82178f995efc2ce0
+++ src/rng/randpool/randpool.cpp	b91702a64aa3b9c89d2510a6ac044ac9ade4de4c
@@ -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();


More information about the botan-devel mailing list