From 255e7ea4e2a0e3d28c0abf2750f42713eff711d7 Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Thu, 9 Oct 2025 07:49:58 +0100 Subject: win32: use RtlGenRandom for /dev/urandom Use the (somewhat ancient) Microsoft RtlGenRandom() function to provide random data for /dev/urandom. Saves 176-240 bytes. (GitHub issue #519) --- shell/Kbuild.src | 1 - shell/random.c | 11 ----------- shell/random.h | 3 --- 3 files changed, 15 deletions(-) (limited to 'shell') diff --git a/shell/Kbuild.src b/shell/Kbuild.src index a287fce4e..6bba4989f 100644 --- a/shell/Kbuild.src +++ b/shell/Kbuild.src @@ -9,4 +9,3 @@ lib-y:= INSERT lib-$(CONFIG_FEATURE_SH_MATH) += math.o -lib-$(CONFIG_FEATURE_PRNG_SHELL) += random.o diff --git a/shell/random.c b/shell/random.c index ffe0cc937..56c7c5a3c 100644 --- a/shell/random.c +++ b/shell/random.c @@ -19,17 +19,6 @@ # include "random.h" # define RAND_BASH_MASK 0x7fff -# if ENABLE_FEATURE_PRNG_SHELL -uint32_t FAST_FUNC -next_random(random_t *rnd) -{ - return full_random(rnd) & RAND_BASH_MASK; -} -# undef RAND_BASH_MASK -# define RAND_BASH_MASK 0xffffffff -# define next_random full_random -# endif - #else # include # include diff --git a/shell/random.h b/shell/random.h index 75fe0f69f..c4eb44c13 100644 --- a/shell/random.h +++ b/shell/random.h @@ -35,9 +35,6 @@ typedef struct random_t { ((rnd)->galois_LFSR = 0) uint32_t next_random(random_t *rnd) FAST_FUNC; -#if ENABLE_FEATURE_PRNG_SHELL -uint32_t full_random(random_t *rnd) FAST_FUNC; -#endif POP_SAVED_FUNCTION_VISIBILITY -- cgit v1.2.3-55-g6feb