diff options
-rw-r--r-- | m4/check-libc.m4 | 40 |
1 files changed, 23 insertions, 17 deletions
diff --git a/m4/check-libc.m4 b/m4/check-libc.m4 index 272ebfe..856495e 100644 --- a/m4/check-libc.m4 +++ b/m4/check-libc.m4 | |||
@@ -52,10 +52,27 @@ AC_CHECK_FUNCS([explicit_bzero getauxval]) | |||
52 | AC_CACHE_CHECK([for getentropy], ac_cv_func_getentropy, [ | 52 | AC_CACHE_CHECK([for getentropy], ac_cv_func_getentropy, [ |
53 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[ | 53 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[ |
54 | #include <sys/types.h> | 54 | #include <sys/types.h> |
55 | #include <sys/random.h> | 55 | #include <unistd.h> |
56 | 56 | ||
57 | #ifdef __APPLE__ | 57 | #ifdef __APPLE__ |
58 | # include <AvailabilityMacros.h> | 58 | # include <AvailabilityMacros.h> |
59 | # include <TargetConditionals.h> | ||
60 | |||
61 | # if (TARGET_OS_IPHONE || TARGET_OS_SIMULATOR) | ||
62 | |||
63 | /* | ||
64 | * As of iOS 10.1, getentropy() as a system call is defined but is not | ||
65 | * declared in sys/random.h and submitting an App that links to getentropy() | ||
66 | * leads to the App store rejecting the App because: | ||
67 | * | ||
68 | * > The app references non-public symbols in $appname: _getentropy | ||
69 | * | ||
70 | * Disabling the check for getentropy() and thus enabling libressl own | ||
71 | * emulation of that fixes the issue. | ||
72 | */ | ||
73 | # error "As far as we know, getentropy() is not usable on iOS" | ||
74 | |||
75 | # else | ||
59 | 76 | ||
60 | /* | 77 | /* |
61 | * Before macOS 10.12 getentropy() was not available. In 10.12 however it | 78 | * Before macOS 10.12 getentropy() was not available. In 10.12 however it |
@@ -78,24 +95,13 @@ AC_CACHE_CHECK([for getentropy], ac_cv_func_getentropy, [ | |||
78 | # error "Running on Mac OSX 10.11 or earlier" | 95 | # error "Running on Mac OSX 10.11 or earlier" |
79 | # endif | 96 | # endif |
80 | # endif | 97 | # endif |
81 | #endif | ||
82 | 98 | ||
83 | /* | 99 | # endif |
84 | * As of iOS 10.1, getentropy() as a system call is defined but is not | 100 | #endif /* __APPLE__ */ |
85 | * declared in sys/random.h and submitting an App that links to getentropy() | ||
86 | * leads to the App store rejecting the App because: | ||
87 | * | ||
88 | * > The app references non-public symbols in $appname: _getentropy | ||
89 | * | ||
90 | * Disabling the check for getentropy() and thus enabling libressl own | ||
91 | * emulation of that fixes the issue. | ||
92 | */ | ||
93 | #if (defined TARGET_IPHONE_OS || defined TARGET_IPHONE_SIMULATOR) | ||
94 | # error "As far as we know, getentropy() is not usable on iOS" | ||
95 | #endif | ||
96 | ]], [[ | 101 | ]], [[ |
97 | char buffer[1024]; | 102 | extern int getentropy(void *, size_t); |
98 | (void)getentropy(buffer, sizeof (buffer)); | 103 | char buffer; |
104 | (void)getentropy(&buffer, sizeof (buffer)); | ||
99 | ]])], | 105 | ]])], |
100 | [ ac_cv_func_getentropy="yes" ], | 106 | [ ac_cv_func_getentropy="yes" ], |
101 | [ ac_cv_func_getentropy="no" | 107 | [ ac_cv_func_getentropy="no" |