]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Darwin platform allows to build on releases before Yosemite/ios 8.
authorDavid Carlier <devnexen@gmail.com>
Tue, 24 Aug 2021 21:40:14 +0000 (22:40 +0100)
committerTomas Mraz <tomas@openssl.org>
Fri, 27 Aug 2021 06:53:05 +0000 (08:53 +0200)
issue #16407 #16408

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/16409)

crypto/rand/rand_unix.c
include/crypto/rand.h

index 43f1069d151d80692126f0a6a7eda7a2b9bcd56b..0f4525106af770f12c6031e48ef0e561fc93ac6d 100644 (file)
@@ -34,9 +34,6 @@
 #if defined(__OpenBSD__)
 # include <sys/param.h>
 #endif
-#if defined(__APPLE__)
-# include <CommonCrypto/CommonRandom.h>
-#endif
 
 #if defined(OPENSSL_SYS_UNIX) || defined(__DJGPP__)
 # include <sys/types.h>
@@ -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;
 
index 5350d3a931198a694a16820b412acabb65065f66..674f840fd13c9b1754178e4a93a91df75d9fa2e6 100644 (file)
 
 # include <openssl/rand.h>
 
+# if defined(__APPLE__) && !defined(OPENSSL_NO_APPLE_CRYPTO_RANDOM)
+#  include <Availability.h>
+#  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 <CommonCrypto/CommonCryptoError.h>
+#   include <CommonCrypto/CommonRandom.h>
+#  endif
+# endif
+
 /* forward declaration */
 typedef struct rand_pool_st RAND_POOL;