summaryrefslogtreecommitdiff
path: root/src/feature
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2019-10-22 12:53:06 -0400
committerNick Mathewson <nickm@torproject.org>2019-10-22 12:53:06 -0400
commitd08d29f15f0c80b74f6440b8b84eefe241c87aad (patch)
tree5482ed2fede1d56a61559758446589a2dc0603a2 /src/feature
parentb588b6087690b2d17fd7f854a3a1b65b569fa79c (diff)
parent4bbefc2aac2d3770817200700e2a384d966bffe2 (diff)
downloadtor-d08d29f15f0c80b74f6440b8b84eefe241c87aad.tar.gz
tor-d08d29f15f0c80b74f6440b8b84eefe241c87aad.zip
Merge remote-tracking branch 'tor-github/pr/1341' into maint-0.4.1
Diffstat (limited to 'src/feature')
-rw-r--r--src/feature/relay/router.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/feature/relay/router.c b/src/feature/relay/router.c
index a838b5b489..29a8ffaa39 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)));
}