mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-06 19:41:15 +01:00
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.
This commit is contained in:
+4
-1
@@ -643,7 +643,10 @@ main(int argc, const char **argv)
|
||||
|
||||
reset_perftime();
|
||||
|
||||
crypto_seed_rng();
|
||||
if (crypto_seed_rng() < 0) {
|
||||
printf("Couldn't seed RNG; exiting.\n");
|
||||
return 1;
|
||||
}
|
||||
crypto_init_siphash_key();
|
||||
options = options_new();
|
||||
init_logging(1);
|
||||
|
||||
@@ -391,7 +391,10 @@ main(int argc, char **argv)
|
||||
init_logging(1);
|
||||
network_init();
|
||||
crypto_global_init(1, NULL, NULL);
|
||||
crypto_seed_rng();
|
||||
if (crypto_seed_rng() < 0) {
|
||||
printf("Couldn't seed RNG; exiting.\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
rq = replyqueue_new(as_flags);
|
||||
tor_assert(rq);
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user