From afb89c7e163bd701318eac9eb165054aa6baa3f9 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Tue, 22 Oct 2013 02:54:45 -0700 Subject: [PATCH] Some systems have arc4random() but not arc4random_buf() --- configure.ac | 2 +- src/libsodium/sodium/utils.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 25ede780..7e689187 100644 --- a/configure.ac +++ b/configure.ac @@ -371,7 +371,7 @@ dnl Checks for functions and headers AC_CHECK_FUNC(clock_gettime, , [AC_CHECK_LIB(rt, clock_gettime)]) AC_CHECK_FUNC(fegetenv, , [AC_CHECK_LIB(m, fegetenv)]) -AC_CHECK_FUNCS([SecureZeroMemory arc4random]) +AC_CHECK_FUNCS([SecureZeroMemory arc4random arc4random_buf]) AC_SUBST([LIBTOOL_EXTRA_FLAGS]) diff --git a/src/libsodium/sodium/utils.c b/src/libsodium/sodium/utils.c index 7026b497..6263dfc1 100644 --- a/src/libsodium/sodium/utils.c +++ b/src/libsodium/sodium/utils.c @@ -54,7 +54,7 @@ _sodium_alignedcalloc(unsigned char ** const unaligned_p, const size_t len) return NULL; } *unaligned_p = unaligned; -#ifdef HAVE_ARC4RANDOM +#ifdef HAVE_ARC4RANDOM_BUF (void) i; arc4random_buf(unaligned, len + (size_t) 256U); #else