From: Pauli Date: Wed, 19 Feb 2025 23:48:37 +0000 (+1100) Subject: ml-kem: avoid pairwise test when doing key generation CAST X-Git-Tag: openssl-3.5.0-alpha1~128 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5811c0e8cf18aef271d75bc1d966c74efdd0b6b8;p=thirdparty%2Fopenssl.git ml-kem: avoid pairwise test when doing key generation CAST Reviewed-by: Shane Lontis Reviewed-by: Tomas Mraz Reviewed-by: Viktor Dukhovni (Merged from https://github.com/openssl/openssl/pull/26838) --- diff --git a/providers/implementations/keymgmt/ml_kem_kmgmt.c b/providers/implementations/keymgmt/ml_kem_kmgmt.c index 5a007f3dc5e..94f923d6537 100644 --- a/providers/implementations/keymgmt/ml_kem_kmgmt.c +++ b/providers/implementations/keymgmt/ml_kem_kmgmt.c @@ -17,6 +17,7 @@ #include #include #include "crypto/ml_kem.h" +#include "internal/fips.h" #include "internal/param_build_set.h" #include "prov/implementations.h" #include "prov/providercommon.h" @@ -83,6 +84,10 @@ static int ml_kem_pairwise_test(const ML_KEM_KEY *key, int key_flags) || (key_flags & ML_KEM_KEY_PCT_TYPE) == 0) return 1; #ifdef FIPS_MODULE + /* During self test, it is a waste to do this test */ + if (ossl_fips_self_testing()) + return 1; + /* * The functions `OSSL_SELF_TEST_*` will return directly if parameter `st` * is NULL.