aboutsummaryrefslogtreecommitdiff
path: root/src/common/aes.h
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2017-12-04 15:09:18 -0500
committerNick Mathewson <nickm@torproject.org>2017-12-08 14:47:19 -0500
commitdb024adc90069ce9961f3993aba1b7372f09d77a (patch)
treebf42a6612ab7f26e6886604ba08e924dca6a28c6 /src/common/aes.h
parent176ad729d9b1ddeccdb3e721b5ab1bf64646223f (diff)
downloadtor-db024adc90069ce9961f3993aba1b7372f09d77a.tar.gz
tor-db024adc90069ce9961f3993aba1b7372f09d77a.zip
Switch to a safer FREE_AND_NULL implementation
This one only evaluates the input once, so it cannot mess up even if there are side effects.
Diffstat (limited to 'src/common/aes.h')
-rw-r--r--src/common/aes.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/common/aes.h b/src/common/aes.h
index 4874f728d4..c2720d29b8 100644
--- a/src/common/aes.h
+++ b/src/common/aes.h
@@ -18,7 +18,8 @@ typedef struct aes_cnt_cipher aes_cnt_cipher_t;
aes_cnt_cipher_t* aes_new_cipher(const uint8_t *key, const uint8_t *iv,
int key_bits);
void aes_cipher_free_(aes_cnt_cipher_t *cipher);
-#define aes_cipher_free(cipher) FREE_AND_NULL(aes_cipher, (cipher))
+#define aes_cipher_free(cipher) \
+ FREE_AND_NULL_UNMATCHED(aes_cnt_cipher_t, aes_cipher_free_, (cipher))
void aes_crypt_inplace(aes_cnt_cipher_t *cipher, char *data, size_t len);
int evaluate_evp_for_aes(int force_value);