aboutsummaryrefslogtreecommitdiffstats
path: root/src/entropy/proc_walk/es_ftw.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2012-02-17 13:16:17 +0000
committerlloyd <[email protected]>2012-02-17 13:16:17 +0000
commitcee8707b07952838e378ea7193af9eff83800b4e (patch)
treeec36628b4b23822b5f033ab7a39921734ce4c99c /src/entropy/proc_walk/es_ftw.cpp
parent718d9503e3bad05fa58d61af11784976a495e21a (diff)
Be more conservative about entropy estimates. In particular, instead
of giving /dev/random, EGD, and CryptoAPI a full 8 bits per byte of entropy, estimate at 6 bits. In the proc walker, allow more files to be read, read more of any particular file, and count each bit for 1/10 as much as before. Reading more of the file seems especially valuable, as some files are quite random, whereas others are very static, and this should ensure we read more of the actually unpredictable inputs. Prefer /dev/random over /dev/urandom
Diffstat (limited to 'src/entropy/proc_walk/es_ftw.cpp')
-rw-r--r--src/entropy/proc_walk/es_ftw.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/entropy/proc_walk/es_ftw.cpp b/src/entropy/proc_walk/es_ftw.cpp
index 5d58f9869..7bf6c3310 100644
--- a/src/entropy/proc_walk/es_ftw.cpp
+++ b/src/entropy/proc_walk/es_ftw.cpp
@@ -127,12 +127,12 @@ FTW_EntropySource::~FTW_EntropySource()
void FTW_EntropySource::poll(Entropy_Accumulator& accum)
{
- const size_t MAX_FILES_READ_PER_POLL = 1024;
+ const size_t MAX_FILES_READ_PER_POLL = 2048;
if(!dir)
dir = new Directory_Walker(path);
- MemoryRegion<byte>& io_buffer = accum.get_io_buffer(128);
+ MemoryRegion<byte>& io_buffer = accum.get_io_buffer(4096);
for(size_t i = 0; i != MAX_FILES_READ_PER_POLL; ++i)
{
@@ -150,7 +150,7 @@ void FTW_EntropySource::poll(Entropy_Accumulator& accum)
::close(fd);
if(got > 0)
- accum.add(&io_buffer[0], got, .01);
+ accum.add(&io_buffer[0], got, .001);
if(accum.polling_goal_achieved())
break;