From d2f5ab1ee8376e817c4d0e68c2bded31341fbc0e Mon Sep 17 00:00:00 2001 From: Brent Cook Date: Sun, 6 Nov 2016 10:10:10 +0100 Subject: prefer builtin arc4random on OS X 10.12+ (using getentropy as the signal) --- m4/check-os-options.m4 | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'm4') diff --git a/m4/check-os-options.m4 b/m4/check-os-options.m4 index f2ff57f..ed7320a 100644 --- a/m4/check-os-options.m4 +++ b/m4/check-os-options.m4 @@ -20,7 +20,15 @@ case $host_os in # weak seed on failure to open /dev/random, based on latest # public source: # http://www.opensource.apple.com/source/Libc/Libc-997.90.3/gen/FreeBSD/arc4random.c - USE_BUILTIN_ARC4RANDOM=yes + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +#include +#include + ]], [[ +char buf[1]; getentropy(buf, 1); + ]])], + [ USE_BUILTIN_ARC4RANDOM=no ], + [ USE_BUILTIN_ARC4RANDOM=yes ] + ) # Not available on iOS AC_CHECK_HEADER([arpa/telnet.h], [], [BUILD_NC=no]) ;; -- cgit v1.2.3-55-g6feb