aboutsummaryrefslogtreecommitdiff
path: root/src/or/main.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2014-02-12 11:56:29 -0500
committerNick Mathewson <nickm@torproject.org>2014-02-12 12:04:07 -0500
commitd3fb846d8c98c13d349762682e714e8312f20270 (patch)
tree68d2ca881730b581d0f94faf9c548c672a9c7f0f /src/or/main.c
parent0e97c8e23e2572c14dd0f4f4fbfca77ee8a48be2 (diff)
downloadtor-d3fb846d8c98c13d349762682e714e8312f20270.tar
tor-d3fb846d8c98c13d349762682e714e8312f20270.tar.gz
Split crypto_global_init() into pre/post config
It's increasingly apparent that we want to make sure we initialize our PRNG nice and early, or else OpenSSL will do it for us. (OpenSSL doesn't do _too_ bad a job, but it's nice to do it ourselves.) We'll also need this for making sure we initialize the siphash key before we do any hashes.
Diffstat (limited to 'src/or/main.c')
-rw-r--r--src/or/main.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/or/main.c b/src/or/main.c
index a970e3580..526f00001 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -2329,6 +2329,13 @@ tor_init(int argc, char *argv[])
/* Have the log set up with our application name. */
tor_snprintf(progname, sizeof(progname), "Tor %s", get_version());
log_set_application_name(progname);
+
+ /* Set up the crypto nice and early */
+ if (crypto_early_init() < 0) {
+ log_err(LD_GENERAL, "Unable to initialize the crypto subsystem!");
+ return 1;
+ }
+
/* Initialize the history structures. */
rep_hist_init();
/* Initialize the service cache. */