From 0627e352656effac8d8e617378e7a68edfce41df Mon Sep 17 00:00:00 2001 From: Ron Yorston <rmy@pobox.com> Date: Thu, 15 Jun 2023 08:49:37 +0100 Subject: 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. --- win32/sh_random.c | 3 +++ 1 file changed, 3 insertions(+) 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 @@ */ static void get_entropy(uint32_t state[2]) { +#if defined(__MINGW64_VERSION_MAJOR) && \ + (__MINGW64_VERSION_MAJOR >= 7 || defined(__MINGW64__)) if (!RtlGenRandom(state, sizeof(state[0])*2)) +#endif GetSystemTimeAsFileTime((FILETIME *)state); #if 0 -- cgit v1.2.3-55-g6feb