From: Sean Parkinson Date: Thu, 29 Mar 2018 04:55:55 +0000 (+1000) Subject: wolfSSL: Changes for memory allocation failure testing X-Git-Tag: hostap_2_7~363 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fc5e88e3ea80f52516cd97e4e1a113548a1c3db4;p=thirdparty%2Fhostap.git wolfSSL: Changes for memory allocation failure testing Signed-off-by: Sean Parkinson --- diff --git a/src/crypto/crypto_wolfssl.c b/src/crypto/crypto_wolfssl.c index e29a6f554..3a8c4c5e8 100644 --- a/src/crypto/crypto_wolfssl.c +++ b/src/crypto/crypto_wolfssl.c @@ -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;