mirror of
https://github.com/jedisct1/libsodium.git
synced 2024-12-19 10:05:05 -07:00
Use CCRandomGenerateBytes if present
Helps with App Store validation rules.
This commit is contained in:
parent
961cd3e7bd
commit
8d9ab6cd76
@ -611,6 +611,7 @@ AC_SUBST(CFLAGS_PCLMUL)
|
||||
AC_SUBST(CFLAGS_RDRAND)
|
||||
|
||||
AC_CHECK_HEADERS([sys/mman.h sys/param.h sys/random.h intrin.h sys/auxv.h])
|
||||
AC_CHECK_HEADERS([CommonCrypto/CommonRandom.h])
|
||||
|
||||
AC_MSG_CHECKING([if _xgetbv() is available])
|
||||
AC_LINK_IFELSE(
|
||||
|
@ -38,6 +38,9 @@
|
||||
# define HAVE_LINUX_COMPATIBLE_GETRANDOM
|
||||
# endif
|
||||
#endif
|
||||
#ifdef HAVE_COMMONCRYPTO_COMMONRANDOM_H
|
||||
# include <CommonCrypto/CommonRandom.h>
|
||||
#endif
|
||||
#if !defined(NO_BLOCKING_RANDOM_POLL) && defined(__linux__)
|
||||
# define BLOCK_ON_DEV_RANDOM
|
||||
#endif
|
||||
@ -175,7 +178,18 @@ randombytes_internal_random_init(void)
|
||||
|
||||
#else /* _WIN32 */
|
||||
|
||||
# ifdef HAVE_GETENTROPY
|
||||
# ifdef HAVE_COMMONCRYPTO_COMMONRANDOM_H
|
||||
static int
|
||||
randombytes_getentropy(void * const buf, const size_t size)
|
||||
{
|
||||
if (CCRandomGenerateBytes(buf, size) != kCCSuccess) {
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
# elif defined(HAVE_GETENTROPY)
|
||||
|
||||
static int
|
||||
_randombytes_getentropy(void * const buf, const size_t size)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user