aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/or/router.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/or/router.c b/src/or/router.c
index 184715b75..f6728aac9 100644
--- a/src/or/router.c
+++ b/src/or/router.c
@@ -82,6 +82,11 @@ static authority_cert_t *legacy_key_certificate = NULL;
static void
set_onion_key(crypto_pk_env_t *k)
{
+ if (onionkey && !crypto_pk_cmp_keys(onionkey, k)) {
+ /* k is already our onion key; free it and return */
+ crypto_free_pk_env(k);
+ return;
+ }
tor_mutex_acquire(key_lock);
crypto_free_pk_env(onionkey);
onionkey = k;