From: David CARLIER Date: Mon, 28 Jun 2021 08:55:22 +0000 (+0100) Subject: apple getentropy removal X-Git-Tag: OpenSSL_1_1_1l~62 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b58ac9f1e3f828b5c65c9edd5bb86603a4886a26;p=thirdparty%2Fopenssl.git apple getentropy removal backport of #15924 Reviewed-by: Tomas Mraz Reviewed-by: Paul Dale (Merged from https://github.com/openssl/openssl/pull/15935) --- 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;