Pedro Monreal Gonzalez
8c598ed63d
* Add openssl-3-disable-hmac-hw-acceleration-with-engine-digest.patch * Add openssl-3-fix-hmac-digest-detection-s390x.patch * Add openssl-3-fix-memleak-s390x_HMAC_CTX_copy.patch - Add hardware acceleration for full AES-XTS jsc#PED-10273 * Add openssl-3-hw-acceleration-aes-xts-s390x.patch - Support MSA 12 SHA3 on s390x jsc#PED-10280 * Add openssl-3-add_EVP_DigestSqueeze_api.patch * Add openssl-3-support-multiple-sha3_squeeze_s390x.patch * Add openssl-3-add-xof-state-handling-s3_absorb.patch * Add openssl-3-fix-state-handling-sha3_absorb_s390x.patch * Add openssl-3-fix-state-handling-sha3_final_s390x.patch * Add openssl-3-fix-state-handling-shake_final_s390x.patch * Add openssl-3-fix-state-handling-keccak_final_s390x.patch * Add openssl-3-support-EVP_DigestSqueeze-in-digest-prov-s390x.patch * Add openssl-3-add-defines-CPACF-funcs.patch * Add openssl-3-add-hw-acceleration-hmac.patch * Add openssl-3-support-CPACF-sha3-shake-perf-improvement.patch * Add openssl-3-fix-s390x_sha3_absorb.patch * Add openssl-3-fix-s390x_shake_squeeze.patch - Update to 3.2.3: * Changes between 3.2.2 and 3.2.3: - Fixed possible denial of service in X.509 name checks. [CVE-2024-6119] - Fixed possible buffer overread in SSL_select_next_proto(). [CVE-2024-5535] * Changes between 3.2.1 and 3.2.2: - Fixed potential use after free after SSL_free_buffers() is called. [CVE-2024-4741] - Fixed an issue where checking excessively long DSA keys or parameters may OBS-URL: https://build.opensuse.org/package/show/security:tls/openssl-3?expand=0&rev=121
114 lines
5.2 KiB
Diff
114 lines
5.2 KiB
Diff
From a325a23bc83f4efd60130001c417ca5b96bdbff1 Mon Sep 17 00:00:00 2001
|
|
From: Clemens Lang <cllang@redhat.com>
|
|
Date: Thu, 17 Nov 2022 19:33:02 +0100
|
|
Subject: [PATCH] signature: Add indicator for PSS salt length
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
FIPS 186-4 section 5 "The RSA Digital Signature Algorithm", subsection
|
|
5.5 "PKCS #1" says: "For RSASSA-PSS [...] the length (in bytes) of the
|
|
salt (sLen) shall satisfy 0 <= sLen <= hLen, where hLen is the length of
|
|
the hash function output block (in bytes)."
|
|
|
|
It is not exactly clear from this text whether hLen refers to the
|
|
message digest or the hash function used for the mask generation
|
|
function MGF1. PKCS#1 v2.1 suggests it is the former:
|
|
|
|
| Typical salt lengths in octets are hLen (the length of the output of
|
|
| the hash function Hash) and 0. In both cases the security of
|
|
| RSASSA-PSS can be closely related to the hardness of inverting RSAVP1.
|
|
| Bellare and Rogaway [4] give a tight lower bound for the security of
|
|
| the original RSA-PSS scheme, which corresponds roughly to the former
|
|
| case, while Coron [12] gives a lower bound for the related Full Domain
|
|
| Hashing scheme, which corresponds roughly to the latter case. In [13]
|
|
| Coron provides a general treatment with various salt lengths ranging
|
|
| from 0 to hLen; see [27] for discussion. See also [31], which adapts
|
|
| the security proofs in [4][13] to address the differences between the
|
|
| original and the present version of RSA-PSS as listed in Note 1 above.
|
|
|
|
Since OpenSSL defaults to creating signatures with the maximum salt
|
|
length, blocking the use of longer salts would probably lead to
|
|
significant problems in practice. Instead, introduce an explicit
|
|
indicator that can be obtained from the EVP_PKEY_CTX object using
|
|
EVP_PKEY_CTX_get_params() with the
|
|
OSSL_SIGNATURE_PARAM_SUSE_FIPS_INDICATOR
|
|
parameter.
|
|
|
|
We also add indicator for RSA_NO_PADDING here to avoid patch-over-patch.
|
|
Dmitry Belyavskiy <dbelyavs@redhat.com>
|
|
|
|
Signed-off-by: Clemens Lang <cllang@redhat.com>
|
|
---
|
|
include/openssl/evp.h | 4 ++++
|
|
providers/implementations/signature/rsa_sig.c | 21 +++++++++++++++++
|
|
util/perl/OpenSSL/paramnames.pm | 23 ++++++++++---------
|
|
3 files changed, 37 insertions(+), 11 deletions(-)
|
|
|
|
Index: openssl-3.2.3/include/openssl/evp.h
|
|
===================================================================
|
|
--- openssl-3.2.3.orig/include/openssl/evp.h
|
|
+++ openssl-3.2.3/include/openssl/evp.h
|
|
@@ -804,6 +804,10 @@ __owur int EVP_CipherFinal(EVP_CIPHER_CT
|
|
__owur int EVP_CipherFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm,
|
|
int *outl);
|
|
|
|
+# define EVP_SIGNATURE_SUSE_FIPS_INDICATOR_UNDETERMINED 0
|
|
+# define EVP_SIGNATURE_SUSE_FIPS_INDICATOR_APPROVED 1
|
|
+# define EVP_SIGNATURE_SUSE_FIPS_INDICATOR_NOT_APPROVED 2
|
|
+
|
|
__owur int EVP_SignFinal(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *s,
|
|
EVP_PKEY *pkey);
|
|
__owur int EVP_SignFinal_ex(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *s,
|
|
Index: openssl-3.2.3/providers/implementations/signature/rsa_sig.c
|
|
===================================================================
|
|
--- openssl-3.2.3.orig/providers/implementations/signature/rsa_sig.c
|
|
+++ openssl-3.2.3/providers/implementations/signature/rsa_sig.c
|
|
@@ -1185,6 +1185,24 @@ static int rsa_get_ctx_params(void *vprs
|
|
}
|
|
}
|
|
|
|
+#ifdef FIPS_MODULE
|
|
+ p = OSSL_PARAM_locate(params, OSSL_SIGNATURE_PARAM_SUSE_FIPS_INDICATOR);
|
|
+ if (p != NULL) {
|
|
+ int fips_indicator = EVP_SIGNATURE_SUSE_FIPS_INDICATOR_APPROVED;
|
|
+ if (prsactx->pad_mode == RSA_PKCS1_PSS_PADDING) {
|
|
+ if (prsactx->md == NULL) {
|
|
+ fips_indicator = EVP_SIGNATURE_SUSE_FIPS_INDICATOR_UNDETERMINED;
|
|
+ } else if (rsa_pss_compute_saltlen(prsactx) > EVP_MD_get_size(prsactx->md)) {
|
|
+ fips_indicator = EVP_SIGNATURE_SUSE_FIPS_INDICATOR_NOT_APPROVED;
|
|
+ }
|
|
+ } else if (prsactx->pad_mode == RSA_NO_PADDING) {
|
|
+ if (prsactx->md == NULL) /* Should always be the case */
|
|
+ fips_indicator = EVP_SIGNATURE_SUSE_FIPS_INDICATOR_NOT_APPROVED;
|
|
+ }
|
|
+ return OSSL_PARAM_set_int(p, fips_indicator);
|
|
+ }
|
|
+#endif
|
|
+
|
|
return 1;
|
|
}
|
|
|
|
@@ -1194,6 +1212,9 @@ static const OSSL_PARAM known_gettable_c
|
|
OSSL_PARAM_utf8_string(OSSL_SIGNATURE_PARAM_DIGEST, NULL, 0),
|
|
OSSL_PARAM_utf8_string(OSSL_SIGNATURE_PARAM_MGF1_DIGEST, NULL, 0),
|
|
OSSL_PARAM_utf8_string(OSSL_SIGNATURE_PARAM_PSS_SALTLEN, NULL, 0),
|
|
+#ifdef FIPS_MODULE
|
|
+ OSSL_PARAM_int(OSSL_SIGNATURE_PARAM_SUSE_FIPS_INDICATOR, NULL),
|
|
+#endif
|
|
OSSL_PARAM_END
|
|
};
|
|
|
|
Index: openssl-3.2.3/util/perl/OpenSSL/paramnames.pm
|
|
===================================================================
|
|
--- openssl-3.2.3.orig/util/perl/OpenSSL/paramnames.pm
|
|
+++ openssl-3.2.3/util/perl/OpenSSL/paramnames.pm
|
|
@@ -386,6 +386,7 @@ my %params = (
|
|
'SIGNATURE_PARAM_MGF1_PROPERTIES' => '*PKEY_PARAM_MGF1_PROPERTIES',
|
|
'SIGNATURE_PARAM_DIGEST_SIZE' => '*PKEY_PARAM_DIGEST_SIZE',
|
|
'SIGNATURE_PARAM_NONCE_TYPE' => "nonce-type",
|
|
+ 'SIGNATURE_PARAM_SUSE_FIPS_INDICATOR' => "suse-fips-indicator",
|
|
'SIGNATURE_PARAM_INSTANCE' => "instance",
|
|
'SIGNATURE_PARAM_CONTEXT_STRING' => "context-string",
|
|
|