From e2927df4522d7e588214f1a5195efa298a6f0d23 Mon Sep 17 00:00:00 2001 From: lloyd Date: Sat, 31 Jan 2009 12:50:17 +0000 Subject: 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). --- src/entropy/unix_procs/es_unix.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'src/entropy') 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; -- cgit v1.2.3