skalibs

Mirror/fork of https://skarnet.org/software/skalibs/
git clone https://ccx.te2000.cz/git/skalibs
Log | Files | Refs | README | LICENSE

commit 73439ad0ff5363ad629086fe04ac44f5569a185e
parent 800b1a7e1a57438a995164ab89045136901a619e
Author: Laurent Bercot <ska-skaware@skarnet.org>
Date:   Sun, 27 Mar 2022 06:46:04 +0000

 Don't write to /dev/urandom. (It's useless or even harmful.)

Diffstat:
Msrc/librandom/random_init.c | 4----
Msrc/librandom/random_makeseed.c | 4+---
2 files changed, 1 insertion(+), 7 deletions(-)

diff --git a/src/librandom/random_init.c b/src/librandom/random_init.c @@ -47,11 +47,7 @@ int random_fd = -1 ; int random_init () { - char seed[160] ; if (random_fd >= 0) return 1 ; - random_makeseed(seed) ; - surf_init(&surf_here, seed) ; - openwritenclose_unsafe("/dev/urandom", seed, 160) ; random_fd = openc_readb("/dev/urandom") ; return random_fd >= 0 ; } diff --git a/src/librandom/random_makeseed.c b/src/librandom/random_makeseed.c @@ -9,9 +9,7 @@ /* Writes 160 bytes of crap into s. Certainly not cryptographically secure or 100% unpredictable, - but we're only using this to help shuffle the entropy of - /dev/urandom or to init an internal SURF PRNG. - iow: we are CS iff the system's RNG is CS. + but we're only using this to seed an internal PRNG. */ void random_makeseed (char *s)