iOS: Don't use getentropy() since it's disallowed in the App Store.

Reported by MoNTE48.
This commit is contained in:
Mike Pall 2021-03-10 20:19:04 +01:00
parent 67dbec82f4
commit 787736990a

View File

@ -109,10 +109,16 @@ static PRGR libfunc_rgr;
#include <sys/syscall.h>
#else
#if LJ_TARGET_OSX
#if LJ_TARGET_OSX && !LJ_TARGET_IOS
/*
** In their infinite wisdom Apple decided to disallow getentropy() in the
** iOS App Store. Even though the call is common to all BSD-ish OS, it's
** recommended by Apple in their own security-related docs, and, to top
** off the foolery, /dev/urandom is handled by the same kernel code,
** yet accessing it is actually permitted (but less efficient).
*/
#include <Availability.h>
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200 || \
__IPHONE_OS_VERSION_MIN_REQUIRED >= 100000
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200
#define LJ_TARGET_HAS_GETENTROPY 1
#endif
#elif LJ_TARGET_BSD || LJ_TARGET_SOLARIS || LJ_TARGET_CYGWIN