diff --git a/wolfcrypt/test/test.c b/wolfcrypt/test/test.c index c6c82d1f9b..c3f8d41569 100644 --- a/wolfcrypt/test/test.c +++ b/wolfcrypt/test/test.c @@ -27902,6 +27902,31 @@ static wc_test_ret_t hpke_test_single(Hpke* hpke) ret = WC_TEST_RET_ENC_NC; } + /* Negative test case with NULL argument */ + if (ret == 0) { + ret = wc_HpkeGenerateKeyPair(NULL, &receiverKey, rng); + if (ret != BAD_FUNC_ARG) + ret = WC_TEST_RET_ENC_EC(ret); + else + ret = 0; + } + + if (ret == 0) { + ret = wc_HpkeGenerateKeyPair(hpke, NULL, rng); + if (ret != BAD_FUNC_ARG) + ret = WC_TEST_RET_ENC_EC(ret); + else + ret = 0; + } + + if (ret == 0) { + ret = wc_HpkeGenerateKeyPair(hpke, &receiverKey, NULL); + if (ret != BAD_FUNC_ARG) + ret = WC_TEST_RET_ENC_EC(ret); + else + ret = 0; + } + if (ephemeralKey != NULL) wc_HpkeFreeKey(hpke, hpke->kem, ephemeralKey, hpke->heap);