aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlloyd <[email protected]>2008-11-23 21:43:28 +0000
committerlloyd <[email protected]>2008-11-23 21:43:28 +0000
commit5d2ea73ab4a35c8136eaff86df02b1c23131976b (patch)
tree971fd179304b8e7bd849db52d4ae7db2f894aaee
parent2187f78f9868267384034b76ba477f8ece75e096 (diff)
Modify es_ftw to use xor_into_buf
-rw-r--r--src/entropy/proc_walk/es_ftw.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/entropy/proc_walk/es_ftw.cpp b/src/entropy/proc_walk/es_ftw.cpp
index 013bb922b..f92a0cf82 100644
--- a/src/entropy/proc_walk/es_ftw.cpp
+++ b/src/entropy/proc_walk/es_ftw.cpp
@@ -5,7 +5,7 @@
#include <botan/es_ftw.h>
#include <botan/secmem.h>
-#include <botan/util.h>
+#include <botan/xor_buf.h>
#include <cstring>
#include <deque>
@@ -118,12 +118,13 @@ u32bit FTW_EntropySource::slow_poll(byte buf[], u32bit length)
SecureVector<byte> read_buf(4096);
u32bit bytes_read = 0;
+ u32bit buf_i = 0;
while(bytes_read < length * 32)
{
int fd = dir->next_fd();
- if(fd == -1)
+ if(fd == -1) // re-walk
{
delete dir;
dir = new Directory_Walker(path);
@@ -137,8 +138,7 @@ u32bit FTW_EntropySource::slow_poll(byte buf[], u32bit length)
if(got > 0 && got <= read_buf.size())
{
- for(ssize_t i = 0; i != got; ++i)
- buf[i % length] ^= read_buf[i];
+ buf_i = xor_into_buf(buf, buf_i, length, read_buf, got);
// never count any one file for more than 128 bytes
bytes_read += std::min<u32bit>(got, 128);