summaryrefslogtreecommitdiff
path: root/gl/lib/rand-isaac.h
diff options
context:
space:
mode:
authorPaul R. Eggert <eggert@cs.ucla.edu>2010-07-20 09:50:37 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2010-07-20 09:51:12 -0700
commitc1d8e6e458c2f9deb3013538d6db8da8f7f4e9f1 (patch)
tree8b541824476fa9f641b11ab89d89a3ebf3743aac /gl/lib/rand-isaac.h
parente5444fa2a7a2ad4246e7a5e961d5c4aad2aecbe9 (diff)
downloadcoreutils-c1d8e6e458c2f9deb3013538d6db8da8f7f4e9f1.tar.xz
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.
Diffstat (limited to 'gl/lib/rand-isaac.h')
-rw-r--r--gl/lib/rand-isaac.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/gl/lib/rand-isaac.h b/gl/lib/rand-isaac.h
index 6559dc8fe..052dc9f3a 100644
--- a/gl/lib/rand-isaac.h
+++ b/gl/lib/rand-isaac.h
@@ -21,6 +21,7 @@
#ifndef RAND_ISAAC_H
# define RAND_ISAAC_H
+# include <stddef.h>
# include <stdint.h>
/* Size of the state tables to use. ISAAC_LOG should be at least 3,
@@ -37,7 +38,7 @@ struct isaac_state
uint32_t a, b, c; /* Extra index variables */
};
-void isaac_seed (struct isaac_state *);
+void isaac_seed (struct isaac_state *, int, size_t);
void isaac_refill (struct isaac_state *, uint32_t[ISAAC_WORDS]);
#endif