diff options
author | lloyd <[email protected]> | 2009-01-27 06:27:40 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2009-01-27 06:27:40 +0000 |
commit | 092c6d68006a2d953d8b622ce2c181a6394aed4e (patch) | |
tree | b10582379b69bd2cd4e4af0b66597342f0d28b72 /src/rng/randpool | |
parent | 497e3656c1141098ab76dc0fb7922e9e9d5b6bc8 (diff) |
Have Entropy_Accumulator dump everything into a BufferedComputation.
Since both Randpool and HMAC_RNG fed the input into a MAC anyway, this
works nicely. (It would be nicer to use tr1::function but, argh, don't
want to fully depend on TR1 quite yet. C++0x cannot come soon enough).
This avoids requiring to do run length encoding, it just dumps everything
as-is into the MAC. This ensures the buffer is not a potential narrow pipe
for the entropy (for instance, one might imagine an entropy source which
outputs one random byte every 16 bytes, and the rest some repeating pattern -
using a 16 byte buffer, you would only get 8 bits of entropy total, no matter
how many times you sampled).
Diffstat (limited to 'src/rng/randpool')
-rw-r--r-- | src/rng/randpool/randpool.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/rng/randpool/randpool.cpp b/src/rng/randpool/randpool.cpp index 1a111e20e..41a8ca23a 100644 --- a/src/rng/randpool/randpool.cpp +++ b/src/rng/randpool/randpool.cpp @@ -101,7 +101,7 @@ void Randpool::mix_pool() */ void Randpool::reseed(u32bit poll_bits) { - Entropy_Accumulator accum(poll_bits); + Entropy_Accumulator accum(*mac, poll_bits); for(u32bit i = 0; i != entropy_sources.size(); ++i) { @@ -111,7 +111,7 @@ void Randpool::reseed(u32bit poll_bits) break; } - SecureVector<byte> mac_val = mac->process(accum.get_entropy_buffer()); + SecureVector<byte> mac_val = mac->final(); xor_buf(pool, mac_val, mac_val.size()); mix_pool(); |