aboutsummaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorBrent Cook <bcook@openbsd.org>2016-01-03 20:47:20 -0600
committerBrent Cook <bcook@openbsd.org>2016-01-03 21:24:05 -0600
commit35e669fd1a0fb3f8af5e127c7d62d4c2a0ae3503 (patch)
tree6478b7028d7affe76bc4d3fea5945723c5de233e /m4
parentd0009039dec393dfa65dfebb2e5f41288ac185cc (diff)
downloadportable-35e669fd1a0fb3f8af5e127c7d62d4c2a0ae3503.tar.gz
portable-35e669fd1a0fb3f8af5e127c7d62d4c2a0ae3503.tar.bz2
portable-35e669fd1a0fb3f8af5e127c7d62d4c2a0ae3503.zip
whitelist NetBSD 7.0 native arc4random(3) implementation.
NetBSD 7 improves arc4random(3) over earlier versions by adding fork detection, stronger assertions on seed failure.
Diffstat (limited to 'm4')
-rw-r--r--m4/check-libc.m44
-rw-r--r--m4/check-os-options.m416
2 files changed, 17 insertions, 3 deletions
diff --git a/m4/check-libc.m4 b/m4/check-libc.m4
index 44721a0..4a0debf 100644
--- a/m4/check-libc.m4
+++ b/m4/check-libc.m4
@@ -56,9 +56,7 @@ AM_CONDITIONAL([HAVE_TIMINGSAFE_MEMCMP], [test "x$ac_cv_func_timingsafe_memcmp"
56 56
57# Override arc4random_buf implementations with known issues 57# Override arc4random_buf implementations with known issues
58AM_CONDITIONAL([HAVE_ARC4RANDOM_BUF], 58AM_CONDITIONAL([HAVE_ARC4RANDOM_BUF],
59 [test "x$HOST_OS" != xdarwin \ 59 [test "x$USE_BUILTIN_ARC4RANDOM" != yes \
60 -a "x$HOST_OS" != xfreebsd \
61 -a "x$HOST_OS" != xnetbsd \
62 -a "x$ac_cv_func_arc4random_buf" = xyes]) 60 -a "x$ac_cv_func_arc4random_buf" = xyes])
63 61
64# Check for getentropy fallback dependencies 62# Check for getentropy fallback dependencies
diff --git a/m4/check-os-options.m4 b/m4/check-os-options.m4
index 28209f1..d8c4969 100644
--- a/m4/check-os-options.m4
+++ b/m4/check-os-options.m4
@@ -17,11 +17,17 @@ case $host_os in
17 ;; 17 ;;
18 *darwin*) 18 *darwin*)
19 BUILD_NC=yes 19 BUILD_NC=yes
20 # weak seed on failure to open /dev/random, based on latest public source
21 # http://www.opensource.apple.com/source/Libc/Libc-997.90.3/gen/FreeBSD/arc4random.c
22 USE_BUILTIN_ARC4RANDOM=yes
20 HOST_OS=darwin 23 HOST_OS=darwin
21 HOST_ABI=macosx 24 HOST_ABI=macosx
22 ;; 25 ;;
23 *freebsd*) 26 *freebsd*)
24 BUILD_NC=yes 27 BUILD_NC=yes
28 # fork detection missing, weak seed on failure
29 # https://svnweb.freebsd.org/base/head/lib/libc/gen/arc4random.c?revision=268642&view=markup
30 USE_BUILTIN_ARC4RANDOM=yes
25 HOST_OS=freebsd 31 HOST_OS=freebsd
26 HOST_ABI=elf 32 HOST_ABI=elf
27 AC_SUBST([PROG_LDADD], ['-lthr']) 33 AC_SUBST([PROG_LDADD], ['-lthr'])
@@ -44,6 +50,16 @@ case $host_os in
44 ;; 50 ;;
45 *netbsd*) 51 *netbsd*)
46 BUILD_NC=yes 52 BUILD_NC=yes
53 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
54#include <sys/param.h>
55#if __NetBSD_Version__ < 700000001
56 undefined
57#endif
58 ]], [[]])],
59 [ USE_BUILTIN_ARC4RANDOM=no ],
60 [ USE_BUILTIN_ARC4RANDOM=yes ]
61 )
62
47 HOST_OS=netbsd 63 HOST_OS=netbsd
48 CPPFLAGS="$CPPFLAGS -D_OPENBSD_SOURCE" 64 CPPFLAGS="$CPPFLAGS -D_OPENBSD_SOURCE"
49 ;; 65 ;;