From b58ac9f1e3f828b5c65c9edd5bb86603a4886a26 Mon Sep 17 00:00:00 2001 From: David CARLIER Date: Mon, 28 Jun 2021 09:55:22 +0100 Subject: [PATCH] apple getentropy removal backport of #15924 Reviewed-by: Tomas Mraz Reviewed-by: Paul Dale (Merged from https://github.com/openssl/openssl/pull/15935) --- crypto/rand/rand_unix.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/crypto/rand/rand_unix.c b/crypto/rand/rand_unix.c index ec6be791b37..eda0d5ae200 100644 --- a/crypto/rand/rand_unix.c +++ b/crypto/rand/rand_unix.c @@ -34,6 +34,9 @@ #if defined(__OpenBSD__) # include #endif +#if defined(__APPLE__) +# include +#endif #if defined(OPENSSL_SYS_UNIX) || defined(__DJGPP__) # include @@ -378,6 +381,11 @@ static ssize_t syscall_random(void *buf, size_t buflen) if (errno != ENOSYS) return -1; } +# elif defined(__APPLE__) + if (CCRandomGenerateBytes(buf, buflen) == kCCSuccess) + return (ssize_t)buflen; + + return -1; # else union { void *p; -- 2.47.2