Skip to content
Snippets Groups Projects
Commit 2da4d64a authored by Nick Mathewson's avatar Nick Mathewson :game_die:
Browse files

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.
parent 1e9488f2
No related branches found
No related tags found
No related merge requests found
o Minor bugfixes (relay):
- Avoid crashing when starting with a corrupt keys directory where
the old ntor key and the new ntor key are identical. Fixes bug 30916;
bugfix on 0.2.4.8-alpha.
......@@ -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)));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment