Skip to content

Commit 688ae60

Browse files
authored
Merge pull request #7573 from aidangarske/hpke_sha512_test
Add test for HPKE for Curve448
2 parents ff6e684 + fe5cc95 commit 688ae60

1 file changed

Lines changed: 23 additions & 2 deletions

File tree

wolfcrypt/test/test.c

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27471,7 +27471,8 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t x963kdf_test(void)
2747127471

2747227472
#endif /* HAVE_X963_KDF */
2747327473

27474-
#if defined(HAVE_HPKE) && (defined(HAVE_ECC) || defined(HAVE_CURVE25519)) && \
27474+
#if defined(HAVE_HPKE) && \
27475+
(defined(HAVE_ECC) || defined(HAVE_CURVE25519) || defined(HAVE_CURVE448)) && \
2747527476
defined(HAVE_AESGCM)
2747627477

2747727478
static wc_test_ret_t hpke_test_single(Hpke* hpke)
@@ -27639,8 +27640,28 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t hpke_test(void)
2763927640
return ret;
2764027641
#endif
2764127642

27643+
27644+
#if defined(HAVE_CURVE448) && \
27645+
(defined(WOLFSSL_SHA384) || defined(WOLFSSL_SHA512))
27646+
/* test with curve448 and aes256 */
27647+
ret = wc_HpkeInit(hpke, DHKEM_X448_HKDF_SHA512, HKDF_SHA512,
27648+
HPKE_AES_256_GCM, NULL);
27649+
27650+
/* HPKE does not support X448 yet, so expect failure */
27651+
if (ret != BAD_FUNC_ARG)
27652+
return WC_TEST_RET_ENC_EC(ret);
27653+
27654+
ret = hpke_test_single(hpke);
27655+
27656+
/* HPKE does not support X448 yet, so expect failure */
27657+
if (WC_TEST_RET_DEC_EC(ret) != BAD_FUNC_ARG)
27658+
return ret;
27659+
ret = 0; /* reset error code */
27660+
#endif
27661+
27662+
/* TODO: HPKE chacha20 is not implemented */
27663+
2764227664
return ret;
27643-
/* x448 and chacha20 are unimplemented */
2764427665
}
2764527666
#endif /* HAVE_HPKE && HAVE_ECC && HAVE_AESGCM */
2764627667

0 commit comments

Comments
 (0)