summaryrefslogtreecommitdiff
path: root/src/or
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2016-05-23 10:58:27 -0400
committerNick Mathewson <nickm@torproject.org>2016-05-23 10:58:27 -0400
commitb53a2059c4495946d1bb27f8be1f6fadb7af69f1 (patch)
treeea7ecc5c2520cc35517cd930cda2cf5e5f0316d1 /src/or
parent2a884926c04959b11c39e656099f19a55c3a8e95 (diff)
downloadtor-b53a2059c4495946d1bb27f8be1f6fadb7af69f1.tar.gz
tor-b53a2059c4495946d1bb27f8be1f6fadb7af69f1.zip
Expose crypto_digest_algorithm_get_length from crypto.c
Also, use it in routerparse.c
Diffstat (limited to 'src/or')
-rw-r--r--src/or/routerparse.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/or/routerparse.c b/src/or/routerparse.c
index 42b05835ad..6ab042e35f 100644
--- a/src/or/routerparse.c
+++ b/src/or/routerparse.c
@@ -3531,10 +3531,8 @@ networkstatus_parse_detached_signatures(const char *s, const char *eos)
continue;
}
- expected_length =
- (alg == DIGEST_SHA1) ? HEX_DIGEST_LEN : HEX_DIGEST256_LEN;
- digest_length =
- (alg == DIGEST_SHA1) ? DIGEST_LEN : DIGEST256_LEN;
+ digest_length = crypto_digest_algorithm_get_length(alg);
+ expected_length = digest_length * 2; /* hex encoding */
if (strlen(hexdigest) != expected_length) {
log_warn(LD_DIR, "Wrong length on consensus-digest in detached "