mirror of
https://github.com/jedisct1/libsodium.git
synced 2026-08-25 08:37:13 +09:00
More aggressive check for getrandom() and getentropy() usability
In particular, they can be present, but not usable for a given compatibility level. This is especially expected on iOS and Android.
This commit is contained in:
+37
-1
@@ -794,8 +794,44 @@ dnl Checks for functions and headers
|
||||
|
||||
AC_FUNC_ALLOCA
|
||||
AS_IF([test "x$EMSCRIPTEN" = "x"],[
|
||||
AC_CHECK_FUNCS([arc4random arc4random_buf getrandom getentropy])
|
||||
AC_CHECK_FUNCS([arc4random arc4random_buf])
|
||||
AC_CHECK_FUNCS([mmap mlock madvise mprotect])
|
||||
|
||||
AC_MSG_CHECKING(for getrandom with a standard API)
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
|
||||
#include <stdlib.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_RANDOM_H
|
||||
# include <sys/random.h>
|
||||
#endif
|
||||
]], [[
|
||||
unsigned char buf;
|
||||
(void) getrandom((void *) &buf, 1U, 0U);
|
||||
]])],
|
||||
[AC_MSG_RESULT(yes)
|
||||
AC_CHECK_FUNCS([getrandom])],
|
||||
[AC_MSG_RESULT(no)
|
||||
])
|
||||
|
||||
AC_MSG_CHECKING(for getentropy with a standard API)
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
|
||||
#include <stdlib.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_RANDOM_H
|
||||
# include <sys/random.h>
|
||||
#endif
|
||||
]], [[
|
||||
unsigned char buf;
|
||||
(void) getentropy((void *) &buf, 1U);
|
||||
]])],
|
||||
[AC_MSG_RESULT(yes)
|
||||
AC_CHECK_FUNCS([getentropy])],
|
||||
[AC_MSG_RESULT(no)
|
||||
])
|
||||
])
|
||||
AC_CHECK_FUNCS([posix_memalign getpid nanosleep])
|
||||
AC_CHECK_FUNCS([memset_s explicit_bzero explicit_memset])
|
||||
|
||||
@@ -20,6 +20,12 @@ export XCODEDIR=$(xcode-select -p)
|
||||
export IOS_SIMULATOR_VERSION_MIN=${IOS_SIMULATOR_VERSION_MIN-"6.0.0"}
|
||||
export IOS_VERSION_MIN=${IOS_VERSION_MIN-"6.0.0"}
|
||||
|
||||
echo
|
||||
echo "Warnings related to headers being present but not usable are due to functions"
|
||||
echo "that didn't exist in the specified minimum iOS version level."
|
||||
echo "They can be safely ignored."
|
||||
echo
|
||||
|
||||
mkdir -p $SIMULATOR32_PREFIX $SIMULATOR64_PREFIX $IOS32_PREFIX $IOS32s_PREFIX $IOS64_PREFIX || exit 1
|
||||
|
||||
# Build for the simulator
|
||||
|
||||
Reference in New Issue
Block a user