wolfSSL: Changes for memory allocation failure testing
Signed-off-by: Sean Parkinson <sean@wolfssl.com>
This commit is contained in:
parent
06657d3166
commit
fc5e88e3ea
1 changed files with 6 additions and 3 deletions
|
@ -423,6 +423,9 @@ int aes_wrap(const u8 *kek, size_t kek_len, int n, const u8 *plain, u8 *cipher)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
if (TEST_FAIL())
|
||||||
|
return -1;
|
||||||
|
|
||||||
ret = wc_AesKeyWrap(kek, kek_len, plain, n * 8, cipher, (n + 1) * 8,
|
ret = wc_AesKeyWrap(kek, kek_len, plain, n * 8, cipher, (n + 1) * 8,
|
||||||
NULL);
|
NULL);
|
||||||
return ret != (n + 1) * 8 ? -1 : 0;
|
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;
|
int ret;
|
||||||
|
|
||||||
|
if (TEST_FAIL())
|
||||||
|
return -1;
|
||||||
|
|
||||||
ret = wc_AesKeyUnWrap(kek, kek_len, cipher, (n + 1) * 8, plain, n * 8,
|
ret = wc_AesKeyUnWrap(kek, kek_len, cipher, (n + 1) * 8, plain, n * 8,
|
||||||
NULL);
|
NULL);
|
||||||
return ret != n * 8 ? -1 : 0;
|
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;
|
DhKey *dh = NULL;
|
||||||
word32 priv_sz, pub_sz;
|
word32 priv_sz, pub_sz;
|
||||||
|
|
||||||
if (TEST_FAIL())
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
dh = os_malloc(sizeof(DhKey));
|
dh = os_malloc(sizeof(DhKey));
|
||||||
if (!dh)
|
if (!dh)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
Loading…
Reference in a new issue