-
Notifications
You must be signed in to change notification settings - Fork 1k
Add CB_ONLY mode for ML-KEM #11212
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Add CB_ONLY mode for ML-KEM #11212
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -39,6 +39,7 @@ int test_wc_mlkem_make_key_kats(void) | |
| { | ||
| EXPECT_DECLS; | ||
| #if defined(WOLFSSL_HAVE_MLKEM) && \ | ||
| defined(WC_MLKEM_HAVE_NATIVE) && \ | ||
| !defined(WOLFSSL_NO_ML_KEM) && !defined(WOLFSSL_MLKEM_NO_MAKE_KEY) | ||
| MlKemKey* key; | ||
| #ifndef WOLFSSL_NO_ML_KEM_512 | ||
|
|
@@ -1498,6 +1499,7 @@ int test_wc_mlkem_encapsulate_kats(void) | |
| { | ||
| EXPECT_DECLS; | ||
| #if defined(WOLFSSL_HAVE_MLKEM) && \ | ||
| defined(WC_MLKEM_HAVE_NATIVE) && \ | ||
| !defined(WOLFSSL_NO_ML_KEM) && !defined(WOLFSSL_MLKEM_NO_ENCAPSULATE) | ||
| MlKemKey* key; | ||
| #ifndef WOLFSSL_NO_ML_KEM_512 | ||
|
|
@@ -2472,6 +2474,7 @@ int test_wc_mlkem_decapsulate_kats(void) | |
| { | ||
| EXPECT_DECLS; | ||
| #if defined(WOLFSSL_HAVE_MLKEM) && \ | ||
| defined(WC_MLKEM_HAVE_NATIVE) && \ | ||
| !defined(WOLFSSL_NO_ML_KEM) && !defined(WOLFSSL_MLKEM_NO_DECAPSULATE) | ||
| MlKemKey* key; | ||
| #ifndef WOLFSSL_NO_ML_KEM_512 | ||
|
|
@@ -3885,7 +3888,8 @@ int test_wc_mlkem_decapsulate_kats(void) | |
| int test_wc_mlkem_decapsulate_pubonly_fails(void) | ||
| { | ||
| EXPECT_DECLS; | ||
| #if !defined(HAVE_FIPS) || FIPS_VERSION3_GE(7,0,0) | ||
| #if (!defined(HAVE_FIPS) || FIPS_VERSION3_GE(7,0,0)) && \ | ||
| defined(WC_MLKEM_HAVE_NATIVE) | ||
| #if defined(WOLFSSL_HAVE_MLKEM) && \ | ||
| !defined(WOLFSSL_NO_ML_KEM) && !defined(WOLFSSL_MLKEM_NO_DECAPSULATE) && \ | ||
| !defined(WOLFSSL_MLKEM_NO_ENCAPSULATE) && \ | ||
|
|
@@ -3962,7 +3966,8 @@ int test_wc_mlkem_decapsulate_pubonly_fails(void) | |
| int test_wc_mlkem_decap_fo_reject(void) | ||
| { | ||
| EXPECT_DECLS; | ||
| #if !defined(HAVE_FIPS) || FIPS_VERSION3_GE(7,0,0) | ||
| #if (!defined(HAVE_FIPS) || FIPS_VERSION3_GE(7,0,0)) && \ | ||
| defined(WC_MLKEM_HAVE_NATIVE) | ||
| #if defined(WOLFSSL_HAVE_MLKEM) && \ | ||
| !defined(WOLFSSL_NO_ML_KEM) && !defined(WOLFSSL_MLKEM_NO_DECAPSULATE) && \ | ||
| !defined(WOLFSSL_MLKEM_NO_ENCAPSULATE) && \ | ||
|
|
@@ -4037,7 +4042,8 @@ int test_wc_mlkem_decap_fo_reject(void) | |
| int test_wc_mlkem_decode_privkey_bad_pubhash(void) | ||
| { | ||
| EXPECT_DECLS; | ||
| #if !defined(HAVE_FIPS) && !defined(HAVE_SELFTEST) | ||
| #if !defined(HAVE_FIPS) && !defined(HAVE_SELFTEST) && \ | ||
| defined(WC_MLKEM_HAVE_NATIVE) | ||
| #if defined(WOLFSSL_HAVE_MLKEM) && \ | ||
| !defined(WOLFSSL_NO_ML_KEM) && !defined(WOLFSSL_MLKEM_NO_MAKE_KEY) | ||
| MlKemKey* key = NULL; | ||
|
|
@@ -4227,7 +4233,8 @@ int test_wc_MlkemFeatureCoverage(void) | |
| int test_wc_MlkemDecisionCoverage(void) | ||
| { | ||
| EXPECT_DECLS; | ||
| #if defined(WOLFSSL_HAVE_MLKEM) && !defined(WOLFSSL_NO_ML_KEM) | ||
| #if defined(WOLFSSL_HAVE_MLKEM) && !defined(WOLFSSL_NO_ML_KEM) && \ | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. test_wc_MlkemFeatureCoverage missing the WC_MLKEM_HAVE_NATIVE guard added to its siblings · Missing edge-case coverage on a function the PR also changed The guard only checks Fix: Add |
||
| defined(WC_MLKEM_HAVE_NATIVE) | ||
| MlKemKey* key = NULL; | ||
| #ifndef WC_NO_CONSTRUCTORS | ||
| MlKemKey* newKey = NULL; | ||
|
|
@@ -4603,6 +4610,7 @@ int test_wc_mlkem_encode_key_len_decision(void) | |
| { | ||
| EXPECT_DECLS; | ||
| #if defined(WOLFSSL_HAVE_MLKEM) && !defined(WOLFSSL_NO_ML_KEM) && \ | ||
| defined(WC_MLKEM_HAVE_NATIVE) && \ | ||
| !defined(WOLFSSL_MLKEM_NO_MAKE_KEY) | ||
| MlKemKey* key; | ||
| WC_RNG rng; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test_wc_MlkemFeatureCoverage left ungated by WC_MLKEM_HAVE_NATIVE · Logic errors
test_wc_MlkemFeatureCoverageand its helpermlkem_feature_roundtripare the only full ML-KEM round-trip tests the PR did not gate onWC_MLKEM_HAVE_NATIVE. UnderWOLF_CRYPTO_CB_ONLY_MLKEMthey still compile, andwc_MlKemKey_MakeKey()on anINVALID_DEVIDkey returnsNO_VALID_DEVID, so the test fails.Fix: Add
defined(WC_MLKEM_HAVE_NATIVE)to the guards at lines 4112 and 4216.