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:
Nick Mathewson
2015-11-25 10:30:58 -05:00
parent 232ccc18c4
commit dedea28c2e
7 changed files with 26 additions and 9 deletions
+4 -1
View File
@@ -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);