From 80c18cb40c3c9ddd56e88019387a3827d0f6add0 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 16 Oct 2022 10:48:29 -0700 Subject: [PATCH 01/10] No need to call w32_init_random MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * src/sysdep.c (init_random): Just use getrandom, since we’re already using it unconditionally elsewhere. --- src/sysdep.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/sysdep.c b/src/sysdep.c index 736723bdf3..4786c8fa4f 100644 --- a/src/sysdep.c +++ b/src/sysdep.c @@ -2163,17 +2163,11 @@ seed_random (void *seed, ptrdiff_t seed_size) init_random (void) { random_seed v; - bool success = false; /* First, try seeding the PRNG from the operating system's entropy source. This approach is both fast and secure. */ -#ifdef WINDOWSNT - /* FIXME: Perhaps getrandom can be used here too? */ - success = w32_init_random (&v, sizeof v) == 0; -#else verify (sizeof v <= 256); - success = getrandom (&v, sizeof v, 0) == sizeof v; -#endif + bool success = getrandom (&v, sizeof v, 0) == sizeof v; /* If that didn't work, just use the current time value and PID. It's at least better than XKCD 221. */ -- 2.34.1