]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Darwin platform allows to build on releases before Yosemite/ios 8.
authorDavid Carlier <devnexen@gmail.com>
Wed, 25 Aug 2021 07:54:38 +0000 (08:54 +0100)
committerTomas Mraz <tomas@openssl.org>
Fri, 27 Aug 2021 06:51:05 +0000 (08:51 +0200)
backport #16409

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

include/crypto/rand.h
providers/implementations/rands/seeding/rand_unix.c

index d9432b241d9bf8a7d1455b1a7c040f49d852434d..ac41a9f62bfe3f4d9718159898246277a0b3ec13 100644 (file)
 # include <openssl/rand.h>
 # include "crypto/rand_pool.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
+
 /*
  * Defines related to seed sources
  */
index 50483830775e540e3ef55ca9979e6e9cd5474cfb..750afca58ed72f8070d2a71bb41a16ed79092213 100644 (file)
 # include <sys/param.h>
 # include <sys/random.h>
 #endif
-#if defined(__APPLE__)
-# include <CommonCrypto/CommonCryptoError.h>
-# include <CommonCrypto/CommonRandom.h>
-#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;