aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/curl/lib/rand.c
diff options
context:
space:
mode:
authorrobot-contrib <robot-contrib@yandex-team.com>2023-11-11 22:28:44 +0300
committerrobot-contrib <robot-contrib@yandex-team.com>2023-11-11 22:43:33 +0300
commit175ec788d14db88a2fafb920c8b5117209c12d5b (patch)
tree5ff4a7d314ce3887c5df8f051d83866edd585ac1 /contrib/libs/curl/lib/rand.c
parentb6c20a8a26d0be34045f2604b4da1ee189920ed2 (diff)
downloadydb-175ec788d14db88a2fafb920c8b5117209c12d5b.tar.gz
Update contrib/libs/curl to 8.2.1
Diffstat (limited to 'contrib/libs/curl/lib/rand.c')
-rw-r--r--contrib/libs/curl/lib/rand.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/contrib/libs/curl/lib/rand.c b/contrib/libs/curl/lib/rand.c
index 2e7e7e8238..7d24765ccd 100644
--- a/contrib/libs/curl/lib/rand.c
+++ b/contrib/libs/curl/lib/rand.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -27,10 +27,18 @@
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
+#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"
#include "sendf.h"
+#include "timeval.h"
#include "rand.h"
/* The last 3 #include files should be in this order */
@@ -139,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 */
@@ -170,8 +183,8 @@ static CURLcode randit(struct Curl_easy *data, unsigned int *rnd)
}
/*
- * Curl_rand() stores 'num' number of random unsigned integers in the buffer
- * 'rndptr' points to.
+ * Curl_rand() stores 'num' number of random unsigned characters in the buffer
+ * 'rnd' points to.
*
* If libcurl is built without TLS support or with a TLS backend that lacks a
* proper random API (rustls, Gskit or mbedTLS), this function will use "weak"