aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Pall <mike>2021-03-10 20:19:04 +0100
committerMike Pall <mike>2021-03-10 20:19:04 +0100
commit787736990ac3b7d5ceaba2697c7d0f58f77bb782 (patch)
tree867549aed1a3064178a592b3c09be9dfe8f193ff
parent67dbec82f4f05a416a78a560a726553beaa7a223 (diff)
downloadluajit-787736990ac3b7d5ceaba2697c7d0f58f77bb782.tar.gz
luajit-787736990ac3b7d5ceaba2697c7d0f58f77bb782.tar.bz2
luajit-787736990ac3b7d5ceaba2697c7d0f58f77bb782.zip
iOS: Don't use getentropy() since it's disallowed in the App Store.
Reported by MoNTE48.
-rw-r--r--src/lj_prng.c12
1 files 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;
109#include <sys/syscall.h> 109#include <sys/syscall.h>
110#else 110#else
111 111
112#if LJ_TARGET_OSX 112#if LJ_TARGET_OSX && !LJ_TARGET_IOS
113/*
114** In their infinite wisdom Apple decided to disallow getentropy() in the
115** iOS App Store. Even though the call is common to all BSD-ish OS, it's
116** recommended by Apple in their own security-related docs, and, to top
117** off the foolery, /dev/urandom is handled by the same kernel code,
118** yet accessing it is actually permitted (but less efficient).
119*/
113#include <Availability.h> 120#include <Availability.h>
114#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200 || \ 121#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200
115 __IPHONE_OS_VERSION_MIN_REQUIRED >= 100000
116#define LJ_TARGET_HAS_GETENTROPY 1 122#define LJ_TARGET_HAS_GETENTROPY 1
117#endif 123#endif
118#elif LJ_TARGET_BSD || LJ_TARGET_SOLARIS || LJ_TARGET_CYGWIN 124#elif LJ_TARGET_BSD || LJ_TARGET_SOLARIS || LJ_TARGET_CYGWIN