From: David Carlier Date: Wed, 25 Aug 2021 07:54:38 +0000 (+0100) Subject: Darwin platform allows to build on releases before Yosemite/ios 8. X-Git-Tag: openssl-3.0.0~52 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c023d98dcf2ba1cc30f545ae54d0e037e80a8794;p=thirdparty%2Fopenssl.git Darwin platform allows to build on releases before Yosemite/ios 8. backport #16409 Reviewed-by: Paul Dale Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/16418) --- diff --git a/include/crypto/rand.h b/include/crypto/rand.h index d9432b241d9..ac41a9f62bf 100644 --- a/include/crypto/rand.h +++ b/include/crypto/rand.h @@ -22,6 +22,16 @@ # include # include "crypto/rand_pool.h" +# if defined(__APPLE__) && !defined(OPENSSL_NO_APPLE_CRYPTO_RANDOM) +# include +# if (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000) || \ + (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) +# define OPENSSL_APPLE_CRYPTO_RANDOM 1 +# include +# include +# endif +# endif + /* * Defines related to seed sources */ diff --git a/providers/implementations/rands/seeding/rand_unix.c b/providers/implementations/rands/seeding/rand_unix.c index 50483830775..750afca58ed 100644 --- a/providers/implementations/rands/seeding/rand_unix.c +++ b/providers/implementations/rands/seeding/rand_unix.c @@ -40,10 +40,6 @@ # include # include #endif -#if defined(__APPLE__) -# include -# include -#endif #if (defined(OPENSSL_SYS_UNIX) && !defined(OPENSSL_SYS_VXWORKS)) \ || defined(__DJGPP__) @@ -370,7 +366,7 @@ static ssize_t syscall_random(void *buf, size_t buflen) if (errno != ENOSYS) return -1; } -# elif defined(__APPLE__) +# elif defined(OPENSSL_APPLE_CRYPTO_RANDOM) if (CCRandomGenerateBytes(buf, buflen) == kCCSuccess) return (ssize_t)buflen;