aboutsummaryrefslogtreecommitdiffstats
path: root/src/rng
diff options
context:
space:
mode:
authorlloyd <[email protected]>2012-02-20 21:04:50 +0000
committerlloyd <[email protected]>2012-02-20 21:04:50 +0000
commit018bfa3c50ec857ce93b44096fc1890dc7dd65a5 (patch)
tree39b72c034c6eb789a80f8d63bfde35f4705663c8 /src/rng
parentec3d97c4b9cde8c017afa0f6c1dc7e69c6ac1229 (diff)
Avoid blocking more than 100 ms in the random device reader. Scale up
how much we ask for on the basis of how many bits we're counting each byte as contributing. Change /dev/*random estimate to 7 bits per byte. Small cleanup in HMAC_RNG.
Diffstat (limited to 'src/rng')
-rw-r--r--src/rng/hmac_rng/hmac_rng.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/rng/hmac_rng/hmac_rng.cpp b/src/rng/hmac_rng/hmac_rng.cpp
index 55503382a..74ba522a4 100644
--- a/src/rng/hmac_rng/hmac_rng.cpp
+++ b/src/rng/hmac_rng/hmac_rng.cpp
@@ -75,7 +75,8 @@ void HMAC_RNG::reseed(size_t poll_bits)
while(!accum.polling_goal_achieved() && poll_attempt < poll_bits)
{
- entropy_sources[poll_attempt % entropy_sources.size()]->poll(accum);
+ const size_t src_idx = poll_attempt % entropy_sources.size();
+ entropy_sources[src_idx]->poll(accum);
++poll_attempt;
}
}