[packages/openssl/v3.6] Rel 4. Skip afalg test when the kernel refuses cbc(aes)
arekm
arekm at pld-linux.org
Fri Nov 20 20:23:32 CET 2026
commit ffcff66a7520a3a1b81f1133ed190a09173cbfc9
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date: Fri Nov 20 20:22:42 2026 +0100
Rel 4. Skip afalg test when the kernel refuses cbc(aes)
Fixes CVE-2026-107493, CVE-2026-124709, CVE-2026-35190.
openssl-CVE-2026-107493.patch | 183 ++++++++++++++++++++++++++++++++++++++
openssl-CVE-2026-124709.patch | 37 ++++++++
openssl-CVE-2026-35190.patch | 87 ++++++++++++++++++
openssl-afalg-test-restrict.patch | 62 +++++++++++++
openssl.spec | 10 ++-
5 files changed, 378 insertions(+), 1 deletion(-)
---
diff --git a/openssl.spec b/openssl.spec
index ff5be3c..e2def14 100644
--- a/openssl.spec
+++ b/openssl.spec
@@ -14,7 +14,7 @@ Summary(ru.UTF-8): Библиотеки и утилиты для соедине
Summary(uk.UTF-8): Бібліотеки та утиліти для з'єднань через Secure Sockets Layer
Name: openssl
Version: 3.6.5
-Release: 3
+Release: 4
License: Apache v2.0
Group: Libraries
Source0: https://github.com/openssl/openssl/releases/download/openssl-%{version}/%{name}-%{version}.tar.gz
@@ -32,6 +32,10 @@ Patch6: %{name}-CVE-2026-95692.patch
Patch7: %{name}-CVE-2026-95691.patch
Patch8: %{name}-CVE-2026-88823.patch
Patch9: %{name}-CVE-2026-88822.patch
+Patch10: %{name}-CVE-2026-107493.patch
+Patch11: %{name}-CVE-2026-124709.patch
+Patch12: %{name}-CVE-2026-35190.patch
+Patch13: %{name}-afalg-test-restrict.patch
URL: https://www.openssl.org/
%ifarch %{arm} ppc mips sparc sparcv9
BuildRequires: libatomic-devel
@@ -222,6 +226,10 @@ RC4, RSA и SSL. Включает статические библиотеки д
%patch -P7 -p1
%patch -P8 -p1
%patch -P9 -p1
+%patch -P10 -p1
+%patch -P11 -p1
+%patch -P12 -p1
+%patch -P13 -p1
# fails with enable-sctp as of 1.1.1
%{__rm} test/recipes/80-test_ssl_new.t
diff --git a/openssl-CVE-2026-107493.patch b/openssl-CVE-2026-107493.patch
new file mode 100644
index 0000000..35f5c00
--- /dev/null
+++ b/openssl-CVE-2026-107493.patch
@@ -0,0 +1,183 @@
+Upstream c8f6d04f8e "Fix PEM_X509_INFO_read_bio_ex() failure with a caller-supplied stack"
+(CVE-2026-107493), https://github.com/openssl/openssl/commit/c8f6d04f8e
+
+--- openssl-3.6.5.orig/crypto/pem/pem_info.c
++++ openssl-3.6.5/crypto/pem/pem_info.c
+@@ -60,7 +60,7 @@ STACK_OF(X509_INFO) *PEM_X509_INFO_read_bio_ex(BIO *bp, STACK_OF(X509_INFO) *sk,
+ unsigned char *data = NULL;
+ const unsigned char *p;
+ long len, error = 0;
+- int ok = 0;
++ int ok = 0, preserve_cnt = 0;
+ STACK_OF(X509_INFO) *ret = NULL;
+ unsigned int i, raw, ptype;
+ d2i_of_void *d2i = 0;
+@@ -70,8 +70,10 @@ STACK_OF(X509_INFO) *PEM_X509_INFO_read_bio_ex(BIO *bp, STACK_OF(X509_INFO) *sk,
+ ERR_raise(ERR_LIB_PEM, ERR_R_CRYPTO_LIB);
+ goto err;
+ }
+- } else
++ } else {
+ ret = sk;
++ preserve_cnt = sk_X509_INFO_num(sk);
++ }
+
+ if ((xi = X509_INFO_new()) == NULL)
+ goto err;
+@@ -199,10 +201,8 @@ STACK_OF(X509_INFO) *PEM_X509_INFO_read_bio_ex(BIO *bp, STACK_OF(X509_INFO) *sk,
+ err:
+ X509_INFO_free(xi);
+ if (!ok) {
+- for (i = 0; ((int)i) < sk_X509_INFO_num(ret); i++) {
+- xi = sk_X509_INFO_value(ret, i);
+- X509_INFO_free(xi);
+- }
++ while (sk_X509_INFO_num(ret) > preserve_cnt)
++ X509_INFO_free(sk_X509_INFO_pop(ret));
+ if (ret != sk)
+ sk_X509_INFO_free(ret);
+ ret = NULL;
+--- openssl-3.6.5.orig/test/x509_check_cert_pkey_test.c
++++ openssl-3.6.5/test/x509_check_cert_pkey_test.c
+@@ -133,6 +133,128 @@ static int test_PEM_X509_INFO_read_bio(void)
+ return TEST_int_eq(count, expected);
+ }
+
++/*
++ * Counts the X509 objects that were tagged via X509_set_ex_data() and have
++ * since been freed, i.e. whose last reference was dropped.
++ */
++static int x509_ex_idx = -1;
++static int tagged_freed;
++
++static void tagged_free_cb(void *parent, void *ptr, CRYPTO_EX_DATA *ad,
++ int idx, long argl, void *argp)
++{
++ if (ptr != NULL)
++ (*(int *)argp)++;
++}
++
++/*
++ * Build the PEM input for one append test:
++ *
++ * 0: a single malformed certificate (valid PEM armour, invalid DER)
++ * 1: the contents of |file|, then a malformed certificate
++ * 2: the contents of |file| only
++ */
++static BIO *append_input(int idx)
++{
++ static const char malformed[] = "-----BEGIN CERTIFICATE-----\n"
++ "MAA=\n"
++ "-----END CERTIFICATE-----\n";
++ BIO *mem = NULL, *in = NULL;
++ char buf[4096];
++ int n;
++
++ if (!TEST_ptr(mem = BIO_new(BIO_s_mem())))
++ return NULL;
++ if (idx != 0) {
++ if (!TEST_ptr(in = BIO_new_file(file, "r")))
++ goto err;
++ while ((n = BIO_read(in, buf, sizeof(buf))) > 0)
++ if (!TEST_int_eq(BIO_write(mem, buf, n), n))
++ goto err;
++ BIO_free(in);
++ in = NULL;
++ }
++ if (idx != 2 && !TEST_int_gt(BIO_puts(mem, malformed), 0))
++ goto err;
++ return mem;
++err:
++ BIO_free(in);
++ BIO_free(mem);
++ return NULL;
++}
++
++/*
++ * Appending to a caller-owned stack must leave the entries that were already
++ * in the stack alone when the append fails, and must roll back any entries
++ * added by the failed call.
++ *
++ * To check that the pre-existing entries are not freed, the test holds an
++ * extra reference on the first certificate in the stack. After the call the
++ * stack must still own its reference, so dropping ours must not free the
++ * certificate, and freeing the stack afterwards must.
++ */
++static int test_PEM_X509_INFO_read_bio_append(int idx)
++{
++ BIO *in = NULL, *mem = NULL;
++ STACK_OF(X509_INFO) *sk = NULL, *ret;
++ X509 *held = NULL;
++ int i, n0, tagged = 0, ok = 0;
++ int expect_ok = (idx == 2);
++
++ tagged_freed = 0;
++ if (!TEST_ptr(in = BIO_new_file(file, "r"))
++ || !TEST_ptr(sk = PEM_X509_INFO_read_bio(in, NULL, NULL, "")))
++ goto err;
++ n0 = sk_X509_INFO_num(sk);
++
++ /* Hold a tagged reference on the first certificate, if there is one. */
++ for (i = 0; i < n0; i++) {
++ X509_INFO *it = sk_X509_INFO_value(sk, i);
++
++ if (it->x509 != NULL) {
++ held = it->x509;
++ if (!TEST_true(X509_up_ref(held))
++ || !TEST_true(X509_set_ex_data(held, x509_ex_idx, held)))
++ goto err;
++ tagged = 1;
++ break;
++ }
++ }
++
++ if (!TEST_ptr(mem = append_input(idx)))
++ goto err;
++ ret = PEM_X509_INFO_read_bio(mem, sk, NULL, "");
++
++ if (expect_ok) {
++ if (!TEST_ptr_eq(ret, sk)
++ || !TEST_int_eq(sk_X509_INFO_num(sk), 2 * n0))
++ goto err;
++ } else {
++ if (!TEST_ptr_null(ret)
++ || !TEST_int_eq(sk_X509_INFO_num(sk), n0))
++ goto err;
++ }
++
++ if (tagged) {
++ /* Our reference must not have been the stack's last one. */
++ X509_free(held);
++ held = NULL;
++ if (!TEST_int_eq(tagged_freed, 0))
++ goto err;
++ }
++ sk_X509_INFO_pop_free(sk, X509_INFO_free);
++ sk = NULL;
++ if (tagged && !TEST_int_eq(tagged_freed, 1))
++ goto err;
++ ok = 1;
++err:
++ X509_free(held);
++ sk_X509_INFO_pop_free(sk, X509_INFO_free);
++ BIO_free(in);
++ BIO_free(mem);
++ return ok;
++}
++
+ const OPTIONS *test_get_options(void)
+ {
+ enum { OPT_TEST_ENUM };
+@@ -165,7 +287,12 @@ int setup_tests(void)
+ return 0;
+ if (!TEST_int_eq(sscanf(num, "%d", &expected), 1))
+ return 0;
++ x509_ex_idx = X509_get_ex_new_index(0, &tagged_freed, NULL, NULL,
++ tagged_free_cb);
++ if (!TEST_int_ge(x509_ex_idx, 0))
++ return 0;
+ ADD_TEST(test_PEM_X509_INFO_read_bio);
++ ADD_ALL_TESTS(test_PEM_X509_INFO_read_bio_append, 3);
+ return 1;
+ }
+
diff --git a/openssl-CVE-2026-124709.patch b/openssl-CVE-2026-124709.patch
new file mode 100644
index 0000000..f15cef2
--- /dev/null
+++ b/openssl-CVE-2026-124709.patch
@@ -0,0 +1,37 @@
+Upstream f3acb0a332 "QUIC: garbage collect deleted streams whose receive part is terminal"
+(CVE-2026-124709), https://github.com/openssl/openssl/commit/f3acb0a332
+
+--- openssl-3.6.5.orig/ssl/quic/quic_stream_map.c
++++ openssl-3.6.5/ssl/quic/quic_stream_map.c
+@@ -293,9 +293,30 @@ static ossl_unused int qsm_send_part_permits_gc(const QUIC_STREAM *qs)
+ }
+ }
+
++static int qsm_recv_part_is_terminal(const QUIC_STREAM *qs)
++{
++ switch (qs->recv_state) {
++ case QUIC_RSTREAM_STATE_DATA_RECVD:
++ case QUIC_RSTREAM_STATE_DATA_READ:
++ case QUIC_RSTREAM_STATE_RESET_RECVD:
++ case QUIC_RSTREAM_STATE_RESET_READ:
++ return 1;
++ default:
++ return 0;
++ }
++}
++
+ static int qsm_ready_for_gc(QUIC_STREAM_MAP *qsm, QUIC_STREAM *qs)
+ {
+- int recv_stream_fully_drained = 0; /* TODO(QUIC FUTURE): Optimisation */
++ /*
++ * Once the receive part has reached a terminal state (all data received
++ * or the peer reset the stream) there is nothing more the peer can send
++ * which we need to track, so we do not need to wait for STOP_SENDING to
++ * be acknowledged. Note that STOP_SENDING may never be sent at all in
++ * this case (e.g. if the peer's RESET_STREAM arrives first), so waiting
++ * for it would leak the stream for the lifetime of the connection.
++ */
++ int recv_stream_fully_drained = qsm_recv_part_is_terminal(qs);
+
+ /*
+ * If sstream has no FIN, we auto-reset it at marked-for-deletion time, so
diff --git a/openssl-CVE-2026-35190.patch b/openssl-CVE-2026-35190.patch
new file mode 100644
index 0000000..950092c
--- /dev/null
+++ b/openssl-CVE-2026-35190.patch
@@ -0,0 +1,87 @@
+Upstream 9491b0d9cc "Fix out-of-bounds read of suiteb_curves[] in TLS 1.3 key_share selection"
+(CVE-2026-35190), https://github.com/openssl/openssl/commit/9491b0d9cc
+
+--- openssl-3.6.5.orig/ssl/statem/extensions_srvr.c
++++ openssl-3.6.5/ssl/statem/extensions_srvr.c
+@@ -834,6 +834,7 @@ int tls_parse_ctos_key_share(SSL_CONNECTION *s, PACKET *pkt,
+ const size_t *srvrtuples;
+ uint16_t *first_group_in_tuple;
+ size_t clnt_num_groups, srvr_num_groups, srvr_num_tuples;
++ size_t srvr_groups_remaining;
+ PACKET *encoded_pubkey_arr = NULL;
+ uint16_t *keyshares_arr = NULL;
+ size_t keyshares_cnt = 0;
+@@ -917,10 +918,23 @@ int tls_parse_ctos_key_share(SSL_CONNECTION *s, PACKET *pkt,
+ * Remark: Selection priority different for client- or server-preference
+ */
+ first_group_in_tuple = (uint16_t *)srvrgroups;
++ srvr_groups_remaining = srvr_num_groups;
+ for (current_tuple = 0; current_tuple < srvr_num_tuples; current_tuple++) {
+ size_t number_of_groups_in_tuple = srvrtuples[current_tuple];
+ int prio_group_idx = 0, candidate_group_idx = 0;
+
++ /*
++ * The tuple sizes must partition srvrgroups exactly. A tuple larger
++ * than the groups still left means the group and tuple lists have
++ * come from different sources, which is an internal error: stop here
++ * rather than reading past the end of srvrgroups.
++ */
++ if (number_of_groups_in_tuple > srvr_groups_remaining) {
++ SSLfatal(s, SSL_AD_INTERNAL_ERROR, ERR_R_INTERNAL_ERROR);
++ goto err;
++ }
++ srvr_groups_remaining -= number_of_groups_in_tuple;
++
+ /* Server or client preference ? */
+ if (s->options & SSL_OP_SERVER_PREFERENCE) {
+ /* Server preference */
+--- openssl-3.6.5.orig/ssl/t1_lib.c
++++ openssl-3.6.5/ssl/t1_lib.c
+@@ -213,6 +213,14 @@ static const uint16_t suiteb_curves[] = {
+ OSSL_TLS_GROUP_ID_secp384r1,
+ };
+
++/*
++ * Group tuples matching the Suite B group lists returned by
++ * tls1_get_supported_groups(): a single tuple holding both P-256 and P-384,
++ * or a single tuple holding just one of them.
++ */
++static const size_t suiteb_tuples_both[] = { OSSL_NELEM(suiteb_curves) };
++static const size_t suiteb_tuples_one[] = { 1 };
++
+ /* Group list string of the built-in pseudo group DEFAULT_SUITE_B */
+ #define SUITE_B_GROUP_NAME "DEFAULT_SUITE_B"
+ #define SUITE_B_GROUP_LIST "?secp256r1:?secp384r1",
+@@ -842,11 +850,32 @@ void tls1_get_requested_keyshare_groups(SSL_CONNECTION *s, const uint16_t **pgro
+ }
+ }
+
++/*
++ * Set *ptuples to the list of group tuple sizes and *ptupleslen to the number
++ * of tuples. The tuples returned here always partition exactly the group list
++ * returned by tls1_get_supported_groups().
++ */
+ void tls1_get_group_tuples(SSL_CONNECTION *s, const size_t **ptuples,
+ size_t *ptupleslen)
+ {
+ SSL_CTX *sctx = SSL_CONNECTION_GET_CTX(s);
+
++ if (tls1_suiteb(s)) {
++ const uint16_t *groups;
++ size_t groupslen;
++
++ /*
++ * In Suite B mode the fixed group list forms a single tuple. Derive
++ * its size from the list tls1_get_supported_groups() actually returns
++ * rather than repeating the Suite B profile selection here.
++ */
++ tls1_get_supported_groups(s, &groups, &groupslen);
++ *ptuples = groupslen == OSSL_NELEM(suiteb_curves) ? suiteb_tuples_both
++ : suiteb_tuples_one;
++ *ptupleslen = 1;
++ return;
++ }
++
+ if (s->ext.supportedgroups == NULL) {
+ *ptuples = sctx->ext.tuples;
+ *ptupleslen = sctx->ext.tuples_len;
diff --git a/openssl-afalg-test-restrict.patch b/openssl-afalg-test-restrict.patch
new file mode 100644
index 0000000..5c6f180
--- /dev/null
+++ b/openssl-afalg-test-restrict.patch
@@ -0,0 +1,62 @@
+afalgtest: skip when the kernel refuses cbc(aes) over AF_ALG; Linux >= 7.3 with
+crypto.af_alg_restrict=1 (default) makes bind() fail with ENOENT for unprivileged users
+
+--- openssl-3.6.5.orig/test/afalgtest.c
++++ openssl-3.6.5/test/afalgtest.c
+@@ -19,6 +19,15 @@
+ #include <openssl/rand.h>
+ #include "testutil.h"
+
++#if defined(__linux__)
++#include <sys/socket.h>
++#include <unistd.h>
++#ifdef AF_ALG
++#include <linux/if_alg.h>
++#define AFALG_PROBE_KERNEL
++#endif
++#endif
++
+ /* Use a buffer size which is not aligned to block size */
+ #define BUFFER_SIZE 17
+
+@@ -121,6 +130,31 @@ static int test_pr16743(void)
+ return ret;
+ }
+
++/*
++ * The engine loads once socket(AF_ALG) works, but the kernel may still refuse
++ * cbc(aes): Linux >= 7.3 with crypto.af_alg_restrict=1 (the default) allows it
++ * only with CAP_NET_ADMIN or CAP_SYS_ADMIN, and bind() fails with ENOENT.
++ */
++static int afalg_kernel_has_cbc_aes(void)
++{
++#ifdef AFALG_PROBE_KERNEL
++ struct sockaddr_alg sa;
++ int fd, ok;
++
++ if ((fd = socket(AF_ALG, SOCK_SEQPACKET, 0)) < 0)
++ return 0;
++ memset(&sa, 0, sizeof(sa));
++ sa.salg_family = AF_ALG;
++ strcpy((char *)sa.salg_type, "skcipher");
++ strcpy((char *)sa.salg_name, "cbc(aes)");
++ ok = bind(fd, (struct sockaddr *)&sa, sizeof(sa)) == 0;
++ close(fd);
++ return ok;
++#else
++ return 1;
++#endif
++}
++
+ int global_init(void)
+ {
+ ENGINE_load_builtin_engines();
+@@ -137,6 +171,8 @@ int setup_tests(void)
+ if ((e = ENGINE_by_id("afalg")) == NULL) {
+ /* Probably a platform env issue, not a test failure. */
+ TEST_info("Can't load AFALG engine");
++ } else if (!afalg_kernel_has_cbc_aes()) {
++ TEST_info("Kernel does not offer cbc(aes) over AF_ALG to this process");
+ } else {
+ ADD_ALL_TESTS(test_afalg_aes_cbc, 3);
+ ADD_TEST(test_pr16743);
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/openssl.git/commitdiff/ffcff66a7520a3a1b81f1133ed190a09173cbfc9
More information about the pld-cvs-commit
mailing list