summaryrefslogtreecommitdiffstats
path: root/Utilities/cmcurl/lib/rand.c
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2023-03-20 20:40:49 (GMT)
committerBrad King <brad.king@kitware.com>2023-03-20 20:40:49 (GMT)
commite3dc4df9b95272037d27be25ae5ef030ffd83fa4 (patch)
tree6132bc02d5204bd988b32ee8ab06053ec7c0e4c4 /Utilities/cmcurl/lib/rand.c
parent4e6c3cd93bc870f44442e6d7e59896bc6d86ce25 (diff)
parente8bff971d9d835a65bcb1711e7214afe37b238e0 (diff)
downloadCMake-e3dc4df9b95272037d27be25ae5ef030ffd83fa4.zip
CMake-e3dc4df9b95272037d27be25ae5ef030ffd83fa4.tar.gz
CMake-e3dc4df9b95272037d27be25ae5ef030ffd83fa4.tar.bz2
Merge branch 'upstream-curl' into update-curl
* upstream-curl: curl 2023-03-20 (b16d1fa8)
Diffstat (limited to 'Utilities/cmcurl/lib/rand.c')
-rw-r--r--Utilities/cmcurl/lib/rand.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/Utilities/cmcurl/lib/rand.c b/Utilities/cmcurl/lib/rand.c
index 4b6ac07..9abb722 100644
--- a/Utilities/cmcurl/lib/rand.c
+++ b/Utilities/cmcurl/lib/rand.c
@@ -30,6 +30,10 @@
#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif
+#ifdef HAVE_ARC4RANDOM
+/* Some platforms might have the prototype missing (ubuntu + libressl) */
+uint32_t arc4random(void);
+#endif
#include <curl/curl.h>
#include "vtls/vtls.h"
@@ -143,6 +147,11 @@ static CURLcode randit(struct Curl_easy *data, unsigned int *rnd)
}
#endif
+#ifdef HAVE_ARC4RANDOM
+ *rnd = (unsigned int)arc4random();
+ return CURLE_OK;
+#endif
+
#if defined(RANDOM_FILE) && !defined(WIN32)
if(!seeded) {
/* if there's a random file to read a seed from, use it */