]> code.delx.au - gnu-emacs/commit
Make 'random' seeds cryptographically secure if possible
authorEli Zaretskii <eliz@gnu.org>
Fri, 15 Jan 2016 09:47:55 +0000 (11:47 +0200)
committerEli Zaretskii <eliz@gnu.org>
Fri, 15 Jan 2016 09:47:55 +0000 (11:47 +0200)
commit3ffe81e245d854a694ae1734f1b6a995bdc5e724
tree2d8fccecc5b404f8fb71e15fe0ea6477a09a1857
parentfee0526a189f43e8470d78e8374bd425890fbe6f
Make 'random' seeds cryptographically secure if possible

* configure.ac: Check for "/dev/urandom".

* src/sysdep.c (init_random) [HAVE_DEV_URANDOM]: Read the stream
for the seed from "/dev/urandom".
[WINDOWSNT]: Obtain the stream for the seed from w32 APIs.
* src/fns.c (Frandom): Update the doc string to indicate that
system entropy is used when available.
* src/w32.c: Include wincrypt.h.
(w32_init_crypt_random, w32_init_random): New functions, use the
CryptGenRandom API.
(globals_of_w32): Initialize w32_crypto_hprov handle to zero.
* src/w32.h (w32_init_random): Add prototype.

* doc/lispref/numbers.texi (Random Numbers): Document more details
about 't' as the argument to 'random'.

* etc/NEWS: Mention that '(random t)' now uses a cryptographically
strong seed if possible.

(Bug#22202)
configure.ac
doc/lispref/numbers.texi
etc/NEWS
src/fns.c
src/sysdep.c
src/w32.c
src/w32.h