F-2203 - Add negative test for ECC ECIES HMAC authentication tag verification

This commit is contained in:
Aidan Garske
2026-04-07 13:05:30 -07:00
parent 081b5e363c
commit 8f2a3f9563
+9
View File
@@ -39039,6 +39039,15 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t ecc_test_buffers(void)
ERROR_OUT(WC_TEST_RET_ENC_EC(ret), done);
if (XMEMCMP(plain, in, inLen))
ERROR_OUT(WC_TEST_RET_ENC_NC, done);
/* Negative test: corrupt HMAC tag in encrypted msg, expect
* HASH_TYPE_E from wc_ecc_decrypt. */
out[x - 1] ^= 0x01;
y = sizeof(plain);
ret = wc_ecc_decrypt(servKey, tmpKey, out, x, plain, &y, NULL);
if (ret != WC_NO_ERR_TRACE(HASH_TYPE_E))
ERROR_OUT(WC_TEST_RET_ENC_EC(ret), done);
ret = 0; /* reset ret for following tests */
}
#endif