diff options
author | Robert Ransom <rransom.8774@gmail.com> | 2011-12-12 11:25:55 -0800 |
---|---|---|
committer | Robert Ransom <rransom.8774@gmail.com> | 2011-12-12 11:25:55 -0800 |
commit | d688a40a0e7c1e8417ecdc463821e50cd1762715 (patch) | |
tree | 94a9ba24db437d66265c672f44e8ae40fb308d4f /src/common/crypto.c | |
parent | e4cebb76c5577b1a39b752cc694147e929662c4a (diff) | |
download | tor-d688a40a0e7c1e8417ecdc463821e50cd1762715.tar tor-d688a40a0e7c1e8417ecdc463821e50cd1762715.tar.gz |
Don't crash on startup of a dormant relay
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.
Diffstat (limited to 'src/common/crypto.c')
-rw-r--r-- | src/common/crypto.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/common/crypto.c b/src/common/crypto.c index 2aa3fc97a..673fc0cc1 100644 --- a/src/common/crypto.c +++ b/src/common/crypto.c @@ -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 |