Skip to content

Commit f9cc0c8

Browse files
authored
Merge pull request #2492 from flatcar/tormath1/openssl
dev-libs/openssl: upgrade to 3.2.3
2 parents 8250b85 + edde97a commit f9cc0c8

File tree

8 files changed

+211
-90
lines changed

8 files changed

+211
-90
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- OpenSSL ([CVE-2024-2511](https://nvd.nist.gov/vuln/detail/CVE-2024-2511), [CVE-2024-4603](https://nvd.nist.gov/vuln/detail/CVE-2024-4603), [CVE-2024-4741](https://nvd.nist.gov/vuln/detail/CVE-2024-4741), [CVE-2024-5535](https://nvd.nist.gov/vuln/detail/CVE-2024-5535), [CVE-2024-6119](https://nvd.nist.gov/vuln/detail/CVE-2024-6119), [CVE-2024-9143](https://nvd.nist.gov/vuln/detail/CVE-2024-9143))
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- OpenSSL ([3.2.3](https://github.com/openssl/openssl/blob/openssl-3.2/CHANGES.md#openssl-32))
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
DIST openssl-3.2.1.tar.gz 17733249 BLAKE2B 960222e0305166160e5ab000e29650b92063bf726551ee9ad46060166d99738d1e3a5b86fd28b14c8f4fb3a72f5aa70850defb87c02990acff3dbcbdac40b347 SHA512 bab2b2419319f1feffaba4692f03edbf13b44d1090c6e075a2d69dad67a2d51e64e6edbf83456a26c83900a726d20d2c4ee4ead9c94b322fd0b536f3b5a863c4
2-
DIST openssl-3.2.1.tar.gz.asc 833 BLAKE2B a1d25fe30bf1804d13a8b6b98edf56be5bf744d9e2706f4169455c24efe2e3a361487d00d0d4bac240c3f0170693d77a39dd0d4ee5c792d2247aa00c47e74ebf SHA512 de39516c7b77612f33cdc830a8d13ef6bcd91c03d24a6ed105480f140f9e1ad7049844e234c96a516d62e0e33ce90442ffd0f309ea674884c735f04d8562f372
1+
DIST openssl-3.2.3.tar.gz 17762604 BLAKE2B 1445336aa92d0fd9df266ad570fe2bf5701279e462dd3fccd4cf662f328bfee923dc6c72c42c1921fd38bce43e1c60cacdec3f1c2963fe0ffda6a0e8e34ac6e4 SHA512 9e9f06ab630914e32e64bfb945dfa375ea3595b3db4eb8ef68288a58909baf753b34998439907c22ff2b8561cfd3f3f6b7fbf22981479e66a98c2e92fda172a2
2+
DIST openssl-3.2.3.tar.gz.asc 833 BLAKE2B 5a7289ed40534a058b9eb7686ce444b9d453a2973ab7ebda01c99f7245f6ba19197123f8bb3b16940d4bfbc5e313babc0249f280e55911190b47da3a47ed1e6a SHA512 e727adb88f84c48082ef0cae963bf999cce11619f7322014cc7f36c16e8375a60542f518c1b86319208cf8da33044e942b3d65208bc59fd4a5f522ab78ff1c23

sdk_container/src/third_party/coreos-overlay/dev-libs/openssl/files/gentoo.config-1.0.4

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ if [[ $1 == "test" ]] ; then
3232
"i686-apple-darwinX |darwin-i386-cc" \
3333
"i386-apple-darwinX |darwin-i386-cc" \
3434
"powerpc-apple-darwinX |darwin-ppc-cc" \
35+
"arm64-apple-darwinX |darwin-arm64-cc" \
3536
"i586-pc-winnt |winnt-parity" \
3637
"s390-ibm-linux-gnu |linux-generic32 -DB_ENDIAN" \
3738
"s390x-linux-gnu |linux64-s390x" \
@@ -155,6 +156,7 @@ darwin)
155156
powerpc) machine=ppc-cc;;
156157
i?86*) machine=i386-cc;;
157158
x86_64) machine=x86_64-cc; system=${system}64;;
159+
arm64) machine=arm64-cc; system=${system}64;;
158160
esac
159161
;;
160162
hpux)

sdk_container/src/third_party/coreos-overlay/dev-libs/openssl/files/openssl-3.2.1-p11-segfault.patch

Lines changed: 0 additions & 79 deletions
This file was deleted.
Lines changed: 193 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,193 @@
1+
https://bugs.gentoo.org/941643
2+
https://github.com/openssl/openssl/commit/bc7e04d7c8d509fb78fc0e285aa948fb0da04700
3+
4+
From bc7e04d7c8d509fb78fc0e285aa948fb0da04700 Mon Sep 17 00:00:00 2001
5+
From: Viktor Dukhovni <[email protected]>
6+
Date: Thu, 19 Sep 2024 01:02:40 +1000
7+
Subject: [PATCH] Harden BN_GF2m_poly2arr against misuse.
8+
9+
The BN_GF2m_poly2arr() function converts characteristic-2 field
10+
(GF_{2^m}) Galois polynomials from a representation as a BIGNUM bitmask,
11+
to a compact array with just the exponents of the non-zero terms.
12+
13+
These polynomials are then used in BN_GF2m_mod_arr() to perform modular
14+
reduction. A precondition of calling BN_GF2m_mod_arr() is that the
15+
polynomial must have a non-zero constant term (i.e. the array has `0` as
16+
its final element).
17+
18+
Internally, callers of BN_GF2m_poly2arr() did not verify that
19+
precondition, and binary EC curve parameters with an invalid polynomial
20+
could lead to out of bounds memory reads and writes in BN_GF2m_mod_arr().
21+
22+
The precondition is always true for polynomials that arise from the
23+
standard form of EC parameters for characteristic-two fields (X9.62).
24+
See the "Finite Field Identification" section of:
25+
26+
https://www.itu.int/ITU-T/formal-language/itu-t/x/x894/2018-cor1/ANSI-X9-62.html
27+
28+
The OpenSSL GF(2^m) code supports only the trinomial and pentanomial
29+
basis X9.62 forms.
30+
31+
This commit updates BN_GF2m_poly2arr() to return `0` (failure) when
32+
the constant term is zero (i.e. the input bitmask BIGNUM is not odd).
33+
34+
Additionally, the return value is made unambiguous when there is not
35+
enough space to also pad the array with a final `-1` sentinel value.
36+
The return value is now always the number of elements (including the
37+
final `-1`) that would be filled when the output array is sufficiently
38+
large. Previously the same count was returned both when the array has
39+
just enough room for the final `-1` and when it had only enough space
40+
for non-sentinel values.
41+
42+
Finally, BN_GF2m_poly2arr() is updated to reject polynomials whose
43+
degree exceeds `OPENSSL_ECC_MAX_FIELD_BITS`, this guards against
44+
CPU exhausition attacks via excessively large inputs.
45+
46+
The above issues do not arise in processing X.509 certificates. These
47+
generally have EC keys from "named curves", and RFC5840 (Section 2.1.1)
48+
disallows explicit EC parameters. The TLS code in OpenSSL enforces this
49+
constraint only after the certificate is decoded, but, even if explicit
50+
parameters are specified, they are in X9.62 form, which cannot represent
51+
problem values as noted above.
52+
53+
Initially reported as oss-fuzz issue 71623.
54+
55+
A closely related issue was earlier reported in
56+
<https://github.com/openssl/openssl/issues/19826>.
57+
58+
Severity: Low, CVE-2024-9143
59+
60+
Reviewed-by: Matt Caswell <[email protected]>
61+
Reviewed-by: Bernd Edlinger <[email protected]>
62+
Reviewed-by: Paul Dale <[email protected]>
63+
Reviewed-by: Tomas Mraz <[email protected]>
64+
(Merged from https://github.com/openssl/openssl/pull/25639)
65+
66+
(cherry picked from commit 8e008cb8b23ec7dc75c45a66eeed09c815b11cd2)
67+
--- a/crypto/bn/bn_gf2m.c
68+
+++ b/crypto/bn/bn_gf2m.c
69+
@@ -15,6 +15,7 @@
70+
#include "bn_local.h"
71+
72+
#ifndef OPENSSL_NO_EC2M
73+
+# include <openssl/ec.h>
74+
75+
/*
76+
* Maximum number of iterations before BN_GF2m_mod_solve_quad_arr should
77+
@@ -1130,16 +1131,26 @@ int BN_GF2m_mod_solve_quad(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
78+
/*
79+
* Convert the bit-string representation of a polynomial ( \sum_{i=0}^n a_i *
80+
* x^i) into an array of integers corresponding to the bits with non-zero
81+
- * coefficient. Array is terminated with -1. Up to max elements of the array
82+
- * will be filled. Return value is total number of array elements that would
83+
- * be filled if array was large enough.
84+
+ * coefficient. The array is intended to be suitable for use with
85+
+ * `BN_GF2m_mod_arr()`, and so the constant term of the polynomial must not be
86+
+ * zero. This translates to a requirement that the input BIGNUM `a` is odd.
87+
+ *
88+
+ * Given sufficient room, the array is terminated with -1. Up to max elements
89+
+ * of the array will be filled.
90+
+ *
91+
+ * The return value is total number of array elements that would be filled if
92+
+ * array was large enough, including the terminating `-1`. It is `0` when `a`
93+
+ * is not odd or the constant term is zero contrary to requirement.
94+
+ *
95+
+ * The return value is also `0` when the leading exponent exceeds
96+
+ * `OPENSSL_ECC_MAX_FIELD_BITS`, this guards against CPU exhaustion attacks,
97+
*/
98+
int BN_GF2m_poly2arr(const BIGNUM *a, int p[], int max)
99+
{
100+
int i, j, k = 0;
101+
BN_ULONG mask;
102+
103+
- if (BN_is_zero(a))
104+
+ if (!BN_is_odd(a))
105+
return 0;
106+
107+
for (i = a->top - 1; i >= 0; i--) {
108+
@@ -1157,12 +1168,13 @@ int BN_GF2m_poly2arr(const BIGNUM *a, int p[], int max)
109+
}
110+
}
111+
112+
- if (k < max) {
113+
+ if (k > 0 && p[0] > OPENSSL_ECC_MAX_FIELD_BITS)
114+
+ return 0;
115+
+
116+
+ if (k < max)
117+
p[k] = -1;
118+
- k++;
119+
- }
120+
121+
- return k;
122+
+ return k + 1;
123+
}
124+
125+
/*
126+
--- a/test/ec_internal_test.c
127+
+++ b/test/ec_internal_test.c
128+
@@ -155,6 +155,56 @@ static int field_tests_ecp_mont(void)
129+
}
130+
131+
#ifndef OPENSSL_NO_EC2M
132+
+/* Test that decoding of invalid GF2m field parameters fails. */
133+
+static int ec2m_field_sanity(void)
134+
+{
135+
+ int ret = 0;
136+
+ BN_CTX *ctx = BN_CTX_new();
137+
+ BIGNUM *p, *a, *b;
138+
+ EC_GROUP *group1 = NULL, *group2 = NULL, *group3 = NULL;
139+
+
140+
+ TEST_info("Testing GF2m hardening\n");
141+
+
142+
+ BN_CTX_start(ctx);
143+
+ p = BN_CTX_get(ctx);
144+
+ a = BN_CTX_get(ctx);
145+
+ if (!TEST_ptr(b = BN_CTX_get(ctx))
146+
+ || !TEST_true(BN_one(a))
147+
+ || !TEST_true(BN_one(b)))
148+
+ goto out;
149+
+
150+
+ /* Even pentanomial value should be rejected */
151+
+ if (!TEST_true(BN_set_word(p, 0xf2)))
152+
+ goto out;
153+
+ if (!TEST_ptr_null(group1 = EC_GROUP_new_curve_GF2m(p, a, b, ctx)))
154+
+ TEST_error("Zero constant term accepted in GF2m polynomial");
155+
+
156+
+ /* Odd hexanomial should also be rejected */
157+
+ if (!TEST_true(BN_set_word(p, 0xf3)))
158+
+ goto out;
159+
+ if (!TEST_ptr_null(group2 = EC_GROUP_new_curve_GF2m(p, a, b, ctx)))
160+
+ TEST_error("Hexanomial accepted as GF2m polynomial");
161+
+
162+
+ /* Excessive polynomial degree should also be rejected */
163+
+ if (!TEST_true(BN_set_word(p, 0x71))
164+
+ || !TEST_true(BN_set_bit(p, OPENSSL_ECC_MAX_FIELD_BITS + 1)))
165+
+ goto out;
166+
+ if (!TEST_ptr_null(group3 = EC_GROUP_new_curve_GF2m(p, a, b, ctx)))
167+
+ TEST_error("GF2m polynomial degree > %d accepted",
168+
+ OPENSSL_ECC_MAX_FIELD_BITS);
169+
+
170+
+ ret = group1 == NULL && group2 == NULL && group3 == NULL;
171+
+
172+
+ out:
173+
+ EC_GROUP_free(group1);
174+
+ EC_GROUP_free(group2);
175+
+ EC_GROUP_free(group3);
176+
+ BN_CTX_end(ctx);
177+
+ BN_CTX_free(ctx);
178+
+
179+
+ return ret;
180+
+}
181+
+
182+
/* test EC_GF2m_simple_method directly */
183+
static int field_tests_ec2_simple(void)
184+
{
185+
@@ -443,6 +493,7 @@ int setup_tests(void)
186+
ADD_TEST(field_tests_ecp_simple);
187+
ADD_TEST(field_tests_ecp_mont);
188+
#ifndef OPENSSL_NO_EC2M
189+
+ ADD_TEST(ec2m_field_sanity);
190+
ADD_TEST(field_tests_ec2_simple);
191+
#endif
192+
ADD_ALL_TESTS(field_tests_default, crv_len);
193+

sdk_container/src/third_party/coreos-overlay/dev-libs/openssl/metadata.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<flag name="bindist">Disable/Restrict EC algorithms (as they seem to be patented) -- note: changes the ABI</flag>
1010
<flag name="fips">Enable FIPS provider</flag>
1111
<flag name="ktls">Enable support for Kernel implementation of TLS (kTLS)</flag>
12+
<flag name="quic">Enable support for QUIC (RFC 9000); a UDP-based protocol intended to replace TCP</flag>
1213
<flag name="rfc3779">Enable support for RFC 3779 (X.509 Extensions for IP Addresses and AS Identifiers)</flag>
1314
<flag name="sslv2">Support for the old/insecure SSLv2 protocol -- note: not required for TLS/https</flag>
1415
<flag name="sslv3">Support for the old/insecure SSLv3 protocol -- note: not required for TLS/https</flag>

sdk_container/src/third_party/coreos-overlay/dev-libs/openssl/openssl-3.2.1-r1.ebuild renamed to sdk_container/src/third_party/coreos-overlay/dev-libs/openssl/openssl-3.2.3-r1.ebuild

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ inherit edo flag-o-matic linux-info toolchain-funcs
99
inherit multilib multilib-minimal multiprocessing preserve-libs verify-sig tmpfiles
1010

1111
DESCRIPTION="Robust, full-featured Open Source Toolkit for the Transport Layer Security (TLS)"
12-
HOMEPAGE="https://www.openssl.org/"
12+
HOMEPAGE="https://openssl-library.org/"
1313

1414
MY_P=${P/_/-}
1515

@@ -19,12 +19,14 @@ if [[ ${PV} == 9999 ]] ; then
1919
inherit git-r3
2020
else
2121
SRC_URI="
22-
mirror://openssl/source/${MY_P}.tar.gz
23-
verify-sig? ( mirror://openssl/source/${MY_P}.tar.gz.asc )
22+
https://github.com/openssl/openssl/releases/download/${P}/${P}.tar.gz
23+
verify-sig? (
24+
https://github.com/openssl/openssl/releases/download/${P}/${P}.tar.gz.asc
25+
)
2426
"
2527

2628
if [[ ${PV} != *_alpha* && ${PV} != *_beta* ]] ; then
27-
KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
29+
KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
2830
fi
2931
fi
3032

@@ -51,8 +53,8 @@ BDEPEND="
5153
app-alternatives/bc
5254
sys-process/procps
5355
)
54-
verify-sig? ( >=sec-keys/openpgp-keys-openssl-20230801 )"
55-
56+
verify-sig? ( >=sec-keys/openpgp-keys-openssl-20240920 )
57+
"
5658
DEPEND="${COMMON_DEPEND}"
5759
RDEPEND="${COMMON_DEPEND}"
5860
PDEPEND="app-misc/ca-certificates"
@@ -62,7 +64,7 @@ MULTILIB_WRAPPED_HEADERS=(
6264
)
6365

6466
PATCHES=(
65-
"${FILESDIR}"/${P}-p11-segfault.patch
67+
"${FILESDIR}"/${P}-CVE-2024-9143.patch
6668
)
6769

6870
pkg_setup() {
@@ -151,8 +153,8 @@ src_configure() {
151153

152154
append-flags $(test-flags-CC -Wa,--noexecstack)
153155

154-
# bug #895308
155-
append-atomic-flags
156+
# bug #895308 -- check inserts GNU ld-compatible arguments
157+
[[ ${CHOST} == *-darwin* ]] || append-atomic-flags
156158
# Configure doesn't respect LIBS
157159
export LDLIBS="${LIBS}"
158160

0 commit comments

Comments
 (0)