aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2013-11-22 12:33:25 -0500
committerNick Mathewson <nickm@torproject.org>2013-11-22 12:33:25 -0500
commita7410c9199e58bd6c5ff131a994f8e02ccb42b91 (patch)
treefc813985ff544ad7ff2ee024ac38e49182226b05 /src
parent569dbcc615959fc48aae5736f5ec89a2bd336488 (diff)
downloadtor-a7410c9199e58bd6c5ff131a994f8e02ccb42b91.tar
tor-a7410c9199e58bd6c5ff131a994f8e02ccb42b91.tar.gz
Add checks to prevent memcmp(.,.,negative) in tests (CID 1064417)
Diffstat (limited to 'src')
-rw-r--r--src/test/test_crypto.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/test/test_crypto.c b/src/test/test_crypto.c
index 6c4820f69..22adc6cc3 100644
--- a/src/test/test_crypto.c
+++ b/src/test/test_crypto.c
@@ -731,11 +731,13 @@ test_crypto_aes_iv(void *arg)
/* Decrypt with the wrong key. */
decrypted_size = crypto_cipher_decrypt_with_iv(key2, decrypted2, 4095,
encrypted1, encrypted_size);
+ test_eq(decrypted_size, 4095);
test_memneq(plain, decrypted2, decrypted_size);
/* Alter the initialization vector. */
encrypted1[0] += 42;
decrypted_size = crypto_cipher_decrypt_with_iv(key1, decrypted1, 4095,
encrypted1, encrypted_size);
+ test_eq(decrypted_size, 4095);
test_memneq(plain, decrypted2, 4095);
/* Special length case: 1. */
encrypted_size = crypto_cipher_encrypt_with_iv(key1, encrypted1, 16 + 1,