randread: use /dev/urandom to seed, not just getpid etc
authorPaul R. Eggert <eggert@cs.ucla.edu>
Tue, 20 Jul 2010 16:50:37 +0000 (09:50 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 20 Jul 2010 16:51:12 +0000 (09:51 -0700)
commitc1d8e6e458c2f9deb3013538d6db8da8f7f4e9f1
tree8b541824476fa9f641b11ab89d89a3ebf3743aac
parente5444fa2a7a2ad4246e7a5e961d5c4aad2aecbe9
randread: use /dev/urandom to seed, not just getpid etc

* gl/lib/rand-isaac.c (isaac_seed_start): New arg SEEDED.
(isaac_seed): New args FD and BYTES_BOUND.  Read from FD if possible.
Don't bother with low-quality sources if FD has enough bytes.
* gl/lib/rand-isaac.h: New size_t arg for isaac_seed.
* gl/lib/randread.c: Include fcntl.h, unistd.h.
(NAME_OF_NONCE_DEVICE): New #define.
(nonce_device): New static var.
(randread_new): Use nonce device if available.
gl/lib/rand-isaac.c
gl/lib/rand-isaac.h
gl/lib/randread.c