]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: aes_encrypt_init() and aes_decrypt_init() to use TEST_FAIL
authorJouni Malinen <jouni@qca.qualcomm.com>
Thu, 14 Jan 2016 17:44:47 +0000 (19:44 +0200)
committerJouni Malinen <j@w1.fi>
Thu, 14 Jan 2016 17:44:47 +0000 (19:44 +0200)
Now the these functions cannot be made to fail by forcing the memory
allocation fail since the OpenSSL-internal version is used, add
TEST_FAIL check to allow OOM test cases to be converted to use the
TEST_FAIL mechanism without reducing coverage.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
src/crypto/crypto_openssl.c

index 6baa6da5a69189affaa162b96e8f5645ff34fe97..11261021641748f2c2ba871ba9951bcb656dcabd 100644 (file)
@@ -256,6 +256,9 @@ void * aes_encrypt_init(const u8 *key, size_t len)
        EVP_CIPHER_CTX *ctx;
        const EVP_CIPHER *type;
 
+       if (TEST_FAIL())
+               return NULL;
+
        type = aes_get_evp_cipher(len);
        if (type == NULL)
                return NULL;
@@ -306,6 +309,9 @@ void * aes_decrypt_init(const u8 *key, size_t len)
        EVP_CIPHER_CTX *ctx;
        const EVP_CIPHER *type;
 
+       if (TEST_FAIL())
+               return NULL;
+
        type = aes_get_evp_cipher(len);
        if (type == NULL)
                return NULL;