From: David Carlier Date: Tue, 24 Aug 2021 21:40:14 +0000 (+0100) Subject: Darwin platform allows to build on releases before Yosemite/ios 8. X-Git-Tag: OpenSSL_1_1_1m~75 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=96ac8f13f4d0ee96baf5724d9f96c44c34b8606c;p=thirdparty%2Fopenssl.git Darwin platform allows to build on releases before Yosemite/ios 8. issue #16407 #16408 Reviewed-by: Paul Dale Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/16409) --- diff --git a/crypto/rand/rand_unix.c b/crypto/rand/rand_unix.c index 43f1069d151..0f4525106af 100644 --- a/crypto/rand/rand_unix.c +++ b/crypto/rand/rand_unix.c @@ -34,9 +34,6 @@ #if defined(__OpenBSD__) # include #endif -#if defined(__APPLE__) -# include -#endif #if defined(OPENSSL_SYS_UNIX) || defined(__DJGPP__) # include @@ -381,7 +378,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; diff --git a/include/crypto/rand.h b/include/crypto/rand.h index 5350d3a9311..674f840fd13 100644 --- a/include/crypto/rand.h +++ b/include/crypto/rand.h @@ -20,6 +20,16 @@ # include +# 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 + /* forward declaration */ typedef struct rand_pool_st RAND_POOL;