]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
darwin platform replacing getentropy usage by platform api instead.
authorDavid CARLIER <devnexen@gmail.com>
Sat, 26 Jun 2021 13:12:38 +0000 (14:12 +0100)
committerPauli <pauli@openssl.org>
Tue, 29 Jun 2021 09:03:28 +0000 (19:03 +1000)
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/15924)

providers/implementations/rands/seeding/rand_unix.c

index 2e6429344c75e74eb8fd8f8738ad086e12e1f734..eab08a815033cdae951898d02303af50f3a4d46d 100644 (file)
@@ -40,6 +40,9 @@
 # include <sys/param.h>
 # include <sys/random.h>
 #endif
+#if defined(__APPLE__)
+# include <CommonCrypto/CommonRandom.h>
+#endif
 
 #if (defined(OPENSSL_SYS_UNIX) && !defined(OPENSSL_SYS_VXWORKS)) \
      || defined(__DJGPP__)
@@ -366,6 +369,12 @@ static ssize_t syscall_random(void *buf, size_t buflen)
         if (errno != ENOSYS)
             return -1;
     }
+#    elif defined(__APPLE__)
+
+    if (CCRandomGenerateBytes(buf, buflen) == kCCSuccess)
+           return (ssize_t)buflen;
+
+    return -1;
 #    else
     union {
         void *p;