read rng seed from random number source device

Linux and BSD system have random number source devices that can be used
as source for a unguessable seed source.

Other platforms fall back to generate the seed with gettime().
This commit is contained in:
Patric Mueller
2019-01-11 19:08:22 +01:00
parent 1083971228
commit 86d694c61b
4 changed files with 56 additions and 13 deletions

View File

@@ -925,7 +925,8 @@ E char *FDECL(strstri, (const char *, const char *));
#endif
E boolean
FDECL(fuzzymatch, (const char *, const char *, const char *, BOOLEAN_P));
E void NDECL(setrandom);
E void NDECL(init_random);
E void NDECL(reseed_random);
E time_t NDECL(getnow);
E int NDECL(getyear);
#if 0

View File

@@ -408,5 +408,18 @@
# define RUNTIME_PASTEBUF_SUPPORT
#endif
/*
* /dev/random is blocking on Linux, so there we default to /dev/urandom which
* should still be good enough.
* BSD systems usually have /dev/random that is supposed to be used.
*/
#ifdef LINUX
# define DEV_RANDOM "/dev/urandom"
#else
# ifdef BSD
# define DEV_RANDOM "/dev/random"
# endif
#endif
#endif /* UNIXCONF_H */
#endif /* UNIX */