diff options
author | Brent Cook <bcook@rapid7.com> | 2016-11-06 10:10:10 +0100 |
---|---|---|
committer | Brent Cook <bcook@openbsd.org> | 2016-11-06 03:12:34 -0600 |
commit | d2f5ab1ee8376e817c4d0e68c2bded31341fbc0e (patch) | |
tree | 29d8102a2051b1f3b4eed8afeb3161bf6c6099d4 /m4 | |
parent | d38ab0a39e0b901bc10e1a65ff4f8a904f09f78c (diff) | |
download | portable-d2f5ab1ee8376e817c4d0e68c2bded31341fbc0e.tar.gz portable-d2f5ab1ee8376e817c4d0e68c2bded31341fbc0e.tar.bz2 portable-d2f5ab1ee8376e817c4d0e68c2bded31341fbc0e.zip |
prefer builtin arc4random on OS X 10.12+ (using getentropy as the signal)
Diffstat (limited to 'm4')
-rw-r--r-- | m4/check-os-options.m4 | 10 |
1 files changed, 9 insertions, 1 deletions
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 | |||
20 | # weak seed on failure to open /dev/random, based on latest | 20 | # weak seed on failure to open /dev/random, based on latest |
21 | # public source: | 21 | # public source: |
22 | # http://www.opensource.apple.com/source/Libc/Libc-997.90.3/gen/FreeBSD/arc4random.c | 22 | # http://www.opensource.apple.com/source/Libc/Libc-997.90.3/gen/FreeBSD/arc4random.c |
23 | USE_BUILTIN_ARC4RANDOM=yes | 23 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
24 | #include <unistd.h> | ||
25 | #include <sys/random.h> | ||
26 | ]], [[ | ||
27 | char buf[1]; getentropy(buf, 1); | ||
28 | ]])], | ||
29 | [ USE_BUILTIN_ARC4RANDOM=no ], | ||
30 | [ USE_BUILTIN_ARC4RANDOM=yes ] | ||
31 | ) | ||
24 | # Not available on iOS | 32 | # Not available on iOS |
25 | AC_CHECK_HEADER([arpa/telnet.h], [], [BUILD_NC=no]) | 33 | AC_CHECK_HEADER([arpa/telnet.h], [], [BUILD_NC=no]) |
26 | ;; | 34 | ;; |