wolfSSL: Changes for memory allocation failure testing

Signed-off-by: Sean Parkinson <sean@wolfssl.com>
This commit is contained in:
Sean Parkinson 2018-03-29 14:55:55 +10:00 committed by Jouni Malinen
parent 06657d3166
commit fc5e88e3ea

View file

@ -423,6 +423,9 @@ int aes_wrap(const u8 *kek, size_t kek_len, int n, const u8 *plain, u8 *cipher)
{
int ret;
if (TEST_FAIL())
return -1;
ret = wc_AesKeyWrap(kek, kek_len, plain, n * 8, cipher, (n + 1) * 8,
NULL);
return ret != (n + 1) * 8 ? -1 : 0;
@ -434,6 +437,9 @@ int aes_unwrap(const u8 *kek, size_t kek_len, int n, const u8 *cipher,
{
int ret;
if (TEST_FAIL())
return -1;
ret = wc_AesKeyUnWrap(kek, kek_len, cipher, (n + 1) * 8, plain, n * 8,
NULL);
return ret != n * 8 ? -1 : 0;
@ -787,9 +793,6 @@ int crypto_dh_init(u8 generator, const u8 *prime, size_t prime_len, u8 *privkey,
DhKey *dh = NULL;
word32 priv_sz, pub_sz;
if (TEST_FAIL())
return -1;
dh = os_malloc(sizeof(DhKey));
if (!dh)
return -1;