[openssl] master update

tomas at openssl.org tomas at openssl.org
Fri Aug 27 06:51:45 UTC 2021


The branch master has been updated
       via  c023d98dcf2ba1cc30f545ae54d0e037e80a8794 (commit)
      from  6f242d224cd1f5d9f4d9b3a1722cca93b92d25b0 (commit)


- Log -----------------------------------------------------------------
commit c023d98dcf2ba1cc30f545ae54d0e037e80a8794
Author: David Carlier <devnexen at gmail.com>
Date:   Wed Aug 25 08:54:38 2021 +0100

    Darwin platform allows to build on releases before Yosemite/ios 8.
    
    backport #16409
    
    Reviewed-by: Paul Dale <pauli at openssl.org>
    Reviewed-by: Tomas Mraz <tomas at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/16418)

-----------------------------------------------------------------------

Summary of changes:
 include/crypto/rand.h                               | 10 ++++++++++
 providers/implementations/rands/seeding/rand_unix.c |  6 +-----
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/include/crypto/rand.h b/include/crypto/rand.h
index d9432b241d..ac41a9f62b 100644
--- a/include/crypto/rand.h
+++ b/include/crypto/rand.h
@@ -22,6 +22,16 @@
 # 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
  */
diff --git a/providers/implementations/rands/seeding/rand_unix.c b/providers/implementations/rands/seeding/rand_unix.c
index 5048383077..750afca58e 100644
--- a/providers/implementations/rands/seeding/rand_unix.c
+++ b/providers/implementations/rands/seeding/rand_unix.c
@@ -40,10 +40,6 @@
 # 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;


More information about the openssl-commits mailing list