diff options
author | Nick Mathewson <nickm@torproject.org> | 2008-02-07 16:10:33 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2008-02-07 16:10:33 +0000 |
commit | eecc44dab8ad98246b2c4dbedf977113f1874f77 (patch) | |
tree | d1b52922bb8a1d03919bf0422ab2ea5e320e0ad3 /src/or/relay.c | |
parent | 842a33ff20f1da87d64ae3922eab135dc37bde16 (diff) | |
download | tor-eecc44dab8ad98246b2c4dbedf977113f1874f77.tar.gz tor-eecc44dab8ad98246b2c4dbedf977113f1874f77.zip |
r17963@catbus: nickm | 2008-02-07 10:14:25 -0500
Be more thorough about memory poisoning and clearing. Add an in-place version of aes_crypt in order to remove a memcpy from relay_crypt_one_payload.
svn:r13414
Diffstat (limited to 'src/or/relay.c')
-rw-r--r-- | src/or/relay.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/src/or/relay.c b/src/or/relay.c index 31f264b637..576d6e2cf1 100644 --- a/src/or/relay.c +++ b/src/or/relay.c @@ -117,19 +117,14 @@ static int relay_crypt_one_payload(crypto_cipher_env_t *cipher, char *in, int encrypt_mode) { - char out[CELL_PAYLOAD_SIZE]; /* 'in' must be this size too */ int r; - - if (encrypt_mode) - r = crypto_cipher_encrypt(cipher, out, in, CELL_PAYLOAD_SIZE); - else - r = crypto_cipher_decrypt(cipher, out, in, CELL_PAYLOAD_SIZE); + (void)encrypt_mode; + r = crypto_cipher_crypt_inplace(cipher, in, CELL_PAYLOAD_SIZE); if (r) { log_warn(LD_BUG,"Error during relay encryption"); return -1; } - memcpy(in,out,CELL_PAYLOAD_SIZE); return 0; } |