diff options
author | Nick Mathewson <nickm@torproject.org> | 2014-06-04 15:30:43 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2014-06-04 15:30:43 -0400 |
commit | 95d47a74815ede0e4d0296f02db39dca3e0c1b39 (patch) | |
tree | 0fbbe1c13897a35183b67ddb8c232a6cbf9c1a8e /src/or | |
parent | 0073c5b517c7e42188214fa5b8c7b61fac6ba248 (diff) | |
parent | d9564d528514442e73221d8fbc3044856a2010a9 (diff) | |
download | tor-95d47a74815ede0e4d0296f02db39dca3e0c1b39.tar tor-95d47a74815ede0e4d0296f02db39dca3e0c1b39.tar.gz |
Merge remote-tracking branch 'public/bug12169_relay_check'
Diffstat (limited to 'src/or')
-rw-r--r-- | src/or/relay.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/or/relay.c b/src/or/relay.c index 5c430a6d7..509d7ced0 100644 --- a/src/or/relay.c +++ b/src/or/relay.c @@ -111,14 +111,14 @@ relay_set_digest(crypto_digest_t *digest, cell_t *cell) static int relay_digest_matches(crypto_digest_t *digest, cell_t *cell) { - char received_integrity[4], calculated_integrity[4]; + uint32_t received_integrity, calculated_integrity; relay_header_t rh; crypto_digest_t *backup_digest=NULL; backup_digest = crypto_digest_dup(digest); relay_header_unpack(&rh, cell->payload); - memcpy(received_integrity, rh.integrity, 4); + memcpy(&received_integrity, rh.integrity, 4); memset(rh.integrity, 0, 4); relay_header_pack(cell->payload, &rh); @@ -127,15 +127,15 @@ relay_digest_matches(crypto_digest_t *digest, cell_t *cell) // received_integrity[2], received_integrity[3]); crypto_digest_add_bytes(digest, (char*) cell->payload, CELL_PAYLOAD_SIZE); - crypto_digest_get_digest(digest, calculated_integrity, 4); + crypto_digest_get_digest(digest, (char*) &calculated_integrity, 4); - if (tor_memneq(received_integrity, calculated_integrity, 4)) { + if (calculated_integrity != received_integrity) { // log_fn(LOG_INFO,"Recognized=0 but bad digest. Not recognizing."); // (%d vs %d).", received_integrity, calculated_integrity); /* restore digest to its old form */ crypto_digest_assign(digest, backup_digest); /* restore the relay header */ - memcpy(rh.integrity, received_integrity, 4); + memcpy(rh.integrity, &received_integrity, 4); relay_header_pack(cell->payload, &rh); crypto_digest_free(backup_digest); return 0; |