|
| 1 | +From 4dbdc399da1c996d6aaaa85cf6d40ea91ca81695 Mon Sep 17 00:00:00 2001 |
| 2 | +From: nkraetzschmar <9020053+nkraetzschmar@users.noreply.github.com> |
| 3 | +Date: Mon, 29 Jun 2026 12:51:47 +0000 |
| 4 | +Subject: [PATCH] providers: flag ECDSA standalone-component signing as |
| 5 | + unapproved |
| 6 | + |
| 7 | +FIPS 140-3 IG 2.4.B treats raw asymmetric primitives as component |
| 8 | +algorithms that may only be claimed as approved in the context of a |
| 9 | +higher-level approved operation. Patch 0034 already gates ECDSA verify |
| 10 | +with verify_message == 0; mirror that on the sign side by gating |
| 11 | +ecdsa_sign_directly() when operation == EVP_PKEY_OP_SIGN (i.e. |
| 12 | +EVP_PKEY_sign() rather than EVP_PKEY_sign_message()) through |
| 13 | +OSSL_FIPS_IND_ON_UNAPPROVED, behind a new |
| 14 | +ecdsa_sign_component_disallowed config flag. |
| 15 | +--- |
| 16 | + providers/fips/include/fips_indicator_params.inc | 1 + |
| 17 | + providers/implementations/signature/ecdsa_sig.c | 8 ++++++++ |
| 18 | + util/perl/OpenSSL/paramnames.pm | 1 + |
| 19 | + 3 files changed, 10 insertions(+) |
| 20 | + |
| 21 | +diff --git a/providers/fips/include/fips_indicator_params.inc b/providers/fips/include/fips_indicator_params.inc |
| 22 | +index 6e2a2dc845..45cd3463bc 100644 |
| 23 | +--- a/providers/fips/include/fips_indicator_params.inc |
| 24 | ++++ b/providers/fips/include/fips_indicator_params.inc |
| 25 | +@@ -38,3 +38,4 @@ OSSL_FIPS_PARAM(slh_dsa_sign_entropy_check, SLH_DSA_SIGN_ENTROPY_CHECK, 1) |
| 26 | + OSSL_FIPS_PARAM(slh_dsa_seed_check, SLH_DSA_SEED_CHECK, 1) |
| 27 | + OSSL_FIPS_PARAM(rsa_verify_min_modulus_disallowed, RSA_VERIFY_MIN_MODULUS_DISABLED, 1) |
| 28 | + OSSL_FIPS_PARAM(ecdsa_p192_verify_disallowed, ECDSA_P192_VERIFY_DISABLED, 1) |
| 29 | ++OSSL_FIPS_PARAM(ecdsa_sign_component_disallowed, ECDSA_SIGN_COMPONENT_DISABLED, 1) |
| 30 | +diff --git a/providers/implementations/signature/ecdsa_sig.c b/providers/implementations/signature/ecdsa_sig.c |
| 31 | +index 08f8ee828e..25709b6fa0 100644 |
| 32 | +--- a/providers/implementations/signature/ecdsa_sig.c |
| 33 | ++++ b/providers/implementations/signature/ecdsa_sig.c |
| 34 | +@@ -331,6 +331,14 @@ static int ecdsa_sign_directly(void *vctx, |
| 35 | + if (!ossl_prov_is_running()) |
| 36 | + return 0; |
| 37 | + |
| 38 | ++#ifdef FIPS_MODULE |
| 39 | ++ if (ctx->operation == EVP_PKEY_OP_SIGN |
| 40 | ++ && !OSSL_FIPS_IND_ON_UNAPPROVED(ctx, OSSL_FIPS_IND_SETTABLE4, |
| 41 | ++ ctx->libctx, "ECDSA Sign", "Component signing", |
| 42 | ++ ossl_fips_config_ecdsa_sign_component_disallowed)) |
| 43 | ++ return 0; |
| 44 | ++#endif |
| 45 | ++ |
| 46 | + if (sig == NULL) { |
| 47 | + *siglen = ecsize; |
| 48 | + return 1; |
| 49 | +diff --git a/util/perl/OpenSSL/paramnames.pm b/util/perl/OpenSSL/paramnames.pm |
| 50 | +index 7f3859aa90..cf3b28b09a 100644 |
| 51 | +--- a/util/perl/OpenSSL/paramnames.pm |
| 52 | ++++ b/util/perl/OpenSSL/paramnames.pm |
| 53 | +@@ -54,6 +54,7 @@ my %params = ( |
| 54 | + 'PROV_PARAM_RSA_NO_PAD_DISABLED' => "rsa-no-pad-disabled", # uint |
| 55 | + 'PROV_PARAM_RSA_VERIFY_MIN_MODULUS_DISABLED' => "rsa-verify-min-modulus-disabled", # uint |
| 56 | + 'PROV_PARAM_ECDSA_P192_VERIFY_DISABLED' => "ecdsa-p192-verify-disabled", # uint |
| 57 | ++ 'PROV_PARAM_ECDSA_SIGN_COMPONENT_DISABLED' => "ecdsa-sign-component-disabled", # uint |
| 58 | + 'PROV_PARAM_HKDF_KEY_CHECK' => "hkdf-key-check", # uint |
| 59 | + 'PROV_PARAM_KBKDF_KEY_CHECK' => "kbkdf-key-check", # uint |
| 60 | + 'PROV_PARAM_TLS13_KDF_KEY_CHECK' => "tls13-kdf-key-check", # uint |
| 61 | +-- |
| 62 | +2.47.3 |
| 63 | + |
0 commit comments