From 787736990ac3b7d5ceaba2697c7d0f58f77bb782 Mon Sep 17 00:00:00 2001 From: Mike Pall Date: Wed, 10 Mar 2021 20:19:04 +0100 Subject: iOS: Don't use getentropy() since it's disallowed in the App Store. Reported by MoNTE48. --- src/lj_prng.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/lj_prng.c b/src/lj_prng.c index f09aaffa..0c4a5cf0 100644 --- a/src/lj_prng.c +++ b/src/lj_prng.c @@ -109,10 +109,16 @@ static PRGR libfunc_rgr; #include #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 -#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 -- cgit v1.2.3-55-g6feb