summaryrefslogtreecommitdiff
path: root/src/or/routerparse.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2016-12-19 15:11:27 -0500
committerNick Mathewson <nickm@torproject.org>2017-01-30 08:37:24 -0500
commitb1567cf500044be4d6c97e4ef65345acb4aa70ff (patch)
treeb1f4c05392d00fc5e37b67ca0b67578788d0c447 /src/or/routerparse.c
parent83e9918107dba1b969a226b79e1d37a852339e45 (diff)
downloadtor-b1567cf500044be4d6c97e4ef65345acb4aa70ff.tar.gz
tor-b1567cf500044be4d6c97e4ef65345acb4aa70ff.zip
Three more fuzzers: consensus, hsdesc, intro points
Diffstat (limited to 'src/or/routerparse.c')
-rw-r--r--src/or/routerparse.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/or/routerparse.c b/src/or/routerparse.c
index 5fd2e0829c..0aa953cc52 100644
--- a/src/or/routerparse.c
+++ b/src/or/routerparse.c
@@ -1172,6 +1172,12 @@ tor_version_is_obsolete(const char *myversion, const char *versionlist)
return ret;
}
+MOCK_IMPL(STATIC int,
+signed_digest_equals, (const uint8_t *d1, const uint8_t *d2, size_t len))
+{
+ return tor_memeq(d1, d2, len);
+}
+
/** Check whether the object body of the token in <b>tok</b> has a good
* signature for <b>digest</b> using key <b>pkey</b>.
* If <b>CST_NO_CHECK_OBJTYPE</b> is set, do not check
@@ -1214,7 +1220,8 @@ check_signature_token(const char *digest,
}
// log_debug(LD_DIR,"Signed %s hash starts %s", doctype,
// hex_str(signed_digest,4));
- if (tor_memneq(digest, signed_digest, digest_len)) {
+ if (! signed_digest_equals((const uint8_t *)digest,
+ (const uint8_t *)signed_digest, digest_len)) {
log_warn(LD_DIR, "Error reading %s: signature does not match.", doctype);
tor_free(signed_digest);
return -1;