diff options
author | David CARLIER <devnexen@gmail.com> | 2021-06-28 09:55:22 +0100 |
---|---|---|
committer | Pauli <pauli@openssl.org> | 2021-06-30 08:46:21 +1000 |
commit | b58ac9f1e3f828b5c65c9edd5bb86603a4886a26 (patch) | |
tree | 20bc611746d49298865577d71ce4dac6152df82c /crypto/rand | |
parent | efac3f67637b7e9b89a924c246577e16445d6e04 (diff) |
apple getentropy removal
backport of #15924
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/15935)
Diffstat (limited to 'crypto/rand')
-rw-r--r-- | crypto/rand/rand_unix.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/crypto/rand/rand_unix.c b/crypto/rand/rand_unix.c index ec6be791b3..eda0d5ae20 100644 --- a/crypto/rand/rand_unix.c +++ b/crypto/rand/rand_unix.c @@ -34,6 +34,9 @@ #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> @@ -378,6 +381,11 @@ 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; |