aboutsummaryrefslogtreecommitdiffstats
path: root/src/entropy/unix_procs
diff options
context:
space:
mode:
authorlloyd <[email protected]>2008-11-23 21:35:24 +0000
committerlloyd <[email protected]>2008-11-23 21:35:24 +0000
commit2a90be43f1211671b2be438bf1dc05738c13d74d (patch)
treefa57b0e776de112b52a3a576a7def2b228d5a9a8 /src/entropy/unix_procs
parentc243688f6062cf4577610d8ef71ba0ec60a932e2 (diff)
Previously es_unix would always try to get 16K, then return. Now it
tries to get an amount cooresponding with the size of the output buffer, specifically 128 times the output size. So, assuming we have enough working sources, each output byte will be the XOR of (at least) 128 bytes of text from the output programs. (Though RLE may reduce that somewhat)
Diffstat (limited to 'src/entropy/unix_procs')
-rw-r--r--src/entropy/unix_procs/es_unix.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/entropy/unix_procs/es_unix.cpp b/src/entropy/unix_procs/es_unix.cpp
index a10dd72a4..cf7e0a8e5 100644
--- a/src/entropy/unix_procs/es_unix.cpp
+++ b/src/entropy/unix_procs/es_unix.cpp
@@ -103,10 +103,9 @@ u32bit Unix_EntropySource::slow_poll(byte buf[], u32bit length)
if(length == 0)
return 0;
- const u32bit TRY_TO_GET = 16 * 1024;
const u32bit MINIMAL_WORKING = 32;
- u32bit got = 0;
+ u32bit total_got = 0;
u32bit buf_i = 0;
for(u32bit j = 0; j != sources.size(); j++)
@@ -124,9 +123,9 @@ u32bit Unix_EntropySource::slow_poll(byte buf[], u32bit length)
}
sources[j].working = (got_from_src >= MINIMAL_WORKING) ? true : false;
- got += got_from_src;
+ total_got += got_from_src;
- if(got >= TRY_TO_GET)
+ if(total_got >= 128*length)
break;
}