aboutsummaryrefslogtreecommitdiffstats
path: root/src/entropy/dev_random/es_dev.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/entropy/dev_random/es_dev.cpp')
-rw-r--r--src/entropy/dev_random/es_dev.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/entropy/dev_random/es_dev.cpp b/src/entropy/dev_random/es_dev.cpp
index 310620716..426ef8443 100644
--- a/src/entropy/dev_random/es_dev.cpp
+++ b/src/entropy/dev_random/es_dev.cpp
@@ -89,9 +89,9 @@ int Device_Reader::open(const std::string& pathname)
}
-/*************************************************
-* Gather entropy from a RNG device *
-*************************************************/
+/**
+* Gather entropy from a RNG device
+*/
u32bit Device_EntropySource::slow_poll(byte output[], u32bit length)
{
u32bit read = 0;
@@ -109,4 +109,12 @@ u32bit Device_EntropySource::slow_poll(byte output[], u32bit length)
return read;
}
+/**
+* Fast /dev/random and co poll: limit output to 64 bytes
+*/
+u32bit Device_EntropySource::fast_poll(byte output[], u32bit length)
+ {
+ return slow_poll(output, std::max<u32bit>(length, 64));
+ }
+
}