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;