mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-10 03:47:29 -03:00
random: getentropy on macOS does not need unistd.h
Remove it. Make this change, so in a future commit, we can combine #ifdefs, and avoid duplicate <sys/random.h> includes once we switch to using getrandom directly. Also remove the comment about macOS 10.12. We already require macOS > 10.15, so it is redundant.
This commit is contained in:
parent
17acb2782a
commit
c13c97dbf8
2 changed files with 2 additions and 5 deletions
|
@ -1179,8 +1179,8 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>
|
||||||
[ AC_MSG_RESULT([no])]
|
[ AC_MSG_RESULT([no])]
|
||||||
)
|
)
|
||||||
|
|
||||||
AC_MSG_CHECKING([for getentropy via random.h])
|
AC_MSG_CHECKING([for getentropy via sys/random.h])
|
||||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||||
#include <sys/random.h>]],
|
#include <sys/random.h>]],
|
||||||
[[ getentropy(nullptr, 32) ]])],
|
[[ getentropy(nullptr, 32) ]])],
|
||||||
[ AC_MSG_RESULT([yes]); AC_DEFINE([HAVE_GETENTROPY_RAND], [1], [Define this symbol if the BSD getentropy system call is available with sys/random.h]) ],
|
[ AC_MSG_RESULT([yes]); AC_DEFINE([HAVE_GETENTROPY_RAND], [1], [Define this symbol if the BSD getentropy system call is available with sys/random.h]) ],
|
||||||
|
|
|
@ -33,7 +33,6 @@
|
||||||
#include <linux/random.h>
|
#include <linux/random.h>
|
||||||
#endif
|
#endif
|
||||||
#if defined(HAVE_GETENTROPY_RAND) && defined(MAC_OSX)
|
#if defined(HAVE_GETENTROPY_RAND) && defined(MAC_OSX)
|
||||||
#include <unistd.h>
|
|
||||||
#include <sys/random.h>
|
#include <sys/random.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_SYSCTL_ARND
|
#ifdef HAVE_SYSCTL_ARND
|
||||||
|
@ -314,8 +313,6 @@ void GetOSRand(unsigned char *ent32)
|
||||||
// Silence a compiler warning about unused function.
|
// Silence a compiler warning about unused function.
|
||||||
(void)GetDevURandom;
|
(void)GetDevURandom;
|
||||||
#elif defined(HAVE_GETENTROPY_RAND) && defined(MAC_OSX)
|
#elif defined(HAVE_GETENTROPY_RAND) && defined(MAC_OSX)
|
||||||
/* getentropy() is available on macOS 10.12 and later.
|
|
||||||
*/
|
|
||||||
if (getentropy(ent32, NUM_OS_RANDOM_BYTES) != 0) {
|
if (getentropy(ent32, NUM_OS_RANDOM_BYTES) != 0) {
|
||||||
RandFailure();
|
RandFailure();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue