import gnutls-3.6.16-6.el8
This commit is contained in:
parent
4b24b34b92
commit
1e87c488b5
247
SOURCES/gnutls-3.6.16-cpuid.patch
Normal file
247
SOURCES/gnutls-3.6.16-cpuid.patch
Normal file
@ -0,0 +1,247 @@
|
||||
From 300c6315d2e644ae81b43fa2dd7bbf68b3afb5b2 Mon Sep 17 00:00:00 2001
|
||||
From: Daiki Ueno <ueno@gnu.org>
|
||||
Date: Thu, 18 Nov 2021 19:02:03 +0100
|
||||
Subject: [PATCH 1/2] accelerated: fix CPU feature detection for Intel CPUs
|
||||
|
||||
This fixes read_cpuid_vals to correctly read the CPUID quadruple, as
|
||||
well as to set the bit the ustream CRYPTOGAMS uses to identify Intel
|
||||
CPUs.
|
||||
|
||||
Suggested by Rafael Gieschke in:
|
||||
https://gitlab.com/gnutls/gnutls/-/issues/1282
|
||||
|
||||
Signed-off-by: Daiki Ueno <ueno@gnu.org>
|
||||
---
|
||||
lib/accelerated/x86/x86-common.c | 91 +++++++++++++++++++++++++-------
|
||||
1 file changed, 71 insertions(+), 20 deletions(-)
|
||||
|
||||
diff --git a/lib/accelerated/x86/x86-common.c b/lib/accelerated/x86/x86-common.c
|
||||
index 3845c6b4c9..cf615ef24f 100644
|
||||
--- a/lib/accelerated/x86/x86-common.c
|
||||
+++ b/lib/accelerated/x86/x86-common.c
|
||||
@@ -81,15 +81,38 @@ unsigned int _gnutls_x86_cpuid_s[4];
|
||||
# define bit_AVX 0x10000000
|
||||
#endif
|
||||
|
||||
-#ifndef OSXSAVE_MASK
|
||||
-/* OSXSAVE|FMA|MOVBE */
|
||||
-# define OSXSAVE_MASK (0x8000000|0x1000|0x400000)
|
||||
+#ifndef bit_AVX2
|
||||
+# define bit_AVX2 0x00000020
|
||||
+#endif
|
||||
+
|
||||
+#ifndef bit_AVX512F
|
||||
+# define bit_AVX512F 0x00010000
|
||||
+#endif
|
||||
+
|
||||
+#ifndef bit_AVX512IFMA
|
||||
+# define bit_AVX512IFMA 0x00200000
|
||||
+#endif
|
||||
+
|
||||
+#ifndef bit_AVX512BW
|
||||
+# define bit_AVX512BW 0x40000000
|
||||
+#endif
|
||||
+
|
||||
+#ifndef bit_AVX512VL
|
||||
+# define bit_AVX512VL 0x80000000
|
||||
+#endif
|
||||
+
|
||||
+#ifndef bit_OSXSAVE
|
||||
+# define bit_OSXSAVE 0x8000000
|
||||
#endif
|
||||
|
||||
#ifndef bit_MOVBE
|
||||
# define bit_MOVBE 0x00400000
|
||||
#endif
|
||||
|
||||
+#ifndef OSXSAVE_MASK
|
||||
+# define OSXSAVE_MASK (bit_OSXSAVE|bit_MOVBE)
|
||||
+#endif
|
||||
+
|
||||
#define via_bit_PADLOCK (0x3 << 6)
|
||||
#define via_bit_PADLOCK_PHE (0x3 << 10)
|
||||
#define via_bit_PADLOCK_PHE_SHA512 (0x3 << 25)
|
||||
@@ -127,7 +150,7 @@ static unsigned read_cpuid_vals(unsigned int vals[4])
|
||||
unsigned t1, t2, t3;
|
||||
vals[0] = vals[1] = vals[2] = vals[3] = 0;
|
||||
|
||||
- if (!__get_cpuid(1, &t1, &vals[0], &vals[1], &t2))
|
||||
+ if (!__get_cpuid(1, &t1, &t2, &vals[1], &vals[0]))
|
||||
return 0;
|
||||
/* suppress AVX512; it works conditionally on certain CPUs on the original code */
|
||||
vals[1] &= 0xfffff7ff;
|
||||
@@ -145,7 +168,7 @@ static unsigned check_4th_gen_intel_features(unsigned ecx)
|
||||
{
|
||||
uint32_t xcr0;
|
||||
|
||||
- if ((ecx & OSXSAVE_MASK) != OSXSAVE_MASK)
|
||||
+ if ((ecx & bit_OSXSAVE) != bit_OSXSAVE)
|
||||
return 0;
|
||||
|
||||
#if defined(_MSC_VER) && !defined(__clang__)
|
||||
@@ -233,10 +256,7 @@ static unsigned check_sha(void)
|
||||
#ifdef ASM_X86_64
|
||||
static unsigned check_avx_movbe(void)
|
||||
{
|
||||
- if (check_4th_gen_intel_features(_gnutls_x86_cpuid_s[1]) == 0)
|
||||
- return 0;
|
||||
-
|
||||
- return ((_gnutls_x86_cpuid_s[1] & bit_AVX));
|
||||
+ return (_gnutls_x86_cpuid_s[1] & bit_AVX);
|
||||
}
|
||||
|
||||
static unsigned check_pclmul(void)
|
||||
@@ -514,33 +534,47 @@ void register_x86_padlock_crypto(unsigned capabilities)
|
||||
}
|
||||
#endif
|
||||
|
||||
-static unsigned check_intel_or_amd(void)
|
||||
+enum x86_cpu_vendor {
|
||||
+ X86_CPU_VENDOR_OTHER,
|
||||
+ X86_CPU_VENDOR_INTEL,
|
||||
+ X86_CPU_VENDOR_AMD,
|
||||
+};
|
||||
+
|
||||
+static enum x86_cpu_vendor check_x86_cpu_vendor(void)
|
||||
{
|
||||
unsigned int a, b, c, d;
|
||||
|
||||
- if (!__get_cpuid(0, &a, &b, &c, &d))
|
||||
- return 0;
|
||||
+ if (!__get_cpuid(0, &a, &b, &c, &d)) {
|
||||
+ return X86_CPU_VENDOR_OTHER;
|
||||
+ }
|
||||
|
||||
- if ((memcmp(&b, "Genu", 4) == 0 &&
|
||||
- memcmp(&d, "ineI", 4) == 0 &&
|
||||
- memcmp(&c, "ntel", 4) == 0) ||
|
||||
- (memcmp(&b, "Auth", 4) == 0 &&
|
||||
- memcmp(&d, "enti", 4) == 0 && memcmp(&c, "cAMD", 4) == 0)) {
|
||||
- return 1;
|
||||
+ if (memcmp(&b, "Genu", 4) == 0 &&
|
||||
+ memcmp(&d, "ineI", 4) == 0 &&
|
||||
+ memcmp(&c, "ntel", 4) == 0) {
|
||||
+ return X86_CPU_VENDOR_INTEL;
|
||||
}
|
||||
|
||||
- return 0;
|
||||
+ if (memcmp(&b, "Auth", 4) == 0 &&
|
||||
+ memcmp(&d, "enti", 4) == 0 &&
|
||||
+ memcmp(&c, "cAMD", 4) == 0) {
|
||||
+ return X86_CPU_VENDOR_AMD;
|
||||
+ }
|
||||
+
|
||||
+ return X86_CPU_VENDOR_OTHER;
|
||||
}
|
||||
|
||||
static
|
||||
void register_x86_intel_crypto(unsigned capabilities)
|
||||
{
|
||||
int ret;
|
||||
+ enum x86_cpu_vendor vendor;
|
||||
|
||||
memset(_gnutls_x86_cpuid_s, 0, sizeof(_gnutls_x86_cpuid_s));
|
||||
|
||||
- if (check_intel_or_amd() == 0)
|
||||
+ vendor = check_x86_cpu_vendor();
|
||||
+ if (vendor == X86_CPU_VENDOR_OTHER) {
|
||||
return;
|
||||
+ }
|
||||
|
||||
if (capabilities == 0) {
|
||||
if (!read_cpuid_vals(_gnutls_x86_cpuid_s))
|
||||
@@ -549,6 +583,23 @@ void register_x86_intel_crypto(unsigned capabilities)
|
||||
capabilities_to_intel_cpuid(capabilities);
|
||||
}
|
||||
|
||||
+ /* CRYPTOGAMS uses the (1 << 30) bit as an indicator of Intel CPUs */
|
||||
+ if (vendor == X86_CPU_VENDOR_INTEL) {
|
||||
+ _gnutls_x86_cpuid_s[0] |= 1 << 30;
|
||||
+ } else {
|
||||
+ _gnutls_x86_cpuid_s[0] &= ~(1 << 30);
|
||||
+ }
|
||||
+
|
||||
+ if (!check_4th_gen_intel_features(_gnutls_x86_cpuid_s[1])) {
|
||||
+ _gnutls_x86_cpuid_s[1] &= ~bit_AVX;
|
||||
+
|
||||
+ /* Clear AVX2 bits as well, according to what OpenSSL does.
|
||||
+ * Should we clear bit_AVX512DQ, bit_AVX512PF, bit_AVX512ER, and
|
||||
+ * bit_AVX512CD? */
|
||||
+ _gnutls_x86_cpuid_s[2] &= ~(bit_AVX2|bit_AVX512F|bit_AVX512IFMA|
|
||||
+ bit_AVX512BW|bit_AVX512BW);
|
||||
+ }
|
||||
+
|
||||
if (check_ssse3()) {
|
||||
_gnutls_debug_log("Intel SSSE3 was detected\n");
|
||||
|
||||
--
|
||||
2.37.3
|
||||
|
||||
|
||||
From cd509dac9e6d1bf76fd12c72c1fd61f1708c254a Mon Sep 17 00:00:00 2001
|
||||
From: Daiki Ueno <ueno@gnu.org>
|
||||
Date: Mon, 15 Aug 2022 09:39:18 +0900
|
||||
Subject: [PATCH 2/2] accelerated: clear AVX bits if it cannot be queried
|
||||
through XSAVE
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
The algorithm to detect AVX is described in 14.3 of "Intel® 64 and IA-32
|
||||
Architectures Software Developer’s Manual".
|
||||
|
||||
GnuTLS previously only followed that algorithm when registering the
|
||||
crypto backend, while the CRYPTOGAMS derived SHA code assembly expects
|
||||
that the extension bits are propagated to _gnutls_x86_cpuid_s.
|
||||
|
||||
Signed-off-by: Daiki Ueno <ueno@gnu.org>
|
||||
---
|
||||
lib/accelerated/x86/x86-common.c | 18 ++++++++++++++++--
|
||||
1 file changed, 16 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/lib/accelerated/x86/x86-common.c b/lib/accelerated/x86/x86-common.c
|
||||
index cf615ef24f..655d0c65f2 100644
|
||||
--- a/lib/accelerated/x86/x86-common.c
|
||||
+++ b/lib/accelerated/x86/x86-common.c
|
||||
@@ -210,7 +210,8 @@ static void capabilities_to_intel_cpuid(unsigned capabilities)
|
||||
}
|
||||
|
||||
if (capabilities & INTEL_AVX) {
|
||||
- if ((a[1] & bit_AVX) && check_4th_gen_intel_features(a[1])) {
|
||||
+ if ((a[1] & bit_AVX) && (a[1] & bit_MOVBE) &&
|
||||
+ check_4th_gen_intel_features(a[1])) {
|
||||
_gnutls_x86_cpuid_s[1] |= bit_AVX|bit_MOVBE;
|
||||
} else {
|
||||
_gnutls_debug_log
|
||||
@@ -256,7 +257,7 @@ static unsigned check_sha(void)
|
||||
#ifdef ASM_X86_64
|
||||
static unsigned check_avx_movbe(void)
|
||||
{
|
||||
- return (_gnutls_x86_cpuid_s[1] & bit_AVX);
|
||||
+ return (_gnutls_x86_cpuid_s[1] & (bit_AVX|bit_MOVBE)) == (bit_AVX|bit_MOVBE);
|
||||
}
|
||||
|
||||
static unsigned check_pclmul(void)
|
||||
@@ -579,6 +580,19 @@ void register_x86_intel_crypto(unsigned capabilities)
|
||||
if (capabilities == 0) {
|
||||
if (!read_cpuid_vals(_gnutls_x86_cpuid_s))
|
||||
return;
|
||||
+ if (!check_4th_gen_intel_features(_gnutls_x86_cpuid_s[1])) {
|
||||
+ _gnutls_x86_cpuid_s[1] &= ~bit_AVX;
|
||||
+
|
||||
+ /* Clear AVX2 bits as well, according to what
|
||||
+ * OpenSSL does. Should we clear
|
||||
+ * bit_AVX512DQ, bit_AVX512PF, bit_AVX512ER,
|
||||
+ * and bit_AVX512CD? */
|
||||
+ _gnutls_x86_cpuid_s[2] &= ~(bit_AVX2|
|
||||
+ bit_AVX512F|
|
||||
+ bit_AVX512IFMA|
|
||||
+ bit_AVX512BW|
|
||||
+ bit_AVX512BW);
|
||||
+ }
|
||||
} else {
|
||||
capabilities_to_intel_cpuid(capabilities);
|
||||
}
|
||||
--
|
||||
2.37.3
|
||||
|
266
SOURCES/gnutls-3.6.16-pkcs7-verify.patch
Normal file
266
SOURCES/gnutls-3.6.16-pkcs7-verify.patch
Normal file
@ -0,0 +1,266 @@
|
||||
From e5dc27d1a457d1b3abc0582cd133910dff0fc309 Mon Sep 17 00:00:00 2001
|
||||
From: Zoltan Fridrich <zfridric@redhat.com>
|
||||
Date: Fri, 22 Jul 2022 12:00:11 +0200
|
||||
Subject: [PATCH] Fix double free during gnutls_pkcs7_verify
|
||||
|
||||
Signed-off-by: Zoltan Fridrich <zfridric@redhat.com>
|
||||
---
|
||||
.gitignore | 1 +
|
||||
lib/x509/pkcs7.c | 3 +-
|
||||
tests/Makefile.am | 3 +-
|
||||
tests/pkcs7-verify-double-free.c | 215 +++++++++++++++++++++++++++++++
|
||||
4 files changed, 220 insertions(+), 2 deletions(-)
|
||||
create mode 100644 tests/pkcs7-verify-double-free.c
|
||||
|
||||
diff --git a/lib/x509/pkcs7.c b/lib/x509/pkcs7.c
|
||||
index 0ff55ba04b..878f867862 100644
|
||||
--- a/lib/x509/pkcs7.c
|
||||
+++ b/lib/x509/pkcs7.c
|
||||
@@ -1318,7 +1318,8 @@ gnutls_x509_crt_t find_signer(gnutls_pkcs7_t pkcs7, gnutls_x509_trust_list_t tl,
|
||||
issuer = find_verified_issuer_of(pkcs7, issuer, purpose, vflags);
|
||||
|
||||
if (issuer != NULL && gnutls_x509_crt_check_issuer(issuer, issuer)) {
|
||||
- if (prev) gnutls_x509_crt_deinit(prev);
|
||||
+ if (prev && prev != signer)
|
||||
+ gnutls_x509_crt_deinit(prev);
|
||||
prev = issuer;
|
||||
break;
|
||||
}
|
||||
diff --git a/tests/Makefile.am b/tests/Makefile.am
|
||||
index b04cb081b4..0563d3c754 100644
|
||||
--- a/tests/Makefile.am
|
||||
+++ b/tests/Makefile.am
|
||||
@@ -220,7 +220,8 @@ ctests += mini-record-2 simple gnutls_hmac_fast set_pkcs12_cred cert certuniquei
|
||||
sign-verify-newapi sign-verify-deterministic iov aead-cipher-vec \
|
||||
tls13-without-timeout-func buffer status-request-revoked \
|
||||
set_x509_ocsp_multi_cli kdf-api keylog-func \
|
||||
- dtls_hello_random_value tls_hello_random_value x509cert-dntypes
|
||||
+ dtls_hello_random_value tls_hello_random_value x509cert-dntypes \
|
||||
+ pkcs7-verify-double-free
|
||||
|
||||
if HAVE_SECCOMP_TESTS
|
||||
ctests += dtls-with-seccomp tls-with-seccomp dtls-client-with-seccomp tls-client-with-seccomp
|
||||
diff --git a/tests/pkcs7-verify-double-free.c b/tests/pkcs7-verify-double-free.c
|
||||
new file mode 100644
|
||||
index 0000000000..fadf307829
|
||||
--- /dev/null
|
||||
+++ b/tests/pkcs7-verify-double-free.c
|
||||
@@ -0,0 +1,215 @@
|
||||
+/*
|
||||
+ * Copyright (C) 2022 Red Hat, Inc.
|
||||
+ *
|
||||
+ * Author: Zoltan Fridrich
|
||||
+ *
|
||||
+ * This file is part of GnuTLS.
|
||||
+ *
|
||||
+ * GnuTLS is free software: you can redistribute it and/or modify it
|
||||
+ * under the terms of the GNU General Public License as published by
|
||||
+ * the Free Software Foundation, either version 3 of the License, or
|
||||
+ * (at your option) any later version.
|
||||
+ *
|
||||
+ * GnuTLS is distributed in the hope that it will be useful, but
|
||||
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
+ * General Public License for more details.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public License
|
||||
+ * along with GnuTLS. If not, see <https://www.gnu.org/licenses/>.
|
||||
+ */
|
||||
+
|
||||
+#ifdef HAVE_CONFIG_H
|
||||
+#include <config.h>
|
||||
+#endif
|
||||
+
|
||||
+#include <stdio.h>
|
||||
+#include <gnutls/pkcs7.h>
|
||||
+#include <gnutls/x509.h>
|
||||
+
|
||||
+#include "utils.h"
|
||||
+
|
||||
+static char rca_pem[] =
|
||||
+ "-----BEGIN CERTIFICATE-----\n"
|
||||
+ "MIIDCjCCAfKgAwIBAgIBATANBgkqhkiG9w0BAQsFADAVMRMwEQYDVQQKDApFeGFt\n"
|
||||
+ "cGxlIENBMCAXDTE3MDcyMTE0NDMzNloYDzIyMjIwNzIxMTQ0MzM2WjAVMRMwEQYD\n"
|
||||
+ "VQQKDApFeGFtcGxlIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA\n"
|
||||
+ "v8hnKPJ/IA0SQB/A/a0Uh+npZ67vsgIMrtTQo0r0kJkmkBz5323xO3DVuJfB3QmX\n"
|
||||
+ "v9zvoeCQLuDvWar5Aixfxgm6s5Q+yPvJj9t3NebDrU+Y4+qyewBIJUF8EF/5iBPC\n"
|
||||
+ "ZHONmzbfIRWvQWGGgb2CRcOHp2J7AY/QLB6LsWPaLjs/DHva28Q13JaTTHIpdu8v\n"
|
||||
+ "t6vHr0nXf66DN4MvtoF3N+o+v3snJCMsfXOqASi4tbWR7gtOfCfiz9uBjh0W2Dut\n"
|
||||
+ "/jclBQkJkLe6esNSM+f4YiOpctVDjmfj8yoHCp394vt0wFqhG38wsTFAyVP6qIcf\n"
|
||||
+ "5zoSu9ovEt2c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79Jc51WHPFXgea4/qyfr\n"
|
||||
+ "4y14PGs0SNxm6T44sXurUs7cXydQVUgnq2VCaWFOTUdxXoAWkV8r8GaUoPD/klVz\n"
|
||||
+ "RqxSZVETmX1XBKhsMnnov41kRwVph2C+VfUspsbaUZaz/o/S1/nokhXRACzKsMBr\n"
|
||||
+ "obqiGxbY35uVzsmbAW5ErhQz98AWJL3Bub1fsEMXg6OEMmPH4AtX888dTIYZNw0E\n"
|
||||
+ "bUIESspz1kjJQTtVQDHTprhwz16YiSVeUonlLgMCAwEAAaNjMGEwDwYDVR0TAQH/\n"
|
||||
+ "BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFPBjxDWjMhjXERirKF9O\n"
|
||||
+ "o/5Cllc5MB8GA1UdIwQYMBaAFIY3julHOYpm4zpdiNpbVQNux7vWMA0GCSqGSIb3\n"
|
||||
+ "DQEBCwUAA4IBAQCTm+vv3hBa6lL5IT+Fw8aTxQ2Ne7mZ5oyazhvXYwwfKNMX3SML\n"
|
||||
+ "W2JdPaL64ZwbxxxYvW401o5Z0CEgru3YFrsqB/hEdl0Uf8UWWJmE1rRa+miTmbjt\n"
|
||||
+ "lrLNCWdrs6CiwvsPITTHg7jevB4KyZYsTSxQFcyr3N3xF+6EmOTC4IkhPPnXYXcp\n"
|
||||
+ "248ih+WOavSYoRvzgB/Dip1WnPYU2mfIV3O8JReRryngA0TzWCLPLUoWR3R4jwtC\n"
|
||||
+ "+1uSLoqaenz3qv3F1WEbke37az9YJuXx/5D8CqFQiZ62TUUtI6fYd8mkMBM4Qfh6\n"
|
||||
+ "NW9XrCkI9wlpL5K9HllhuW0BhKeJkuPpyQ2p\n"
|
||||
+ "-----END CERTIFICATE-----\n";
|
||||
+
|
||||
+static char ee_pem[] =
|
||||
+ "-----BEGIN CERTIFICATE-----\n"
|
||||
+ "MIIDIjCCAgqgAwIBAgIBATANBgkqhkiG9w0BAQsFADAiMSAwHgYDVQQKDBdFeGFt\n"
|
||||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 "l/pWiaoBC+8wK9cDoMUK5yOwXeuCLffCb+UlAD0+z/qxJ2pisE8E9X8rRKRrWI+i\n"
|
||||
+ "G7LtJCEn86EQK8KuRlJxKgj8lClZhoULB0oL4jbblBuNow9WRmM=\n"
|
||||
+ "-----END CERTIFICATE-----\n";
|
||||
+
|
||||
+static char msg_pem[] =
|
||||
+ "-----BEGIN PKCS7-----\n"
|
||||
+ "MIIK2QYJKoZIhvcNAQcCoIIKyjCCCsYCAQExDTALBglghkgBZQMEAgEwCwYJKoZI\n"
|
||||
+ "hvcNAQcBoIIJTzCCAwowggHyoAMCAQICAQEwDQYJKoZIhvcNAQELBQAwFTETMBEG\n"
|
||||
+ "A1UECgwKRXhhbXBsZSBDQTAgFw0xNzA3MjExNDQzMjFaGA8yMjIyMDcyMTE0NDMy\n"
|
||||
+ "MVowFTETMBEGA1UECgwKRXhhbXBsZSBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEP\n"
|
||||
+ "ADCCAQoCggEBAL51eyE4j8wAKQKMGlO9HEY2iaGvsdPSJmidSdmCi1jnNK39Lx4Y\n"
|
||||
+ "31h279hSHF5wtI6VM91HHfeLf1mjEZHlKrXXJQzBPLpbHWapD778drHBitOP8e56\n"
|
||||
+ "fDMIfofLV4tkMk8690vPe4cJH1UHGspMyz6EQF9kPRaW80XtMV/6dalgL/9Esmaw\n"
|
||||
+ "XBNPJAS1VutDuXQkJ/3/rWFLmkpYHHtGPjX782YRmT1s+VOVTsLqmKx0TEL8A381\n"
|
||||
+ "bbElHPUAMjPcyWR5qqA8KWnS5Dwqk3LwI0AvuhQytCq0S7Xl4DXauvxwTRXv0UU7\n"
|
||||
+ "W8r3MLAw9DnlnJiD/RFjw5rbGO3wMePk/qUCAwEAAaNjMGEwDwYDVR0TAQH/BAUw\n"
|
||||
+ "AwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFIh2KRoKJoe2VtpOwWMkRAkR\n"
|
||||
+ "mLWKMB8GA1UdIwQYM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"8QXuNnZ0u7b6mKgrSY2Gf47fpL2aRgaR+BAQncbctu5EH/IL38pWjaGtOhFAj/5q\n"
|
||||
+ "7luVQW11kuyJN3Bd/dtLqawWOwMmAIEigw6X50l5ZHnEVzFfxt+RKTNhk4XWVtbi\n"
|
||||
+ "2iIlITOplW0rnvxYAwCxKL9ocaB7etK8au7ixMxbFp75Ts4iLX8dhlAFdCuFCk8k\n"
|
||||
+ "B8mi9HHuwr3QYRqMPW61hu1wBL3yB8eoZNOwPXb0gkIh6ZvgptxgQzm/cc+Iw9fP\n"
|
||||
+ "QkR0fTM7ElJ5QZmSV98AUbZDHmDvpmcjcUxfSPMc3IoT8T300usRu7QHqKJi\n"
|
||||
+ "-----END PKCS7-----\n";
|
||||
+
|
||||
+const gnutls_datum_t rca_datum = { (void *)rca_pem, sizeof(rca_pem) - 1 };
|
||||
+const gnutls_datum_t ca_datum = { (void *)ca_pem, sizeof(ca_pem) - 1 };
|
||||
+const gnutls_datum_t ee_datum = { (void *)ee_pem, sizeof(ee_pem) - 1 };
|
||||
+const gnutls_datum_t msg_datum = { (void *)msg_pem, sizeof(msg_pem) - 1 };
|
||||
+
|
||||
+static void tls_log_func(int level, const char *str)
|
||||
+{
|
||||
+ fprintf(stderr, "%s |<%d>| %s", "err", level, str);
|
||||
+}
|
||||
+
|
||||
+#define CHECK(X)\
|
||||
+{\
|
||||
+ r = X;\
|
||||
+ if (r < 0)\
|
||||
+ fail("error in %d: %s\n", __LINE__, gnutls_strerror(r));\
|
||||
+}\
|
||||
+
|
||||
+void doit(void)
|
||||
+{
|
||||
+ int r;
|
||||
+ gnutls_x509_crt_t rca_cert = NULL;
|
||||
+ gnutls_x509_crt_t ca_cert = NULL;
|
||||
+ gnutls_x509_crt_t ee_cert = NULL;
|
||||
+ gnutls_x509_trust_list_t tlist = NULL;
|
||||
+ gnutls_pkcs7_t pkcs7 = NULL;
|
||||
+ gnutls_datum_t data = { (unsigned char *)"xxx", 3 };
|
||||
+
|
||||
+ if (debug) {
|
||||
+ gnutls_global_set_log_function(tls_log_func);
|
||||
+ gnutls_global_set_log_level(4711);
|
||||
+ }
|
||||
+
|
||||
+ // Import certificates
|
||||
+ CHECK(gnutls_x509_crt_init(&rca_cert));
|
||||
+ CHECK(gnutls_x509_crt_import(rca_cert, &rca_datum, GNUTLS_X509_FMT_PEM));
|
||||
+ CHECK(gnutls_x509_crt_init(&ca_cert));
|
||||
+ CHECK(gnutls_x509_crt_import(ca_cert, &ca_datum, GNUTLS_X509_FMT_PEM));
|
||||
+ CHECK(gnutls_x509_crt_init(&ee_cert));
|
||||
+ CHECK(gnutls_x509_crt_import(ee_cert, &ee_datum, GNUTLS_X509_FMT_PEM));
|
||||
+
|
||||
+ // Setup trust store
|
||||
+ CHECK(gnutls_x509_trust_list_init(&tlist, 0));
|
||||
+ CHECK(gnutls_x509_trust_list_add_named_crt(tlist, rca_cert, "rca", 3, 0));
|
||||
+ CHECK(gnutls_x509_trust_list_add_named_crt(tlist, ca_cert, "ca", 2, 0));
|
||||
+ CHECK(gnutls_x509_trust_list_add_named_crt(tlist, ee_cert, "ee", 2, 0));
|
||||
+
|
||||
+ // Setup pkcs7 structure
|
||||
+ CHECK(gnutls_pkcs7_init(&pkcs7));
|
||||
+ CHECK(gnutls_pkcs7_import(pkcs7, &msg_datum, GNUTLS_X509_FMT_PEM));
|
||||
+
|
||||
+ // Signature verification
|
||||
+ gnutls_pkcs7_verify(pkcs7, tlist, NULL, 0, 0, &data, 0);
|
||||
+
|
||||
+ gnutls_x509_crt_deinit(rca_cert);
|
||||
+ gnutls_x509_crt_deinit(ca_cert);
|
||||
+ gnutls_x509_crt_deinit(ee_cert);
|
||||
+ gnutls_x509_trust_list_deinit(tlist, 0);
|
||||
+ gnutls_pkcs7_deinit(pkcs7);
|
||||
+}
|
||||
--
|
||||
2.37.2
|
||||
|
@ -1,5 +1,5 @@
|
||||
Version: 3.6.16
|
||||
Release: 4%{?dist}
|
||||
Release: 6%{?dist}
|
||||
Patch1: gnutls-3.2.7-rpath.patch
|
||||
Patch2: gnutls-3.6.4-no-now-guile.patch
|
||||
Patch3: gnutls-3.6.13-enable-intel-cet.patch
|
||||
@ -8,6 +8,8 @@ Patch11: gnutls-3.6.14-fips-kdf-selftests.patch
|
||||
Patch12: gnutls-3.6.16-tls12-cert-type.patch
|
||||
Patch13: gnutls-3.6.16-trust-ca-sha1.patch
|
||||
Patch14: gnutls-3.6.16-doc-p11tool-ckaid.patch
|
||||
Patch15: gnutls-3.6.16-pkcs7-verify.patch
|
||||
Patch16: gnutls-3.6.16-cpuid.patch
|
||||
%bcond_without dane
|
||||
%if 0%{?rhel}
|
||||
%bcond_with guile
|
||||
@ -165,6 +167,7 @@ echo "SYSTEM=NORMAL" >> tests/system.prio
|
||||
# via the crypto policies
|
||||
|
||||
%build
|
||||
autoreconf -fi
|
||||
CCASFLAGS="$CCASFLAGS -Wa,--generate-missing-build-notes=yes"
|
||||
export CCASFLAGS
|
||||
%configure --with-libtasn1-prefix=%{_prefix} \
|
||||
@ -291,6 +294,12 @@ fi
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Mon Dec 19 2022 Daiki Ueno <dueno@redhat.com> - 3.6.16-6
|
||||
- Fix x86_64 CPU feature detection when AVX is not available (#2116610)
|
||||
|
||||
* Mon Aug 29 2022 Daiki Ueno <dueno@redhat.com> - 3.6.16-5
|
||||
- Fix double-free in gnutls_pkcs7_verify (#2109788)
|
||||
|
||||
* Mon Jun 28 2021 Daiki Ueno <dueno@redhat.com> - 3.6.16-4
|
||||
- p11tool: Document ID reuse behavior when importing certs (#1776250)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user