diff options
| author | Jung-uk Kim <jkim@FreeBSD.org> | 2021-09-01 02:23:22 +0000 | 
|---|---|---|
| committer | Jung-uk Kim <jkim@FreeBSD.org> | 2021-09-01 02:23:22 +0000 | 
| commit | c1d1798abd60f12527b70443cb7d0b9cd78ef7b1 (patch) | |
| tree | 1ac1ccb6b23135a8b57efdff5c4a84ad03202f7a /crypto/rand/rand_unix.c | |
| parent | 94fa08a4bcdfbb3434b025d67d014af3b18e5380 (diff) | |
Diffstat (limited to 'crypto/rand/rand_unix.c')
| -rw-r--r-- | crypto/rand/rand_unix.c | 10 | 
1 files changed, 9 insertions, 1 deletions
diff --git a/crypto/rand/rand_unix.c b/crypto/rand/rand_unix.c index ec6be791b37f..43f1069d151d 100644 --- a/crypto/rand/rand_unix.c +++ b/crypto/rand/rand_unix.c @@ -1,5 +1,5 @@  /* - * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved.   *   * Licensed under the OpenSSL license (the "License").  You may not use   * this file except in compliance with the License.  You can obtain a copy @@ -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;  | 
