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 <jouni@qca.qualcomm.com>
This commit is contained in:
parent
b5562a1a6e
commit
f229f2c67d
1 changed files with 4 additions and 0 deletions
|
@ -383,6 +383,8 @@ int aes_wrap(const u8 *kek, size_t kek_len, int n, const u8 *plain, u8 *cipher)
|
||||||
AES_KEY actx;
|
AES_KEY actx;
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
|
if (TEST_FAIL())
|
||||||
|
return -1;
|
||||||
if (AES_set_encrypt_key(kek, kek_len << 3, &actx))
|
if (AES_set_encrypt_key(kek, kek_len << 3, &actx))
|
||||||
return -1;
|
return -1;
|
||||||
res = AES_wrap_key(&actx, NULL, cipher, plain, n * 8);
|
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;
|
AES_KEY actx;
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
|
if (TEST_FAIL())
|
||||||
|
return -1;
|
||||||
if (AES_set_decrypt_key(kek, kek_len << 3, &actx))
|
if (AES_set_decrypt_key(kek, kek_len << 3, &actx))
|
||||||
return -1;
|
return -1;
|
||||||
res = AES_unwrap_key(&actx, NULL, plain, cipher, (n + 1) * 8);
|
res = AES_unwrap_key(&actx, NULL, plain, cipher, (n + 1) * 8);
|
||||||
|
|
Loading…
Reference in a new issue