diff options
author | teor <teor@torproject.org> | 2019-11-06 11:17:01 +1000 |
---|---|---|
committer | teor <teor@torproject.org> | 2019-11-06 11:17:01 +1000 |
commit | d2e4262ebc134f4c6ae9e702a14da45489575b4f (patch) | |
tree | 113a23a439de23ac40945d76931188fc1e89d4f2 /src/feature | |
parent | 6bfdd096792194d1077a101a34859bff996c940e (diff) | |
parent | 2da4d64a64a803f4b0a6d56e517b4288bef6c4f8 (diff) | |
download | tor-d2e4262ebc134f4c6ae9e702a14da45489575b4f.tar.gz tor-d2e4262ebc134f4c6ae9e702a14da45489575b4f.zip |
Merge remote-tracking branch 'tor-github/pr/1340' into maint-0.3.5
Diffstat (limited to 'src/feature')
-rw-r--r-- | src/feature/relay/router.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/feature/relay/router.c b/src/feature/relay/router.c index dad2c6a50f..1dbaf2ed66 100644 --- a/src/feature/relay/router.c +++ b/src/feature/relay/router.c @@ -278,19 +278,17 @@ construct_ntor_key_map(void) { di_digest256_map_t *m = NULL; - if (!tor_mem_is_zero((const char*) - curve25519_onion_key.pubkey.public_key, - CURVE25519_PUBKEY_LEN)) { - dimap_add_entry(&m, - curve25519_onion_key.pubkey.public_key, + const uint8_t *cur_pk = curve25519_onion_key.pubkey.public_key; + const uint8_t *last_pk = last_curve25519_onion_key.pubkey.public_key; + + if (!tor_mem_is_zero((const char *)cur_pk, CURVE25519_PUBKEY_LEN)) { + dimap_add_entry(&m, cur_pk, tor_memdup(&curve25519_onion_key, sizeof(curve25519_keypair_t))); } - if (!tor_mem_is_zero((const char*) - last_curve25519_onion_key.pubkey.public_key, - CURVE25519_PUBKEY_LEN)) { - dimap_add_entry(&m, - last_curve25519_onion_key.pubkey.public_key, + 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))); } |