aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@protonmail.com>2020-03-17 16:44:29 +0100
committerWladimir J. van der Laan <laanwj@protonmail.com>2020-03-17 17:03:20 +0100
commit1d64dfe4fa050a81e4f9b665f2fad2180401cc6e (patch)
treefcd4b16f78ab2eb59802b435a15acff123675056 /src
parent8fc5f2bdf01d09d2e6f5df3134e95cebc7f3519a (diff)
parentf9f210d8de43b4559fe7c80bb286aeb60de52b54 (diff)
Merge #18364: random: remove getentropy() fallback for macOS < 10.12
f9f210d8de43b4559fe7c80bb286aeb60de52b54 doc: fix GetTimeMicros() comment in random.cpp (fanquake) a8897115626ab6509c67511e50e73c0f7c953c6a rand: remove getentropy() fallback for macOS < 10.12 (fanquake) Pull request description: We [no longer support macOS < 10.12](https://github.com/bitcoin/bitcoin/pull/17550) (our binaries will not run), so remove the fallback for when `getentropy()` wasn't available. From the manpage: ```bash HISTORY The getentropy() function appeared in OSX 10.12 ``` Note that compiling on macOS you'll see a new unused function warning: ```bash random.cpp:256:13: warning: unused function 'GetDevURandom' [-Wunused-function] static void GetDevURandom(unsigned char *ent32) ^ 1 warning generated. ``` This will likely be addressed as part of #17563. ACKs for top commit: vasild: ACK f9f210d8 (code review, not tested) elichai: utACK f9f210d8de43b4559fe7c80bb286aeb60de52b54 practicalswift: ACK f9f210d8de43b4559fe7c80bb286aeb60de52b54 -- patch looks correct laanwj: ACK f9f210d8de43b4559fe7c80bb286aeb60de52b54 hebasto: ACK f9f210d8de43b4559fe7c80bb286aeb60de52b54, tested on macOS 10.13.6: compiled Tree-SHA512: 6bd2a721f23605a8bca0b7b51f42d628ebf92a18e74eb43194331ba745ee449223aff84119892781c40b188c70b75417447f4e390e3d9ac549292de2b1e8b308
Diffstat (limited to 'src')
-rw-r--r--src/random.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/random.cpp b/src/random.cpp
index f0082cf3e0..f7f3dd9de3 100644
--- a/src/random.cpp
+++ b/src/random.cpp
@@ -15,7 +15,7 @@
#endif
#include <logging.h> // for LogPrintf()
#include <sync.h> // for Mutex
-#include <util/time.h> // for GetTime()
+#include <util/time.h> // for GetTimeMicros()
#include <stdlib.h>
#include <thread>
@@ -315,13 +315,10 @@ void GetOSRand(unsigned char *ent32)
RandFailure();
}
#elif defined(HAVE_GETENTROPY_RAND) && defined(MAC_OSX)
- // We need a fallback for OSX < 10.12
- if (&getentropy != nullptr) {
- if (getentropy(ent32, NUM_OS_RANDOM_BYTES) != 0) {
- RandFailure();
- }
- } else {
- GetDevURandom(ent32);
+ /* getentropy() is available on macOS 10.12 and later.
+ */
+ if (getentropy(ent32, NUM_OS_RANDOM_BYTES) != 0) {
+ RandFailure();
}
#elif defined(HAVE_SYSCTL_ARND)
/* FreeBSD and similar. It is possible for the call to return less