aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2017-07-18 08:24:40 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2017-07-18 08:29:35 +0200
commit81560b07ce8a14fb3a965a8f231545f05d8d7768 (patch)
tree14b8ac9e9673687339f423efc90b592c91640855 /src
parent75b5643c47c3b382ed97a9f5e2bdc883a0f98709 (diff)
parent077d01f2fcc305809f084ccc34badc531ae2f30a (diff)
downloadbitcoin-81560b07ce8a14fb3a965a8f231545f05d8d7768.tar.xz
Merge #10855: random: only use getentropy on openbsd
077d01f random: only use getentropy on openbsd (Cory Fields) Pull request description: Follow-up from #10335. I can confirm that this fixes my issue when building against a new glibc + old linux headers for back-compat. Tree-SHA512: a0fcf26995fbd3636f970e729a172c6e1d7c0de371e703f0653cd9776600f438ec43acd2b1eb92f2678a011968da8fbbeef8a54599434851f4c6ffe78291c172
Diffstat (limited to 'src')
-rw-r--r--src/random.cpp4
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();