util.crand: Make it possible to use arc4random on Linux (needs libbsd)

This commit is contained in:
Kim Alvefur 2017-12-03 15:21:12 +01:00
parent da570eb0a4
commit abb425e70f
2 changed files with 7 additions and 1 deletions

2
configure vendored
View file

@ -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

View file

@ -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