summaryrefslogtreecommitdiff
path: root/arc4random.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2013-08-13 10:59:27 -0400
committerNick Mathewson <nickm@torproject.org>2013-08-13 10:59:27 -0400
commit9695e9c192b866793110c885fb87143de8cebf2a (patch)
treef6208782db70de2694c139b4394f8427915830ac /arc4random.c
parentd44f91ad7915ad08ad2b6dad3e52902edc619ef2 (diff)
downloadlibevent-9695e9c192b866793110c885fb87143de8cebf2a.tar.gz
Avoid other RNG initialization FS reads when urandom file is specified
Diffstat (limited to 'arc4random.c')
-rw-r--r--arc4random.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/arc4random.c b/arc4random.c
index 04805703..4b6f5f2f 100644
--- a/arc4random.c
+++ b/arc4random.c
@@ -326,10 +326,13 @@ arc4_seed_urandom(void)
return arc4_seed_urandom_helper_(arc4random_urandom_filename);
for (i = 0; filenames[i]; ++i) {
- if (arc4_seed_urandom_helper_(filenames[i]) == 0)
+ if (arc4_seed_urandom_helper_(filenames[i]) == 0) {
+ printf("okay %s\n", filenames[i]);
return 0;
+ }
}
+ puts("FAIL");
return -1;
}
#endif
@@ -350,7 +353,8 @@ arc4_seed(void)
ok = 1;
#endif
#ifdef TRY_SEED_PROC_SYS_KERNEL_RANDOM_UUID
- if (0 == arc4_seed_proc_sys_kernel_random_uuid())
+ if (arc4random_urandom_filename == NULL &&
+ 0 == arc4_seed_proc_sys_kernel_random_uuid())
ok = 1;
#endif
#ifdef TRY_SEED_SYSCTL_LINUX