]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Don't crash on startup of a dormant relay
authorRobert Ransom <rransom.8774@gmail.com>
Mon, 12 Dec 2011 19:25:55 +0000 (11:25 -0800)
committerRobert Ransom <rransom.8774@gmail.com>
Mon, 12 Dec 2011 19:25:55 +0000 (11:25 -0800)
If a relay is dormant at startup, it will call init_keys before
crypto_set_tls_dh_prime.  This is bad.  Let's make it not so bad, because
someday it *will* happen again.

changes/bug4702 [new file with mode: 0644]
src/common/crypto.c

diff --git a/changes/bug4702 b/changes/bug4702
new file mode 100644 (file)
index 0000000..dcd3bfc
--- /dev/null
@@ -0,0 +1,6 @@
+  o Minor bugfixes:
+
+    - Fix an assertion failure when a relay with accounting enabled
+      starts up while dormant.  Fixes bug 4702; bugfix on
+      0.2.3.9-alpha.
+
index 2aa3fc97a57314daa8512b8b7330544b8897c0f7..673fc0cc1fa46ddc66c35b82caddd4b6c20fa395 100644 (file)
@@ -2089,8 +2089,11 @@ init_dh_param(void)
   dh_param_p = circuit_dh_prime;
   dh_param_g = generator;
 
-  /* Should be already set by config.c. */
-  tor_assert(dh_param_p_tls);
+  /* Ensure that we have TLS DH parameters set up, too, even if we're
+     going to change them soon. */
+  if (!dh_param_p_tls) {
+    crypto_set_tls_dh_prime(NULL);
+  }
 }
 
 /** Number of bits to use when choosing the x or y value in a Diffie-Hellman