]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
build: limit `arc4random` detection to no-SSL configs
authorViktor Szakats <commit@vsz.me>
Sat, 14 Sep 2024 15:37:33 +0000 (17:37 +0200)
committerViktor Szakats <commit@vsz.me>
Thu, 19 Sep 2024 13:44:59 +0000 (15:44 +0200)
`arc4random()` is no longer used if any TLS backend is active.
Limit feature detection to builds with no TLS backend.

Closes #14909

CMakeLists.txt
configure.ac

index e4bd12a064ac6ddde631923140697db2fcb2cafe..5ebeb5a8b676a09ffba3acb91ee01d294d6f9447 100644 (file)
@@ -1490,7 +1490,6 @@ check_symbol_exists("stricmp"         "${CURL_INCLUDES};string.h" HAVE_STRICMP)
 check_symbol_exists("strcmpi"         "${CURL_INCLUDES};string.h" HAVE_STRCMPI)
 check_symbol_exists("memrchr"         "${CURL_INCLUDES};string.h" HAVE_MEMRCHR)
 check_symbol_exists("alarm"           "${CURL_INCLUDES}" HAVE_ALARM)
-check_symbol_exists("arc4random"      "${CURL_INCLUDES};stdlib.h" HAVE_ARC4RANDOM)
 check_symbol_exists("fcntl"           "${CURL_INCLUDES}" HAVE_FCNTL)
 check_symbol_exists("getppid"         "${CURL_INCLUDES}" HAVE_GETPPID)
 check_symbol_exists("utimes"          "${CURL_INCLUDES}" HAVE_UTIMES)
@@ -1527,6 +1526,10 @@ check_symbol_exists("setlocale"       "${CURL_INCLUDES}" HAVE_SETLOCALE)
 check_symbol_exists("setmode"         "${CURL_INCLUDES}" HAVE_SETMODE)
 check_symbol_exists("setrlimit"       "${CURL_INCLUDES}" HAVE_SETRLIMIT)
 
+if(NOT _ssl_enabled)
+  check_symbol_exists("arc4random" "${CURL_INCLUDES};stdlib.h" HAVE_ARC4RANDOM)
+endif()
+
 if(NOT MSVC OR (MSVC_VERSION GREATER_EQUAL 1900))
   # Earlier MSVC compilers had faulty snprintf implementations
   check_symbol_exists("snprintf" "stdio.h" HAVE_SNPRINTF)
index 269d7bd4464afb3ec46919db1c308e11c9d9b380..a42f42ccc1aa8586aec7573f9ff80705264aa5f0 100644 (file)
@@ -3969,7 +3969,6 @@ AC_CHECK_DECLS([getpwuid_r], [], [AC_DEFINE(HAVE_DECL_GETPWUID_R_MISSING, 1, "Se
 
 AC_CHECK_FUNCS([\
   _fseeki64 \
-  arc4random \
   eventfd \
   fnmatch \
   geteuid \
@@ -3992,6 +3991,10 @@ AC_CHECK_FUNCS([\
   utimes \
 ])
 
+if test -z "$ssl_backends"; then
+  AC_CHECK_FUNCS([arc4random])
+fi
+
 if test "$curl_cv_native_windows" != 'yes'; then
   AC_CHECK_FUNCS([fseeko])