Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/15924)
# 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__)
if (errno != ENOSYS)
return -1;
}
+# elif defined(__APPLE__)
+
+ if (CCRandomGenerateBytes(buf, buflen) == kCCSuccess)
+ return (ssize_t)buflen;
+
+ return -1;
# else
union {
void *p;