diff options
author | Nick Mathewson <nickm@torproject.org> | 2019-09-18 11:19:41 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2019-09-18 11:19:41 -0400 |
commit | 4bbefc2aac2d3770817200700e2a384d966bffe2 (patch) | |
tree | b618f3e6705a9b2ddd35f3a91802be9d333c650e /src/feature/relay | |
parent | 70bcff6010f933c7dbce5d797ea354c6475e1f94 (diff) | |
parent | 2da4d64a64a803f4b0a6d56e517b4288bef6c4f8 (diff) | |
download | tor-4bbefc2aac2d3770817200700e2a384d966bffe2.tar.gz tor-4bbefc2aac2d3770817200700e2a384d966bffe2.zip |
Merge branch 'bug30916_035' into bug30916_041
Diffstat (limited to 'src/feature/relay')
-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 25bb1835c2..e2ba51a5b7 100644 --- a/src/feature/relay/router.c +++ b/src/feature/relay/router.c @@ -284,19 +284,17 @@ construct_ntor_key_map(void) { di_digest256_map_t *m = NULL; - if (!fast_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 (!fast_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 (!fast_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 (!fast_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))); } |