Changeset

8448:f516a52f19e8

util.crand: Make it possible to use arc4random on Linux (needs libbsd)
author Kim Alvefur <zash@zash.se>
date Sun, 03 Dec 2017 15:21:12 +0100
parents 8447:200f4f1b7833
children 8449:b572a708fd41
files configure util-src/crand.c
diffstat 2 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/configure	Sun Dec 03 15:03:25 2017 +0100
+++ b/configure	Sun Dec 03 15:21:12 2017 +0100
@@ -528,6 +528,8 @@
 
 if [ "$PRNG" = "OPENSSL" ]; then
    PRNGLIBS=$OPENSSL_LIBS
+elif [ "$PRNG" = "ARC4RANDOM" -a "$(uname)" = "Linux" ]; then
+   PRNGLIBS="-lbsd"
 fi
 
 # Write config
--- a/util-src/crand.c	Sun Dec 03 15:03:25 2017 +0100
+++ b/util-src/crand.c	Sun Dec 03 15:21:12 2017 +0100
@@ -54,7 +54,11 @@
 
 #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