From f229f2c67d370b1d70c1255819ad964918da820c Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Tue, 14 Feb 2017 10:53:10 +0200 Subject: [PATCH] tests: Add TEST_FAIL() to OpenSSL aes_wrap() and aes_unwrap() This makes it easier to add more testing coverage for error paths. Signed-off-by: Jouni Malinen --- src/crypto/crypto_openssl.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/crypto/crypto_openssl.c b/src/crypto/crypto_openssl.c index 02cb391bc..b5ffeea08 100644 --- a/src/crypto/crypto_openssl.c +++ b/src/crypto/crypto_openssl.c @@ -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);