aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorAlexander Bluhm <[email protected]>2017-03-30 16:40:41 +0200
committerAlexander Bluhm <[email protected]>2017-03-30 16:42:42 +0200
commiteb9bde389750a567cfbfc3c25770323173b6e770 (patch)
tree0d78c93220e43dde6f4183370f14e237e9fc89b1 /src/lib
parentd218baa7722f6e8e216a9127cbd577e305d4a490 (diff)
Always poll 256 bytes from Getentropy.
The OpenBSD system limit for getentropy(2) is 256 bytes. It does not make sense to use the BOTAN_SYSTEM_RNG_POLL_REQUEST define here. As it is only used in one place, another define would be overkill.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/entropy/getentropy/getentropy.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/lib/entropy/getentropy/getentropy.cpp b/src/lib/entropy/getentropy/getentropy.cpp
index 56c356eba..e578a4ed5 100644
--- a/src/lib/entropy/getentropy/getentropy.cpp
+++ b/src/lib/entropy/getentropy/getentropy.cpp
@@ -12,12 +12,13 @@
namespace Botan {
/**
-* Gather BOTAN_SYSTEM_RNG_POLL_REQUEST bytes entropy from getentropy(2).
-* This is 64 bytes, note that maximum buffer size is limited to 256 bytes.
+* Gather 256 bytes entropy from getentropy(2). Note that maximum
+* buffer size is limited to 256 bytes. On OpenBSD this does neither
+* block nor fail.
*/
size_t Getentropy::poll(RandomNumberGenerator& rng)
{
- secure_vector<uint8_t> buf(BOTAN_SYSTEM_RNG_POLL_REQUEST);
+ secure_vector<uint8_t> buf(256);
if(::getentropy(buf.data(), buf.size()) == 0)
{