summaryrefslogtreecommitdiff
path: root/src/or/hs_circuit.c
diff options
context:
space:
mode:
authorNeel Chauhan <neel@neelc.org>2018-04-27 17:45:16 -0400
committerGeorge Kadianakis <desnacked@riseup.net>2018-05-02 14:08:28 +0300
commitaf70d3c459d3b11b04e49c1b659183fe2e96e252 (patch)
tree83816f0d9fccb2997441c13480e34c59cac37f16 /src/or/hs_circuit.c
parent60fad8d41fc7395bd573a2cd9585ae9cb03febc3 (diff)
downloadtor-af70d3c459d3b11b04e49c1b659183fe2e96e252.tar.gz
tor-af70d3c459d3b11b04e49c1b659183fe2e96e252.zip
Optimize legacy intro point digest calculation.
Diffstat (limited to 'src/or/hs_circuit.c')
-rw-r--r--src/or/hs_circuit.c19
1 files changed, 4 insertions, 15 deletions
diff --git a/src/or/hs_circuit.c b/src/or/hs_circuit.c
index 3a674f6223..4174470636 100644
--- a/src/or/hs_circuit.c
+++ b/src/or/hs_circuit.c
@@ -193,11 +193,8 @@ register_intro_circ(const hs_service_intro_point_t *ip,
tor_assert(circ);
if (ip->base.is_only_legacy) {
- uint8_t digest[DIGEST_LEN];
- if (BUG(crypto_pk_get_digest(ip->legacy_key, (char *) digest) < 0)) {
- return;
- }
- hs_circuitmap_register_intro_circ_v2_service_side(circ, digest);
+ hs_circuitmap_register_intro_circ_v2_service_side(circ,
+ ip->legacy_key_digest);
} else {
hs_circuitmap_register_intro_circ_v3_service_side(circ,
&ip->auth_key_kp.pubkey);
@@ -675,22 +672,14 @@ setup_introduce1_data(const hs_desc_intro_point_t *ip,
origin_circuit_t *
hs_circ_service_get_intro_circ(const hs_service_intro_point_t *ip)
{
- origin_circuit_t *circ = NULL;
-
tor_assert(ip);
if (ip->base.is_only_legacy) {
- uint8_t digest[DIGEST_LEN];
- if (BUG(crypto_pk_get_digest(ip->legacy_key, (char *) digest) < 0)) {
- goto end;
- }
- circ = hs_circuitmap_get_intro_circ_v2_service_side(digest);
+ return hs_circuitmap_get_intro_circ_v2_service_side(ip->legacy_key_digest);
} else {
- circ = hs_circuitmap_get_intro_circ_v3_service_side(
+ return hs_circuitmap_get_intro_circ_v3_service_side(
&ip->auth_key_kp.pubkey);
}
- end:
- return circ;
}
/* Called when we fail building a rendezvous circuit at some point other than