aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2019-09-18 11:14:45 -0400
committerNick Mathewson <nickm@torproject.org>2019-09-18 11:14:45 -0400
commit2da4d64a64a803f4b0a6d56e517b4288bef6c4f8 (patch)
treee63a3f8ff9f8bc28b775f28818c06e8dc84fc45e /src
parent1e9488f2fd829d48eb5ef6c2170e0f7163061136 (diff)
downloadtor-2da4d64a64a803f4b0a6d56e517b4288bef6c4f8.tar.gz
tor-2da4d64a64a803f4b0a6d56e517b4288bef6c4f8.zip
Avoid a crash if our "current" and "old" ntor onion keys are equal
Our dimap code asserts if you try to add the same key twice; this can't happen if everything is running smoothly, but it's possible if you try to start a relay where secret_onion_key_ntor is the same as secret_onion_key_ntor.old. Fixes bug 30916; bugfix on 0.2.4.8-alpha when ntor keys were introduced.
Diffstat (limited to 'src')
-rw-r--r--src/feature/relay/router.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/feature/relay/router.c b/src/feature/relay/router.c
index 88a30cef08..1dbaf2ed66 100644
--- a/src/feature/relay/router.c
+++ b/src/feature/relay/router.c
@@ -286,7 +286,8 @@ construct_ntor_key_map(void)
tor_memdup(&curve25519_onion_key,
sizeof(curve25519_keypair_t)));
}
- if (!tor_mem_is_zero((const char*)last_pk, CURVE25519_PUBKEY_LEN)) {
+ if (!tor_mem_is_zero((const char*)last_pk, CURVE25519_PUBKEY_LEN) &&
+ tor_memneq(cur_pk, last_pk, CURVE25519_PUBKEY_LEN)) {
dimap_add_entry(&m, last_pk,
tor_memdup(&last_curve25519_onion_key,
sizeof(curve25519_keypair_t)));