Curl_rand_bytes to control env override

- in DEBUGBUILD, all specifying if true random numbers
  are desired or simulated ones via CURL_ENTROPY
- allows to use randoms in other DEBUG checks to not
  interfere with the CURL_ENTROPY
- without this change, any Curl_rand() use will alter
  results of some AUTHENTICATION methods like DIGEST

Closes #14264
This commit is contained in:
Stefan Eissing 2024-07-23 12:21:51 +02:00 committed by Daniel Stenberg
parent 0324d557e4
commit 2372a5915c
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
3 changed files with 42 additions and 20 deletions

View file

@ -1464,7 +1464,7 @@ static ssize_t cf_socket_send(struct Curl_cfilter *cf, struct Curl_easy *data,
/* simulate network blocking/partial writes */
if(ctx->wblock_percent > 0) {
unsigned char c = 0;
Curl_rand(data, &c, 1);
Curl_rand_bytes(data, FALSE, &c, 1);
if(c >= ((100-ctx->wblock_percent)*256/100)) {
CURL_TRC_CF(data, cf, "send(len=%zu) SIMULATE EWOULDBLOCK", orig_len);
*err = CURLE_AGAIN;