diff options
author | Nick Mathewson <nickm@torproject.org> | 2017-03-07 11:42:24 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2017-03-16 14:38:29 -0400 |
commit | f193b666cd50ff04e48c8efeeeb13920438cf88b (patch) | |
tree | 5394e5f76bb2430203e464773b1e21d84f383548 /src/or/consdiff.c | |
parent | c6046f4db8b182133ccc756529b508522be180c8 (diff) | |
download | tor-f193b666cd50ff04e48c8efeeeb13920438cf88b.tar.gz tor-f193b666cd50ff04e48c8efeeeb13920438cf88b.zip |
Remove digest[12]_hex
Diffstat (limited to 'src/or/consdiff.c')
-rw-r--r-- | src/or/consdiff.c | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/src/or/consdiff.c b/src/or/consdiff.c index 73ac7977dd..a3006ce0c5 100644 --- a/src/or/consdiff.c +++ b/src/or/consdiff.c @@ -846,14 +846,13 @@ consdiff_gen_diff(smartlist_t *cons1, smartlist_t *cons2, } /** Fetch the digest of the base consensus in the consensus diff, encoded in - * base16 as found in the diff itself. digest1 and digest2 must be of length - * DIGEST256_LEN or larger if not NULL. digest1_hex and digest2_hex must be of - * length HEX_DIGEST256_LEN or larger if not NULL. + * base16 as found in the diff itself. digest1_out and digest2_out must be of + * length DIGEST256_LEN or larger if not NULL. */ int consdiff_get_digests(smartlist_t *diff, - char *digest1, char *digest1_hex, - char *digest2, char *digest2_hex) + char *digest1_out, + char *digest2_out) { smartlist_t *hash_words = NULL; const char *format; @@ -897,13 +896,6 @@ consdiff_get_digests(smartlist_t *diff, goto error_cleanup; } - if (digest1_hex) { - strlcpy(digest1_hex, cons1_hash_hex, HEX_DIGEST256_LEN+1); - } - if (digest2_hex) { - strlcpy(digest2_hex, cons2_hash_hex, HEX_DIGEST256_LEN+1); - } - if (base16_decode(cons1_hash, DIGEST256_LEN, cons1_hash_hex, HEX_DIGEST256_LEN) != DIGEST256_LEN || base16_decode(cons2_hash, DIGEST256_LEN, @@ -913,11 +905,11 @@ consdiff_get_digests(smartlist_t *diff, goto error_cleanup; } - if (digest1) { - memcpy(digest1, cons1_hash, DIGEST256_LEN); + if (digest1_out) { + memcpy(digest1_out, cons1_hash, DIGEST256_LEN); } - if (digest2) { - memcpy(digest2, cons2_hash, DIGEST256_LEN); + if (digest2_out) { + memcpy(digest2_out, cons2_hash, DIGEST256_LEN); } SMARTLIST_FOREACH(hash_words, char *, cp, tor_free(cp)); @@ -947,8 +939,7 @@ consdiff_apply_diff(smartlist_t *cons1, smartlist_t *diff, char e_cons1_hash[DIGEST256_LEN]; char e_cons2_hash[DIGEST256_LEN]; - if (consdiff_get_digests(diff, - e_cons1_hash, NULL, e_cons2_hash, NULL) != 0) { + if (consdiff_get_digests(diff, e_cons1_hash, e_cons2_hash) != 0) { goto error_cleanup; } |