Skip to content

Commit e05dbd5

Browse files
authored
Merge pull request #7570 from jackctj117/test
Code Coverage for hpke.c test case HAVE_CURVE448 using test.c
2 parents 688ae60 + 14068fb commit e05dbd5

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

wolfcrypt/test/test.c

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27626,10 +27626,24 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t hpke_test(void)
2762627626
#endif
2762727627
#endif
2762827628

27629+
/* Test coverage for wc_HpkeInit with Curve448, even though it is not supported */
27630+
#if defined(HAVE_CURVE448) && \
27631+
(defined(WOLFSSL_SHA384) || defined(WOLFSSL_SHA512))
27632+
/* test with_curve448 */
27633+
ret = wc_HpkeInit(hpke, DHKEM_X448_HKDF_SHA512, HKDF_SHA512,
27634+
HPKE_AES_256_GCM, NULL);
27635+
27636+
if (ret != BAD_FUNC_ARG) /* Curve448 is not supported yet */
27637+
ret = WC_TEST_RET_ENC_EC(ret);
27638+
else
27639+
ret = 0;
27640+
#endif
27641+
2762927642
#if defined(HAVE_CURVE25519)
2763027643
/* test with curve25519 and aes256 */
27631-
ret = wc_HpkeInit(hpke, DHKEM_X25519_HKDF_SHA256, HKDF_SHA256,
27632-
HPKE_AES_256_GCM, NULL);
27644+
if (ret == 0)
27645+
ret = wc_HpkeInit(hpke, DHKEM_X25519_HKDF_SHA256, HKDF_SHA256,
27646+
HPKE_AES_256_GCM, NULL);
2763327647

2763427648
if (ret != 0)
2763527649
return WC_TEST_RET_ENC_EC(ret);

0 commit comments

Comments
 (0)