[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] r18210: {tor} Make sure that even in the weird fiddly paths that lead to i (in tor/trunk: . src/common src/or)



Author: nickm
Date: 2009-01-21 10:38:39 -0500 (Wed, 21 Jan 2009)
New Revision: 18210

Modified:
   tor/trunk/ChangeLog
   tor/trunk/src/common/crypto.c
   tor/trunk/src/or/main.c
   tor/trunk/src/or/router.c
Log:
Make sure that even in the weird fiddly paths that lead to init_keys,
crypto_global_init gets called.  Also have it be crypto_global_init
that calls crypto_seed_rng, so we are not dependent on OpenSSL's
RAND_poll in these fiddly cases.

Should fix bug 907.  Bugfix on 0.0.9pre6.  Backport candidate.

Modified: tor/trunk/ChangeLog
===================================================================
--- tor/trunk/ChangeLog	2009-01-21 13:53:48 UTC (rev 18209)
+++ tor/trunk/ChangeLog	2009-01-21 15:38:39 UTC (rev 18210)
@@ -6,6 +6,9 @@
       0.2.1.11-alpha.
     - Fix a bug in address parsing that was preventing bridges or hidden
       service targets from being at IPv6 addresses.
+    - Solve a bug that kept hardware crypto acceleration from getting
+      enabled when accounting was turned on.  Fixes bug 907.  Bugfix on
+      0.0.9pre6.
 
 
 Changes in version 0.2.1.11-alpha - 2009-01-20

Modified: tor/trunk/src/common/crypto.c
===================================================================
--- tor/trunk/src/common/crypto.c	2009-01-21 13:53:48 UTC (rev 18209)
+++ tor/trunk/src/common/crypto.c	2009-01-21 15:38:39 UTC (rev 18210)
@@ -197,6 +197,7 @@
       log_engine("3DES", ENGINE_get_cipher_engine(NID_des_ede3_ecb));
       log_engine("AES", ENGINE_get_cipher_engine(NID_aes_128_ecb));
     }
+    return crypto_seed_rng(1);
   }
   return 0;
 }

Modified: tor/trunk/src/or/main.c
===================================================================
--- tor/trunk/src/or/main.c	2009-01-21 13:53:48 UTC (rev 18209)
+++ tor/trunk/src/or/main.c	2009-01-21 15:38:39 UTC (rev 18210)
@@ -1817,9 +1817,8 @@
              "and you probably shouldn't.");
 #endif
 
-  crypto_global_init(get_options()->HardwareAccel);
-  if (crypto_seed_rng(1)) {
-    log_err(LD_BUG, "Unable to seed random number generator. Exiting.");
+  if (crypto_global_init(get_options()->HardwareAccel)) {
+    log_err(LD_BUG, "Unable to initialize OpenSSL. Exiting.");
     return -1;
   }
 

Modified: tor/trunk/src/or/router.c
===================================================================
--- tor/trunk/src/or/router.c	2009-01-21 13:53:48 UTC (rev 18209)
+++ tor/trunk/src/or/router.c	2009-01-21 15:38:39 UTC (rev 18210)
@@ -444,6 +444,12 @@
   if (!key_lock)
     key_lock = tor_mutex_new();
 
+  /* There are a couple of paths that put us here before */
+  if (crypto_global_init(get_options()->HardwareAccel)) {
+    log_err(LD_BUG, "Unable to initialize OpenSSL. Exiting.");
+    return -1;
+  }
+
   /* OP's don't need persistent keys; just make up an identity and
    * initialize the TLS context. */
   if (!server_mode(options)) {