aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config.h.guess7
-rw-r--r--src/openssl.c4
2 files changed, 9 insertions, 2 deletions
diff --git a/config.h.guess b/config.h.guess
index c40f6bf..9b5fcdc 100644
--- a/config.h.guess
+++ b/config.h.guess
@@ -657,6 +657,13 @@
#define HAVE_ARC4RANDOM_ADDRANDOM (HAVE_ARC4RANDOM && !AG_OPENBSD_PREREQ(5,5))
#endif
+#ifndef HAVE_ARC4RANDOM_BUF
+#define HAVE_ARC4RANDOM_BUF_APPLE_ (!__APPLE__ || AG_MACOS_PREREQ(10,7,0) || AG_IPHONE_PREREQ(4,3))
+#define HAVE_ARC4RANDOM_BUF_NETBSD_ (!__NetBSD__ || AG_NETBSD_PREREQ(6,0,0))
+#define HAVE_ARC4RANDOM_BUF_IFF_ (HAVE_ARC4RANDOM_BUF_APPLE_ && HAVE_ARC4RANDOM_BUF_NETBSD_)
+#define HAVE_ARC4RANDOM_BUF (HAVE_ARC4RANDOM && HAVE_ARC4RANDOM_BUF_IFF_)
+#endif
+
#ifndef HAVE_ARC4RANDOM_STIR
#define HAVE_ARC4RANDOM_STIR HAVE_ARC4RANDOM_ADDRANDOM
#endif
diff --git a/src/openssl.c b/src/openssl.c
index 78dbd65..88561aa 100644
--- a/src/openssl.c
+++ b/src/openssl.c
@@ -7824,11 +7824,11 @@ static int randL_stir(struct randL_state *st, unsigned rqstd) {
int error;
unsigned char data[256];
-#if HAVE_ARC4RANDOM
+#if HAVE_ARC4RANDOM_BUF
while (count < rqstd) {
size_t n = MIN(rqstd - count, sizeof data);
- arc4random(data, n);
+ arc4random_buf(data, n);
RAND_seed(data, n);