]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Add TEST_FAIL() condition to aes_128_cbc_encrypt/decrypt()
authorJouni Malinen <j@w1.fi>
Sat, 28 Nov 2015 17:00:32 +0000 (19:00 +0200)
committerJouni Malinen <j@w1.fi>
Sat, 28 Nov 2015 18:46:36 +0000 (20:46 +0200)
This enables more error path testing.

Signed-off-by: Jouni Malinen <j@w1.fi>
src/crypto/aes-cbc.c
src/crypto/crypto_openssl.c

index 2833cfcc840d91b4e8409a812e85c5335fd2320b..0835f2cfb77ec31f609e5f06bfe6fb3ad9c1e978 100644 (file)
@@ -28,6 +28,9 @@ int aes_128_cbc_encrypt(const u8 *key, const u8 *iv, u8 *data, size_t data_len)
        u8 *pos = data;
        int i, j, blocks;
 
+       if (TEST_FAIL())
+               return -1;
+
        ctx = aes_encrypt_init(key, 16);
        if (ctx == NULL)
                return -1;
@@ -61,6 +64,9 @@ int aes_128_cbc_decrypt(const u8 *key, const u8 *iv, u8 *data, size_t data_len)
        u8 *pos = data;
        int i, j, blocks;
 
+       if (TEST_FAIL())
+               return -1;
+
        ctx = aes_decrypt_init(key, 16);
        if (ctx == NULL)
                return -1;
index 9e344d1de8e0080bcf48cc29dc7f44935777f1fb..ad2d2d4a2c78ad31b071d5752e7e8a4eedb17404 100644 (file)
@@ -345,6 +345,9 @@ int aes_128_cbc_encrypt(const u8 *key, const u8 *iv, u8 *data, size_t data_len)
        int clen, len;
        u8 buf[16];
 
+       if (TEST_FAIL())
+               return -1;
+
        EVP_CIPHER_CTX_init(&ctx);
        if (EVP_EncryptInit_ex(&ctx, EVP_aes_128_cbc(), NULL, key, iv) != 1)
                return -1;
@@ -370,6 +373,9 @@ int aes_128_cbc_decrypt(const u8 *key, const u8 *iv, u8 *data, size_t data_len)
        int plen, len;
        u8 buf[16];
 
+       if (TEST_FAIL())
+               return -1;
+
        EVP_CIPHER_CTX_init(&ctx);
        if (EVP_DecryptInit_ex(&ctx, EVP_aes_128_cbc(), NULL, key, iv) != 1)
                return -1;