diff options
author | Nick Mathewson <nickm@torproject.org> | 2017-05-03 10:17:37 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2017-05-04 08:37:41 -0400 |
commit | 112286338b61ed747572cfa67ac38e2052e7c807 (patch) | |
tree | 55fa2684d9ab3201011cb65da950687cf1db9974 /src/or/routerparse.c | |
parent | 0418357ffd575ff4a3ec95937f596776c3b9ecec (diff) | |
download | tor-112286338b61ed747572cfa67ac38e2052e7c807.tar.gz tor-112286338b61ed747572cfa67ac38e2052e7c807.zip |
Store the sha3 of a networkstatus as part of the networkstatus_t
Also store it in the cached_dir_t.
Diffstat (limited to 'src/or/routerparse.c')
-rw-r--r-- | src/or/routerparse.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/or/routerparse.c b/src/or/routerparse.c index f39c33261f..4def75a23e 100644 --- a/src/or/routerparse.c +++ b/src/or/routerparse.c @@ -3384,6 +3384,7 @@ networkstatus_parse_vote_from_string(const char *s, const char **eos_out, networkstatus_voter_info_t *voter = NULL; networkstatus_t *ns = NULL; common_digests_t ns_digests; + uint8_t sha3_full[DIGEST256_LEN]; const char *cert, *end_of_header, *end_of_footer, *s_dup = s; directory_token_t *tok; struct in_addr in; @@ -3397,7 +3398,10 @@ networkstatus_parse_vote_from_string(const char *s, const char **eos_out, if (eos_out) *eos_out = NULL; - if (router_get_networkstatus_v3_hashes(s, &ns_digests)) { + // XXXX replace SHA3_full with as_signed digest once #22143 is merged. + // XXXX Merge #22143 before this! + if (router_get_networkstatus_v3_hashes(s, &ns_digests) || + crypto_digest256((char *)sha3_full, s, strlen(s), DIGEST_SHA3_256)<0) { log_warn(LD_DIR, "Unable to compute digest of network-status"); goto err; } @@ -3414,6 +3418,7 @@ networkstatus_parse_vote_from_string(const char *s, const char **eos_out, ns = tor_malloc_zero(sizeof(networkstatus_t)); memcpy(&ns->digests, &ns_digests, sizeof(ns_digests)); + memcpy(&ns->digest_full_sha3, sha3_full, sizeof(sha3_full)); tok = find_by_keyword(tokens, K_NETWORK_STATUS_VERSION); tor_assert(tok); |