aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlloyd <[email protected]>2009-01-31 12:50:17 +0000
committerlloyd <[email protected]>2009-01-31 12:50:17 +0000
commite2927df4522d7e588214f1a5195efa298a6f0d23 (patch)
tree9d23c6c5c103187ba9d552cd815a74ae434bc949
parent0698d2ce28b4150173dc4f0f6577489124e16290 (diff)
In es_unix, two changes
Make the fast poll significantly more pessimistic/realistic about how many bits of randomness we're getting from getrusage and stat. Don't cut out from execing programs if the desired poll bits is under 128. Simply poll until either the accumulator says we're done or we run out of sources. Assumption is that the poll won't be run at all unless it is ncessary (es_unix comes late in the list of sources to use since it is pretty slow).
-rw-r--r--src/entropy/unix_procs/es_unix.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/entropy/unix_procs/es_unix.cpp b/src/entropy/unix_procs/es_unix.cpp
index 3ac8cd8d3..c8cf6daec 100644
--- a/src/entropy/unix_procs/es_unix.cpp
+++ b/src/entropy/unix_procs/es_unix.cpp
@@ -66,7 +66,7 @@ void Unix_EntropySource::poll(Entropy_Accumulator& accum)
struct stat statbuf;
clear_mem(&statbuf, 1);
::stat(stat_targets[j], &statbuf);
- accum.add(&statbuf, sizeof(statbuf), .05);
+ accum.add(&statbuf, sizeof(statbuf), .005);
}
accum.add(::getpid(), 0);
@@ -79,13 +79,10 @@ void Unix_EntropySource::poll(Entropy_Accumulator& accum)
struct ::rusage usage;
::getrusage(RUSAGE_SELF, &usage);
- accum.add(usage, .05);
+ accum.add(usage, .005);
::getrusage(RUSAGE_CHILDREN, &usage);
- accum.add(usage, .05);
-
- if(accum.desired_remaining_bits() < 128)
- return;
+ accum.add(usage, .005);
const u32bit MINIMAL_WORKING = 16;