Skip to content

Commit 61d3f4d

Browse files
committed
Backport CVE fixes and latest changes to FIPS, update suffix
1 parent c0dc52a commit 61d3f4d

25 files changed

Lines changed: 2741 additions & 1 deletion

prepare_source

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ version="$version_orig-1"
33
git_src --branch "debian/openssl-$version" "https://salsa.debian.org/debian/openssl.git"
44

55
import_upstream_patches
6-
version_suffix="gl46~bp1877"
6+
version_suffix="gl51~bp1877"
77
fips_version_suffix=$(echo "${version_suffix}" | cut -d~ -f1)
88
sed "s/SED_MARKER_FOR_FIPS_VERSION/$fips_version_suffix/" <patches-debian/rules.patch.tpl > patches-debian/rules.patch
99
apply_patches patches-debian
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
From ba4c73c0665a7cb40e1dbab64f778edaa4c19bfd Mon Sep 17 00:00:00 2001
2+
From: nkraetzschmar <9020053+nkraetzschmar@users.noreply.github.com>
3+
Date: Mon, 29 Jun 2026 12:12:09 +0000
4+
Subject: [PATCH] providers: flag RSA decrypt with no padding as unapproved
5+
6+
FIPS 140-3 IG 2.4.B treats raw RSA primitives as component algorithms
7+
that must not be used standalone. Patch 0032 already gates the encrypt
8+
path against pad_mode == RSA_NO_PADDING; mirror that behaviour in
9+
rsa_decrypt() so a decrypt call with no padding goes through
10+
OSSL_FIPS_IND_ON_UNAPPROVED and reuses the existing
11+
rsa_no_padding_disabled config flag.
12+
---
13+
providers/fips/self_test_kats.c | 2 +-
14+
providers/implementations/asymciphers/rsa_enc.c | 8 ++++++++
15+
2 files changed, 9 insertions(+), 1 deletion(-)
16+
17+
diff --git a/providers/fips/self_test_kats.c b/providers/fips/self_test_kats.c
18+
index e17cd2cd8e..e96aba1613 100644
19+
--- a/providers/fips/self_test_kats.c
20+
+++ b/providers/fips/self_test_kats.c
21+
@@ -880,7 +880,7 @@ static int self_test_asym_cipher(const ST_KAT_ASYM_CIPHER *t, OSSL_SELF_TEST *st
22+
23+
OSSL_SELF_TEST_onbegin(st, OSSL_SELF_TEST_TYPE_KAT_ASYM_CIPHER, t->desc);
24+
25+
- if (t->encrypt && strcmp(t->algorithm, "RSA") == 0)
26+
+ if (strcmp(t->algorithm, "RSA") == 0)
27+
extra_postinit_params = rsa_encrypt_fips_params;
28+
29+
bnctx = BN_CTX_new_ex(libctx);
30+
diff --git a/providers/implementations/asymciphers/rsa_enc.c b/providers/implementations/asymciphers/rsa_enc.c
31+
index 330fc71f7b..fa5181c99e 100644
32+
--- a/providers/implementations/asymciphers/rsa_enc.c
33+
+++ b/providers/implementations/asymciphers/rsa_enc.c
34+
@@ -259,6 +259,14 @@ static int rsa_decrypt(void *vprsactx, unsigned char *out, size_t *outlen,
35+
ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_PADDING_MODE);
36+
return 0;
37+
}
38+
+ if (prsactx->pad_mode == RSA_NO_PADDING
39+
+ && !OSSL_FIPS_IND_ON_UNAPPROVED(prsactx, OSSL_FIPS_IND_SETTABLE2,
40+
+ prsactx->libctx, "RSA Decrypt",
41+
+ "No padding",
42+
+ ossl_fips_config_rsa_no_padding_disabled)) {
43+
+ ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_PADDING_MODE);
44+
+ return 0;
45+
+ }
46+
#endif
47+
48+
if (prsactx->pad_mode == RSA_PKCS1_WITH_TLS_PADDING) {
49+
--
50+
2.47.3
51+
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
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+
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
From f2b2545d228c209994d6cacd00e6844722b18ab7 Mon Sep 17 00:00:00 2001
2+
From: nkraetzschmar <9020053+nkraetzschmar@users.noreply.github.com>
3+
Date: Mon, 29 Jun 2026 13:12:06 +0000
4+
Subject: [PATCH] providers: flag RSA verify with no padding as unapproved
5+
6+
FIPS 140-3 IG 2.4.B does not list the RSA signature verification
7+
primitive among the components that may be validated; running
8+
EVP_PKEY_verify() against a raw RSA modular exponentiation with
9+
RSA_NO_PADDING therefore must not be reported as an approved service.
10+
Patch 0039 already gates the equivalent sign-side path; add the
11+
matching hook in rsa_verify_directly() reusing the existing
12+
rsa_no_padding_disabled config flag.
13+
---
14+
providers/implementations/signature/rsa_sig.c | 7 +++++++
15+
1 file changed, 7 insertions(+)
16+
17+
diff --git a/providers/implementations/signature/rsa_sig.c b/providers/implementations/signature/rsa_sig.c
18+
index a6b7123709..cfe2a2381c 100644
19+
--- a/providers/implementations/signature/rsa_sig.c
20+
+++ b/providers/implementations/signature/rsa_sig.c
21+
@@ -1074,6 +1074,13 @@ static int rsa_verify_directly(PROV_RSA_CTX *prsactx,
22+
ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_KEY_LENGTH);
23+
return 0;
24+
}
25+
+ if (prsactx->pad_mode == RSA_NO_PADDING
26+
+ && !OSSL_FIPS_IND_ON_UNAPPROVED(prsactx, OSSL_FIPS_IND_SETTABLE7,
27+
+ prsactx->libctx, "RSA Verify", "No padding",
28+
+ ossl_fips_config_rsa_no_padding_disabled)) {
29+
+ ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_PADDING_MODE);
30+
+ return 0;
31+
+ }
32+
#endif
33+
34+
if (prsactx->md != NULL) {
35+
--
36+
2.47.3
37+
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
From 5c7d0f954e55c04c1f7ae22d6219e02b69b6e06b Mon Sep 17 00:00:00 2001
2+
From: nkraetzschmar <9020053+nkraetzschmar@users.noreply.github.com>
3+
Date: Mon, 29 Jun 2026 15:15:56 +0000
4+
Subject: [PATCH] providers: flag hybrid ML-KEM keygen and check as unapproved
5+
6+
Patch 0046 marked the X25519MLKEM768, X448MLKEM1024, SecP256r1MLKEM768
7+
and SecP384r1MLKEM1024 hybrid schemes as unapproved in the FIPS
8+
provider's KEM dispatch table, which makes encapsulation and
9+
decapsulation report non-approved. The keymgmt dispatch table for the
10+
same schemes was left at FIPS_DEFAULT_PROPERTIES, so EVP_PKEY_keygen
11+
and EVP_PKEY_check still report approved. Flip those four entries to
12+
FIPS_UNAPPROVED_PROPERTIES as well.
13+
---
14+
providers/fips/fipsprov.c | 8 ++++----
15+
1 file changed, 4 insertions(+), 4 deletions(-)
16+
17+
diff --git a/providers/fips/fipsprov.c b/providers/fips/fipsprov.c
18+
index 54de206b17..c03f240219 100644
19+
--- a/providers/fips/fipsprov.c
20+
+++ b/providers/fips/fipsprov.c
21+
@@ -623,15 +623,15 @@ static const OSSL_ALGORITHM fips_keymgmt[] = {
22+
{ PROV_NAMES_ML_KEM_1024, FIPS_DEFAULT_PROPERTIES, ossl_ml_kem_1024_keymgmt_functions,
23+
PROV_DESCS_ML_KEM_1024 },
24+
#if !defined(OPENSSL_NO_ECX)
25+
- { PROV_NAMES_X25519MLKEM768, FIPS_DEFAULT_PROPERTIES, ossl_mlx_x25519_kem_kmgmt_functions,
26+
+ { PROV_NAMES_X25519MLKEM768, FIPS_UNAPPROVED_PROPERTIES, ossl_mlx_x25519_kem_kmgmt_functions,
27+
PROV_DESCS_X25519MLKEM768 },
28+
- { PROV_NAMES_X448MLKEM1024, FIPS_DEFAULT_PROPERTIES, ossl_mlx_x448_kem_kmgmt_functions,
29+
+ { PROV_NAMES_X448MLKEM1024, FIPS_UNAPPROVED_PROPERTIES, ossl_mlx_x448_kem_kmgmt_functions,
30+
PROV_DESCS_X448MLKEM1024 },
31+
#endif
32+
#if !defined(OPENSSL_NO_EC)
33+
- { PROV_NAMES_SecP256r1MLKEM768, FIPS_DEFAULT_PROPERTIES, ossl_mlx_p256_kem_kmgmt_functions,
34+
+ { PROV_NAMES_SecP256r1MLKEM768, FIPS_UNAPPROVED_PROPERTIES, ossl_mlx_p256_kem_kmgmt_functions,
35+
PROV_DESCS_SecP256r1MLKEM768 },
36+
- { PROV_NAMES_SecP384r1MLKEM1024, FIPS_DEFAULT_PROPERTIES, ossl_mlx_p384_kem_kmgmt_functions,
37+
+ { PROV_NAMES_SecP384r1MLKEM1024, FIPS_UNAPPROVED_PROPERTIES, ossl_mlx_p384_kem_kmgmt_functions,
38+
PROV_DESCS_SecP384r1MLKEM1024 },
39+
#endif
40+
#endif
41+
--
42+
2.47.3
43+
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
:100644 100644 b3b95ed76b 0000000000 M test/recipes/30-test_evp_data/evpmd_sha.txt
2+
3+
diff --git a/test/recipes/30-test_evp_data/evpmd_sha.txt b/test/recipes/30-test_evp_data/evpmd_sha.txt
4+
index b3b95ed76b..b3d4da9411 100644
5+
--- a/test/recipes/30-test_evp_data/evpmd_sha.txt
6+
+++ b/test/recipes/30-test_evp_data/evpmd_sha.txt
7+
@@ -14,17 +14,17 @@
8+
9+
-Title = SHA tests from (RFC6234 section 8.5 and others)
10+
-
11+
-Digest = SHA1
12+
-Input = "abc"
13+
-Output = a9993e364706816aba3e25717850c26c9cd0d89d
14+
-
15+
-Digest = SHA1
16+
-Input = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"
17+
-Output = 84983e441c3bd26ebaae4aa1f95129e5e54670f1
18+
-
19+
-Digest = SHA1
20+
-Input = "a"
21+
-Ncopy = 1000
22+
-Count = 1000
23+
-Output = 34aa973cd4c4daa4f61eeb2bdbad27316534016f
24+
+#Title = SHA tests from (RFC6234 section 8.5 and others)
25+
+#
26+
+#Digest = SHA1
27+
+#Input = "abc"
28+
+#Output = a9993e364706816aba3e25717850c26c9cd0d89d
29+
+#
30+
+#Digest = SHA1
31+
+#Input = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"
32+
+#Output = 84983e441c3bd26ebaae4aa1f95129e5e54670f1
33+
+#
34+
+#Digest = SHA1
35+
+#Input = "a"
36+
+#Ncopy = 1000
37+
+#Count = 1000
38+
+#Output = 34aa973cd4c4daa4f61eeb2bdbad27316534016f
39+
40+
:100644 100644 d14005a89a 0000000000 M doc/man7/OSSL_PROVIDER-FIPS.pod
41+
42+
diff --git a/doc/man7/OSSL_PROVIDER-FIPS.pod b/doc/man7/OSSL_PROVIDER-FIPS.pod
43+
index d14005a89a..688b1b464d 100644
44+
--- a/doc/man7/OSSL_PROVIDER-FIPS.pod
45+
+++ b/doc/man7/OSSL_PROVIDER-FIPS.pod
46+
@@ -429,4 +429,2 @@ Symmetric cipher tests used with the "KAT_Cipher" type.
47+
48+
-=item "SHA1" (B<OSSL_SELF_TEST_DESC_MD_SHA1>)
49+
-
50+
=item "SHA2" (B<OSSL_SELF_TEST_DESC_MD_SHA2>)
51+
:100644 100644 de736794a9 0000000000 M include/openssl/self_test.h
52+
53+
diff --git a/include/openssl/self_test.h b/include/openssl/self_test.h
54+
index de736794a9..4161985b4b 100644
55+
--- a/include/openssl/self_test.h
56+
+++ b/include/openssl/self_test.h
57+
@@ -63,3 +63,2 @@ extern "C" {
58+
#define OSSL_SELF_TEST_DESC_ASYM_RSA_DEC "RSA_Decrypt"
59+
-#define OSSL_SELF_TEST_DESC_MD_SHA1 "SHA1"
60+
#define OSSL_SELF_TEST_DESC_MD_SHA2 "SHA2"
61+
:100644 100644 6abab0a7a1 0000000000 M providers/fips/self_test_data.inc
62+
63+
:100644 100644 6abab0a7a1 0000000000 M providers/fips/self_test_data.inc
64+
65+
diff --git a/providers/fips/self_test_data.inc b/providers/fips/self_test_data.inc
66+
index 6abab0a7a1..14a3a0e2b9 100644
67+
--- a/providers/fips/self_test_data.inc
68+
+++ b/providers/fips/self_test_data.inc
69+
@@ -200,8 +200,2 @@ static const ST_KAT_DIGEST st_kat_digest_tests[] =
70+
{
71+
- {
72+
- OSSL_SELF_TEST_DESC_MD_SHA1,
73+
- "SHA1",
74+
- ITM_STR(sha1_pt),
75+
- ITM(sha1_digest),
76+
- },
77+
{

0 commit comments

Comments
 (0)