diff --git a/CMakeLists.txt b/CMakeLists.txt index 768ce2dc3a..45d763d5a9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1055,8 +1055,10 @@ if(HAVE_SIZEOF_LONG_LONG) set(HAVE_LL 1) endif() -find_file(RANDOM_FILE urandom /dev) -mark_as_advanced(RANDOM_FILE) +if(NOT CMAKE_CROSSCOMPILING) + find_file(RANDOM_FILE urandom /dev) + mark_as_advanced(RANDOM_FILE) +endif() # Check for some functions that are used if(HAVE_LIBWS2_32) diff --git a/lib/rand.c b/lib/rand.c index 6ccbe4f954..dd02f52680 100644 --- a/lib/rand.c +++ b/lib/rand.c @@ -73,7 +73,7 @@ static CURLcode randit(struct Curl_easy *data, unsigned int *rnd) /* ---- non-cryptographic version following ---- */ -#ifdef RANDOM_FILE +#if defined(RANDOM_FILE) && !defined(WIN32) if(!seeded) { /* if there's a random file to read a seed from, use it */ int fd = open(RANDOM_FILE, O_RDONLY); @@ -108,7 +108,8 @@ static CURLcode randit(struct Curl_easy *data, unsigned int *rnd) * 'rndptr' points to. * * If libcurl is built without TLS support or with a TLS backend that lacks a - * proper random API (Gskit or mbedTLS), this function will use "weak" random. + * proper random API (rustls, Gskit or mbedTLS), this function will use "weak" + * random. * * When built *with* TLS support and a backend that offers strong random, it * will return error if it cannot provide strong random values.