diff options
author | Nick Mathewson <nickm@torproject.org> | 2004-04-06 20:16:12 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2004-04-06 20:16:12 +0000 |
commit | 6290d027c97ecdf2b6c75762fcc226ea006d0be3 (patch) | |
tree | c2dcd168ab8cbb708b1133a55eb24f8b7db5f1a6 /src/or/routerlist.c | |
parent | ce51a30adc4392cff170c4ef22fb396cd09dbeaa (diff) | |
download | tor-6290d027c97ecdf2b6c75762fcc226ea006d0be3.tar tor-6290d027c97ecdf2b6c75762fcc226ea006d0be3.tar.gz |
Continue attack on magic numbers; use new crypto wrappers where possible
svn:r1504
Diffstat (limited to 'src/or/routerlist.c')
-rw-r--r-- | src/or/routerlist.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/or/routerlist.c b/src/or/routerlist.c index 7b1267817..0f29b34e7 100644 --- a/src/or/routerlist.c +++ b/src/or/routerlist.c @@ -663,9 +663,7 @@ router_get_routerlist_from_directory_impl(const char *str, log_fn(LOG_WARN, "Unable to compute digest of directory"); goto err; } - log(LOG_DEBUG,"Received directory hashes to %02x:%02x:%02x:%02x", - ((int)digest[0])&0xff,((int)digest[1])&0xff, - ((int)digest[2])&0xff,((int)digest[3])&0xff); + log(LOG_DEBUG,"Received directory hashes to %s",hex_str(digest,4)); if ((end = strstr(str,"\nrouter "))) { ++end; @@ -760,9 +758,8 @@ router_get_routerlist_from_directory_impl(const char *str, log_fn(LOG_WARN, "Error reading directory: invalid signature."); goto err; } - log(LOG_DEBUG,"Signed directory hash starts %02x:%02x:%02x:%02x", - ((int)signed_digest[0])&0xff,((int)signed_digest[1])&0xff, - ((int)signed_digest[2])&0xff,((int)signed_digest[3])&0xff); + log(LOG_DEBUG,"Signed directory hash starts %s", hex_str(signed_digest,4)); + if (memcmp(digest, signed_digest, 20)) { log_fn(LOG_WARN, "Error reading directory: signature does not match."); goto err; |