]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Add TEST_FAIL() to OpenSSL aes_wrap() and aes_unwrap()
authorJouni Malinen <jouni@qca.qualcomm.com>
Tue, 14 Feb 2017 08:53:10 +0000 (10:53 +0200)
committerJouni Malinen <j@w1.fi>
Tue, 14 Feb 2017 08:53:10 +0000 (10:53 +0200)
This makes it easier to add more testing coverage for error paths.

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

index 02cb391bcc700411ad76b19c8bf50c421cc04e32..b5ffeea0821ae33253939fe1ff6d5350a37a82c6 100644 (file)
@@ -383,6 +383,8 @@ int aes_wrap(const u8 *kek, size_t kek_len, int n, const u8 *plain, u8 *cipher)
        AES_KEY actx;
        int res;
 
+       if (TEST_FAIL())
+               return -1;
        if (AES_set_encrypt_key(kek, kek_len << 3, &actx))
                return -1;
        res = AES_wrap_key(&actx, NULL, cipher, plain, n * 8);
@@ -397,6 +399,8 @@ int aes_unwrap(const u8 *kek, size_t kek_len, int n, const u8 *cipher,
        AES_KEY actx;
        int res;
 
+       if (TEST_FAIL())
+               return -1;
        if (AES_set_decrypt_key(kek, kek_len << 3, &actx))
                return -1;
        res = AES_unwrap_key(&actx, NULL, plain, cipher, (n + 1) * 8);