diff options
author | George Kadianakis <desnacked@riseup.net> | 2017-08-03 15:42:30 +0300 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2017-08-08 20:29:34 -0400 |
commit | 74981d1f133f0ecb1050715af4ee5d409fcebd41 (patch) | |
tree | e117e191cae512050cc5c16820cea9dd06fc2c5c /src/or/hs_cell.c | |
parent | 29b3dd1c054e8dda464c046c701d6946f53434fa (diff) | |
download | tor-74981d1f133f0ecb1050715af4ee5d409fcebd41.tar.gz tor-74981d1f133f0ecb1050715af4ee5d409fcebd41.zip |
memwipe interesting unused memory
Diffstat (limited to 'src/or/hs_cell.c')
-rw-r--r-- | src/or/hs_cell.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/or/hs_cell.c b/src/or/hs_cell.c index 712faa3358..922ff73468 100644 --- a/src/or/hs_cell.c +++ b/src/or/hs_cell.c @@ -193,18 +193,16 @@ build_legacy_establish_intro(const char *circ_nonce, crypto_pk_t *enc_key, uint8_t *cell_out) { ssize_t cell_len; - char buf[RELAY_PAYLOAD_SIZE] = {0}; tor_assert(circ_nonce); tor_assert(enc_key); tor_assert(cell_out); - cell_len = rend_service_encode_establish_intro_cell(buf, sizeof(buf), + memwipe(cell_out, 0, RELAY_PAYLOAD_SIZE); + + cell_len = rend_service_encode_establish_intro_cell((char*)cell_out, + RELAY_PAYLOAD_SIZE, enc_key, circ_nonce); - tor_assert(cell_len <= RELAY_PAYLOAD_SIZE); - if (cell_len >= 0) { - memcpy(cell_out, buf, cell_len); - } return cell_len; } @@ -326,6 +324,9 @@ hs_cell_build_establish_intro(const char *circ_nonce, tmp_cell_enc, tmp_cell_enc_len - tmp_cell_mac_offset); handshake_ptr = trn_cell_establish_intro_getarray_handshake_mac(cell); memcpy(handshake_ptr, mac, sizeof(mac)); + + memwipe(mac, 0, sizeof(mac)); + memwipe(tmp_cell_enc, 0, sizeof(tmp_cell_enc)); } /* Calculate the cell signature SIG. */ @@ -353,6 +354,8 @@ hs_cell_build_establish_intro(const char *circ_nonce, /* Copy the signature into the cell. */ sig_ptr = trn_cell_establish_intro_getarray_sig(cell); memcpy(sig_ptr, sig.sig, sig_len); + + memwipe(tmp_cell_enc, 0, sizeof(tmp_cell_enc)); } /* Encode the cell. Can't be bigger than a standard cell. */ |