diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2017-05-20 20:41:30 +0200 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2017-12-19 11:22:53 +0100 |
commit | e3262cd5c04be19011ccd93c34fe419e196b1f61 (patch) | |
tree | 645598dd79a898fd98758a7a427bcfe8e0f37338 | |
parent | eeb2b43b5e54d950b7178cec091ae1b86d0582e4 (diff) | |
download | gnutls-e3262cd5c04be19011ccd93c34fe419e196b1f61.tar.gz |
sysrng-linux: improved detection of getrandom()
The getrandom() call is defined in sys/random.h.
Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
-rw-r--r-- | configure.ac | 4 | ||||
-rw-r--r-- | lib/nettle/sysrng-linux.c | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/configure.ac b/configure.ac index 72fa336688..73e5036772 100644 --- a/configure.ac +++ b/configure.ac @@ -218,11 +218,11 @@ dnl check for getrandom() rnd_variant="auto-detect" AC_MSG_CHECKING([for getrandom]) AC_LINK_IFELSE([AC_LANG_PROGRAM([ - #include <linux/random.h>],[ + #include <sys/random.h>],[ getrandom(0, 0, 0); ])], [AC_MSG_RESULT(yes) - AC_DEFINE([HAVE_LINUX_GETRANDOM], 1, [Enable the Linux getrandom function]) + AC_DEFINE([HAVE_GETRANDOM], 1, [Enable the Linux getrandom function]) rnd_variant=getrandom], [AC_MSG_RESULT(no)]) diff --git a/lib/nettle/sysrng-linux.c b/lib/nettle/sysrng-linux.c index 3931abbea6..95993daa7e 100644 --- a/lib/nettle/sysrng-linux.c +++ b/lib/nettle/sysrng-linux.c @@ -51,8 +51,8 @@ static ino_t _gnutls_urandom_fd_ino = 0; static dev_t _gnutls_urandom_fd_rdev = 0; #if defined(__linux__) -# ifdef HAVE_LINUX_GETRANDOM -# include <linux/random.h> +# ifdef HAVE_GETRANDOM +# include <sys/random.h> # else # include <sys/syscall.h> # undef getrandom |