From b53a2059c4495946d1bb27f8be1f6fadb7af69f1 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Mon, 23 May 2016 10:58:27 -0400 Subject: Expose crypto_digest_algorithm_get_length from crypto.c Also, use it in routerparse.c --- src/or/routerparse.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/or/routerparse.c') 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 " -- cgit v1.2.3-54-g00ecf