aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2023-06-15 08:49:37 +0100
committerRon Yorston <rmy@pobox.com>2023-06-15 08:53:44 +0100
commit0627e352656effac8d8e617378e7a68edfce41df (patch)
tree40958aa343e592a3dd19c7ddd954a882841a691f
parent0476a3411f16604422bfafddcc3ca0b9791d5188 (diff)
downloadbusybox-w32-0627e352656effac8d8e617378e7a68edfce41df.tar.gz
busybox-w32-0627e352656effac8d8e617378e7a68edfce41df.tar.bz2
busybox-w32-0627e352656effac8d8e617378e7a68edfce41df.zip
Fix for old mingw-w64 (32-bit)
It appears that RtlGenRandom() wasn't supported in 32-bit builds using mingw-w64 until version 7.0.0 (Fedora 33). Use the time to initialise the PRNG in earlier versions.
-rw-r--r--win32/sh_random.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/win32/sh_random.c b/win32/sh_random.c
index 32ce135c8..10e942e80 100644
--- a/win32/sh_random.c
+++ b/win32/sh_random.c
@@ -9,7 +9,10 @@
9 */ 9 */
10static void get_entropy(uint32_t state[2]) 10static void get_entropy(uint32_t state[2])
11{ 11{
12#if defined(__MINGW64_VERSION_MAJOR) && \
13 (__MINGW64_VERSION_MAJOR >= 7 || defined(__MINGW64__))
12 if (!RtlGenRandom(state, sizeof(state[0])*2)) 14 if (!RtlGenRandom(state, sizeof(state[0])*2))
15#endif
13 GetSystemTimeAsFileTime((FILETIME *)state); 16 GetSystemTimeAsFileTime((FILETIME *)state);
14 17
15#if 0 18#if 0