From abb425e70f217eb660aadb29885e07a7238b7feb Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sun, 3 Dec 2017 15:21:12 +0100 Subject: util.crand: Make it possible to use arc4random on Linux (needs libbsd) --- configure | 2 ++ util-src/crand.c | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/configure b/configure index c26f78ed..13f7eff3 100755 --- a/configure +++ b/configure @@ -528,6 +528,8 @@ OPENSSL_LIBS="-l$OPENSSL_LIB" if [ "$PRNG" = "OPENSSL" ]; then PRNGLIBS=$OPENSSL_LIBS +elif [ "$PRNG" = "ARC4RANDOM" -a "$(uname)" = "Linux" ]; then + PRNGLIBS="-lbsd" fi # Write config diff --git a/util-src/crand.c b/util-src/crand.c index ab2f4ad1..cdc3c211 100644 --- a/util-src/crand.c +++ b/util-src/crand.c @@ -54,7 +54,11 @@ int getrandom(void *buf, size_t buflen, unsigned int flags) { #elif defined(WITH_OPENSSL) #include -#elif ! defined(WITH_ARC4RANDOM) +#elif defined(WITH_ARC4RANDOM) +#ifdef __linux__ +#include +#endif +#else #error util.crand compiled without a random source #endif -- cgit v1.2.3