summaryrefslogtreecommitdiff
path: root/src/librandom
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2022-03-27 06:46:04 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2022-03-27 06:46:04 +0000
commit73439ad0ff5363ad629086fe04ac44f5569a185e (patch)
treed97ac8d4e9707bceaaddc3a78b130db7b5746e7c /src/librandom
parent800b1a7e1a57438a995164ab89045136901a619e (diff)
downloadskalibs-73439ad0ff5363ad629086fe04ac44f5569a185e.tar.xz
Don't write to /dev/urandom. (It's useless or even harmful.)
Diffstat (limited to 'src/librandom')
-rw-r--r--src/librandom/random_init.c4
-rw-r--r--src/librandom/random_makeseed.c4
2 files changed, 1 insertions, 7 deletions
diff --git a/src/librandom/random_init.c b/src/librandom/random_init.c
index 72671df..cd880e8 100644
--- 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
index c15ad5a..9c518cf 100644
--- 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)