diff options
Diffstat (limited to 'src/lib/entropy/proc_walk/proc_walk.cpp')
-rw-r--r-- | src/lib/entropy/proc_walk/proc_walk.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/lib/entropy/proc_walk/proc_walk.cpp b/src/lib/entropy/proc_walk/proc_walk.cpp index c59a8227b..a0c3f830a 100644 --- a/src/lib/entropy/proc_walk/proc_walk.cpp +++ b/src/lib/entropy/proc_walk/proc_walk.cpp @@ -110,7 +110,7 @@ int Directory_Walker::next_fd() } -void ProcWalking_EntropySource::poll(Entropy_Accumulator& accum) +size_t ProcWalking_EntropySource::poll(RandomNumberGenerator& rng) { const size_t MAX_FILES_READ_PER_POLL = 2048; @@ -121,6 +121,8 @@ void ProcWalking_EntropySource::poll(Entropy_Accumulator& accum) m_buf.resize(4096); + size_t bits = 0; + for(size_t i = 0; i != MAX_FILES_READ_PER_POLL; ++i) { int fd = m_dir->next_fd(); @@ -136,11 +138,15 @@ void ProcWalking_EntropySource::poll(Entropy_Accumulator& accum) ::close(fd); if(got > 0) - accum.add(m_buf.data(), got, BOTAN_ENTROPY_ESTIMATE_SYSTEM_TEXT); + { + rng.add_entropy(m_buf.data(), static_cast<size_t>(got)); + } - if(accum.polling_finished()) + if(bits > 128) break; } + + return bits; } } |