diff options
author | Cory Fields <cory-nospam-@coryfields.com> | 2017-07-17 13:14:53 -0400 |
---|---|---|
committer | Cory Fields <cory-nospam-@coryfields.com> | 2017-07-17 13:14:53 -0400 |
commit | 077d01f2fcc305809f084ccc34badc531ae2f30a (patch) | |
tree | ea2a54eae81db2802bfb552a5ca2565c9227f8ec /src/random.cpp | |
parent | 0b019357ff09e7a522307fc271d6b60562a7b890 (diff) |
random: only use getentropy on openbsd
Diffstat (limited to 'src/random.cpp')
-rw-r--r-- | src/random.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/random.cpp b/src/random.cpp index 3226abb69e..b308e8f4a1 100644 --- a/src/random.cpp +++ b/src/random.cpp @@ -227,10 +227,12 @@ void GetOSRand(unsigned char *ent32) RandFailure(); } } -#elif defined(HAVE_GETENTROPY) +#elif defined(HAVE_GETENTROPY) && defined(__OpenBSD__) /* On OpenBSD this can return up to 256 bytes of entropy, will return an * error if more are requested. * The call cannot return less than the requested number of bytes. + getentropy is explicitly limited to openbsd here, as a similar (but not + the same) function may exist on other platforms via glibc. */ if (getentropy(ent32, NUM_OS_RANDOM_BYTES) != 0) { RandFailure(); |