Forward port downstream patches from c9s
Related: RHEL-50011 Signed-off-by: Daiki Ueno <dueno@redhat.com>
This commit is contained in:
parent
0ad408d5bc
commit
3ac22bcadb
2567
gnutls-3.7.2-enable-intel-cet.patch
Normal file
2567
gnutls-3.7.2-enable-intel-cet.patch
Normal file
File diff suppressed because it is too large
Load Diff
33
gnutls-3.7.2-no-explicit-init.patch
Normal file
33
gnutls-3.7.2-no-explicit-init.patch
Normal file
@ -0,0 +1,33 @@
|
||||
From c7f4ce40eaecafdefbf4db0ac2d3665bc0c41b33 Mon Sep 17 00:00:00 2001
|
||||
From: rpm-build <rpm-build>
|
||||
Date: Tue, 21 Nov 2023 14:13:38 +0900
|
||||
Subject: [PATCH] gnutls-3.7.2-no-explicit-init.patch
|
||||
|
||||
Signed-off-by: rpm-build <rpm-build>
|
||||
---
|
||||
lib/global.c | 9 ---------
|
||||
1 file changed, 9 deletions(-)
|
||||
|
||||
diff --git a/lib/global.c b/lib/global.c
|
||||
index 924ec94..3baa202 100644
|
||||
--- a/lib/global.c
|
||||
+++ b/lib/global.c
|
||||
@@ -510,15 +510,6 @@ static void _CONSTRUCTOR lib_init(void)
|
||||
return;
|
||||
}
|
||||
|
||||
- e = secure_getenv("GNUTLS_NO_EXPLICIT_INIT");
|
||||
- if (e != NULL) {
|
||||
- _gnutls_debug_log(
|
||||
- "GNUTLS_NO_EXPLICIT_INIT is deprecated; use GNUTLS_NO_IMPLICIT_INIT\n");
|
||||
- ret = atoi(e);
|
||||
- if (ret == 1)
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
ret = _gnutls_global_init(1);
|
||||
if (ret < 0) {
|
||||
fprintf(stderr, "Error in GnuTLS initialization: %s\n",
|
||||
--
|
||||
2.41.0
|
||||
|
26
gnutls-3.7.3-disable-config-reload.patch
Normal file
26
gnutls-3.7.3-disable-config-reload.patch
Normal file
@ -0,0 +1,26 @@
|
||||
diff --git a/lib/priority.c b/lib/priority.c
|
||||
index 9feec47fe2..40511710fd 100644
|
||||
--- a/lib/priority.c
|
||||
+++ b/lib/priority.c
|
||||
@@ -2001,13 +2001,14 @@ char *_gnutls_resolve_priorities(const char* priorities)
|
||||
additional++;
|
||||
}
|
||||
|
||||
- /* Always try to refresh the cached data, to allow it to be
|
||||
- * updated without restarting all applications.
|
||||
- */
|
||||
- ret = _gnutls_update_system_priorities(false /* defer_system_wide */);
|
||||
- if (ret < 0) {
|
||||
- _gnutls_debug_log("failed to update system priorities: %s\n",
|
||||
- gnutls_strerror(ret));
|
||||
+ /* If priority string is not constructed yet, construct and finalize */
|
||||
+ if (!system_wide_config.priority_string) {
|
||||
+ ret = _gnutls_update_system_priorities(false
|
||||
+ /* defer_system_wide */);
|
||||
+ if (ret < 0) {
|
||||
+ _gnutls_debug_log("failed to update system priorities: "
|
||||
+ " %s\n", gnutls_strerror(ret));
|
||||
+ }
|
||||
}
|
||||
|
||||
do {
|
29
gnutls-3.7.3-fips-dsa-post.patch
Normal file
29
gnutls-3.7.3-fips-dsa-post.patch
Normal file
@ -0,0 +1,29 @@
|
||||
From b6c6e699ec79820bc949db3c71992ce277eef141 Mon Sep 17 00:00:00 2001
|
||||
From: rpm-build <rpm-build>
|
||||
Date: Thu, 15 Aug 2024 09:37:55 +0900
|
||||
Subject: [PATCH] gnutls-3.7.3-fips-dsa-post.patch
|
||||
|
||||
Signed-off-by: rpm-build <rpm-build>
|
||||
---
|
||||
lib/fips.c | 5 -----
|
||||
1 file changed, 5 deletions(-)
|
||||
|
||||
diff --git a/lib/fips.c b/lib/fips.c
|
||||
index 1611200..8a9824a 100644
|
||||
--- a/lib/fips.c
|
||||
+++ b/lib/fips.c
|
||||
@@ -611,11 +611,6 @@ int _gnutls_fips_perform_self_checks2(void)
|
||||
}
|
||||
}
|
||||
|
||||
- ret = gnutls_pk_self_test(0, GNUTLS_PK_DSA);
|
||||
- if (ret < 0) {
|
||||
- return gnutls_assert_val(GNUTLS_E_SELF_TEST_ERROR);
|
||||
- }
|
||||
-
|
||||
ret = gnutls_pk_self_test(0, GNUTLS_PK_EC);
|
||||
if (ret < 0) {
|
||||
return gnutls_assert_val(GNUTLS_E_SELF_TEST_ERROR);
|
||||
--
|
||||
2.46.0
|
||||
|
41
gnutls-3.7.6-drbg-reseed.patch
Normal file
41
gnutls-3.7.6-drbg-reseed.patch
Normal file
@ -0,0 +1,41 @@
|
||||
From 968de8a9779788a853a4c0cd75beda779cb15f52 Mon Sep 17 00:00:00 2001
|
||||
From: rpm-build <rpm-build>
|
||||
Date: Thu, 16 Nov 2023 17:09:58 +0900
|
||||
Subject: [PATCH] gnutls-3.7.6-drbg-reseed.patch
|
||||
|
||||
Signed-off-by: rpm-build <rpm-build>
|
||||
---
|
||||
lib/nettle/sysrng-linux.c | 10 +++++++++-
|
||||
1 file changed, 9 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/lib/nettle/sysrng-linux.c b/lib/nettle/sysrng-linux.c
|
||||
index 25d74fe..8b9cc46 100644
|
||||
--- a/lib/nettle/sysrng-linux.c
|
||||
+++ b/lib/nettle/sysrng-linux.c
|
||||
@@ -31,6 +31,9 @@
|
||||
#include "num.h"
|
||||
#include <errno.h>
|
||||
#include "rnd-common.h"
|
||||
+#include "fips.h"
|
||||
+#else
|
||||
+#define _gnutls_fips_mode_enabled() 0
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
@@ -104,7 +107,12 @@ static int force_getrandom(void *buf, size_t buflen, unsigned int flags)
|
||||
static int _rnd_get_system_entropy_getrandom(void *_rnd, size_t size)
|
||||
{
|
||||
int ret;
|
||||
- ret = force_getrandom(_rnd, size, 0);
|
||||
+ unsigned int flags = 0;
|
||||
+
|
||||
+ if (_gnutls_fips_mode_enabled()) {
|
||||
+ flags |= 2/*GRND_RANDOM*/;
|
||||
+ }
|
||||
+ ret = force_getrandom(_rnd, size, flags);
|
||||
if (ret == -1) {
|
||||
int e = errno;
|
||||
gnutls_assert();
|
||||
--
|
||||
2.41.0
|
||||
|
109
gnutls-3.7.6-fips-sha1-sigver.patch
Normal file
109
gnutls-3.7.6-fips-sha1-sigver.patch
Normal file
@ -0,0 +1,109 @@
|
||||
From cc7473a9ea185e072ab1bae0903c77bd7d7cf5bc Mon Sep 17 00:00:00 2001
|
||||
From: rpm-build <rpm-build>
|
||||
Date: Mon, 20 Nov 2023 07:45:42 +0900
|
||||
Subject: [PATCH] gnutls-3.7.6-fips-sha1-sigver.patch
|
||||
|
||||
Signed-off-by: rpm-build <rpm-build>
|
||||
---
|
||||
lib/nettle/pk.c | 13 +++++--------
|
||||
lib/pubkey.c | 3 ---
|
||||
tests/fips-test.c | 8 ++++----
|
||||
3 files changed, 9 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git a/lib/nettle/pk.c b/lib/nettle/pk.c
|
||||
index 4ddfcff..36a7c24 100644
|
||||
--- a/lib/nettle/pk.c
|
||||
+++ b/lib/nettle/pk.c
|
||||
@@ -1609,10 +1609,7 @@ static int _wrap_nettle_pk_verify(gnutls_pk_algorithm_t algo,
|
||||
if (hash_len > vdata->size)
|
||||
hash_len = vdata->size;
|
||||
|
||||
- /* SHA-1 is allowed for SigVer in FIPS 140-3 in legacy
|
||||
- * mode */
|
||||
switch (DIG_TO_MAC(sign_params->dsa_dig)) {
|
||||
- case GNUTLS_MAC_SHA1:
|
||||
case GNUTLS_MAC_SHA256:
|
||||
case GNUTLS_MAC_SHA384:
|
||||
case GNUTLS_MAC_SHA512:
|
||||
@@ -1683,8 +1680,8 @@ static int _wrap_nettle_pk_verify(gnutls_pk_algorithm_t algo,
|
||||
* 2048-bit or one of the known lengths (1024, 1280,
|
||||
* 1536, 1792; i.e., multiple of 256-bits).
|
||||
*
|
||||
- * In addition to this, only SHA-1 and SHA-2 are allowed
|
||||
- * for SigVer; it is checked in _pkcs1_rsa_verify_sig in
|
||||
+ * In addition to this, only SHA-2 is allowed for
|
||||
+ * SigVer; it is checked in _pkcs1_rsa_verify_sig in
|
||||
* lib/pubkey.c.
|
||||
*/
|
||||
if (unlikely(bits < 2048 && bits != 1024 && bits != 1280 &&
|
||||
@@ -1730,9 +1727,9 @@ static int _wrap_nettle_pk_verify(gnutls_pk_algorithm_t algo,
|
||||
}
|
||||
|
||||
/* RSA modulus size should be 2048-bit or larger in FIPS
|
||||
- * 140-3. In addition to this, only SHA-1 and SHA-2 are
|
||||
- * allowed for SigVer, while Nettle only supports
|
||||
- * SHA256, SHA384, and SHA512 for RSA-PSS (see
|
||||
+ * 140-3. In addition to this, only SHA-2 is allowed
|
||||
+ * for SigVer, while Nettle only supports SHA256,
|
||||
+ * SHA384, and SHA512 for RSA-PSS (see
|
||||
* _rsa_pss_verify_digest in this file for the details).
|
||||
*/
|
||||
if (unlikely(mpz_sizeinbase(pub.n, 2) < 2048)) {
|
||||
diff --git a/lib/pubkey.c b/lib/pubkey.c
|
||||
index 1139ad9..714806a 100644
|
||||
--- a/lib/pubkey.c
|
||||
+++ b/lib/pubkey.c
|
||||
@@ -2452,10 +2452,7 @@ static int _pkcs1_rsa_verify_sig(gnutls_pk_algorithm_t pk,
|
||||
d.size = digest_size;
|
||||
|
||||
if (pk == GNUTLS_PK_RSA) {
|
||||
- /* SHA-1 is allowed for SigVer in FIPS 140-3 in legacy
|
||||
- * mode */
|
||||
switch (me->id) {
|
||||
- case GNUTLS_MAC_SHA1:
|
||||
case GNUTLS_MAC_SHA256:
|
||||
case GNUTLS_MAC_SHA384:
|
||||
case GNUTLS_MAC_SHA512:
|
||||
diff --git a/tests/fips-test.c b/tests/fips-test.c
|
||||
index 180da05..09120c1 100644
|
||||
--- a/tests/fips-test.c
|
||||
+++ b/tests/fips-test.c
|
||||
@@ -596,7 +596,7 @@ void doit(void)
|
||||
}
|
||||
FIPS_POP_CONTEXT(NOT_APPROVED);
|
||||
|
||||
- /* Verify a signature created with 2432-bit RSA and SHA-1; approved */
|
||||
+ /* Verify a signature created with 2432-bit RSA and SHA-1; not approved */
|
||||
FIPS_PUSH_CONTEXT();
|
||||
ret = gnutls_pubkey_verify_data2(pubkey, GNUTLS_SIGN_RSA_SHA1,
|
||||
GNUTLS_VERIFY_ALLOW_SIGN_WITH_SHA1,
|
||||
@@ -604,7 +604,7 @@ void doit(void)
|
||||
if (ret < 0) {
|
||||
fail("gnutls_pubkey_verify_data2 failed\n");
|
||||
}
|
||||
- FIPS_POP_CONTEXT(APPROVED);
|
||||
+ FIPS_POP_CONTEXT(NOT_APPROVED);
|
||||
gnutls_free(signature.data);
|
||||
gnutls_pubkey_deinit(pubkey);
|
||||
gnutls_privkey_deinit(privkey);
|
||||
@@ -708,7 +708,7 @@ void doit(void)
|
||||
}
|
||||
FIPS_POP_CONTEXT(NOT_APPROVED);
|
||||
|
||||
- /* Verify a signature created with ECDSA and SHA-1; approved */
|
||||
+ /* Verify a signature created with ECDSA and SHA-1; not approved */
|
||||
FIPS_PUSH_CONTEXT();
|
||||
ret = gnutls_pubkey_verify_data2(pubkey, GNUTLS_SIGN_ECDSA_SHA1,
|
||||
GNUTLS_VERIFY_ALLOW_SIGN_WITH_SHA1,
|
||||
@@ -716,7 +716,7 @@ void doit(void)
|
||||
if (ret < 0) {
|
||||
fail("gnutls_pubkey_verify_data2 failed\n");
|
||||
}
|
||||
- FIPS_POP_CONTEXT(APPROVED);
|
||||
+ FIPS_POP_CONTEXT(NOT_APPROVED);
|
||||
gnutls_free(signature.data);
|
||||
|
||||
/* Create a signature with ECDSA and SHA-1 (old API); not approved */
|
||||
--
|
||||
2.41.0
|
||||
|
20
gnutls.spec
20
gnutls.spec
@ -14,12 +14,28 @@ print(string.sub(hash, 0, 16))
|
||||
|
||||
Version: 3.8.6
|
||||
Release: %{?autorelease}%{!?autorelease:1%{?dist}}
|
||||
# not upstreamed: can we drop this as configure is regenerated when bootstrappign?
|
||||
Patch: gnutls-3.2.7-rpath.patch
|
||||
|
||||
# follow https://gitlab.com/gnutls/gnutls/-/issues/1443
|
||||
# not upstreamed: modifies the generated code
|
||||
Patch: gnutls-3.7.2-enable-intel-cet.patch
|
||||
# not upstreamed: to ignore GNUTLS_NO_EXPLICIT_INIT, for long-term support purposes
|
||||
Patch: gnutls-3.7.2-no-explicit-init.patch
|
||||
# not upstreamed: to avoid any inconsistency between algorithms enabled through API vs the ones enabled through config file, for long-term support purposes
|
||||
Patch: gnutls-3.7.3-disable-config-reload.patch
|
||||
# not upstreamed: should be removed once --disable-dsa is ported
|
||||
Patch: gnutls-3.7.3-fips-dsa-post.patch
|
||||
# not upstreamed, reseed source DRBG for prediction resistance
|
||||
Patch: gnutls-3.7.6-drbg-reseed.patch
|
||||
# not upstreamed, hard blocking SHA-1 signature verification, for long-term support purposes
|
||||
Patch: gnutls-3.7.6-fips-sha1-sigver.patch
|
||||
# not upstreamed: see https://gitlab.com/gnutls/gnutls/-/issues/1443
|
||||
Patch: gnutls-3.7.8-ktls_skip_tls12_chachapoly_test.patch
|
||||
|
||||
# upstreamed: should be removed after rebase to 3.8.7
|
||||
Patch: gnutls-3.8.6-compression-dlwrap.patch
|
||||
# upstreamed: should be removed after rebase to 3.8.7
|
||||
Patch: gnutls-3.8.6-liboqs-x25519-kyber768d00.patch
|
||||
# upstreamed: should be removed after rebase to 3.8.7
|
||||
Patch: gnutls-3.8.6-nettle-rsa-oaep.patch
|
||||
|
||||
%bcond_without bootstrap
|
||||
|
Loading…
Reference in New Issue
Block a user