mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-06 03:02:37 +02:00
random: switch to using getrandom() directly
This requires a linux kernel of 3.17.0+, which seems entirely reasonable. 3.17 went EOL in 2015, and the last supported 3.x kernel (3.16) went EOL > 4 years ago, in 2020. For reference, the current oldest maintained kernel is 4.14 (released 2017, EOL Jan 2024). Support for `getrandom()` (and `getentropy()`) was added to glibc 2.25, https://sourceware.org/legacy-ml/libc-alpha/2017-02/msg00079.html, and we already require 2.27+. All that being said, I don't think you would encounter a current day system, running with kernel headers older than 3.17 (released 2014) but also having a glibc of 2.27+ (released 2018).
This commit is contained in:
11
configure.ac
11
configure.ac
@@ -1170,12 +1170,11 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <ctime>]],
|
||||
)
|
||||
|
||||
dnl Check for different ways of gathering OS randomness
|
||||
AC_MSG_CHECKING([for Linux getrandom syscall])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>
|
||||
#include <sys/syscall.h>
|
||||
#include <linux/random.h>]],
|
||||
[[ syscall(SYS_getrandom, nullptr, 32, 0); ]])],
|
||||
[ AC_MSG_RESULT([yes]); AC_DEFINE([HAVE_SYS_GETRANDOM], [1], [Define this symbol if the Linux getrandom system call is available]) ],
|
||||
AC_MSG_CHECKING([for Linux getrandom function])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||
#include <sys/random.h>]],
|
||||
[[ getrandom(nullptr, 32, 0); ]])],
|
||||
[ AC_MSG_RESULT([yes]); AC_DEFINE([HAVE_GETRANDOM], [1], [Define this symbol if the Linux getrandom function call is available]) ],
|
||||
[ AC_MSG_RESULT([no])]
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user