aboutsummaryrefslogtreecommitdiff
path: root/src/test/testing_common.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2015-11-25 10:30:58 -0500
committerNick Mathewson <nickm@torproject.org>2015-11-25 22:29:59 -0500
commitdedea28c2ef59eb86f5d9704e5609ae13fa8b3c2 (patch)
tree92ddba2410a8a80aad28734be47c78c460bbd6e6 /src/test/testing_common.c
parent232ccc18c40f0d0302b2e21b0f67885c548f8e63 (diff)
downloadtor-dedea28c2ef59eb86f5d9704e5609ae13fa8b3c2.tar.gz
tor-dedea28c2ef59eb86f5d9704e5609ae13fa8b3c2.zip
Make crypto_seed_rng() and crypto_rand() less scary.
These functions must really never fail; so have crypto_rand() assert that it's working okay, and have crypto_seed_rng() demand that callers check its return value. Also have crypto_seed_rng() check RAND_status() before returning.
Diffstat (limited to 'src/test/testing_common.c')
-rw-r--r--src/test/testing_common.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/test/testing_common.c b/src/test/testing_common.c
index 441024bd7d..2ea158fddd 100644
--- a/src/test/testing_common.c
+++ b/src/test/testing_common.c
@@ -272,7 +272,10 @@ main(int c, const char **v)
return 1;
}
crypto_set_tls_dh_prime();
- crypto_seed_rng();
+ if (crypto_seed_rng() < 0) {
+ printf("Couldn't seed RNG; exiting.\n");
+ return 1;
+ }
rep_hist_init();
network_init();
setup_directory();