diff options
author | Kim Alvefur <zash@zash.se> | 2017-12-03 15:21:12 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2017-12-03 15:21:12 +0100 |
commit | 49ac287d45c921717ed928d73198fb10df3b7785 (patch) | |
tree | 7bf81f4d70bac58ed3522b88d14c3c0dbeb9c487 | |
parent | a2f2567e8fa4a8c9cdca1f1a909c287b2935f899 (diff) | |
download | prosody-49ac287d45c921717ed928d73198fb10df3b7785.tar.gz prosody-49ac287d45c921717ed928d73198fb10df3b7785.zip |
util.crand: Make it possible to use arc4random on Linux (needs libbsd)
-rwxr-xr-x | configure | 2 | ||||
-rw-r--r-- | util-src/crand.c | 6 |
2 files changed, 7 insertions, 1 deletions
@@ -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 <openssl/rand.h> -#elif ! defined(WITH_ARC4RANDOM) +#elif defined(WITH_ARC4RANDOM) +#ifdef __linux__ +#include <bsd/stdlib.h> +#endif +#else #error util.crand compiled without a random source #endif |