summaryrefslogtreecommitdiffstats
path: root/meta/recipes-support
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-support')
-rw-r--r--meta/recipes-support/apr/apr-util/0001-Fix-error-handling-in-gdbm.patch135
-rw-r--r--meta/recipes-support/apr/apr-util_1.6.3.bb (renamed from meta/recipes-support/apr/apr-util_1.6.1.bb)8
-rw-r--r--meta/recipes-support/apr/apr/0001-Add-option-to-disable-timed-dependant-tests.patch20
-rw-r--r--meta/recipes-support/apr/apr/0001-configure-Remove-runtime-test-for-mmap-that-can-map-.patch58
-rw-r--r--meta/recipes-support/apr/apr/0002-apr-Remove-workdir-path-references-from-installed-ap.patch25
-rw-r--r--meta/recipes-support/apr/apr/0003-Makefile.in-configure.in-support-cross-compiling.patch63
-rw-r--r--meta/recipes-support/apr/apr/0006-apr-fix-off_t-size-doesn-t-match-in-glibc-when-cross.patch76
-rw-r--r--meta/recipes-support/apr/apr/libtoolize_check.patch21
-rw-r--r--meta/recipes-support/apr/apr_1.7.2.bb (renamed from meta/recipes-support/apr/apr_1.7.0.bb)31
-rw-r--r--meta/recipes-support/argp-standalone/argp-standalone_1.3.bb1
-rw-r--r--meta/recipes-support/aspell/aspell_0.60.8.bb17
-rw-r--r--meta/recipes-support/aspell/files/CVE-2019-25051.patch101
-rw-r--r--meta/recipes-support/atk/at-spi2-atk_2.34.1.bb2
-rw-r--r--meta/recipes-support/atk/at-spi2-core_2.34.0.bb6
-rw-r--r--meta/recipes-support/atk/atk_2.34.1.bb1
-rw-r--r--meta/recipes-support/attr/acl_2.2.53.bb5
-rw-r--r--meta/recipes-support/attr/attr.inc6
-rw-r--r--meta/recipes-support/bash-completion/bash-completion_2.10.bb7
-rw-r--r--meta/recipes-support/bmap-tools/bmap-tools_3.5.bb2
-rw-r--r--meta/recipes-support/boost/boost-1.72.0.inc2
-rw-r--r--meta/recipes-support/boost/boost.inc6
-rw-r--r--meta/recipes-support/boost/boost/0001-Fix-Wsign-compare-warning-with-glibc-2.34-on-Linux-p.patch32
-rw-r--r--meta/recipes-support/boost/boost/0001-Revert-change-to-elide-a-warning-that-caused-Solaris.patch24
-rw-r--r--meta/recipes-support/boost/boost_1.72.0.bb2
-rw-r--r--meta/recipes-support/ca-certificates/ca-certificates/0001-Revert-mozilla-certdata2pem.py-print-a-warning-for-e.patch80
-rw-r--r--meta/recipes-support/ca-certificates/ca-certificates/sbindir.patch20
-rw-r--r--meta/recipes-support/ca-certificates/ca-certificates/update-ca-certificates-support-Toybox.patch34
-rw-r--r--meta/recipes-support/ca-certificates/ca-certificates_20211016.bb (renamed from meta/recipes-support/ca-certificates/ca-certificates_20210119.bb)13
-rw-r--r--meta/recipes-support/consolekit/consolekit_0.4.6.bb2
-rw-r--r--meta/recipes-support/curl/curl/CVE-2021-22876.patch59
-rw-r--r--meta/recipes-support/curl/curl/CVE-2021-22890.patch464
-rw-r--r--meta/recipes-support/curl/curl/CVE-2021-22898.patch26
-rw-r--r--meta/recipes-support/curl/curl/CVE-2021-22924.patch226
-rw-r--r--meta/recipes-support/curl/curl/CVE-2021-22925.patch43
-rw-r--r--meta/recipes-support/curl/curl/CVE-2021-22946-pre1.patch86
-rw-r--r--meta/recipes-support/curl/curl/CVE-2021-22946.patch328
-rw-r--r--meta/recipes-support/curl/curl/CVE-2021-22947.patch352
-rw-r--r--meta/recipes-support/curl/curl/CVE-2022-22576.patch148
-rw-r--r--meta/recipes-support/curl/curl/CVE-2022-27774-1.patch45
-rw-r--r--meta/recipes-support/curl/curl/CVE-2022-27774-2.patch80
-rw-r--r--meta/recipes-support/curl/curl/CVE-2022-27774-3.patch83
-rw-r--r--meta/recipes-support/curl/curl/CVE-2022-27774-4.patch35
-rw-r--r--meta/recipes-support/curl/curl/CVE-2022-27775.patch39
-rw-r--r--meta/recipes-support/curl/curl/CVE-2022-27776.patch114
-rw-r--r--meta/recipes-support/curl/curl/CVE-2022-27781.patch46
-rw-r--r--meta/recipes-support/curl/curl/CVE-2022-27782-1.patch363
-rw-r--r--meta/recipes-support/curl/curl/CVE-2022-27782-2.patch71
-rw-r--r--meta/recipes-support/curl/curl/CVE-2022-32206.patch52
-rw-r--r--meta/recipes-support/curl/curl/CVE-2022-32207.patch284
-rw-r--r--meta/recipes-support/curl/curl/CVE-2022-32208.patch72
-rw-r--r--meta/recipes-support/curl/curl/CVE-2022-32221.patch29
-rw-r--r--meta/recipes-support/curl/curl/CVE-2022-35252.patch72
-rw-r--r--meta/recipes-support/curl/curl/CVE-2022-35260.patch68
-rw-r--r--meta/recipes-support/curl/curl/CVE-2022-43552.patch82
-rw-r--r--meta/recipes-support/curl/curl/CVE-2023-23916.patch231
-rw-r--r--meta/recipes-support/curl/curl/CVE-2023-27533.patch59
-rw-r--r--meta/recipes-support/curl/curl/CVE-2023-27534-pre1.patch51
-rw-r--r--meta/recipes-support/curl/curl/CVE-2023-27534.patch33
-rw-r--r--meta/recipes-support/curl/curl/CVE-2023-27535-pre1.patch236
-rw-r--r--meta/recipes-support/curl/curl/CVE-2023-27535.patch170
-rw-r--r--meta/recipes-support/curl/curl/CVE-2023-27536.patch55
-rw-r--r--meta/recipes-support/curl/curl/CVE-2023-27538.patch31
-rw-r--r--meta/recipes-support/curl/curl/CVE-2023-28320-fol1.patch197
-rw-r--r--meta/recipes-support/curl/curl/CVE-2023-28320.patch86
-rw-r--r--meta/recipes-support/curl/curl/CVE-2023-28321.patch272
-rw-r--r--meta/recipes-support/curl/curl/CVE-2023-28322.patch380
-rw-r--r--meta/recipes-support/curl/curl/CVE-2023-32001.patch38
-rw-r--r--meta/recipes-support/curl/curl/CVE-2023-38545.patch148
-rw-r--r--meta/recipes-support/curl/curl/CVE-2023-38546.patch132
-rw-r--r--meta/recipes-support/curl/curl/CVE-2023-46218.patch52
-rw-r--r--meta/recipes-support/curl/curl/CVE-2024-2398.patch88
-rw-r--r--meta/recipes-support/curl/curl_7.69.1.bb55
-rw-r--r--meta/recipes-support/db/db_5.3.28.bb3
-rw-r--r--meta/recipes-support/debianutils/debianutils_4.9.1.bb5
-rw-r--r--meta/recipes-support/diffoscope/diffoscope_172.bb (renamed from meta/recipes-support/diffoscope/diffoscope_136.bb)11
-rw-r--r--meta/recipes-support/dos2unix/dos2unix_7.4.1.bb2
-rw-r--r--meta/recipes-support/enchant/enchant2_2.2.8.bb3
-rw-r--r--meta/recipes-support/fribidi/fribidi/CVE-2022-25308.patch50
-rw-r--r--meta/recipes-support/fribidi/fribidi/CVE-2022-25309.patch31
-rw-r--r--meta/recipes-support/fribidi/fribidi/CVE-2022-25310.patch30
-rw-r--r--meta/recipes-support/fribidi/fribidi_1.0.9.bb9
-rw-r--r--meta/recipes-support/gdbm/gdbm_1.18.1.bb3
-rw-r--r--meta/recipes-support/gmp/gmp/cve-2021-43618.patch27
-rw-r--r--meta/recipes-support/gmp/gmp_6.2.0.bb1
-rw-r--r--meta/recipes-support/gnome-desktop-testing/gnome-desktop-testing_2018.1.bb6
-rw-r--r--meta/recipes-support/gnupg/gnupg/0001-configure.ac-use-a-custom-value-for-the-location-of-.patch6
-rw-r--r--meta/recipes-support/gnupg/gnupg/0003-dirmngr-uses-libgpg-error.patch24
-rw-r--r--meta/recipes-support/gnupg/gnupg/CVE-2022-34903.patch44
-rw-r--r--meta/recipes-support/gnupg/gnupg/relocate.patch20
-rw-r--r--meta/recipes-support/gnupg/gnupg_2.2.27.bb (renamed from meta/recipes-support/gnupg/gnupg_2.2.20.bb)10
-rw-r--r--meta/recipes-support/gnutls/gnutls/CVE-2021-20231.patch67
-rw-r--r--meta/recipes-support/gnutls/gnutls/CVE-2021-20232.patch65
-rw-r--r--meta/recipes-support/gnutls/gnutls/CVE-2021-4209.patch37
-rw-r--r--meta/recipes-support/gnutls/gnutls/CVE-2022-2509.patch282
-rw-r--r--meta/recipes-support/gnutls/gnutls/CVE-2023-0361.patch85
-rw-r--r--meta/recipes-support/gnutls/gnutls/CVE-2023-5981.patch206
-rw-r--r--meta/recipes-support/gnutls/gnutls/CVE-2024-0553.patch125
-rw-r--r--meta/recipes-support/gnutls/gnutls_3.6.14.bb11
-rw-r--r--meta/recipes-support/gnutls/libtasn1/CVE-2021-46848.patch45
-rw-r--r--meta/recipes-support/gnutls/libtasn1_4.16.0.bb3
-rw-r--r--meta/recipes-support/gpgme/gpgme/0001-use-closefrom-on-linux-and-glibc-2.34.patch24
-rw-r--r--meta/recipes-support/gpgme/gpgme_1.13.1.bb3
-rw-r--r--meta/recipes-support/iso-codes/iso-codes_4.4.bb5
-rw-r--r--meta/recipes-support/itstool/itstool_2.0.6.bb4
-rw-r--r--meta/recipes-support/libassuan/libassuan_2.5.3.bb3
-rw-r--r--meta/recipes-support/libatomic-ops/libatomic-ops_7.6.10.bb1
-rw-r--r--meta/recipes-support/libbsd/libbsd_0.10.0.bb6
-rw-r--r--meta/recipes-support/libcap/files/CVE-2023-2602.patch52
-rw-r--r--meta/recipes-support/libcap/files/CVE-2023-2603.patch58
-rw-r--r--meta/recipes-support/libcap/libcap_2.32.bb8
-rw-r--r--meta/recipes-support/libcheck/libcheck_0.14.0.bb5
-rw-r--r--meta/recipes-support/libcroco/libcroco_0.6.13.bb3
-rw-r--r--meta/recipes-support/libdaemon/libdaemon_0.14.bb4
-rw-r--r--meta/recipes-support/libevdev/libevdev/determinism.patch3
-rw-r--r--meta/recipes-support/libevdev/libevdev_1.8.0.bb3
-rw-r--r--meta/recipes-support/libevent/libevent/0002-test-regress.h-Increase-default-timeval-tolerance-50.patch33
-rw-r--r--meta/recipes-support/libevent/libevent_2.1.11.bb6
-rw-r--r--meta/recipes-support/libexif/libexif_0.6.22.bb3
-rw-r--r--meta/recipes-support/libfm/libfm-extra_1.3.1.bb1
-rw-r--r--meta/recipes-support/libfm/libfm_1.3.1.bb2
-rw-r--r--meta/recipes-support/libgcrypt/files/CVE-2021-33560.patch77
-rw-r--r--meta/recipes-support/libgcrypt/files/CVE-2021-40528.patch109
-rw-r--r--meta/recipes-support/libgcrypt/libgcrypt_1.8.5.bb5
-rw-r--r--meta/recipes-support/libgpg-error/libgpg-error_1.37.bb1
-rw-r--r--meta/recipes-support/libical/libical_3.0.7.bb4
-rw-r--r--meta/recipes-support/libjitterentropy/libjitterentropy_2.2.0.bb2
-rw-r--r--meta/recipes-support/libksba/libksba/CVE-2022-3515.patch47
-rw-r--r--meta/recipes-support/libksba/libksba/CVE-2022-47629.patch69
-rw-r--r--meta/recipes-support/libksba/libksba_1.3.5.bb10
-rw-r--r--meta/recipes-support/libnl/libnl_3.5.0.bb5
-rw-r--r--meta/recipes-support/libpcre/libpcre/fix-pcre-name-collision.patch41
-rw-r--r--meta/recipes-support/libpcre/libpcre2/CVE-2022-1586-regression.patch30
-rw-r--r--meta/recipes-support/libpcre/libpcre2/CVE-2022-1586.patch59
-rw-r--r--meta/recipes-support/libpcre/libpcre2/CVE-2022-1587.patch660
-rw-r--r--meta/recipes-support/libpcre/libpcre2/CVE-2022-41409.patch74
-rw-r--r--meta/recipes-support/libpcre/libpcre2_10.34.bb6
-rw-r--r--meta/recipes-support/libpcre/libpcre_8.44.bb3
-rw-r--r--meta/recipes-support/libproxy/libproxy_0.4.15.bb4
-rw-r--r--meta/recipes-support/libpsl/libpsl_0.21.0.bb13
-rw-r--r--meta/recipes-support/libsoup/libsoup-2.4_2.68.4.bb4
-rw-r--r--meta/recipes-support/libunistring/libunistring_0.9.10.bb1
-rw-r--r--meta/recipes-support/libunwind/libunwind/0001-Fix-compilation-with-fno-common.patch420
-rw-r--r--meta/recipes-support/libunwind/libunwind_1.3.1.bb1
-rw-r--r--meta/recipes-support/liburcu/liburcu_0.11.1.bb3
-rw-r--r--meta/recipes-support/libusb/libusb1_1.0.22.bb6
-rw-r--r--meta/recipes-support/libxslt/libxslt/CVE-2021-30560.patch201
-rw-r--r--meta/recipes-support/libxslt/libxslt_1.1.34.bb10
-rw-r--r--meta/recipes-support/lz4/files/CVE-2021-3520.patch27
-rw-r--r--meta/recipes-support/lz4/lz4_1.9.2.bb10
-rw-r--r--meta/recipes-support/lzo/lzo_2.10.bb4
-rw-r--r--meta/recipes-support/lzop/lzop_1.04.bb1
-rw-r--r--meta/recipes-support/mpfr/mpfr_4.0.2.bb1
-rw-r--r--meta/recipes-support/nettle/nettle-3.5.1/CVE-2021-20305-1.patch215
-rw-r--r--meta/recipes-support/nettle/nettle-3.5.1/CVE-2021-20305-2.patch53
-rw-r--r--meta/recipes-support/nettle/nettle-3.5.1/CVE-2021-20305-3.patch122
-rw-r--r--meta/recipes-support/nettle/nettle-3.5.1/CVE-2021-20305-4.patch48
-rw-r--r--meta/recipes-support/nettle/nettle-3.5.1/CVE-2021-20305-5.patch53
-rw-r--r--meta/recipes-support/nettle/nettle-3.5.1/CVE-2021-3580_1.patch277
-rw-r--r--meta/recipes-support/nettle/nettle-3.5.1/CVE-2021-3580_2.patch163
-rw-r--r--meta/recipes-support/nettle/nettle_3.5.1.bb8
-rw-r--r--meta/recipes-support/npth/npth_1.6.bb1
-rw-r--r--meta/recipes-support/p11-kit/p11-kit_0.23.22.bb4
-rw-r--r--meta/recipes-support/popt/popt_1.16.bb1
-rw-r--r--meta/recipes-support/ptest-runner/ptest-runner_2.4.0.bb4
-rw-r--r--meta/recipes-support/re2c/re2c/CVE-2018-21232-1.patch347
-rw-r--r--meta/recipes-support/re2c/re2c/CVE-2018-21232-2.patch243
-rw-r--r--meta/recipes-support/re2c/re2c/CVE-2018-21232-3.patch156
-rw-r--r--meta/recipes-support/re2c/re2c/CVE-2018-21232-4.patch166
-rw-r--r--meta/recipes-support/re2c/re2c_1.0.1.bb10
-rw-r--r--meta/recipes-support/rng-tools/rng-tools/rngd.service1
-rw-r--r--meta/recipes-support/rng-tools/rng-tools_6.9.bb2
-rw-r--r--meta/recipes-support/serf/serf_1.3.9.bb5
-rw-r--r--meta/recipes-support/shared-mime-info/shared-mime-info_git.bb3
-rw-r--r--meta/recipes-support/sqlite/files/CVE-2020-35525.patch21
-rw-r--r--meta/recipes-support/sqlite/files/CVE-2020-35527.patch22
-rw-r--r--meta/recipes-support/sqlite/files/CVE-2021-20223.patch23
-rw-r--r--meta/recipes-support/sqlite/files/CVE-2022-35737.patch29
-rw-r--r--meta/recipes-support/sqlite/files/CVE-2023-7104.patch46
-rw-r--r--meta/recipes-support/sqlite/sqlite3.inc1
-rw-r--r--meta/recipes-support/sqlite/sqlite3_3.31.1.bb5
-rw-r--r--meta/recipes-support/taglib/taglib_1.11.1.bb1
-rw-r--r--meta/recipes-support/vim/files/0001-src-Makefile-improve-reproducibility.patch13
-rw-r--r--meta/recipes-support/vim/files/disable_acl_header_check.patch15
-rw-r--r--meta/recipes-support/vim/files/no-path-adjust.patch8
-rw-r--r--meta/recipes-support/vim/files/racefix.patch33
-rw-r--r--meta/recipes-support/vim/files/vim-add-knob-whether-elf.h-are-checked.patch13
-rw-r--r--meta/recipes-support/vim/vim-tiny_9.0.bb (renamed from meta/recipes-support/vim/vim-tiny_8.2.bb)0
-rw-r--r--meta/recipes-support/vim/vim.inc48
-rw-r--r--meta/recipes-support/vim/vim_9.0.bb (renamed from meta/recipes-support/vim/vim_8.2.bb)0
-rw-r--r--meta/recipes-support/vte/vte_0.58.3.bb2
190 files changed, 11315 insertions, 574 deletions
diff --git a/meta/recipes-support/apr/apr-util/0001-Fix-error-handling-in-gdbm.patch b/meta/recipes-support/apr/apr-util/0001-Fix-error-handling-in-gdbm.patch
deleted file mode 100644
index 57e7453312..0000000000
--- a/meta/recipes-support/apr/apr-util/0001-Fix-error-handling-in-gdbm.patch
+++ /dev/null
@@ -1,135 +0,0 @@
1From 6b638fa9afbeb54dfa19378e391465a5284ce1ad Mon Sep 17 00:00:00 2001
2From: Changqing Li <changqing.li@windriver.com>
3Date: Wed, 12 Sep 2018 17:16:36 +0800
4Subject: [PATCH] Fix error handling in gdbm
5
6Only check for gdbm_errno if the return value of the called gdbm_*
7function says so. This fixes apr-util with gdbm 1.14, which does not
8seem to always reset gdbm_errno.
9
10Also make the gdbm driver return error codes starting with
11APR_OS_START_USEERR instead of always returning APR_EGENERAL. This is
12what the berkleydb driver already does.
13
14Also ensure that dsize is 0 if dptr == NULL.
15
16Upstream-Status: Backport[https://svn.apache.org/viewvc?
17view=revision&amp;revision=1825311]
18
19Signed-off-by: Changqing Li <changqing.li@windriver.com>
20---
21 dbm/apr_dbm_gdbm.c | 47 +++++++++++++++++++++++++++++------------------
22 1 file changed, 29 insertions(+), 18 deletions(-)
23
24diff --git a/dbm/apr_dbm_gdbm.c b/dbm/apr_dbm_gdbm.c
25index 749447a..1c86327 100644
26--- a/dbm/apr_dbm_gdbm.c
27+++ b/dbm/apr_dbm_gdbm.c
28@@ -36,13 +36,25 @@
29 static apr_status_t g2s(int gerr)
30 {
31 if (gerr == -1) {
32- /* ### need to fix this */
33- return APR_EGENERAL;
34+ if (gdbm_errno == GDBM_NO_ERROR)
35+ return APR_SUCCESS;
36+ return APR_OS_START_USEERR + gdbm_errno;
37 }
38
39 return APR_SUCCESS;
40 }
41
42+static apr_status_t gdat2s(datum d)
43+{
44+ if (d.dptr == NULL) {
45+ if (gdbm_errno == GDBM_NO_ERROR || gdbm_errno == GDBM_ITEM_NOT_FOUND)
46+ return APR_SUCCESS;
47+ return APR_OS_START_USEERR + gdbm_errno;
48+ }
49+
50+ return APR_SUCCESS;
51+}
52+
53 static apr_status_t datum_cleanup(void *dptr)
54 {
55 if (dptr)
56@@ -53,22 +65,15 @@ static apr_status_t datum_cleanup(void *dptr)
57
58 static apr_status_t set_error(apr_dbm_t *dbm, apr_status_t dbm_said)
59 {
60- apr_status_t rv = APR_SUCCESS;
61
62- /* ### ignore whatever the DBM said (dbm_said); ask it explicitly */
63+ dbm->errcode = dbm_said;
64
65- if ((dbm->errcode = gdbm_errno) == GDBM_NO_ERROR) {
66+ if (dbm_said == APR_SUCCESS)
67 dbm->errmsg = NULL;
68- }
69- else {
70- dbm->errmsg = gdbm_strerror(gdbm_errno);
71- rv = APR_EGENERAL; /* ### need something better */
72- }
73-
74- /* captured it. clear it now. */
75- gdbm_errno = GDBM_NO_ERROR;
76+ else
77+ dbm->errmsg = gdbm_strerror(dbm_said - APR_OS_START_USEERR);
78
79- return rv;
80+ return dbm_said;
81 }
82
83 /* --------------------------------------------------------------------------
84@@ -107,7 +112,7 @@ static apr_status_t vt_gdbm_open(apr_dbm_t **pdb, const char *pathname,
85 NULL);
86
87 if (file == NULL)
88- return APR_EGENERAL; /* ### need a better error */
89+ return APR_OS_START_USEERR + gdbm_errno; /* ### need a better error */
90
91 /* we have an open database... return it */
92 *pdb = apr_pcalloc(pool, sizeof(**pdb));
93@@ -141,10 +146,12 @@ static apr_status_t vt_gdbm_fetch(apr_dbm_t *dbm, apr_datum_t key,
94 if (pvalue->dptr)
95 apr_pool_cleanup_register(dbm->pool, pvalue->dptr, datum_cleanup,
96 apr_pool_cleanup_null);
97+ else
98+ pvalue->dsize = 0;
99
100 /* store the error info into DBM, and return a status code. Also, note
101 that *pvalue should have been cleared on error. */
102- return set_error(dbm, APR_SUCCESS);
103+ return set_error(dbm, gdat2s(rd));
104 }
105
106 static apr_status_t vt_gdbm_store(apr_dbm_t *dbm, apr_datum_t key,
107@@ -201,9 +208,11 @@ static apr_status_t vt_gdbm_firstkey(apr_dbm_t *dbm, apr_datum_t *pkey)
108 if (pkey->dptr)
109 apr_pool_cleanup_register(dbm->pool, pkey->dptr, datum_cleanup,
110 apr_pool_cleanup_null);
111+ else
112+ pkey->dsize = 0;
113
114 /* store any error info into DBM, and return a status code. */
115- return set_error(dbm, APR_SUCCESS);
116+ return set_error(dbm, gdat2s(rd));
117 }
118
119 static apr_status_t vt_gdbm_nextkey(apr_dbm_t *dbm, apr_datum_t *pkey)
120@@ -221,9 +230,11 @@ static apr_status_t vt_gdbm_nextkey(apr_dbm_t *dbm, apr_datum_t *pkey)
121 if (pkey->dptr)
122 apr_pool_cleanup_register(dbm->pool, pkey->dptr, datum_cleanup,
123 apr_pool_cleanup_null);
124+ else
125+ pkey->dsize = 0;
126
127 /* store any error info into DBM, and return a status code. */
128- return set_error(dbm, APR_SUCCESS);
129+ return set_error(dbm, gdat2s(rd));
130 }
131
132 static void vt_gdbm_freedatum(apr_dbm_t *dbm, apr_datum_t data)
133--
1342.7.4
135
diff --git a/meta/recipes-support/apr/apr-util_1.6.1.bb b/meta/recipes-support/apr/apr-util_1.6.3.bb
index f7d827a1d8..3d9d619c7b 100644
--- a/meta/recipes-support/apr/apr-util_1.6.1.bb
+++ b/meta/recipes-support/apr/apr-util_1.6.3.bb
@@ -13,11 +13,9 @@ SRC_URI = "${APACHE_MIRROR}/apr/${BPN}-${PV}.tar.gz \
13 file://configfix.patch \ 13 file://configfix.patch \
14 file://configure_fixes.patch \ 14 file://configure_fixes.patch \
15 file://run-ptest \ 15 file://run-ptest \
16 file://0001-Fix-error-handling-in-gdbm.patch \ 16 "
17"
18 17
19SRC_URI[md5sum] = "bd502b9a8670a8012c4d90c31a84955f" 18SRC_URI[sha256sum] = "2b74d8932703826862ca305b094eef2983c27b39d5c9414442e9976a9acf1983"
20SRC_URI[sha256sum] = "b65e40713da57d004123b6319828be7f1273fbc6490e145874ee1177e112c459"
21 19
22EXTRA_OECONF = "--with-apr=${STAGING_BINDIR_CROSS}/apr-1-config \ 20EXTRA_OECONF = "--with-apr=${STAGING_BINDIR_CROSS}/apr-1-config \
23 --without-odbc \ 21 --without-odbc \
@@ -35,6 +33,7 @@ OE_BINCONFIG_EXTRA_MANGLE = " -e 's:location=source:location=installed:'"
35do_configure_append() { 33do_configure_append() {
36 if [ "${CLASSOVERRIDE}" = "class-target" ]; then 34 if [ "${CLASSOVERRIDE}" = "class-target" ]; then
37 cp ${STAGING_DATADIR}/apr/apr_rules.mk ${B}/build/rules.mk 35 cp ${STAGING_DATADIR}/apr/apr_rules.mk ${B}/build/rules.mk
36 sed -i -e 's#^CFLAGS=.*#CFLAGS=${TARGET_CFLAGS}#g' ${B}/build/rules.mk
38 fi 37 fi
39} 38}
40do_configure_prepend_class-native() { 39do_configure_prepend_class-native() {
@@ -49,6 +48,7 @@ do_configure_append_class-native() {
49 48
50do_configure_prepend_class-nativesdk() { 49do_configure_prepend_class-nativesdk() {
51 cp ${STAGING_DATADIR}/apr/apr_rules.mk ${S}/build/rules.mk 50 cp ${STAGING_DATADIR}/apr/apr_rules.mk ${S}/build/rules.mk
51 sed -i -e 's#^CFLAGS=.*#CFLAGS=${TARGET_CFLAGS}#g' ${S}/build/rules.mk
52} 52}
53 53
54do_configure_append_class-nativesdk() { 54do_configure_append_class-nativesdk() {
diff --git a/meta/recipes-support/apr/apr/0001-Add-option-to-disable-timed-dependant-tests.patch b/meta/recipes-support/apr/apr/0001-Add-option-to-disable-timed-dependant-tests.patch
index abff4e9331..a274f3a16e 100644
--- a/meta/recipes-support/apr/apr/0001-Add-option-to-disable-timed-dependant-tests.patch
+++ b/meta/recipes-support/apr/apr/0001-Add-option-to-disable-timed-dependant-tests.patch
@@ -1,14 +1,15 @@
1From 2bbe20b4f69e84e7a18bc79d382486953f479328 Mon Sep 17 00:00:00 2001 1From 225abf37cd0b49960664b59f08e515a4c4ea5ad0 Mon Sep 17 00:00:00 2001
2From: Jeremy Puhlman <jpuhlman@mvista.com> 2From: Jeremy Puhlman <jpuhlman@mvista.com>
3Date: Thu, 26 Mar 2020 18:30:36 +0000 3Date: Thu, 26 Mar 2020 18:30:36 +0000
4Subject: [PATCH] Add option to disable timed dependant tests 4Subject: [PATCH] Add option to disable timed dependant tests
5 5
6The disabled tests rely on timing to pass correctly. On a virtualized 6The disabled tests rely on timing to pass correctly. On a virtualized
7system under heavy load, these tests randomly fail because they miss 7system under heavy load, these tests randomly fail because they miss
8a timer or other timing related issues. 8a timer or other timing related issues.
9 9
10Upstream-Status: Pending 10Upstream-Status: Pending
11Signed-off-by: Jeremy Puhlman <jpuhlman@mvista.com> 11Signed-off-by: Jeremy Puhlman <jpuhlman@mvista.com>
12
12--- 13---
13 configure.in | 6 ++++++ 14 configure.in | 6 ++++++
14 include/apr.h.in | 1 + 15 include/apr.h.in | 1 +
@@ -16,10 +17,10 @@ Signed-off-by: Jeremy Puhlman <jpuhlman@mvista.com>
16 3 files changed, 9 insertions(+), 2 deletions(-) 17 3 files changed, 9 insertions(+), 2 deletions(-)
17 18
18diff --git a/configure.in b/configure.in 19diff --git a/configure.in b/configure.in
19index d9f32d6..f0c5661 100644 20index bfd488b..3663220 100644
20--- a/configure.in 21--- a/configure.in
21+++ b/configure.in 22+++ b/configure.in
22@@ -2886,6 +2886,12 @@ AC_ARG_ENABLE(timedlocks, 23@@ -3023,6 +3023,12 @@ AC_ARG_ENABLE(timedlocks,
23 ) 24 )
24 AC_SUBST(apr_has_timedlocks) 25 AC_SUBST(apr_has_timedlocks)
25 26
@@ -45,10 +46,10 @@ index ee99def..c46a5f4 100644
45 #define APR_PROCATTR_USER_SET_REQUIRES_PASSWORD @apr_procattr_user_set_requires_password@ 46 #define APR_PROCATTR_USER_SET_REQUIRES_PASSWORD @apr_procattr_user_set_requires_password@
46 47
47diff --git a/test/testlock.c b/test/testlock.c 48diff --git a/test/testlock.c b/test/testlock.c
48index a43f477..6233d0b 100644 49index e3437c1..04e01b9 100644
49--- a/test/testlock.c 50--- a/test/testlock.c
50+++ b/test/testlock.c 51+++ b/test/testlock.c
51@@ -396,13 +396,13 @@ abts_suite *testlock(abts_suite *suite) 52@@ -535,7 +535,7 @@ abts_suite *testlock(abts_suite *suite)
52 abts_run_test(suite, threads_not_impl, NULL); 53 abts_run_test(suite, threads_not_impl, NULL);
53 #else 54 #else
54 abts_run_test(suite, test_thread_mutex, NULL); 55 abts_run_test(suite, test_thread_mutex, NULL);
@@ -56,6 +57,8 @@ index a43f477..6233d0b 100644
56+#if APR_HAS_TIMEDLOCKS && APR_HAVE_TIME_DEPENDANT_TESTS 57+#if APR_HAS_TIMEDLOCKS && APR_HAVE_TIME_DEPENDANT_TESTS
57 abts_run_test(suite, test_thread_timedmutex, NULL); 58 abts_run_test(suite, test_thread_timedmutex, NULL);
58 #endif 59 #endif
60 abts_run_test(suite, test_thread_nestedmutex, NULL);
61@@ -543,7 +543,7 @@ abts_suite *testlock(abts_suite *suite)
59 abts_run_test(suite, test_thread_rwlock, NULL); 62 abts_run_test(suite, test_thread_rwlock, NULL);
60 abts_run_test(suite, test_cond, NULL); 63 abts_run_test(suite, test_cond, NULL);
61 abts_run_test(suite, test_timeoutcond, NULL); 64 abts_run_test(suite, test_timeoutcond, NULL);
@@ -63,7 +66,4 @@ index a43f477..6233d0b 100644
63+#if APR_HAS_TIMEDLOCKS && APR_HAVE_TIME_DEPENDANT_TESTS 66+#if APR_HAS_TIMEDLOCKS && APR_HAVE_TIME_DEPENDANT_TESTS
64 abts_run_test(suite, test_timeoutmutex, NULL); 67 abts_run_test(suite, test_timeoutmutex, NULL);
65 #endif 68 #endif
66 #endif 69 #ifdef WIN32
67--
682.23.0
69
diff --git a/meta/recipes-support/apr/apr/0001-configure-Remove-runtime-test-for-mmap-that-can-map-.patch b/meta/recipes-support/apr/apr/0001-configure-Remove-runtime-test-for-mmap-that-can-map-.patch
new file mode 100644
index 0000000000..a78b16284f
--- /dev/null
+++ b/meta/recipes-support/apr/apr/0001-configure-Remove-runtime-test-for-mmap-that-can-map-.patch
@@ -0,0 +1,58 @@
1From 316b81c462f065927d7fec56aadd5c8cb94d1cf0 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 26 Aug 2022 00:28:08 -0700
4Subject: [PATCH] configure: Remove runtime test for mmap that can map
5 /dev/zero
6
7This never works for cross-compile moreover it ends up disabling
8ac_cv_file__dev_zero which then results in compiler errors in shared
9mutexes
10
11Upstream-Status: Inappropriate [Cross-compile specific]
12Signed-off-by: Khem Raj <raj.khem@gmail.com>
13
14---
15 configure.in | 30 ------------------------------
16 1 file changed, 30 deletions(-)
17
18diff --git a/configure.in b/configure.in
19index 3663220..dce9789 100644
20--- a/configure.in
21+++ b/configure.in
22@@ -1303,36 +1303,6 @@ AC_CHECK_FUNCS([mmap munmap shm_open shm_unlink shmget shmat shmdt shmctl \
23 APR_CHECK_DEFINE(MAP_ANON, sys/mman.h)
24 AC_CHECK_FILE(/dev/zero)
25
26-# Not all systems can mmap /dev/zero (such as HP-UX). Check for that.
27-if test "$ac_cv_func_mmap" = "yes" &&
28- test "$ac_cv_file__dev_zero" = "yes"; then
29- AC_CACHE_CHECK([for mmap that can map /dev/zero],
30- [ac_cv_mmap__dev_zero],
31- [AC_TRY_RUN([#include <sys/types.h>
32-#include <sys/stat.h>
33-#include <fcntl.h>
34-#ifdef HAVE_SYS_MMAN_H
35-#include <sys/mman.h>
36-#endif
37- int main()
38- {
39- int fd;
40- void *m;
41- fd = open("/dev/zero", O_RDWR);
42- if (fd < 0) {
43- return 1;
44- }
45- m = mmap(0, sizeof(void*), PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
46- if (m == (void *)-1) { /* aka MAP_FAILED */
47- return 2;
48- }
49- if (munmap(m, sizeof(void*)) < 0) {
50- return 3;
51- }
52- return 0;
53- }], [], [ac_cv_file__dev_zero=no], [ac_cv_file__dev_zero=no])])
54-fi
55-
56 # Now we determine which one is our anonymous shmem preference.
57 haveshmgetanon="0"
58 havemmapzero="0"
diff --git a/meta/recipes-support/apr/apr/0002-apr-Remove-workdir-path-references-from-installed-ap.patch b/meta/recipes-support/apr/apr/0002-apr-Remove-workdir-path-references-from-installed-ap.patch
index 72e706f966..d63423f3a1 100644
--- a/meta/recipes-support/apr/apr/0002-apr-Remove-workdir-path-references-from-installed-ap.patch
+++ b/meta/recipes-support/apr/apr/0002-apr-Remove-workdir-path-references-from-installed-ap.patch
@@ -1,8 +1,7 @@
1From 5925b20da8bbc34d9bf5a5dca123ef38864d43c6 Mon Sep 17 00:00:00 2001 1From 689a8db96a6d1e1cae9cbfb35d05ac82140a6555 Mon Sep 17 00:00:00 2001
2From: Hongxu Jia <hongxu.jia@windriver.com> 2From: Hongxu Jia <hongxu.jia@windriver.com>
3Date: Tue, 30 Jan 2018 09:39:06 +0800 3Date: Tue, 30 Jan 2018 09:39:06 +0800
4Subject: [PATCH 2/7] apr: Remove workdir path references from installed apr 4Subject: [PATCH] apr: Remove workdir path references from installed apr files
5 files
6 5
7Upstream-Status: Inappropriate [configuration] 6Upstream-Status: Inappropriate [configuration]
8 7
@@ -14,20 +13,23 @@ packages at target run time, the workdir path caused confusion.
14Rebase to 1.6.3 13Rebase to 1.6.3
15 14
16Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> 15Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
16
17--- 17---
18 apr-config.in | 26 ++------------------------ 18 apr-config.in | 32 ++------------------------------
19 1 file changed, 2 insertions(+), 24 deletions(-) 19 1 file changed, 2 insertions(+), 30 deletions(-)
20 20
21diff --git a/apr-config.in b/apr-config.in 21diff --git a/apr-config.in b/apr-config.in
22index 84b4073..bbbf651 100644 22index bed47ca..47874e5 100644
23--- a/apr-config.in 23--- a/apr-config.in
24+++ b/apr-config.in 24+++ b/apr-config.in
25@@ -152,14 +152,7 @@ while test $# -gt 0; do 25@@ -164,16 +164,7 @@ while test $# -gt 0; do
26 flags="$flags $LDFLAGS" 26 flags="$flags $LDFLAGS"
27 ;; 27 ;;
28 --includes) 28 --includes)
29- if test "$location" = "installed"; then 29- if test "$location" = "installed"; then
30 flags="$flags -I$includedir $EXTRA_INCLUDES" 30 flags="$flags -I$includedir $EXTRA_INCLUDES"
31- elif test "$location" = "crosscompile"; then
32- flags="$flags -I$APR_TARGET_DIR/$includedir $EXTRA_INCLUDES"
31- elif test "$location" = "source"; then 33- elif test "$location" = "source"; then
32- flags="$flags -I$APR_SOURCE_DIR/include $EXTRA_INCLUDES" 34- flags="$flags -I$APR_SOURCE_DIR/include $EXTRA_INCLUDES"
33- else 35- else
@@ -37,13 +39,15 @@ index 84b4073..bbbf651 100644
37 ;; 39 ;;
38 --srcdir) 40 --srcdir)
39 echo $APR_SOURCE_DIR 41 echo $APR_SOURCE_DIR
40@@ -181,29 +174,14 @@ while test $# -gt 0; do 42@@ -197,33 +188,14 @@ while test $# -gt 0; do
41 exit 0 43 exit 0
42 ;; 44 ;;
43 --link-ld) 45 --link-ld)
44- if test "$location" = "installed"; then 46- if test "$location" = "installed"; then
45- ### avoid using -L if libdir is a "standard" location like /usr/lib 47- ### avoid using -L if libdir is a "standard" location like /usr/lib
46- flags="$flags -L$libdir -l${APR_LIBNAME}" 48- flags="$flags -L$libdir -l${APR_LIBNAME}"
49- elif test "$location" = "crosscompile"; then
50- flags="$flags -L$APR_TARGET_DIR/$libdir -l${APR_LIBNAME}"
47- else 51- else
48- ### this surely can't work since the library is in .libs? 52- ### this surely can't work since the library is in .libs?
49- flags="$flags -L$APR_BUILD_DIR -l${APR_LIBNAME}" 53- flags="$flags -L$APR_BUILD_DIR -l${APR_LIBNAME}"
@@ -62,6 +66,8 @@ index 84b4073..bbbf651 100644
62- # Since the user is specifying they are linking with libtool, we 66- # Since the user is specifying they are linking with libtool, we
63- # *know* that -R will be recognized by libtool. 67- # *know* that -R will be recognized by libtool.
64- flags="$flags -L$libdir -R$libdir -l${APR_LIBNAME}" 68- flags="$flags -L$libdir -R$libdir -l${APR_LIBNAME}"
69- elif test "$location" = "crosscompile"; then
70- flags="$flags -L${APR_TARGET_DIR}/$libdir -l${APR_LIBNAME}"
65- else 71- else
66- flags="$flags $LA_FILE" 72- flags="$flags $LA_FILE"
67- fi 73- fi
@@ -69,6 +75,3 @@ index 84b4073..bbbf651 100644
69 ;; 75 ;;
70 --shlib-path-var) 76 --shlib-path-var)
71 echo "$SHLIBPATH_VAR" 77 echo "$SHLIBPATH_VAR"
72--
731.8.3.1
74
diff --git a/meta/recipes-support/apr/apr/0003-Makefile.in-configure.in-support-cross-compiling.patch b/meta/recipes-support/apr/apr/0003-Makefile.in-configure.in-support-cross-compiling.patch
deleted file mode 100644
index 4dd53bd8eb..0000000000
--- a/meta/recipes-support/apr/apr/0003-Makefile.in-configure.in-support-cross-compiling.patch
+++ /dev/null
@@ -1,63 +0,0 @@
1From d5028c10f156c224475b340cfb1ba025d6797243 Mon Sep 17 00:00:00 2001
2From: Hongxu Jia <hongxu.jia@windriver.com>
3Date: Fri, 2 Feb 2018 15:51:42 +0800
4Subject: [PATCH 3/7] Makefile.in/configure.in: support cross compiling
5
6While cross compiling, the tools/gen_test_char could not
7be executed at build time, use AX_PROG_CC_FOR_BUILD to
8build native tools/gen_test_char
9
10Upstream-Status: Submitted [https://github.com/apache/apr/pull/8]
11
12Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
13---
14 Makefile.in | 10 +++-------
15 configure.in | 3 +++
16 2 files changed, 6 insertions(+), 7 deletions(-)
17
18diff --git a/Makefile.in b/Makefile.in
19index 5fb760e..8675f90 100644
20--- a/Makefile.in
21+++ b/Makefile.in
22@@ -46,7 +46,7 @@ LT_VERSION = @LT_VERSION@
23
24 CLEAN_TARGETS = apr-config.out apr.exp exports.c export_vars.c .make.dirs \
25 build/apr_rules.out tools/gen_test_char@EXEEXT@ \
26- tools/gen_test_char.o tools/gen_test_char.lo \
27+ tools/gen_test_char.o \
28 include/private/apr_escape_test_char.h
29 DISTCLEAN_TARGETS = config.cache config.log config.status \
30 include/apr.h include/arch/unix/apr_private.h \
31@@ -131,13 +131,9 @@ check: $(TARGET_LIB)
32 etags:
33 etags `find . -name '*.[ch]'`
34
35-OBJECTS_gen_test_char = tools/gen_test_char.lo $(LOCAL_LIBS)
36-tools/gen_test_char.lo: tools/gen_test_char.c
37+tools/gen_test_char@EXEEXT@: tools/gen_test_char.c
38 $(APR_MKDIR) tools
39- $(LT_COMPILE)
40-
41-tools/gen_test_char@EXEEXT@: $(OBJECTS_gen_test_char)
42- $(LINK_PROG) $(OBJECTS_gen_test_char) $(ALL_LIBS)
43+ $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $< -o $@
44
45 include/private/apr_escape_test_char.h: tools/gen_test_char@EXEEXT@
46 $(APR_MKDIR) include/private
47diff --git a/configure.in b/configure.in
48index 719f331..361120f 100644
49--- a/configure.in
50+++ b/configure.in
51@@ -183,6 +183,9 @@ dnl can only be used once within a configure script, so this prevents a
52 dnl preload section from invoking the macro to get compiler info.
53 AC_PROG_CC
54
55+dnl Check build CC for gen_test_char compiling which is executed at build time.
56+AX_PROG_CC_FOR_BUILD
57+
58 dnl AC_PROG_SED is only avaliable in recent autoconf versions.
59 dnl Use AC_CHECK_PROG instead if AC_PROG_SED is not present.
60 ifdef([AC_PROG_SED],
61--
621.8.3.1
63
diff --git a/meta/recipes-support/apr/apr/0006-apr-fix-off_t-size-doesn-t-match-in-glibc-when-cross.patch b/meta/recipes-support/apr/apr/0006-apr-fix-off_t-size-doesn-t-match-in-glibc-when-cross.patch
deleted file mode 100644
index d1a2ebe881..0000000000
--- a/meta/recipes-support/apr/apr/0006-apr-fix-off_t-size-doesn-t-match-in-glibc-when-cross.patch
+++ /dev/null
@@ -1,76 +0,0 @@
1From 49661ea3858cf8494926cccf57d3e8c6dcb47117 Mon Sep 17 00:00:00 2001
2From: Dengke Du <dengke.du@windriver.com>
3Date: Wed, 14 Dec 2016 18:13:08 +0800
4Subject: [PATCH] apr: fix off_t size doesn't match in glibc when cross
5 compiling
6
7In configure.in, it contains the following:
8
9 APR_CHECK_SIZEOF_EXTENDED([#include <sys/types.h>], off_t, 8)
10
11the macro "APR_CHECK_SIZEOF_EXTENDED" was defined in build/apr_common.m4,
12it use the "AC_TRY_RUN" macro, this macro let the off_t to 8, when cross
13compiling enable.
14
15So it was hardcoded for cross compiling, we should detect it dynamic based on
16the sysroot's glibc. We change it to the following:
17
18 AC_CHECK_SIZEOF(off_t)
19
20The same for the following hardcoded types for cross compiling:
21
22 pid_t 8
23 ssize_t 8
24 size_t 8
25 off_t 8
26
27Change the above correspondingly.
28
29Signed-off-by: Dengke Du <dengke.du@windriver.com>
30
31Upstream-Status: Pending
32
33---
34 configure.in | 8 ++++----
35 1 file changed, 4 insertions(+), 4 deletions(-)
36
37diff --git a/configure.in b/configure.in
38index 27b8539..fb408d1 100644
39--- a/configure.in
40+++ b/configure.in
41@@ -1801,7 +1801,7 @@ else
42 socklen_t_value="int"
43 fi
44
45-APR_CHECK_SIZEOF_EXTENDED([#include <sys/types.h>], pid_t, 8)
46+AC_CHECK_SIZEOF(pid_t)
47
48 if test "$ac_cv_sizeof_pid_t" = "$ac_cv_sizeof_short"; then
49 pid_t_fmt='#define APR_PID_T_FMT "hd"'
50@@ -1873,7 +1873,7 @@ APR_CHECK_TYPES_FMT_COMPATIBLE(size_t, unsigned long, lu, [size_t_fmt="lu"], [
51 APR_CHECK_TYPES_FMT_COMPATIBLE(size_t, unsigned int, u, [size_t_fmt="u"])
52 ])
53
54-APR_CHECK_SIZEOF_EXTENDED([#include <sys/types.h>], ssize_t, 8)
55+AC_CHECK_SIZEOF(ssize_t)
56
57 dnl the else cases below should no longer occur;
58 AC_MSG_CHECKING([which format to use for apr_ssize_t])
59@@ -1891,7 +1891,7 @@ fi
60
61 ssize_t_fmt="#define APR_SSIZE_T_FMT \"$ssize_t_fmt\""
62
63-APR_CHECK_SIZEOF_EXTENDED([#include <stddef.h>], size_t, 8)
64+AC_CHECK_SIZEOF(size_t)
65
66 # else cases below should no longer occur;
67 AC_MSG_CHECKING([which format to use for apr_size_t])
68@@ -1909,7 +1909,7 @@ fi
69
70 size_t_fmt="#define APR_SIZE_T_FMT \"$size_t_fmt\""
71
72-APR_CHECK_SIZEOF_EXTENDED([#include <sys/types.h>], off_t, 8)
73+AC_CHECK_SIZEOF(off_t)
74
75 if test "${ac_cv_sizeof_off_t}${apr_cv_use_lfs64}" = "4yes"; then
76 # Enable LFS
diff --git a/meta/recipes-support/apr/apr/libtoolize_check.patch b/meta/recipes-support/apr/apr/libtoolize_check.patch
index 740792e6b0..80ce43caa4 100644
--- a/meta/recipes-support/apr/apr/libtoolize_check.patch
+++ b/meta/recipes-support/apr/apr/libtoolize_check.patch
@@ -1,6 +1,7 @@
1From 17835709bc55657b7af1f7c99b3f572b819cf97e Mon Sep 17 00:00:00 2001
1From: Helmut Grohne <helmut@subdivi.de> 2From: Helmut Grohne <helmut@subdivi.de>
2Subject: check for libtoolize rather than libtool 3Date: Tue, 7 Feb 2023 07:04:00 +0000
3Last-Update: 2014-09-19 4Subject: [PATCH] check for libtoolize rather than libtool
4 5
5libtool is now in package libtool-bin, but apr only needs libtoolize. 6libtool is now in package libtool-bin, but apr only needs libtoolize.
6 7
@@ -8,14 +9,22 @@ Upstream-Status: Pending [ from debian: https://sources.debian.org/data/main/a/a
8 9
9Signed-off-by: Robert Yang <liezhi.yang@windriver.com> 10Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
10 11
11--- apr.orig/build/buildcheck.sh 12---
12+++ apr/build/buildcheck.sh 13 build/buildcheck.sh | 10 ++++------
13@@ -39,11 +39,11 @@ fi 14 1 file changed, 4 insertions(+), 6 deletions(-)
15
16diff --git a/build/buildcheck.sh b/build/buildcheck.sh
17index 44921b5..08bc8a8 100755
18--- a/build/buildcheck.sh
19+++ b/build/buildcheck.sh
20@@ -39,13 +39,11 @@ fi
14 # ltmain.sh (GNU libtool 1.1361 2004/01/02 23:10:52) 1.5a 21 # ltmain.sh (GNU libtool 1.1361 2004/01/02 23:10:52) 1.5a
15 # output is multiline from 1.5 onwards 22 # output is multiline from 1.5 onwards
16 23
17-# Require libtool 1.4 or newer 24-# Require libtool 1.4 or newer
18-libtool=`build/PrintPath glibtool1 glibtool libtool libtool15 libtool14` 25-if test -z "$libtool"; then
26- libtool=`build/PrintPath glibtool1 glibtool libtool libtool15 libtool14`
27-fi
19-lt_pversion=`$libtool --version 2>/dev/null|sed -e 's/([^)]*)//g;s/^[^0-9]*//;s/[- ].*//g;q'` 28-lt_pversion=`$libtool --version 2>/dev/null|sed -e 's/([^)]*)//g;s/^[^0-9]*//;s/[- ].*//g;q'`
20+# Require libtoolize 1.4 or newer 29+# Require libtoolize 1.4 or newer
21+libtoolize=`build/PrintPath glibtoolize1 glibtoolize libtoolize libtoolize15 libtoolize14` 30+libtoolize=`build/PrintPath glibtoolize1 glibtoolize libtoolize libtoolize15 libtoolize14`
diff --git a/meta/recipes-support/apr/apr_1.7.0.bb b/meta/recipes-support/apr/apr_1.7.2.bb
index c9b9bf0f50..807dce21da 100644
--- a/meta/recipes-support/apr/apr_1.7.0.bb
+++ b/meta/recipes-support/apr/apr_1.7.2.bb
@@ -1,8 +1,8 @@
1SUMMARY = "Apache Portable Runtime (APR) library" 1SUMMARY = "Apache Portable Runtime (APR) library"
2DESCRIPTION = "The Apache Portable Runtime (APR) is a supporting library for the \ 2
3Apache web server. It provides a set of APIs that map to the underlying \ 3DESCRIPTION = "Create and maintain software libraries that provide a predictable \
4operating system (OS). Where the OS does not support a particular function, \ 4and consistent interface to underlying platform-specific implementations."
5APR will provide an emulation." 5
6HOMEPAGE = "http://apr.apache.org/" 6HOMEPAGE = "http://apr.apache.org/"
7SECTION = "libs" 7SECTION = "libs"
8DEPENDS = "util-linux" 8DEPENDS = "util-linux"
@@ -16,17 +16,15 @@ BBCLASSEXTEND = "native nativesdk"
16SRC_URI = "${APACHE_MIRROR}/apr/${BPN}-${PV}.tar.bz2 \ 16SRC_URI = "${APACHE_MIRROR}/apr/${BPN}-${PV}.tar.bz2 \
17 file://run-ptest \ 17 file://run-ptest \
18 file://0002-apr-Remove-workdir-path-references-from-installed-ap.patch \ 18 file://0002-apr-Remove-workdir-path-references-from-installed-ap.patch \
19 file://0003-Makefile.in-configure.in-support-cross-compiling.patch \
20 file://0004-Fix-packet-discards-HTTP-redirect.patch \ 19 file://0004-Fix-packet-discards-HTTP-redirect.patch \
21 file://0005-configure.in-fix-LTFLAGS-to-make-it-work-with-ccache.patch \ 20 file://0005-configure.in-fix-LTFLAGS-to-make-it-work-with-ccache.patch \
22 file://0006-apr-fix-off_t-size-doesn-t-match-in-glibc-when-cross.patch \
23 file://0007-explicitly-link-libapr-against-phtread-to-make-gold-.patch \ 21 file://0007-explicitly-link-libapr-against-phtread-to-make-gold-.patch \
24 file://libtoolize_check.patch \ 22 file://libtoolize_check.patch \
25 file://0001-Add-option-to-disable-timed-dependant-tests.patch \ 23 file://0001-Add-option-to-disable-timed-dependant-tests.patch \
24 file://0001-configure-Remove-runtime-test-for-mmap-that-can-map-.patch \
26 " 25 "
27 26
28SRC_URI[md5sum] = "7a14a83d664e87599ea25ff4432e48a7" 27SRC_URI[sha256sum] = "75e77cc86776c030c0a5c408dfbd0bf2a0b75eed5351e52d5439fa1e5509a43e"
29SRC_URI[sha256sum] = "e2e148f0b2e99b8e5c6caa09f6d4fb4dd3e83f744aa72a952f94f5a14436f7ea"
30 28
31inherit autotools-brokensep lib_package binconfig multilib_header ptest multilib_script 29inherit autotools-brokensep lib_package binconfig multilib_header ptest multilib_script
32 30
@@ -34,17 +32,30 @@ OE_BINCONFIG_EXTRA_MANGLE = " -e 's:location=source:location=installed:'"
34 32
35# Added to fix some issues with cmake. Refer to https://github.com/bmwcarit/meta-ros/issues/68#issuecomment-19896928 33# Added to fix some issues with cmake. Refer to https://github.com/bmwcarit/meta-ros/issues/68#issuecomment-19896928
36CACHED_CONFIGUREVARS += "apr_cv_mutex_recursive=yes" 34CACHED_CONFIGUREVARS += "apr_cv_mutex_recursive=yes"
37 35# Enable largefile
36CACHED_CONFIGUREVARS += "apr_cv_use_lfs64=yes"
37# Additional AC_TRY_RUN tests which will need to be cached for cross compile
38CACHED_CONFIGUREVARS += "apr_cv_epoll=yes epoll_create1=yes apr_cv_sock_cloexec=yes \
39 ac_cv_struct_rlimit=yes \
40 ac_cv_func_sem_open=yes \
41 apr_cv_process_shared_works=yes \
42 apr_cv_mutex_robust_shared=yes \
43 "
38# Also suppress trying to use sctp. 44# Also suppress trying to use sctp.
39# 45#
40CACHED_CONFIGUREVARS += "ac_cv_header_netinet_sctp_h=no ac_cv_header_netinet_sctp_uio_h=no" 46CACHED_CONFIGUREVARS += "ac_cv_header_netinet_sctp_h=no ac_cv_header_netinet_sctp_uio_h=no"
41 47
42CACHED_CONFIGUREVARS += "ac_cv_sizeof_struct_iovec=yes" 48# ac_cv_sizeof_struct_iovec is deduced using runtime check which will fail during cross-compile
49CACHED_CONFIGUREVARS += "${@['ac_cv_sizeof_struct_iovec=16','ac_cv_sizeof_struct_iovec=8'][d.getVar('SITEINFO_BITS') != '32']}"
50
43CACHED_CONFIGUREVARS += "ac_cv_file__dev_zero=yes" 51CACHED_CONFIGUREVARS += "ac_cv_file__dev_zero=yes"
44 52
53CACHED_CONFIGUREVARS:append:libc-musl = " ac_cv_strerror_r_rc_int=yes"
45PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)}" 54PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)}"
55PACKAGECONFIG:append:libc-musl = " xsi-strerror"
46PACKAGECONFIG[ipv6] = "--enable-ipv6,--disable-ipv6," 56PACKAGECONFIG[ipv6] = "--enable-ipv6,--disable-ipv6,"
47PACKAGECONFIG[timed-tests] = "--enable-timed-tests,--disable-timed-tests," 57PACKAGECONFIG[timed-tests] = "--enable-timed-tests,--disable-timed-tests,"
58PACKAGECONFIG[xsi-strerror] = "ac_cv_strerror_r_rc_int=yes,ac_cv_strerror_r_rc_int=no,"
48 59
49do_configure_prepend() { 60do_configure_prepend() {
50 # Avoid absolute paths for grep since it causes failures 61 # Avoid absolute paths for grep since it causes failures
diff --git a/meta/recipes-support/argp-standalone/argp-standalone_1.3.bb b/meta/recipes-support/argp-standalone/argp-standalone_1.3.bb
index 21bbcab3d3..d1db562bb5 100644
--- a/meta/recipes-support/argp-standalone/argp-standalone_1.3.bb
+++ b/meta/recipes-support/argp-standalone/argp-standalone_1.3.bb
@@ -2,6 +2,7 @@
2# Released under the MIT license (see COPYING.MIT for the terms) 2# Released under the MIT license (see COPYING.MIT for the terms)
3 3
4SUMMARY = "Glibc hierarchical argument parsing standalone library" 4SUMMARY = "Glibc hierarchical argument parsing standalone library"
5DESCRIPTION = "Standalone version of arguments parsing functions from GLIBC"
5HOMEPAGE = "http://www.lysator.liu.se/~nisse/misc/" 6HOMEPAGE = "http://www.lysator.liu.se/~nisse/misc/"
6LICENSE = "LGPL-2.1" 7LICENSE = "LGPL-2.1"
7LIC_FILES_CHKSUM = "file://argp.h;beginline=1;endline=20;md5=008b7e53dea6f9e1d9fdef0d9cf3184a" 8LIC_FILES_CHKSUM = "file://argp.h;beginline=1;endline=20;md5=008b7e53dea6f9e1d9fdef0d9cf3184a"
diff --git a/meta/recipes-support/aspell/aspell_0.60.8.bb b/meta/recipes-support/aspell/aspell_0.60.8.bb
index f1d931b39c..9147c820e7 100644
--- a/meta/recipes-support/aspell/aspell_0.60.8.bb
+++ b/meta/recipes-support/aspell/aspell_0.60.8.bb
@@ -1,14 +1,21 @@
1SUMMARY = "GNU Aspell spell-checker" 1SUMMARY = "GNU Aspell spell-checker"
2DESCRIPTION = "GNU Aspell is a spell-checker which can be used either as a \ 2
3standalone application or embedded in other programs. Its main feature is that \ 3DESCRIPTION = "Spell checker designed to eventually replace Ispell. \
4it does a much better job of suggesting possible spellings than just about any \ 4It can either be used as a library or as an independent spell checker. \
5other spell-checker available for the English language" 5Its main feature is that it does a superior job of suggesting possible \
6replacements for a misspelled word than just about any other spell \
7checker out there for the English language."
8
6SECTION = "console/utils" 9SECTION = "console/utils"
7 10
11HOMEPAGE = "http://aspell.net/"
12
8LICENSE = "LGPLv2 | LGPLv2.1" 13LICENSE = "LGPLv2 | LGPLv2.1"
9LIC_FILES_CHKSUM = "file://COPYING;md5=7fbc338309ac38fefcd64b04bb903e34" 14LIC_FILES_CHKSUM = "file://COPYING;md5=7fbc338309ac38fefcd64b04bb903e34"
10 15
11SRC_URI = "${GNU_MIRROR}/aspell/aspell-${PV}.tar.gz" 16SRC_URI = "${GNU_MIRROR}/aspell/aspell-${PV}.tar.gz \
17 file://CVE-2019-25051.patch \
18"
12SRC_URI[md5sum] = "012fa9209203ae4e5a61c2a668fd10e3" 19SRC_URI[md5sum] = "012fa9209203ae4e5a61c2a668fd10e3"
13SRC_URI[sha256sum] = "f9b77e515334a751b2e60daab5db23499e26c9209f5e7b7443b05235ad0226f2" 20SRC_URI[sha256sum] = "f9b77e515334a751b2e60daab5db23499e26c9209f5e7b7443b05235ad0226f2"
14 21
diff --git a/meta/recipes-support/aspell/files/CVE-2019-25051.patch b/meta/recipes-support/aspell/files/CVE-2019-25051.patch
new file mode 100644
index 0000000000..8513f6de79
--- /dev/null
+++ b/meta/recipes-support/aspell/files/CVE-2019-25051.patch
@@ -0,0 +1,101 @@
1From 0718b375425aad8e54e1150313b862e4c6fd324a Mon Sep 17 00:00:00 2001
2From: Kevin Atkinson <kevina@gnu.org>
3Date: Sat, 21 Dec 2019 20:32:47 +0000
4Subject: [PATCH] objstack: assert that the alloc size will fit within a chunk
5 to prevent a buffer overflow
6
7Bug found using OSS-Fuze.
8
9Upstream-Status: Backport
10[https://github.com/gnuaspell/aspell/commit/0718b375425aad8e54e1150313b862e4c6fd324a]
11CVE: CVE-2019-25051
12Signed-off-by: Chee Yang Lee <chee.yang.lee@intel.com>
13---
14 common/objstack.hpp | 18 ++++++++++++++----
15 1 file changed, 14 insertions(+), 4 deletions(-)
16
17diff --git a/common/objstack.hpp b/common/objstack.hpp
18index 3997bf7..bd97ccd 100644
19--- a/common/objstack.hpp
20+++ b/common/objstack.hpp
21@@ -5,6 +5,7 @@
22 #include "parm_string.hpp"
23 #include <stdlib.h>
24 #include <assert.h>
25+#include <stddef.h>
26
27 namespace acommon {
28
29@@ -26,6 +27,12 @@ class ObjStack
30 byte * temp_end;
31 void setup_chunk();
32 void new_chunk();
33+ bool will_overflow(size_t sz) const {
34+ return offsetof(Node,data) + sz > chunk_size;
35+ }
36+ void check_size(size_t sz) {
37+ assert(!will_overflow(sz));
38+ }
39
40 ObjStack(const ObjStack &);
41 void operator=(const ObjStack &);
42@@ -56,7 +63,7 @@ class ObjStack
43 void * alloc_bottom(size_t size) {
44 byte * tmp = bottom;
45 bottom += size;
46- if (bottom > top) {new_chunk(); tmp = bottom; bottom += size;}
47+ if (bottom > top) {check_size(size); new_chunk(); tmp = bottom; bottom += size;}
48 return tmp;
49 }
50 // This alloc_bottom will insure that the object is aligned based on the
51@@ -66,7 +73,7 @@ class ObjStack
52 align_bottom(align);
53 byte * tmp = bottom;
54 bottom += size;
55- if (bottom > top) {new_chunk(); goto loop;}
56+ if (bottom > top) {check_size(size); new_chunk(); goto loop;}
57 return tmp;
58 }
59 char * dup_bottom(ParmString str) {
60@@ -79,7 +86,7 @@ class ObjStack
61 // always be aligned as such.
62 void * alloc_top(size_t size) {
63 top -= size;
64- if (top < bottom) {new_chunk(); top -= size;}
65+ if (top < bottom) {check_size(size); new_chunk(); top -= size;}
66 return top;
67 }
68 // This alloc_top will insure that the object is aligned based on
69@@ -88,7 +95,7 @@ class ObjStack
70 {loop:
71 top -= size;
72 align_top(align);
73- if (top < bottom) {new_chunk(); goto loop;}
74+ if (top < bottom) {check_size(size); new_chunk(); goto loop;}
75 return top;
76 }
77 char * dup_top(ParmString str) {
78@@ -117,6 +124,7 @@ class ObjStack
79 void * alloc_temp(size_t size) {
80 temp_end = bottom + size;
81 if (temp_end > top) {
82+ check_size(size);
83 new_chunk();
84 temp_end = bottom + size;
85 }
86@@ -131,6 +139,7 @@ class ObjStack
87 } else {
88 size_t s = temp_end - bottom;
89 byte * p = bottom;
90+ check_size(size);
91 new_chunk();
92 memcpy(bottom, p, s);
93 temp_end = bottom + size;
94@@ -150,6 +159,7 @@ class ObjStack
95 } else {
96 size_t s = temp_end - bottom;
97 byte * p = bottom;
98+ check_size(size);
99 new_chunk();
100 memcpy(bottom, p, s);
101 temp_end = bottom + size;
diff --git a/meta/recipes-support/atk/at-spi2-atk_2.34.1.bb b/meta/recipes-support/atk/at-spi2-atk_2.34.1.bb
index c297912588..ad30617e56 100644
--- a/meta/recipes-support/atk/at-spi2-atk_2.34.1.bb
+++ b/meta/recipes-support/atk/at-spi2-atk_2.34.1.bb
@@ -1,5 +1,7 @@
1SUMMARY = "AT-SPI 2 Toolkit Bridge" 1SUMMARY = "AT-SPI 2 Toolkit Bridge"
2DESCRIPTION = "Contains a library that bridges ATK to At-Spi2 D-Bus service. Toolkit widgets use it to provide their content to screen readers such as Orca."
2HOMEPAGE = "https://wiki.linuxfoundation.org/accessibility/d-bus" 3HOMEPAGE = "https://wiki.linuxfoundation.org/accessibility/d-bus"
4BUGTRACKER = "http://bugzilla.gnome.org/"
3LICENSE = "LGPL-2.1+" 5LICENSE = "LGPL-2.1+"
4LIC_FILES_CHKSUM = "file://COPYING;md5=4fbd65380cdd255951079008b364516c" 6LIC_FILES_CHKSUM = "file://COPYING;md5=4fbd65380cdd255951079008b364516c"
5 7
diff --git a/meta/recipes-support/atk/at-spi2-core_2.34.0.bb b/meta/recipes-support/atk/at-spi2-core_2.34.0.bb
index bcef8ef169..2ad09878b7 100644
--- a/meta/recipes-support/atk/at-spi2-core_2.34.0.bb
+++ b/meta/recipes-support/atk/at-spi2-core_2.34.0.bb
@@ -1,7 +1,9 @@
1SUMMARY = "Assistive Technology Service Provider Interface (dbus core)" 1SUMMARY = "Assistive Technology Service Provider Interface (dbus core)"
2DESCRIPTION = "At-Spi2 is a protocol over DBus, toolkit widgets use it to \ 2
3provide their content to screen readers such as Orca." 3DESCRIPTION = "It provides a Service Provider Interface for the Assistive Technologies available on the GNOME platform and a library against which applications can be linked."
4
4HOMEPAGE = "https://wiki.linuxfoundation.org/accessibility/d-bus" 5HOMEPAGE = "https://wiki.linuxfoundation.org/accessibility/d-bus"
6BUGTRACKER = "http://bugzilla.gnome.org/"
5LICENSE = "LGPL-2.1+" 7LICENSE = "LGPL-2.1+"
6LIC_FILES_CHKSUM = "file://COPYING;md5=4fbd65380cdd255951079008b364516c" 8LIC_FILES_CHKSUM = "file://COPYING;md5=4fbd65380cdd255951079008b364516c"
7 9
diff --git a/meta/recipes-support/atk/atk_2.34.1.bb b/meta/recipes-support/atk/atk_2.34.1.bb
index 741350ffe5..25ef3c6c52 100644
--- a/meta/recipes-support/atk/atk_2.34.1.bb
+++ b/meta/recipes-support/atk/atk_2.34.1.bb
@@ -1,4 +1,5 @@
1SUMMARY = "Accessibility toolkit for GNOME" 1SUMMARY = "Accessibility toolkit for GNOME"
2DESCRIPTION = "Provides application programming interfaces (APIs) for implementing accessibility support in software."
2HOMEPAGE = "https://wiki.gnome.org/Accessibility" 3HOMEPAGE = "https://wiki.gnome.org/Accessibility"
3BUGTRACKER = "https://gitlab.gnome.org/GNOME/atk/-/issues" 4BUGTRACKER = "https://gitlab.gnome.org/GNOME/atk/-/issues"
4SECTION = "x11/libs" 5SECTION = "x11/libs"
diff --git a/meta/recipes-support/attr/acl_2.2.53.bb b/meta/recipes-support/attr/acl_2.2.53.bb
index b120c1f16f..7cee45948d 100644
--- a/meta/recipes-support/attr/acl_2.2.53.bb
+++ b/meta/recipes-support/attr/acl_2.2.53.bb
@@ -1,7 +1,10 @@
1SUMMARY = "Utilities for managing POSIX Access Control Lists" 1SUMMARY = "Utilities for managing POSIX Access Control Lists"
2HOMEPAGE = "http://savannah.nongnu.org/projects/acl/"
3DESCRIPTION = "ACL allows you to provide different levels of access to files \ 2DESCRIPTION = "ACL allows you to provide different levels of access to files \
4and folders for different users." 3and folders for different users."
4
5HOMEPAGE = "http://savannah.nongnu.org/projects/acl/"
6BUGTRACKER = "http://savannah.nongnu.org/bugs/?group=acl"
7
5SECTION = "libs" 8SECTION = "libs"
6 9
7LICENSE = "LGPLv2.1+ & GPLv2+" 10LICENSE = "LGPLv2.1+ & GPLv2+"
diff --git a/meta/recipes-support/attr/attr.inc b/meta/recipes-support/attr/attr.inc
index 8515f96bf7..30ba0b4445 100644
--- a/meta/recipes-support/attr/attr.inc
+++ b/meta/recipes-support/attr/attr.inc
@@ -1,8 +1,6 @@
1SUMMARY = "Utilities for manipulating filesystem extended attributes" 1SUMMARY = "Utilities for manipulating filesystem extended attributes"
2DESCRIPTION = "A set of tools for manipulating extended attributes on filesystem \ 2DESCRIPTION = "Implement the ability for a user to attach name:value pairs to objects within the XFS filesystem."
3objects, in particular getfattr(1) and setfattr(1). An attr(1) command \ 3
4is also provided which is largely compatible with the SGI IRIX tool of \
5the same name."
6HOMEPAGE = "http://savannah.nongnu.org/projects/attr/" 4HOMEPAGE = "http://savannah.nongnu.org/projects/attr/"
7SECTION = "libs" 5SECTION = "libs"
8 6
diff --git a/meta/recipes-support/bash-completion/bash-completion_2.10.bb b/meta/recipes-support/bash-completion/bash-completion_2.10.bb
index 58e565dee5..1f99bf7386 100644
--- a/meta/recipes-support/bash-completion/bash-completion_2.10.bb
+++ b/meta/recipes-support/bash-completion/bash-completion_2.10.bb
@@ -1,6 +1,9 @@
1SUMMARY = "Programmable Completion for Bash 4" 1SUMMARY = "Programmable Completion for Bash 4"
2DESCRIPTION = "bash completion extends bash's standard completion behavior to \ 2DESCRIPTION = "Collection of command line command completions for the Bash shell, \
3achieve complex command lines with just a few keystrokes." 3collection of helper functions to assist in creating new completions, \
4and set of facilities for loading completions automatically on demand, as well \
5as installing them."
6
4HOMEPAGE = "https://github.com/scop/bash-completion" 7HOMEPAGE = "https://github.com/scop/bash-completion"
5BUGTRACKER = "https://github.com/scop/bash-completion/issues" 8BUGTRACKER = "https://github.com/scop/bash-completion/issues"
6 9
diff --git a/meta/recipes-support/bmap-tools/bmap-tools_3.5.bb b/meta/recipes-support/bmap-tools/bmap-tools_3.5.bb
index 986f0124e2..6a93cacc18 100644
--- a/meta/recipes-support/bmap-tools/bmap-tools_3.5.bb
+++ b/meta/recipes-support/bmap-tools/bmap-tools_3.5.bb
@@ -9,7 +9,7 @@ SECTION = "console/utils"
9LICENSE = "GPLv2" 9LICENSE = "GPLv2"
10LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263" 10LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"
11 11
12SRC_URI = "git://github.com/intel/${BPN}" 12SRC_URI = "git://github.com/intel/${BPN};branch=main;protocol=https"
13 13
14SRCREV = "db7087b883bf52cbff063ad17a41cc1cbb85104d" 14SRCREV = "db7087b883bf52cbff063ad17a41cc1cbb85104d"
15S = "${WORKDIR}/git" 15S = "${WORKDIR}/git"
diff --git a/meta/recipes-support/boost/boost-1.72.0.inc b/meta/recipes-support/boost/boost-1.72.0.inc
index 55a095bf1c..d152895f09 100644
--- a/meta/recipes-support/boost/boost-1.72.0.inc
+++ b/meta/recipes-support/boost/boost-1.72.0.inc
@@ -11,7 +11,7 @@ BOOST_VER = "${@"_".join(d.getVar("PV").split("."))}"
11BOOST_MAJ = "${@"_".join(d.getVar("PV").split(".")[0:2])}" 11BOOST_MAJ = "${@"_".join(d.getVar("PV").split(".")[0:2])}"
12BOOST_P = "boost_${BOOST_VER}" 12BOOST_P = "boost_${BOOST_VER}"
13 13
14SRC_URI = "https://dl.bintray.com/boostorg/release/${PV}/source/${BOOST_P}.tar.bz2" 14SRC_URI = "https://boostorg.jfrog.io/artifactory/main/release/${PV}/source/${BOOST_P}.tar.bz2"
15SRC_URI[md5sum] = "cb40943d2a2cb8ce08d42bc48b0f84f0" 15SRC_URI[md5sum] = "cb40943d2a2cb8ce08d42bc48b0f84f0"
16SRC_URI[sha256sum] = "59c9b274bc451cf91a9ba1dd2c7fdcaf5d60b1b3aa83f2c9fa143417cc660722" 16SRC_URI[sha256sum] = "59c9b274bc451cf91a9ba1dd2c7fdcaf5d60b1b3aa83f2c9fa143417cc660722"
17 17
diff --git a/meta/recipes-support/boost/boost.inc b/meta/recipes-support/boost/boost.inc
index 8eb9494381..1c13fb3599 100644
--- a/meta/recipes-support/boost/boost.inc
+++ b/meta/recipes-support/boost/boost.inc
@@ -1,4 +1,8 @@
1SUMMARY = "Free peer-reviewed portable C++ source libraries" 1SUMMARY = "Free peer-reviewed portable C++ source libraries"
2DESCRIPTION = "Provides free peer-reviewed portable C++ source libraries. The emphasis is on libraries which work well with the C++ \
3Standard Library. One goal is to establish 'existing practice' and \
4provide reference implementations so that the Boost libraries are suitable for eventual standardization. Some of the libraries have already been proposed for inclusion in the C++ Standards Committee's \
5upcoming C++ Standard Library Technical Report."
2SECTION = "libs" 6SECTION = "libs"
3DEPENDS = "bjam-native zlib bzip2" 7DEPENDS = "bjam-native zlib bzip2"
4 8
@@ -161,7 +165,7 @@ do_configure() {
161 165
162 # D2194:Fixing the failure of "error: duplicate initialization of gcc with the following parameters" during compilation. 166 # D2194:Fixing the failure of "error: duplicate initialization of gcc with the following parameters" during compilation.
163 rm -f ${WORKDIR}/user-config.jam 167 rm -f ${WORKDIR}/user-config.jam
164 echo 'using gcc : 4.3.1 : ${CXX} : <cflags>"${CFLAGS}" <cxxflags>"${CXXFLAGS}" <linkflags>"${LDFLAGS}" ;' >> ${WORKDIR}/user-config.jam 168 echo 'using gcc : : ${CXX} : <cflags>"${CFLAGS}" <cxxflags>"${CXXFLAGS}" <linkflags>"${LDFLAGS}" ;' >> ${WORKDIR}/user-config.jam
165 169
166 # If we want Python then we need to tell Boost *exactly* where to find it 170 # If we want Python then we need to tell Boost *exactly* where to find it
167 if ${@bb.utils.contains('BOOST_LIBS', 'python', 'true', 'false', d)}; then 171 if ${@bb.utils.contains('BOOST_LIBS', 'python', 'true', 'false', d)}; then
diff --git a/meta/recipes-support/boost/boost/0001-Fix-Wsign-compare-warning-with-glibc-2.34-on-Linux-p.patch b/meta/recipes-support/boost/boost/0001-Fix-Wsign-compare-warning-with-glibc-2.34-on-Linux-p.patch
new file mode 100644
index 0000000000..46c706931b
--- /dev/null
+++ b/meta/recipes-support/boost/boost/0001-Fix-Wsign-compare-warning-with-glibc-2.34-on-Linux-p.patch
@@ -0,0 +1,32 @@
1From f9d0e594d43afcb4ab0043117249feb266ba4515 Mon Sep 17 00:00:00 2001
2From: Romain Geissler <romain.geissler@amadeus.com>
3Date: Tue, 10 Aug 2021 14:22:28 +0000
4Subject: [PATCH] Fix -Wsign-compare warning with glibc 2.34 on Linux
5 platforms.
6
7In file included from /data/mwrep/res/osp/Boost/21-0-0-0/include/boost/thread/thread_only.hpp:17,
8 from /data/mwrep/res/osp/Boost/21-0-0-0/include/boost/thread/thread.hpp:12,
9 from src/GetTest.cpp:12:
10/data/mwrep/res/osp/Boost/21-0-0-0/include/boost/thread/pthread/thread_data.hpp: In member function 'void boost::thread_attributes::set_stack_size(std::size_t)':
11/data/mwrep/res/osp/Boost/21-0-0-0/include/boost/thread/pthread/thread_data.hpp:61:19: error: comparison of integer expressions of different signedness: 'std::size_t' {aka 'long unsigned int'} and 'long int' [-Werror=sign-compare]
12 61 | if (size<PTHREAD_STACK_MIN) size=PTHREAD_STACK_MIN;
13 | ^
14
15Upstream-Status: Backport [1.78.0 https://github.com/boostorg/thread/commit/f9d0e594d43afcb4ab0043117249feb266ba4515]
16---
17 boost/thread/pthread/thread_data.hpp | 2 +-
18 1 file changed, 1 insertion(+), 1 deletion(-)
19
20diff --git a/boost/thread/pthread/thread_data.hpp b/boost/thread/pthread/thread_data.hpp
21index bc9b1367..c43b276d 100644
22--- a/boost/thread/pthread/thread_data.hpp
23+++ b/boost/thread/pthread/thread_data.hpp
24@@ -58,7 +58,7 @@ namespace boost
25 std::size_t page_size = ::sysconf( _SC_PAGESIZE);
26 #endif
27 #ifdef PTHREAD_STACK_MIN
28- if (size<PTHREAD_STACK_MIN) size=PTHREAD_STACK_MIN;
29+ if (size<static_cast<std::size_t>(PTHREAD_STACK_MIN)) size=PTHREAD_STACK_MIN;
30 #endif
31 size = ((size+page_size-1)/page_size)*page_size;
32 int res = pthread_attr_setstacksize(&val_, size);
diff --git a/meta/recipes-support/boost/boost/0001-Revert-change-to-elide-a-warning-that-caused-Solaris.patch b/meta/recipes-support/boost/boost/0001-Revert-change-to-elide-a-warning-that-caused-Solaris.patch
new file mode 100644
index 0000000000..3784cf9165
--- /dev/null
+++ b/meta/recipes-support/boost/boost/0001-Revert-change-to-elide-a-warning-that-caused-Solaris.patch
@@ -0,0 +1,24 @@
1From 74fb0a26099bc51d717f5f154b37231ce7df3e98 Mon Sep 17 00:00:00 2001
2From: Rob Boehne <robb@datalogics.com>
3Date: Wed, 20 Nov 2019 11:25:20 -0600
4Subject: [PATCH] Revert change to elide a warning that caused Solaris builds
5 to fail.
6
7Upstream-Status: Backport [1.73.0 https://github.com/boostorg/thread/commit/74fb0a26099bc51d717f5f154b37231ce7df3e98]
8---
9 boost/thread/pthread/thread_data.hpp | 2 +-
10 1 file changed, 1 insertion(+), 1 deletion(-)
11
12diff --git a/boost/thread/pthread/thread_data.hpp b/boost/thread/pthread/thread_data.hpp
13index aefbeb43..bc9b1367 100644
14--- a/boost/thread/pthread/thread_data.hpp
15+++ b/boost/thread/pthread/thread_data.hpp
16@@ -57,7 +57,7 @@ namespace boost
17 #else
18 std::size_t page_size = ::sysconf( _SC_PAGESIZE);
19 #endif
20-#if PTHREAD_STACK_MIN > 0
21+#ifdef PTHREAD_STACK_MIN
22 if (size<PTHREAD_STACK_MIN) size=PTHREAD_STACK_MIN;
23 #endif
24 size = ((size+page_size-1)/page_size)*page_size;
diff --git a/meta/recipes-support/boost/boost_1.72.0.bb b/meta/recipes-support/boost/boost_1.72.0.bb
index df1cc16937..b3ec11933c 100644
--- a/meta/recipes-support/boost/boost_1.72.0.bb
+++ b/meta/recipes-support/boost/boost_1.72.0.bb
@@ -9,4 +9,6 @@ SRC_URI += " \
9 file://0001-dont-setup-compiler-flags-m32-m64.patch \ 9 file://0001-dont-setup-compiler-flags-m32-m64.patch \
10 file://0001-revert-cease-dependence-on-range.patch \ 10 file://0001-revert-cease-dependence-on-range.patch \
11 file://0001-added-typedef-executor_type.patch \ 11 file://0001-added-typedef-executor_type.patch \
12 file://0001-Revert-change-to-elide-a-warning-that-caused-Solaris.patch \
13 file://0001-Fix-Wsign-compare-warning-with-glibc-2.34-on-Linux-p.patch \
12 " 14 "
diff --git a/meta/recipes-support/ca-certificates/ca-certificates/0001-Revert-mozilla-certdata2pem.py-print-a-warning-for-e.patch b/meta/recipes-support/ca-certificates/ca-certificates/0001-Revert-mozilla-certdata2pem.py-print-a-warning-for-e.patch
new file mode 100644
index 0000000000..5c4a32f526
--- /dev/null
+++ b/meta/recipes-support/ca-certificates/ca-certificates/0001-Revert-mozilla-certdata2pem.py-print-a-warning-for-e.patch
@@ -0,0 +1,80 @@
1From cb43ec15b700b25f3c4fe44043a1a021aaf5b768 Mon Sep 17 00:00:00 2001
2From: Alexander Kanavin <alex@linutronix.de>
3Date: Mon, 18 Oct 2021 12:05:49 +0200
4Subject: [PATCH] Revert "mozilla/certdata2pem.py: print a warning for expired
5 certificates."
6
7This avoids a dependency on python3-cryptography, and only checks
8for expired certs (which is upstream concern, but not ours).
9
10Upstream-Status: Inappropriate [oe-core specific]
11Signed-off-by: Alexander Kanavin <alex@linutronix.de>
12---
13 debian/changelog | 1 -
14 debian/control | 2 +-
15 mozilla/certdata2pem.py | 11 -----------
16 3 files changed, 1 insertion(+), 13 deletions(-)
17
18diff --git a/debian/changelog b/debian/changelog
19index 531e4d0..4006509 100644
20--- a/debian/changelog
21+++ b/debian/changelog
22@@ -37,7 +37,6 @@ ca-certificates (20211004) unstable; urgency=low
23 - "Trustis FPS Root CA"
24 - "Staat der Nederlanden Root CA - G3"
25 * Blacklist expired root certificate "DST Root CA X3" (closes: #995432)
26- * mozilla/certdata2pem.py: print a warning for expired certificates.
27
28 -- Julien Cristau <jcristau@debian.org> Thu, 07 Oct 2021 17:12:47 +0200
29
30diff --git a/debian/control b/debian/control
31index 4434b7a..5c6ba24 100644
32--- a/debian/control
33+++ b/debian/control
34@@ -3,7 +3,7 @@ Section: misc
35 Priority: optional
36 Maintainer: Julien Cristau <jcristau@debian.org>
37 Build-Depends: debhelper-compat (= 13), po-debconf
38-Build-Depends-Indep: python3, openssl, python3-cryptography
39+Build-Depends-Indep: python3, openssl
40 Standards-Version: 4.5.0.2
41 Vcs-Git: https://salsa.debian.org/debian/ca-certificates.git
42 Vcs-Browser: https://salsa.debian.org/debian/ca-certificates
43diff --git a/mozilla/certdata2pem.py b/mozilla/certdata2pem.py
44index ede23d4..7d796f1 100644
45--- a/mozilla/certdata2pem.py
46+++ b/mozilla/certdata2pem.py
47@@ -21,16 +21,12 @@
48 # USA.
49
50 import base64
51-import datetime
52 import os.path
53 import re
54 import sys
55 import textwrap
56 import io
57
58-from cryptography import x509
59-
60-
61 objects = []
62
63 # Dirty file parser.
64@@ -121,13 +117,6 @@ for obj in objects:
65 if obj['CKA_CLASS'] == 'CKO_CERTIFICATE':
66 if not obj['CKA_LABEL'] in trust or not trust[obj['CKA_LABEL']]:
67 continue
68-
69- cert = x509.load_der_x509_certificate(obj['CKA_VALUE'])
70- if cert.not_valid_after < datetime.datetime.now():
71- print('!'*74)
72- print('Trusted but expired certificate found: %s' % obj['CKA_LABEL'])
73- print('!'*74)
74-
75 bname = obj['CKA_LABEL'][1:-1].replace('/', '_')\
76 .replace(' ', '_')\
77 .replace('(', '=')\
78--
792.20.1
80
diff --git a/meta/recipes-support/ca-certificates/ca-certificates/sbindir.patch b/meta/recipes-support/ca-certificates/ca-certificates/sbindir.patch
deleted file mode 100644
index a113fa8b15..0000000000
--- a/meta/recipes-support/ca-certificates/ca-certificates/sbindir.patch
+++ /dev/null
@@ -1,20 +0,0 @@
1Upstream-Status: Pending
2
3Let us alter the install destination of the script via SBINDIR
4
5--- ca-certificates-20130119.orig/sbin/Makefile
6+++ ca-certificates-20130119/sbin/Makefile
7@@ -3,9 +3,12 @@
8 #
9 #
10
11+SBINDIR = /usr/sbin
12+
13 all:
14
15 clean:
16
17 install:
18- install -m755 update-ca-certificates $(DESTDIR)/usr/sbin/
19+ install -d $(DESTDIR)$(SBINDIR)
20+ install -m755 update-ca-certificates $(DESTDIR)$(SBINDIR)/
diff --git a/meta/recipes-support/ca-certificates/ca-certificates/update-ca-certificates-support-Toybox.patch b/meta/recipes-support/ca-certificates/ca-certificates/update-ca-certificates-support-Toybox.patch
deleted file mode 100644
index 6e2171f758..0000000000
--- a/meta/recipes-support/ca-certificates/ca-certificates/update-ca-certificates-support-Toybox.patch
+++ /dev/null
@@ -1,34 +0,0 @@
1From 30378026d136efa779732e3f6664e2ecf461e458 Mon Sep 17 00:00:00 2001
2From: Patrick Ohly <patrick.ohly@intel.com>
3Date: Thu, 17 Mar 2016 12:38:09 +0100
4Subject: [PATCH] update-ca-certificates: support Toybox
5
6"mktemp -t" is deprecated and does not work when using Toybox. Replace
7with something that works also with Toybox.
8
9Upstream-Status: Pending
10
11Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
12---
13 sbin/update-ca-certificates | 6 +++---
14 1 file changed, 3 insertions(+), 3 deletions(-)
15
16diff --git a/sbin/update-ca-certificates b/sbin/update-ca-certificates
17index 79c41bb..ae9e3f1 100755
18--- a/sbin/update-ca-certificates
19+++ b/sbin/update-ca-certificates
20@@ -113,9 +113,9 @@ trap cleanup 0
21
22 # Helper files. (Some of them are not simple arrays because we spawn
23 # subshells later on.)
24-TEMPBUNDLE="$(mktemp -t "${CERTBUNDLE}.tmp.XXXXXX")"
25-ADDED="$(mktemp -t "ca-certificates.tmp.XXXXXX")"
26-REMOVED="$(mktemp -t "ca-certificates.tmp.XXXXXX")"
27+TEMPBUNDLE="$(mktemp -p${TMPDIR:-/tmp} "${CERTBUNDLE}.tmp.XXXXXX")"
28+ADDED="$(mktemp -p${TMPDIR:-/tmp} "ca-certificates.tmp.XXXXXX")"
29+REMOVED="$(mktemp -p${TMPDIR:-/tmp} "ca-certificates.tmp.XXXXXX")"
30
31 # Adds a certificate to the list of trusted ones. This includes a symlink
32 # in /etc/ssl/certs to the certificate file and its inclusion into the
33--
342.1.4
diff --git a/meta/recipes-support/ca-certificates/ca-certificates_20210119.bb b/meta/recipes-support/ca-certificates/ca-certificates_20211016.bb
index 888a235c1a..a54d6b458a 100644
--- a/meta/recipes-support/ca-certificates/ca-certificates_20210119.bb
+++ b/meta/recipes-support/ca-certificates/ca-certificates_20211016.bb
@@ -14,15 +14,14 @@ DEPENDS_class-nativesdk = "openssl-native"
14# Need rehash from openssl and run-parts from debianutils 14# Need rehash from openssl and run-parts from debianutils
15PACKAGE_WRITE_DEPS += "openssl-native debianutils-native" 15PACKAGE_WRITE_DEPS += "openssl-native debianutils-native"
16 16
17SRCREV = "181be7ebd169b4a6fb5d90c3e6dc791e90534144" 17SRCREV = "07de54fdcc5806bde549e1edf60738c6bccf50e8"
18 18
19SRC_URI = "git://salsa.debian.org/debian/ca-certificates.git;protocol=https \ 19SRC_URI = "git://salsa.debian.org/debian/ca-certificates.git;protocol=https;branch=master \
20 file://0002-update-ca-certificates-use-SYSROOT.patch \ 20 file://0002-update-ca-certificates-use-SYSROOT.patch \
21 file://0001-update-ca-certificates-don-t-use-Debianisms-in-run-p.patch \ 21 file://0001-update-ca-certificates-don-t-use-Debianisms-in-run-p.patch \
22 file://update-ca-certificates-support-Toybox.patch \
23 file://default-sysroot.patch \ 22 file://default-sysroot.patch \
24 file://sbindir.patch \
25 file://0003-update-ca-certificates-use-relative-symlinks-from-ET.patch \ 23 file://0003-update-ca-certificates-use-relative-symlinks-from-ET.patch \
24 file://0001-Revert-mozilla-certdata2pem.py-print-a-warning-for-e.patch \
26 " 25 "
27UPSTREAM_CHECK_GITTAGREGEX = "(?P<pver>\d+)" 26UPSTREAM_CHECK_GITTAGREGEX = "(?P<pver>\d+)"
28 27
@@ -83,8 +82,8 @@ do_install_append_class-native () {
83 SYSROOT="${D}${base_prefix}" ${D}${sbindir}/update-ca-certificates 82 SYSROOT="${D}${base_prefix}" ${D}${sbindir}/update-ca-certificates
84} 83}
85 84
86RDEPENDS_${PN}_class-target = "openssl-bin" 85RDEPENDS_${PN}_append_class-target = " openssl-bin openssl"
87RDEPENDS_${PN}_class-native = "openssl-native" 86RDEPENDS_${PN}_append_class-native = " openssl-native"
88RDEPENDS_${PN}_class-nativesdk = "nativesdk-openssl-bin" 87RDEPENDS_${PN}_append_class-nativesdk = " nativesdk-openssl-bin nativesdk-openssl"
89 88
90BBCLASSEXTEND = "native nativesdk" 89BBCLASSEXTEND = "native nativesdk"
diff --git a/meta/recipes-support/consolekit/consolekit_0.4.6.bb b/meta/recipes-support/consolekit/consolekit_0.4.6.bb
index 89f2d77b66..22e755747b 100644
--- a/meta/recipes-support/consolekit/consolekit_0.4.6.bb
+++ b/meta/recipes-support/consolekit/consolekit_0.4.6.bb
@@ -1,4 +1,6 @@
1SUMMARY = "Framework for defining and tracking users, login sessions, and seats" 1SUMMARY = "Framework for defining and tracking users, login sessions, and seats"
2DESCRIPTION = "It provides a mechanism for software to react to changes \
3of any of these items or of any of the metadata associated with them."
2HOMEPAGE = "http://www.freedesktop.org/wiki/Software/ConsoleKit" 4HOMEPAGE = "http://www.freedesktop.org/wiki/Software/ConsoleKit"
3BUGTRACKER = "https://bugs.freedesktop.org/buglist.cgi?query_format=specific&product=ConsoleKit" 5BUGTRACKER = "https://bugs.freedesktop.org/buglist.cgi?query_format=specific&product=ConsoleKit"
4 6
diff --git a/meta/recipes-support/curl/curl/CVE-2021-22876.patch b/meta/recipes-support/curl/curl/CVE-2021-22876.patch
new file mode 100644
index 0000000000..fc396aabef
--- /dev/null
+++ b/meta/recipes-support/curl/curl/CVE-2021-22876.patch
@@ -0,0 +1,59 @@
1transfer: strip credentials from the auto-referer header field
2
3CVE-2021-22876
4
5Patch taken from Ubuntu curl 7.68.0-1ubuntu2.5.
6
7Bug: https://curl.se/docs/CVE-2021-22876.html
8Upstream-Status: backport
9---
10 lib/transfer.c | 25 +++++++++++++++++++++++--
11 1 file changed, 23 insertions(+), 2 deletions(-)
12
13diff --git a/lib/transfer.c b/lib/transfer.c
14index e76834eb3..744e1c00b 100644
15--- a/lib/transfer.c
16+++ b/lib/transfer.c
17@@ -1570,6 +1570,9 @@ CURLcode Curl_follow(struct Curl_easy *data,
18 data->set.followlocation++; /* count location-followers */
19
20 if(data->set.http_auto_referer) {
21+ CURLU *u;
22+ char *referer;
23+
24 /* We are asked to automatically set the previous URL as the referer
25 when we get the next URL. We pick the ->url field, which may or may
26 not be 100% correct */
27@@ -1579,9 +1582,27 @@ CURLcode Curl_follow(struct Curl_easy *data,
28 data->change.referer_alloc = FALSE;
29 }
30
31- data->change.referer = strdup(data->change.url);
32- if(!data->change.referer)
33+ /* Make a copy of the URL without crenditals and fragment */
34+ u = curl_url();
35+ if(!u)
36+ return CURLE_OUT_OF_MEMORY;
37+
38+ uc = curl_url_set(u, CURLUPART_URL, data->change.url, 0);
39+ if(!uc)
40+ uc = curl_url_set(u, CURLUPART_FRAGMENT, NULL, 0);
41+ if(!uc)
42+ uc = curl_url_set(u, CURLUPART_USER, NULL, 0);
43+ if(!uc)
44+ uc = curl_url_set(u, CURLUPART_PASSWORD, NULL, 0);
45+ if(!uc)
46+ uc = curl_url_get(u, CURLUPART_URL, &referer, 0);
47+
48+ curl_url_cleanup(u);
49+
50+ if(uc || referer == NULL)
51 return CURLE_OUT_OF_MEMORY;
52+
53+ data->change.referer = referer;
54 data->change.referer_alloc = TRUE; /* yes, free this later */
55 }
56 }
57--
582.20.1
59
diff --git a/meta/recipes-support/curl/curl/CVE-2021-22890.patch b/meta/recipes-support/curl/curl/CVE-2021-22890.patch
new file mode 100644
index 0000000000..8c0ecbfe7f
--- /dev/null
+++ b/meta/recipes-support/curl/curl/CVE-2021-22890.patch
@@ -0,0 +1,464 @@
1vtls: add 'isproxy' argument to Curl_ssl_get/addsessionid()
2
3To make sure we set and extract the correct session.
4
5Patch taken from Ubuntu curl 7.68.0-1ubuntu2.5.
6
7CVE-2021-22890
8
9Reported-by: Mingtao Yang
10Bug: https://curl.se/docs/CVE-2021-22890.html
11Upstream-Status: backport
12---
13 lib/vtls/bearssl.c | 9 +++++---
14 lib/vtls/gtls.c | 9 +++++---
15 lib/vtls/mbedtls.c | 8 ++++---
16 lib/vtls/mesalink.c | 9 +++++---
17 lib/vtls/openssl.c | 52 ++++++++++++++++++++++++++++++++++----------
18 lib/vtls/schannel.c | 10 +++++----
19 lib/vtls/sectransp.c | 9 ++++----
20 lib/vtls/vtls.c | 9 ++++++--
21 lib/vtls/vtls.h | 2 ++
22 lib/vtls/wolfssl.c | 8 ++++---
23 10 files changed, 88 insertions(+), 37 deletions(-)
24
25diff --git a/lib/vtls/bearssl.c b/lib/vtls/bearssl.c
26index 67f945831..32cb0a4c2 100644
27--- a/lib/vtls/bearssl.c
28+++ b/lib/vtls/bearssl.c
29@@ -372,7 +372,8 @@ static CURLcode bearssl_connect_step1(struct connectdata *conn, int sockindex)
30 void *session;
31
32 Curl_ssl_sessionid_lock(conn);
33- if(!Curl_ssl_getsessionid(conn, &session, NULL, sockindex)) {
34+ if(!Curl_ssl_getsessionid(conn, SSL_IS_PROXY() ? TRUE : FALSE,
35+ &session, NULL, sockindex)) {
36 br_ssl_engine_set_session_parameters(&BACKEND->ctx.eng, session);
37 infof(data, "BearSSL: re-using session ID\n");
38 }
39@@ -560,10 +561,12 @@ static CURLcode bearssl_connect_step3(struct connectdata *conn, int sockindex)
40 return CURLE_OUT_OF_MEMORY;
41 br_ssl_engine_get_session_parameters(&BACKEND->ctx.eng, session);
42 Curl_ssl_sessionid_lock(conn);
43- incache = !(Curl_ssl_getsessionid(conn, &oldsession, NULL, sockindex));
44+ incache = !(Curl_ssl_getsessionid(conn, SSL_IS_PROXY() ? TRUE : FALSE,
45+ &oldsession, NULL, sockindex));
46 if(incache)
47 Curl_ssl_delsessionid(conn, oldsession);
48- ret = Curl_ssl_addsessionid(conn, session, 0, sockindex);
49+ ret = Curl_ssl_addsessionid(conn, SSL_IS_PROXY() ? TRUE : FALSE,
50+ session, 0, sockindex);
51 Curl_ssl_sessionid_unlock(conn);
52 if(ret) {
53 free(session);
54diff --git a/lib/vtls/gtls.c b/lib/vtls/gtls.c
55index 5f740eeba..46e149c7d 100644
56--- a/lib/vtls/gtls.c
57+++ b/lib/vtls/gtls.c
58@@ -937,7 +937,8 @@ gtls_connect_step1(struct connectdata *conn,
59 size_t ssl_idsize;
60
61 Curl_ssl_sessionid_lock(conn);
62- if(!Curl_ssl_getsessionid(conn, &ssl_sessionid, &ssl_idsize, sockindex)) {
63+ if(!Curl_ssl_getsessionid(conn, SSL_IS_PROXY() ? TRUE : FALSE,
64+ &ssl_sessionid, &ssl_idsize, sockindex)) {
65 /* we got a session id, use it! */
66 gnutls_session_set_data(session, ssl_sessionid, ssl_idsize);
67
68@@ -1485,7 +1486,8 @@ gtls_connect_step3(struct connectdata *conn,
69 gnutls_session_get_data(session, connect_sessionid, &connect_idsize);
70
71 Curl_ssl_sessionid_lock(conn);
72- incache = !(Curl_ssl_getsessionid(conn, &ssl_sessionid, NULL,
73+ incache = !(Curl_ssl_getsessionid(conn, SSL_IS_PROXY() ? TRUE : FALSE,
74+ &ssl_sessionid, NULL,
75 sockindex));
76 if(incache) {
77 /* there was one before in the cache, so instead of risking that the
78@@ -1494,7 +1496,8 @@ gtls_connect_step3(struct connectdata *conn,
79 }
80
81 /* store this session id */
82- result = Curl_ssl_addsessionid(conn, connect_sessionid, connect_idsize,
83+ result = Curl_ssl_addsessionid(conn, SSL_IS_PROXY() ? TRUE : FALSE,
84+ connect_sessionid, connect_idsize,
85 sockindex);
86 Curl_ssl_sessionid_unlock(conn);
87 if(result) {
88diff --git a/lib/vtls/mbedtls.c b/lib/vtls/mbedtls.c
89index f057315f3..19df8478e 100644
90--- a/lib/vtls/mbedtls.c
91+++ b/lib/vtls/mbedtls.c
92@@ -453,7 +453,8 @@ mbed_connect_step1(struct connectdata *conn,
93 void *old_session = NULL;
94
95 Curl_ssl_sessionid_lock(conn);
96- if(!Curl_ssl_getsessionid(conn, &old_session, NULL, sockindex)) {
97+ if(!Curl_ssl_getsessionid(conn, SSL_IS_PROXY() ? TRUE : FALSE,
98+ &old_session, NULL, sockindex)) {
99 ret = mbedtls_ssl_set_session(&BACKEND->ssl, old_session);
100 if(ret) {
101 Curl_ssl_sessionid_unlock(conn);
102@@ -709,6 +710,7 @@ mbed_connect_step3(struct connectdata *conn,
103 int ret;
104 mbedtls_ssl_session *our_ssl_sessionid;
105 void *old_ssl_sessionid = NULL;
106+ bool isproxy = SSL_IS_PROXY() ? TRUE : FALSE;
107
108 our_ssl_sessionid = malloc(sizeof(mbedtls_ssl_session));
109 if(!our_ssl_sessionid)
110@@ -727,10 +729,10 @@ mbed_connect_step3(struct connectdata *conn,
111
112 /* If there's already a matching session in the cache, delete it */
113 Curl_ssl_sessionid_lock(conn);
114- if(!Curl_ssl_getsessionid(conn, &old_ssl_sessionid, NULL, sockindex))
115+ if(!Curl_ssl_getsessionid(conn, isproxy, &old_ssl_sessionid, NULL, sockindex))
116 Curl_ssl_delsessionid(conn, old_ssl_sessionid);
117
118- retcode = Curl_ssl_addsessionid(conn, our_ssl_sessionid, 0, sockindex);
119+ retcode = Curl_ssl_addsessionid(conn, isproxy, our_ssl_sessionid, 0, sockindex);
120 Curl_ssl_sessionid_unlock(conn);
121 if(retcode) {
122 mbedtls_ssl_session_free(our_ssl_sessionid);
123diff --git a/lib/vtls/mesalink.c b/lib/vtls/mesalink.c
124index cab1e390b..79d1e3dfa 100644
125--- a/lib/vtls/mesalink.c
126+++ b/lib/vtls/mesalink.c
127@@ -263,7 +263,8 @@ mesalink_connect_step1(struct connectdata *conn, int sockindex)
128 void *ssl_sessionid = NULL;
129
130 Curl_ssl_sessionid_lock(conn);
131- if(!Curl_ssl_getsessionid(conn, &ssl_sessionid, NULL, sockindex)) {
132+ if(!Curl_ssl_getsessionid(conn, SSL_IS_PROXY() ? TRUE : FALSE,
133+ &ssl_sessionid, NULL, sockindex)) {
134 /* we got a session id, use it! */
135 if(!SSL_set_session(BACKEND->handle, ssl_sessionid)) {
136 Curl_ssl_sessionid_unlock(conn);
137@@ -347,12 +348,14 @@ mesalink_connect_step3(struct connectdata *conn, int sockindex)
138 bool incache;
139 SSL_SESSION *our_ssl_sessionid;
140 void *old_ssl_sessionid = NULL;
141+ bool inproxy = SSL_IS_PROXY() ? TRUE : FALSE;
142
143 our_ssl_sessionid = SSL_get_session(BACKEND->handle);
144
145 Curl_ssl_sessionid_lock(conn);
146 incache =
147- !(Curl_ssl_getsessionid(conn, &old_ssl_sessionid, NULL, sockindex));
148+ !(Curl_ssl_getsessionid(conn, isproxy, &old_ssl_sessionid,
149+ NULL, sockindex));
150 if(incache) {
151 if(old_ssl_sessionid != our_ssl_sessionid) {
152 infof(data, "old SSL session ID is stale, removing\n");
153@@ -363,7 +366,7 @@ mesalink_connect_step3(struct connectdata *conn, int sockindex)
154
155 if(!incache) {
156 result = Curl_ssl_addsessionid(
157- conn, our_ssl_sessionid, 0 /* unknown size */, sockindex);
158+ conn, isproxy, our_ssl_sessionid, 0 /* unknown size */, sockindex);
159 if(result) {
160 Curl_ssl_sessionid_unlock(conn);
161 failf(data, "failed to store ssl session");
162diff --git a/lib/vtls/openssl.c b/lib/vtls/openssl.c
163index 1d09cadca..64f43605a 100644
164--- a/lib/vtls/openssl.c
165+++ b/lib/vtls/openssl.c
166@@ -422,12 +422,23 @@ static int ossl_get_ssl_conn_index(void)
167 */
168 static int ossl_get_ssl_sockindex_index(void)
169 {
170- static int ssl_ex_data_sockindex_index = -1;
171- if(ssl_ex_data_sockindex_index < 0) {
172- ssl_ex_data_sockindex_index = SSL_get_ex_new_index(0, NULL, NULL, NULL,
173- NULL);
174+ static int sockindex_index = -1;
175+ if(sockindex_index < 0) {
176+ sockindex_index = SSL_get_ex_new_index(0, NULL, NULL, NULL, NULL);
177 }
178- return ssl_ex_data_sockindex_index;
179+ return sockindex_index;
180+}
181+
182+/* Return an extra data index for proxy boolean.
183+ * This index can be used with SSL_get_ex_data() and SSL_set_ex_data().
184+ */
185+static int ossl_get_proxy_index(void)
186+{
187+ static int proxy_index = -1;
188+ if(proxy_index < 0) {
189+ proxy_index = SSL_get_ex_new_index(0, NULL, NULL, NULL, NULL);
190+ }
191+ return proxy_index;
192 }
193
194 static int passwd_callback(char *buf, int num, int encrypting,
195@@ -1079,7 +1090,8 @@ static int Curl_ossl_init(void)
196 #endif
197
198 /* Initialize the extra data indexes */
199- if(ossl_get_ssl_conn_index() < 0 || ossl_get_ssl_sockindex_index() < 0)
200+ if(ossl_get_ssl_conn_index() < 0 || ossl_get_ssl_sockindex_index() < 0 ||
201+ ossl_get_proxy_index() < 0)
202 return 0;
203
204 return 1;
205@@ -2341,8 +2353,10 @@ static int ossl_new_session_cb(SSL *ssl, SSL_SESSION *ssl_sessionid)
206 curl_socket_t *sockindex_ptr;
207 int connectdata_idx = ossl_get_ssl_conn_index();
208 int sockindex_idx = ossl_get_ssl_sockindex_index();
209+ int proxy_idx = ossl_get_proxy_index();
210+ bool isproxy;
211
212- if(connectdata_idx < 0 || sockindex_idx < 0)
213+ if(connectdata_idx < 0 || sockindex_idx < 0 || proxy_idx < 0)
214 return 0;
215
216 conn = (struct connectdata*) SSL_get_ex_data(ssl, connectdata_idx);
217@@ -2355,13 +2369,18 @@ static int ossl_new_session_cb(SSL *ssl, SSL_SESSION *ssl_sessionid)
218 sockindex_ptr = (curl_socket_t*) SSL_get_ex_data(ssl, sockindex_idx);
219 sockindex = (int)(sockindex_ptr - conn->sock);
220
221+ isproxy = SSL_get_ex_data(ssl, proxy_idx) ? TRUE : FALSE;
222+
223 if(SSL_SET_OPTION(primary.sessionid)) {
224 bool incache;
225 void *old_ssl_sessionid = NULL;
226
227 Curl_ssl_sessionid_lock(conn);
228- incache = !(Curl_ssl_getsessionid(conn, &old_ssl_sessionid, NULL,
229- sockindex));
230+ if(isproxy)
231+ incache = FALSE;
232+ else
233+ incache = !(Curl_ssl_getsessionid(conn, isproxy,
234+ &old_ssl_sessionid, NULL, sockindex));
235 if(incache) {
236 if(old_ssl_sessionid != ssl_sessionid) {
237 infof(data, "old SSL session ID is stale, removing\n");
238@@ -2371,7 +2390,7 @@ static int ossl_new_session_cb(SSL *ssl, SSL_SESSION *ssl_sessionid)
239 }
240
241 if(!incache) {
242- if(!Curl_ssl_addsessionid(conn, ssl_sessionid,
243+ if(!Curl_ssl_addsessionid(conn, isproxy, ssl_sessionid,
244 0 /* unknown size */, sockindex)) {
245 /* the session has been put into the session cache */
246 res = 1;
247@@ -2868,16 +2887,25 @@ static CURLcode ossl_connect_step1(struct connectdata *conn, int sockindex)
248 void *ssl_sessionid = NULL;
249 int connectdata_idx = ossl_get_ssl_conn_index();
250 int sockindex_idx = ossl_get_ssl_sockindex_index();
251+ int proxy_idx = ossl_get_proxy_index();
252
253- if(connectdata_idx >= 0 && sockindex_idx >= 0) {
254+ if(connectdata_idx >= 0 && sockindex_idx >= 0 && proxy_idx >= 0) {
255 /* Store the data needed for the "new session" callback.
256 * The sockindex is stored as a pointer to an array element. */
257 SSL_set_ex_data(BACKEND->handle, connectdata_idx, conn);
258 SSL_set_ex_data(BACKEND->handle, sockindex_idx, conn->sock + sockindex);
259+#ifndef CURL_DISABLE_PROXY
260+ SSL_set_ex_data(BACKEND->handle, proxy_idx, SSL_IS_PROXY() ? (void *) 1:
261+ NULL);
262+#else
263+ SSL_set_ex_data(BACKEND->handle, proxy_idx, NULL);
264+#endif
265+
266 }
267
268 Curl_ssl_sessionid_lock(conn);
269- if(!Curl_ssl_getsessionid(conn, &ssl_sessionid, NULL, sockindex)) {
270+ if(!Curl_ssl_getsessionid(conn, SSL_IS_PROXY() ? TRUE : FALSE,
271+ &ssl_sessionid, NULL, sockindex)) {
272 /* we got a session id, use it! */
273 if(!SSL_set_session(BACKEND->handle, ssl_sessionid)) {
274 Curl_ssl_sessionid_unlock(conn);
275diff --git a/lib/vtls/schannel.c b/lib/vtls/schannel.c
276index f665ee340..a354ce95d 100644
277--- a/lib/vtls/schannel.c
278+++ b/lib/vtls/schannel.c
279@@ -487,7 +487,8 @@ schannel_connect_step1(struct connectdata *conn, int sockindex)
280 /* check for an existing re-usable credential handle */
281 if(SSL_SET_OPTION(primary.sessionid)) {
282 Curl_ssl_sessionid_lock(conn);
283- if(!Curl_ssl_getsessionid(conn, (void **)&old_cred, NULL, sockindex)) {
284+ if(!Curl_ssl_getsessionid(conn, SSL_IS_PROXY() ? TRUE : FALSE,
285+ (void **)&old_cred, NULL, sockindex)) {
286 BACKEND->cred = old_cred;
287 DEBUGF(infof(data, "schannel: re-using existing credential handle\n"));
288
289@@ -1193,8 +1194,9 @@ schannel_connect_step3(struct connectdata *conn, int sockindex)
290 struct ssl_connect_data *connssl = &conn->ssl[sockindex];
291 SECURITY_STATUS sspi_status = SEC_E_OK;
292 CERT_CONTEXT *ccert_context = NULL;
293+ bool isproxy = SSL_IS_PROXY();
294 #ifdef DEBUGBUILD
295- const char * const hostname = SSL_IS_PROXY() ? conn->http_proxy.host.name :
296+ const char * const hostname = isproxy ? conn->http_proxy.host.name :
297 conn->host.name;
298 #endif
299 #ifdef HAS_ALPN
300@@ -1268,7 +1270,7 @@ schannel_connect_step3(struct connectdata *conn, int sockindex)
301 struct curl_schannel_cred *old_cred = NULL;
302
303 Curl_ssl_sessionid_lock(conn);
304- incache = !(Curl_ssl_getsessionid(conn, (void **)&old_cred, NULL,
305+ incache = !(Curl_ssl_getsessionid(conn, isproxy, (void **)&old_cred, NULL,
306 sockindex));
307 if(incache) {
308 if(old_cred != BACKEND->cred) {
309@@ -1280,7 +1282,7 @@ schannel_connect_step3(struct connectdata *conn, int sockindex)
310 }
311 }
312 if(!incache) {
313- result = Curl_ssl_addsessionid(conn, (void *)BACKEND->cred,
314+ result = Curl_ssl_addsessionid(conn, isproxy, (void *)BACKEND->cred,
315 sizeof(struct curl_schannel_cred),
316 sockindex);
317 if(result) {
318diff --git a/lib/vtls/sectransp.c b/lib/vtls/sectransp.c
319index 7dd028fb7..9c67d465a 100644
320--- a/lib/vtls/sectransp.c
321+++ b/lib/vtls/sectransp.c
322@@ -1376,7 +1376,8 @@ static CURLcode sectransp_connect_step1(struct connectdata *conn,
323 const char * const ssl_cafile = SSL_CONN_CONFIG(CAfile);
324 const bool verifypeer = SSL_CONN_CONFIG(verifypeer);
325 char * const ssl_cert = SSL_SET_OPTION(cert);
326- const char * const hostname = SSL_IS_PROXY() ? conn->http_proxy.host.name :
327+ bool isproxy = SSL_IS_PROXY();
328+ const char * const hostname = isproxy ? conn->http_proxy.host.name :
329 conn->host.name;
330 const long int port = SSL_IS_PROXY() ? conn->port : conn->remote_port;
331 #ifdef ENABLE_IPV6
332@@ -1584,7 +1585,7 @@ static CURLcode sectransp_connect_step1(struct connectdata *conn,
333
334 #ifdef USE_NGHTTP2
335 if(data->set.httpversion >= CURL_HTTP_VERSION_2 &&
336- (!SSL_IS_PROXY() || !conn->bits.tunnel_proxy)) {
337+ (!isproxy || !conn->bits.tunnel_proxy)) {
338 CFArrayAppendValue(alpnArr, CFSTR(NGHTTP2_PROTO_VERSION_ID));
339 infof(data, "ALPN, offering %s\n", NGHTTP2_PROTO_VERSION_ID);
340 }
341@@ -1916,7 +1917,7 @@ static CURLcode sectransp_connect_step1(struct connectdata *conn,
342 size_t ssl_sessionid_len;
343
344 Curl_ssl_sessionid_lock(conn);
345- if(!Curl_ssl_getsessionid(conn, (void **)&ssl_sessionid,
346+ if(!Curl_ssl_getsessionid(conn, isproxy, (void **)&ssl_sessionid,
347 &ssl_sessionid_len, sockindex)) {
348 /* we got a session id, use it! */
349 err = SSLSetPeerID(BACKEND->ssl_ctx, ssl_sessionid, ssl_sessionid_len);
350@@ -1944,7 +1945,7 @@ static CURLcode sectransp_connect_step1(struct connectdata *conn,
351 return CURLE_SSL_CONNECT_ERROR;
352 }
353
354- result = Curl_ssl_addsessionid(conn, ssl_sessionid, ssl_sessionid_len,
355+ result = Curl_ssl_addsessionid(conn, isproxy, ssl_sessionid, ssl_sessionid_len,
356 sockindex);
357 Curl_ssl_sessionid_unlock(conn);
358 if(result) {
359diff --git a/lib/vtls/vtls.c b/lib/vtls/vtls.c
360index dfefa1bd5..aaf73ef8f 100644
361--- a/lib/vtls/vtls.c
362+++ b/lib/vtls/vtls.c
363@@ -305,6 +305,7 @@ void Curl_ssl_sessionid_unlock(struct connectdata *conn)
364 * there's one suitable, it is provided. Returns TRUE when no entry matched.
365 */
366 bool Curl_ssl_getsessionid(struct connectdata *conn,
367+ const bool isProxy,
368 void **ssl_sessionid,
369 size_t *idsize, /* set 0 if unknown */
370 int sockindex)
371@@ -315,7 +316,6 @@ bool Curl_ssl_getsessionid(struct connectdata *conn,
372 long *general_age;
373 bool no_match = TRUE;
374
375- const bool isProxy = CONNECT_PROXY_SSL();
376 struct ssl_primary_config * const ssl_config = isProxy ?
377 &conn->proxy_ssl_config :
378 &conn->ssl_config;
379@@ -324,6 +324,11 @@ bool Curl_ssl_getsessionid(struct connectdata *conn,
380 int port = isProxy ? (int)conn->port : conn->remote_port;
381 *ssl_sessionid = NULL;
382
383+#ifdef CURL_DISABLE_PROXY
384+ if(isProxy)
385+ return TRUE;
386+#endif
387+
388 DEBUGASSERT(SSL_SET_OPTION(primary.sessionid));
389
390 if(!SSL_SET_OPTION(primary.sessionid))
391@@ -411,6 +416,7 @@ void Curl_ssl_delsessionid(struct connectdata *conn, void *ssl_sessionid)
392 * later on.
393 */
394 CURLcode Curl_ssl_addsessionid(struct connectdata *conn,
395+ bool isProxy,
396 void *ssl_sessionid,
397 size_t idsize,
398 int sockindex)
399@@ -423,7 +429,6 @@ CURLcode Curl_ssl_addsessionid(struct connectdata *conn,
400 char *clone_conn_to_host;
401 int conn_to_port;
402 long *general_age;
403- const bool isProxy = CONNECT_PROXY_SSL();
404 struct ssl_primary_config * const ssl_config = isProxy ?
405 &conn->proxy_ssl_config :
406 &conn->ssl_config;
407diff --git a/lib/vtls/vtls.h b/lib/vtls/vtls.h
408index a81b2f22d..a5e348752 100644
409--- a/lib/vtls/vtls.h
410+++ b/lib/vtls/vtls.h
411@@ -202,6 +202,7 @@ void Curl_ssl_sessionid_unlock(struct connectdata *conn);
412 * under sessionid mutex).
413 */
414 bool Curl_ssl_getsessionid(struct connectdata *conn,
415+ const bool isproxy,
416 void **ssl_sessionid,
417 size_t *idsize, /* set 0 if unknown */
418 int sockindex);
419@@ -211,6 +212,7 @@ bool Curl_ssl_getsessionid(struct connectdata *conn,
420 * object with cache (e.g. incrementing refcount on success)
421 */
422 CURLcode Curl_ssl_addsessionid(struct connectdata *conn,
423+ const bool isProxy,
424 void *ssl_sessionid,
425 size_t idsize,
426 int sockindex);
427diff --git a/lib/vtls/wolfssl.c b/lib/vtls/wolfssl.c
428index 8c2d3f4a2..dd9f907ff 100644
429--- a/lib/vtls/wolfssl.c
430+++ b/lib/vtls/wolfssl.c
431@@ -392,7 +392,8 @@ wolfssl_connect_step1(struct connectdata *conn,
432 void *ssl_sessionid = NULL;
433
434 Curl_ssl_sessionid_lock(conn);
435- if(!Curl_ssl_getsessionid(conn, &ssl_sessionid, NULL, sockindex)) {
436+ if(!Curl_ssl_getsessionid(conn, SSL_IS_PROXY() ? TRUE : FALSE,
437+ &ssl_sessionid, NULL, sockindex)) {
438 /* we got a session id, use it! */
439 if(!SSL_set_session(BACKEND->handle, ssl_sessionid)) {
440 char error_buffer[WOLFSSL_MAX_ERROR_SZ];
441@@ -618,9 +619,10 @@ wolfssl_connect_step3(struct connectdata *conn,
442 void *old_ssl_sessionid = NULL;
443
444 our_ssl_sessionid = SSL_get_session(BACKEND->handle);
445+ bool isproxy = SSL_IS_PROXY() ? TRUE : FALSE;
446
447 Curl_ssl_sessionid_lock(conn);
448- incache = !(Curl_ssl_getsessionid(conn, &old_ssl_sessionid, NULL,
449+ incache = !(Curl_ssl_getsessionid(conn, isproxy, &old_ssl_sessionid, NULL,
450 sockindex));
451 if(incache) {
452 if(old_ssl_sessionid != our_ssl_sessionid) {
453@@ -631,7 +633,7 @@ wolfssl_connect_step3(struct connectdata *conn,
454 }
455
456 if(!incache) {
457- result = Curl_ssl_addsessionid(conn, our_ssl_sessionid,
458+ result = Curl_ssl_addsessionid(conn, isproxy, our_ssl_sessionid,
459 0 /* unknown size */, sockindex);
460 if(result) {
461 Curl_ssl_sessionid_unlock(conn);
462--
4632.20.1
464
diff --git a/meta/recipes-support/curl/curl/CVE-2021-22898.patch b/meta/recipes-support/curl/curl/CVE-2021-22898.patch
new file mode 100644
index 0000000000..0800e10175
--- /dev/null
+++ b/meta/recipes-support/curl/curl/CVE-2021-22898.patch
@@ -0,0 +1,26 @@
1From 39ce47f219b09c380b81f89fe54ac586c8db6bde Mon Sep 17 00:00:00 2001
2From: Harry Sintonen <sintonen@iki.fi>
3Date: Fri, 7 May 2021 13:09:57 +0200
4Subject: [PATCH] telnet: check sscanf() for correct number of matches
5
6CVE: CVE-2021-22898
7Upstream-Status: Backport
8Link: https://github.com/curl/curl/commit/39ce47f219b09c380b81f89fe54ac586c8db6bde
9Bug: https://curl.se/docs/CVE-2021-22898.html
10---
11 lib/telnet.c | 2 +-
12 1 file changed, 1 insertion(+), 1 deletion(-)
13
14diff --git a/lib/telnet.c b/lib/telnet.c
15index 26e0658ba9cc..fdd137fb0c04 100644
16--- a/lib/telnet.c
17+++ b/lib/telnet.c
18@@ -922,7 +922,7 @@ static void suboption(struct Curl_easy *data)
19 size_t tmplen = (strlen(v->data) + 1);
20 /* Add the variable only if it fits */
21 if(len + tmplen < (int)sizeof(temp)-6) {
22- if(sscanf(v->data, "%127[^,],%127s", varname, varval)) {
23+ if(sscanf(v->data, "%127[^,],%127s", varname, varval) == 2) {
24 msnprintf((char *)&temp[len], sizeof(temp) - len,
25 "%c%s%c%s", CURL_NEW_ENV_VAR, varname,
26 CURL_NEW_ENV_VALUE, varval);
diff --git a/meta/recipes-support/curl/curl/CVE-2021-22924.patch b/meta/recipes-support/curl/curl/CVE-2021-22924.patch
new file mode 100644
index 0000000000..68fde45ddf
--- /dev/null
+++ b/meta/recipes-support/curl/curl/CVE-2021-22924.patch
@@ -0,0 +1,226 @@
1Subject: [PATCH] vtls: fix connection reuse checks for issuer cert and
2 case sensitivity CVE-2021-22924
3
4Reported-by: Harry Sintonen
5Bug: https://curl.se/docs/CVE-2021-22924.html
6CVE: CVE-2021-22924
7Upstream-Status: backport from Ubuntu curl_7.68.0-1ubuntu2.6
8Signed-off-by: Mike Crowe <mac@mcrowe.com>
9---
10 lib/url.c | 5 +++--
11 lib/urldata.h | 2 +-
12 lib/vtls/gtls.c | 10 +++++-----
13 lib/vtls/nss.c | 4 ++--
14 lib/vtls/openssl.c | 12 ++++++------
15 lib/vtls/vtls.c | 23 ++++++++++++++++++-----
16 6 files changed, 35 insertions(+), 21 deletions(-)
17
18diff --git a/lib/url.c b/lib/url.c
19index 47fc66aed..eebad8d32 100644
20--- a/lib/url.c
21+++ b/lib/url.c
22@@ -3555,6 +3555,9 @@ static CURLcode create_conn(struct Curl_easy *data,
23 data->set.proxy_ssl.primary.CApath = data->set.str[STRING_SSL_CAPATH_PROXY];
24 data->set.ssl.primary.CAfile = data->set.str[STRING_SSL_CAFILE_ORIG];
25 data->set.proxy_ssl.primary.CAfile = data->set.str[STRING_SSL_CAFILE_PROXY];
26+ data->set.ssl.primary.issuercert = data->set.str[STRING_SSL_ISSUERCERT_ORIG];
27+ data->set.proxy_ssl.primary.issuercert =
28+ data->set.str[STRING_SSL_ISSUERCERT_PROXY];
29 data->set.ssl.primary.random_file = data->set.str[STRING_SSL_RANDOM_FILE];
30 data->set.proxy_ssl.primary.random_file =
31 data->set.str[STRING_SSL_RANDOM_FILE];
32@@ -3575,8 +3578,6 @@ static CURLcode create_conn(struct Curl_easy *data,
33
34 data->set.ssl.CRLfile = data->set.str[STRING_SSL_CRLFILE_ORIG];
35 data->set.proxy_ssl.CRLfile = data->set.str[STRING_SSL_CRLFILE_PROXY];
36- data->set.ssl.issuercert = data->set.str[STRING_SSL_ISSUERCERT_ORIG];
37- data->set.proxy_ssl.issuercert = data->set.str[STRING_SSL_ISSUERCERT_PROXY];
38 data->set.ssl.cert = data->set.str[STRING_CERT_ORIG];
39 data->set.proxy_ssl.cert = data->set.str[STRING_CERT_PROXY];
40 data->set.ssl.cert_type = data->set.str[STRING_CERT_TYPE_ORIG];
41diff --git a/lib/urldata.h b/lib/urldata.h
42index fbb8b645e..615fbf369 100644
43--- a/lib/urldata.h
44+++ b/lib/urldata.h
45@@ -224,6 +224,7 @@ struct ssl_primary_config {
46 long version_max; /* max supported version the client wants to use*/
47 char *CApath; /* certificate dir (doesn't work on windows) */
48 char *CAfile; /* certificate to verify peer against */
49+ char *issuercert; /* optional issuer certificate filename */
50 char *clientcert;
51 char *random_file; /* path to file containing "random" data */
52 char *egdsocket; /* path to file containing the EGD daemon socket */
53@@ -240,7 +241,6 @@ struct ssl_config_data {
54 struct ssl_primary_config primary;
55 long certverifyresult; /* result from the certificate verification */
56 char *CRLfile; /* CRL to check certificate revocation */
57- char *issuercert;/* optional issuer certificate filename */
58 curl_ssl_ctx_callback fsslctx; /* function to initialize ssl ctx */
59 void *fsslctxp; /* parameter for call back */
60 char *cert; /* client certificate file name */
61diff --git a/lib/vtls/gtls.c b/lib/vtls/gtls.c
62index 46e149c7d..8c051024f 100644
63--- a/lib/vtls/gtls.c
64+++ b/lib/vtls/gtls.c
65@@ -1059,7 +1059,7 @@ gtls_connect_step3(struct connectdata *conn,
66 if(!chainp) {
67 if(SSL_CONN_CONFIG(verifypeer) ||
68 SSL_CONN_CONFIG(verifyhost) ||
69- SSL_SET_OPTION(issuercert)) {
70+ SSL_CONN_CONFIG(issuercert)) {
71 #ifdef USE_TLS_SRP
72 if(SSL_SET_OPTION(authtype) == CURL_TLSAUTH_SRP
73 && SSL_SET_OPTION(username) != NULL
74@@ -1241,21 +1241,21 @@ gtls_connect_step3(struct connectdata *conn,
75 gnutls_x509_crt_t format */
76 gnutls_x509_crt_import(x509_cert, chainp, GNUTLS_X509_FMT_DER);
77
78- if(SSL_SET_OPTION(issuercert)) {
79+ if(SSL_CONN_CONFIG(issuercert)) {
80 gnutls_x509_crt_init(&x509_issuer);
81- issuerp = load_file(SSL_SET_OPTION(issuercert));
82+ issuerp = load_file(SSL_CONN_CONFIG(issuercert));
83 gnutls_x509_crt_import(x509_issuer, &issuerp, GNUTLS_X509_FMT_PEM);
84 rc = gnutls_x509_crt_check_issuer(x509_cert, x509_issuer);
85 gnutls_x509_crt_deinit(x509_issuer);
86 unload_file(issuerp);
87 if(rc <= 0) {
88 failf(data, "server certificate issuer check failed (IssuerCert: %s)",
89- SSL_SET_OPTION(issuercert)?SSL_SET_OPTION(issuercert):"none");
90+ SSL_CONN_CONFIG(issuercert)?SSL_CONN_CONFIG(issuercert):"none");
91 gnutls_x509_crt_deinit(x509_cert);
92 return CURLE_SSL_ISSUER_ERROR;
93 }
94 infof(data, "\t server certificate issuer check OK (Issuer Cert: %s)\n",
95- SSL_SET_OPTION(issuercert)?SSL_SET_OPTION(issuercert):"none");
96+ SSL_CONN_CONFIG(issuercert)?SSL_CONN_CONFIG(issuercert):"none");
97 }
98
99 size = sizeof(certbuf);
100diff --git a/lib/vtls/nss.c b/lib/vtls/nss.c
101index ef51b0d91..375c78b1b 100644
102--- a/lib/vtls/nss.c
103+++ b/lib/vtls/nss.c
104@@ -2151,9 +2151,9 @@ static CURLcode nss_do_connect(struct connectdata *conn, int sockindex)
105 if(result)
106 goto error;
107
108- if(SSL_SET_OPTION(issuercert)) {
109+ if(SSL_CONN_CONFIG(issuercert)) {
110 SECStatus ret = SECFailure;
111- char *nickname = dup_nickname(data, SSL_SET_OPTION(issuercert));
112+ char *nickname = dup_nickname(data, SSL_CONN_CONFIG(issuercert));
113 if(nickname) {
114 /* we support only nicknames in case of issuercert for now */
115 ret = check_issuer_cert(BACKEND->handle, nickname);
116diff --git a/lib/vtls/openssl.c b/lib/vtls/openssl.c
117index 64f43605a..7e81fd3a0 100644
118--- a/lib/vtls/openssl.c
119+++ b/lib/vtls/openssl.c
120@@ -3547,7 +3547,7 @@ static CURLcode servercert(struct connectdata *conn,
121 deallocating the certificate. */
122
123 /* e.g. match issuer name with provided issuer certificate */
124- if(SSL_SET_OPTION(issuercert)) {
125+ if(SSL_CONN_CONFIG(issuercert)) {
126 fp = BIO_new(BIO_s_file());
127 if(fp == NULL) {
128 failf(data,
129@@ -3560,10 +3560,10 @@ static CURLcode servercert(struct connectdata *conn,
130 return CURLE_OUT_OF_MEMORY;
131 }
132
133- if(BIO_read_filename(fp, SSL_SET_OPTION(issuercert)) <= 0) {
134+ if(BIO_read_filename(fp, SSL_CONN_CONFIG(issuercert)) <= 0) {
135 if(strict)
136 failf(data, "SSL: Unable to open issuer cert (%s)",
137- SSL_SET_OPTION(issuercert));
138+ SSL_CONN_CONFIG(issuercert));
139 BIO_free(fp);
140 X509_free(BACKEND->server_cert);
141 BACKEND->server_cert = NULL;
142@@ -3574,7 +3574,7 @@ static CURLcode servercert(struct connectdata *conn,
143 if(!issuer) {
144 if(strict)
145 failf(data, "SSL: Unable to read issuer cert (%s)",
146- SSL_SET_OPTION(issuercert));
147+ SSL_CONN_CONFIG(issuercert));
148 BIO_free(fp);
149 X509_free(issuer);
150 X509_free(BACKEND->server_cert);
151@@ -3585,7 +3585,7 @@ static CURLcode servercert(struct connectdata *conn,
152 if(X509_check_issued(issuer, BACKEND->server_cert) != X509_V_OK) {
153 if(strict)
154 failf(data, "SSL: Certificate issuer check failed (%s)",
155- SSL_SET_OPTION(issuercert));
156+ SSL_CONN_CONFIG(issuercert));
157 BIO_free(fp);
158 X509_free(issuer);
159 X509_free(BACKEND->server_cert);
160@@ -3594,7 +3594,7 @@ static CURLcode servercert(struct connectdata *conn,
161 }
162
163 infof(data, " SSL certificate issuer check ok (%s)\n",
164- SSL_SET_OPTION(issuercert));
165+ SSL_CONN_CONFIG(issuercert));
166 BIO_free(fp);
167 X509_free(issuer);
168 }
169diff --git a/lib/vtls/vtls.c b/lib/vtls/vtls.c
170index aaf73ef8f..8c681da14 100644
171--- a/lib/vtls/vtls.c
172+++ b/lib/vtls/vtls.c
173@@ -82,6 +82,16 @@
174 else \
175 dest->var = NULL;
176
177+static bool safecmp(char *a, char *b)
178+{
179+ if(a && b)
180+ return !strcmp(a, b);
181+ else if(!a && !b)
182+ return TRUE; /* match */
183+ return FALSE; /* no match */
184+}
185+
186+
187 bool
188 Curl_ssl_config_matches(struct ssl_primary_config* data,
189 struct ssl_primary_config* needle)
190@@ -91,11 +101,12 @@ Curl_ssl_config_matches(struct ssl_primary_config* data,
191 (data->verifypeer == needle->verifypeer) &&
192 (data->verifyhost == needle->verifyhost) &&
193 (data->verifystatus == needle->verifystatus) &&
194- Curl_safe_strcasecompare(data->CApath, needle->CApath) &&
195- Curl_safe_strcasecompare(data->CAfile, needle->CAfile) &&
196- Curl_safe_strcasecompare(data->clientcert, needle->clientcert) &&
197- Curl_safe_strcasecompare(data->random_file, needle->random_file) &&
198- Curl_safe_strcasecompare(data->egdsocket, needle->egdsocket) &&
199+ safecmp(data->CApath, needle->CApath) &&
200+ safecmp(data->CAfile, needle->CAfile) &&
201+ safecmp(data->issuercert, needle->issuercert) &&
202+ safecmp(data->clientcert, needle->clientcert) &&
203+ safecmp(data->random_file, needle->random_file) &&
204+ safecmp(data->egdsocket, needle->egdsocket) &&
205 Curl_safe_strcasecompare(data->cipher_list, needle->cipher_list) &&
206 Curl_safe_strcasecompare(data->cipher_list13, needle->cipher_list13) &&
207 Curl_safe_strcasecompare(data->pinned_key, needle->pinned_key))
208@@ -117,6 +128,7 @@ Curl_clone_primary_ssl_config(struct ssl_primary_config *source,
209
210 CLONE_STRING(CApath);
211 CLONE_STRING(CAfile);
212+ CLONE_STRING(issuercert);
213 CLONE_STRING(clientcert);
214 CLONE_STRING(random_file);
215 CLONE_STRING(egdsocket);
216@@ -131,6 +143,7 @@ void Curl_free_primary_ssl_config(struct ssl_primary_config* sslc)
217 {
218 Curl_safefree(sslc->CApath);
219 Curl_safefree(sslc->CAfile);
220+ Curl_safefree(sslc->issuercert);
221 Curl_safefree(sslc->clientcert);
222 Curl_safefree(sslc->random_file);
223 Curl_safefree(sslc->egdsocket);
224--
2252.30.2
226
diff --git a/meta/recipes-support/curl/curl/CVE-2021-22925.patch b/meta/recipes-support/curl/curl/CVE-2021-22925.patch
new file mode 100644
index 0000000000..13b55f76be
--- /dev/null
+++ b/meta/recipes-support/curl/curl/CVE-2021-22925.patch
@@ -0,0 +1,43 @@
1Subject: [PATCH] telnet: fix option parser to not send uninitialized
2 contents CVE-2021-22925
3
4Reported-by: Red Hat Product Security
5Bug: https://curl.se/docs/CVE-2021-22925.html
6CVE: CVE-2021-22925
7Upstream-Status: backport from Ubuntu curl_7.68.0-1ubuntu2.6
8Signed-off-by: Mike Crowe <mac@mcrowe.com>
9---
10 lib/telnet.c | 17 +++++++++++------
11 1 file changed, 11 insertions(+), 6 deletions(-)
12
13diff --git a/lib/telnet.c b/lib/telnet.c
14index 4bf4c652c..3347ad6d1 100644
15--- a/lib/telnet.c
16+++ b/lib/telnet.c
17@@ -967,12 +967,17 @@ static void suboption(struct connectdata *conn)
18 size_t tmplen = (strlen(v->data) + 1);
19 /* Add the variable only if it fits */
20 if(len + tmplen < (int)sizeof(temp)-6) {
21- if(sscanf(v->data, "%127[^,],%127s", varname, varval) == 2) {
22- msnprintf((char *)&temp[len], sizeof(temp) - len,
23- "%c%s%c%s", CURL_NEW_ENV_VAR, varname,
24- CURL_NEW_ENV_VALUE, varval);
25- len += tmplen;
26- }
27+ int rv;
28+ char sep[2] = "";
29+ varval[0] = 0;
30+ rv = sscanf(v->data, "%127[^,]%1[,]%127s", varname, sep, varval);
31+ if(rv == 1)
32+ len += msnprintf((char *)&temp[len], sizeof(temp) - len,
33+ "%c%s", CURL_NEW_ENV_VAR, varname);
34+ else if(rv >= 2)
35+ len += msnprintf((char *)&temp[len], sizeof(temp) - len,
36+ "%c%s%c%s", CURL_NEW_ENV_VAR, varname,
37+ CURL_NEW_ENV_VALUE, varval);
38 }
39 }
40 msnprintf((char *)&temp[len], sizeof(temp) - len,
41--
422.30.2
43
diff --git a/meta/recipes-support/curl/curl/CVE-2021-22946-pre1.patch b/meta/recipes-support/curl/curl/CVE-2021-22946-pre1.patch
new file mode 100644
index 0000000000..4afd755149
--- /dev/null
+++ b/meta/recipes-support/curl/curl/CVE-2021-22946-pre1.patch
@@ -0,0 +1,86 @@
1Backport of:
2
3From 1397a7de6e312e019a3b339f855ba0a5cafa9127 Mon Sep 17 00:00:00 2001
4From: Daniel Stenberg <daniel@haxx.se>
5Date: Mon, 21 Sep 2020 09:15:51 +0200
6Subject: [PATCH] ftp: separate FTPS from FTP over "HTTPS proxy"
7
8When using HTTPS proxy, SSL is used but not in the view of the FTP
9protocol handler itself so separate the connection's use of SSL from the
10FTP control connection's sue.
11
12Reported-by: Mingtao Yang
13Fixes #5523
14Closes #6006
15
16Upstream-Status: backport from 7.68.0-1ubuntu2.7
17Signed-off-by: Mike Crowe <mac@mcrowe.com>
18---
19 lib/ftp.c | 13 ++++++-------
20 lib/urldata.h | 1 +
21 2 files changed, 7 insertions(+), 7 deletions(-)
22
23diff --git a/lib/ftp.c b/lib/ftp.c
24index 3382772..677527f 100644
25--- a/lib/ftp.c
26+++ b/lib/ftp.c
27@@ -2488,7 +2488,7 @@ static CURLcode ftp_state_loggedin(struct connectdata *conn)
28 {
29 CURLcode result = CURLE_OK;
30
31- if(conn->ssl[FIRSTSOCKET].use) {
32+ if(conn->bits.ftp_use_control_ssl) {
33 /* PBSZ = PROTECTION BUFFER SIZE.
34
35 The 'draft-murray-auth-ftp-ssl' (draft 12, page 7) says:
36@@ -2633,11 +2633,8 @@ static CURLcode ftp_statemach_act(struct connectdata *conn)
37 }
38 #endif
39
40- if(data->set.use_ssl &&
41- (!conn->ssl[FIRSTSOCKET].use ||
42- (conn->bits.proxy_ssl_connected[FIRSTSOCKET] &&
43- !conn->proxy_ssl[FIRSTSOCKET].use))) {
44- /* We don't have a SSL/TLS connection yet, but FTPS is
45+ if(data->set.use_ssl && !conn->bits.ftp_use_control_ssl) {
46+ /* We don't have a SSL/TLS control connection yet, but FTPS is
47 requested. Try a FTPS connection now */
48
49 ftpc->count3 = 0;
50@@ -2682,6 +2679,7 @@ static CURLcode ftp_statemach_act(struct connectdata *conn)
51 result = Curl_ssl_connect(conn, FIRSTSOCKET);
52 if(!result) {
53 conn->bits.ftp_use_data_ssl = FALSE; /* clear-text data */
54+ conn->bits.ftp_use_control_ssl = TRUE; /* SSL on control */
55 result = ftp_state_user(conn);
56 }
57 }
58@@ -3072,7 +3070,7 @@ static CURLcode ftp_block_statemach(struct connectdata *conn)
59 *
60 */
61 static CURLcode ftp_connect(struct connectdata *conn,
62- bool *done) /* see description above */
63+ bool *done) /* see description above */
64 {
65 CURLcode result;
66 struct ftp_conn *ftpc = &conn->proto.ftpc;
67@@ -3093,6 +3091,7 @@ static CURLcode ftp_connect(struct connectdata *conn,
68 result = Curl_ssl_connect(conn, FIRSTSOCKET);
69 if(result)
70 return result;
71+ conn->bits.ftp_use_control_ssl = TRUE;
72 }
73
74 Curl_pp_init(pp); /* init the generic pingpong data */
75diff --git a/lib/urldata.h b/lib/urldata.h
76index ff2d686..d1fb4a9 100644
77--- a/lib/urldata.h
78+++ b/lib/urldata.h
79@@ -461,6 +461,7 @@ struct ConnectBits {
80 EPRT doesn't work we disable it for the forthcoming
81 requests */
82 BIT(ftp_use_data_ssl); /* Enabled SSL for the data connection */
83+ BIT(ftp_use_control_ssl); /* Enabled SSL for the control connection */
84 #endif
85 BIT(netrc); /* name+password provided by netrc */
86 BIT(userpwd_in_url); /* name+password found in url */
diff --git a/meta/recipes-support/curl/curl/CVE-2021-22946.patch b/meta/recipes-support/curl/curl/CVE-2021-22946.patch
new file mode 100644
index 0000000000..98032d8b78
--- /dev/null
+++ b/meta/recipes-support/curl/curl/CVE-2021-22946.patch
@@ -0,0 +1,328 @@
1Backport of:
2
3From 96d71feb27e533a8b337512841a537952916262c Mon Sep 17 00:00:00 2001
4From: Patrick Monnerat <patrick@monnerat.net>
5Date: Wed, 8 Sep 2021 11:56:22 +0200
6Subject: [PATCH] ftp,imap,pop3: do not ignore --ssl-reqd
7
8In imap and pop3, check if TLS is required even when capabilities
9request has failed.
10
11In ftp, ignore preauthentication (230 status of server greeting) if TLS
12is required.
13
14Bug: https://curl.se/docs/CVE-2021-22946.html
15Upstream-Status: backport from 7.68.0-1ubuntu2.7
16Signed-off-by: Mike Crowe <mac@mcrowe.com>
17CVE: CVE-2021-22946
18---
19 lib/ftp.c | 9 ++++---
20 lib/imap.c | 24 ++++++++----------
21 lib/pop3.c | 33 +++++++++++-------------
22 tests/data/Makefile.inc | 2 ++
23 tests/data/test984 | 56 +++++++++++++++++++++++++++++++++++++++++
24 tests/data/test985 | 54 +++++++++++++++++++++++++++++++++++++++
25 tests/data/test986 | 53 ++++++++++++++++++++++++++++++++++++++
26 7 files changed, 195 insertions(+), 36 deletions(-)
27 create mode 100644 tests/data/test984
28 create mode 100644 tests/data/test985
29 create mode 100644 tests/data/test986
30
31diff --git a/lib/ftp.c b/lib/ftp.c
32index 677527f..91b43d8 100644
33--- a/lib/ftp.c
34+++ b/lib/ftp.c
35@@ -2606,9 +2606,12 @@ static CURLcode ftp_statemach_act(struct connectdata *conn)
36 /* we have now received a full FTP server response */
37 switch(ftpc->state) {
38 case FTP_WAIT220:
39- if(ftpcode == 230)
40- /* 230 User logged in - already! */
41- return ftp_state_user_resp(conn, ftpcode, ftpc->state);
42+ if(ftpcode == 230) {
43+ /* 230 User logged in - already! Take as 220 if TLS required. */
44+ if(data->set.use_ssl <= CURLUSESSL_TRY ||
45+ conn->bits.ftp_use_control_ssl)
46+ return ftp_state_user_resp(conn, ftpcode, ftpc->state);
47+ }
48 else if(ftpcode != 220) {
49 failf(data, "Got a %03d ftp-server response when 220 was expected",
50 ftpcode);
51diff --git a/lib/imap.c b/lib/imap.c
52index 66172bd..9880ce1 100644
53--- a/lib/imap.c
54+++ b/lib/imap.c
55@@ -917,22 +917,18 @@ static CURLcode imap_state_capability_resp(struct connectdata *conn,
56 line += wordlen;
57 }
58 }
59- else if(imapcode == IMAP_RESP_OK) {
60- if(data->set.use_ssl && !conn->ssl[FIRSTSOCKET].use) {
61- /* We don't have a SSL/TLS connection yet, but SSL is requested */
62- if(imapc->tls_supported)
63- /* Switch to TLS connection now */
64- result = imap_perform_starttls(conn);
65- else if(data->set.use_ssl == CURLUSESSL_TRY)
66- /* Fallback and carry on with authentication */
67- result = imap_perform_authentication(conn);
68- else {
69- failf(data, "STARTTLS not supported.");
70- result = CURLE_USE_SSL_FAILED;
71- }
72+ else if(data->set.use_ssl && !conn->ssl[FIRSTSOCKET].use) {
73+ /* PREAUTH is not compatible with STARTTLS. */
74+ if(imapcode == IMAP_RESP_OK && imapc->tls_supported && !imapc->preauth) {
75+ /* Switch to TLS connection now */
76+ result = imap_perform_starttls(conn);
77 }
78- else
79+ else if(data->set.use_ssl <= CURLUSESSL_TRY)
80 result = imap_perform_authentication(conn);
81+ else {
82+ failf(data, "STARTTLS not available.");
83+ result = CURLE_USE_SSL_FAILED;
84+ }
85 }
86 else
87 result = imap_perform_authentication(conn);
88diff --git a/lib/pop3.c b/lib/pop3.c
89index 57c1373..145b2b4 100644
90--- a/lib/pop3.c
91+++ b/lib/pop3.c
92@@ -721,28 +721,23 @@ static CURLcode pop3_state_capa_resp(struct connectdata *conn, int pop3code,
93 }
94 }
95 }
96- else if(pop3code == '+') {
97- if(data->set.use_ssl && !conn->ssl[FIRSTSOCKET].use) {
98- /* We don't have a SSL/TLS connection yet, but SSL is requested */
99- if(pop3c->tls_supported)
100- /* Switch to TLS connection now */
101- result = pop3_perform_starttls(conn);
102- else if(data->set.use_ssl == CURLUSESSL_TRY)
103- /* Fallback and carry on with authentication */
104- result = pop3_perform_authentication(conn);
105- else {
106- failf(data, "STLS not supported.");
107- result = CURLE_USE_SSL_FAILED;
108- }
109- }
110- else
111- result = pop3_perform_authentication(conn);
112- }
113 else {
114 /* Clear text is supported when CAPA isn't recognised */
115- pop3c->authtypes |= POP3_TYPE_CLEARTEXT;
116+ if(pop3code != '+')
117+ pop3c->authtypes |= POP3_TYPE_CLEARTEXT;
118
119- result = pop3_perform_authentication(conn);
120+ if(!data->set.use_ssl || conn->ssl[FIRSTSOCKET].use)
121+ result = pop3_perform_authentication(conn);
122+ else if(pop3code == '+' && pop3c->tls_supported)
123+ /* Switch to TLS connection now */
124+ result = pop3_perform_starttls(conn);
125+ else if(data->set.use_ssl <= CURLUSESSL_TRY)
126+ /* Fallback and carry on with authentication */
127+ result = pop3_perform_authentication(conn);
128+ else {
129+ failf(data, "STLS not supported.");
130+ result = CURLE_USE_SSL_FAILED;
131+ }
132 }
133
134 return result;
135diff --git a/tests/data/Makefile.inc b/tests/data/Makefile.inc
136index f9535a6..0fa6799 100644
137--- a/tests/data/Makefile.inc
138+++ b/tests/data/Makefile.inc
139@@ -112,6 +112,8 @@ test945 test946 test947 test948 test949 test950 test951 test952 test953 \
140 test954 test955 test956 test957 test958 test959 test960 test961 test962 \
141 test963 test964 test965 test966 test967 test968 test969 \
142 \
143+test984 test985 test986 \
144+\
145 test1000 test1001 test1002 test1003 test1004 test1005 test1006 test1007 \
146 test1008 test1009 test1010 test1011 test1012 test1013 test1014 test1015 \
147 test1016 test1017 test1018 test1019 test1020 test1021 test1022 test1023 \
148diff --git a/tests/data/test984 b/tests/data/test984
149new file mode 100644
150index 0000000..e573f23
151--- /dev/null
152+++ b/tests/data/test984
153@@ -0,0 +1,56 @@
154+<testcase>
155+<info>
156+<keywords>
157+IMAP
158+STARTTLS
159+</keywords>
160+</info>
161+
162+#
163+# Server-side
164+<reply>
165+<servercmd>
166+REPLY CAPABILITY A001 BAD Not implemented
167+</servercmd>
168+</reply>
169+
170+#
171+# Client-side
172+<client>
173+<features>
174+SSL
175+</features>
176+<server>
177+imap
178+</server>
179+ <name>
180+IMAP require STARTTLS with failing capabilities
181+ </name>
182+ <command>
183+imap://%HOSTIP:%IMAPPORT/%TESTNUMBER -T log/upload%TESTNUMBER -u user:secret --ssl-reqd
184+</command>
185+<file name="log/upload%TESTNUMBER">
186+Date: Mon, 7 Feb 1994 21:52:25 -0800 (PST)
187+From: Fred Foobar <foobar@example.COM>
188+Subject: afternoon meeting
189+To: joe@example.com
190+Message-Id: <B27397-0100000@example.COM>
191+MIME-Version: 1.0
192+Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
193+
194+Hello Joe, do you think we can meet at 3:30 tomorrow?
195+</file>
196+</client>
197+
198+#
199+# Verify data after the test has been "shot"
200+<verify>
201+# 64 is CURLE_USE_SSL_FAILED
202+<errorcode>
203+64
204+</errorcode>
205+<protocol>
206+A001 CAPABILITY
207+</protocol>
208+</verify>
209+</testcase>
210diff --git a/tests/data/test985 b/tests/data/test985
211new file mode 100644
212index 0000000..d0db4aa
213--- /dev/null
214+++ b/tests/data/test985
215@@ -0,0 +1,54 @@
216+<testcase>
217+<info>
218+<keywords>
219+POP3
220+STARTTLS
221+</keywords>
222+</info>
223+
224+#
225+# Server-side
226+<reply>
227+<servercmd>
228+REPLY CAPA -ERR Not implemented
229+</servercmd>
230+<data nocheck="yes">
231+From: me@somewhere
232+To: fake@nowhere
233+
234+body
235+
236+--
237+ yours sincerely
238+</data>
239+</reply>
240+
241+#
242+# Client-side
243+<client>
244+<features>
245+SSL
246+</features>
247+<server>
248+pop3
249+</server>
250+ <name>
251+POP3 require STARTTLS with failing capabilities
252+ </name>
253+ <command>
254+pop3://%HOSTIP:%POP3PORT/%TESTNUMBER -u user:secret --ssl-reqd
255+ </command>
256+</client>
257+
258+#
259+# Verify data after the test has been "shot"
260+<verify>
261+# 64 is CURLE_USE_SSL_FAILED
262+<errorcode>
263+64
264+</errorcode>
265+<protocol>
266+CAPA
267+</protocol>
268+</verify>
269+</testcase>
270diff --git a/tests/data/test986 b/tests/data/test986
271new file mode 100644
272index 0000000..a709437
273--- /dev/null
274+++ b/tests/data/test986
275@@ -0,0 +1,53 @@
276+<testcase>
277+<info>
278+<keywords>
279+FTP
280+STARTTLS
281+</keywords>
282+</info>
283+
284+#
285+# Server-side
286+<reply>
287+<servercmd>
288+REPLY welcome 230 Welcome
289+REPLY AUTH 500 unknown command
290+</servercmd>
291+</reply>
292+
293+# Client-side
294+<client>
295+<features>
296+SSL
297+</features>
298+<server>
299+ftp
300+</server>
301+ <name>
302+FTP require STARTTLS while preauthenticated
303+ </name>
304+<file name="log/test%TESTNUMBER.txt">
305+data
306+ to
307+ see
308+that FTPS
309+works
310+ so does it?
311+</file>
312+ <command>
313+--ssl-reqd --ftp-ssl-control ftp://%HOSTIP:%FTPPORT/%TESTNUMBER -T log/test%TESTNUMBER.txt -u user:secret
314+</command>
315+</client>
316+
317+# Verify data after the test has been "shot"
318+<verify>
319+# 64 is CURLE_USE_SSL_FAILED
320+<errorcode>
321+64
322+</errorcode>
323+<protocol>
324+AUTH SSL
325+AUTH TLS
326+</protocol>
327+</verify>
328+</testcase>
diff --git a/meta/recipes-support/curl/curl/CVE-2021-22947.patch b/meta/recipes-support/curl/curl/CVE-2021-22947.patch
new file mode 100644
index 0000000000..070a328e27
--- /dev/null
+++ b/meta/recipes-support/curl/curl/CVE-2021-22947.patch
@@ -0,0 +1,352 @@
1Backport of:
2
3From 259b4f2e1fd01fbc55e569ee0a507afeae34f77c Mon Sep 17 00:00:00 2001
4From: Patrick Monnerat <patrick@monnerat.net>
5Date: Tue, 7 Sep 2021 13:26:42 +0200
6Subject: [PATCH] ftp,imap,pop3,smtp: reject STARTTLS server response
7 pipelining
8
9If a server pipelines future responses within the STARTTLS response, the
10former are preserved in the pingpong cache across TLS negotiation and
11used as responses to the encrypted commands.
12
13This fix detects pipelined STARTTLS responses and rejects them with an
14error.
15
16Bug: https://curl.se/docs/CVE-2021-22947.html
17Upstream-Status: backport from 7.68.0-1ubuntu2.7
18Signed-off-by: Mike Crowe <mac@mcrowe.com>
19CVE: CVE-2021-22947
20
21---
22 lib/ftp.c | 3 +++
23 lib/imap.c | 4 +++
24 lib/pop3.c | 4 +++
25 lib/smtp.c | 4 +++
26 tests/data/Makefile.inc | 2 ++
27 tests/data/test980 | 52 ++++++++++++++++++++++++++++++++++++
28 tests/data/test981 | 59 +++++++++++++++++++++++++++++++++++++++++
29 tests/data/test982 | 57 +++++++++++++++++++++++++++++++++++++++
30 tests/data/test983 | 52 ++++++++++++++++++++++++++++++++++++
31 9 files changed, 237 insertions(+)
32 create mode 100644 tests/data/test980
33 create mode 100644 tests/data/test981
34 create mode 100644 tests/data/test982
35 create mode 100644 tests/data/test983
36
37diff --git a/lib/ftp.c b/lib/ftp.c
38index 91b43d8..31a34e8 100644
39--- a/lib/ftp.c
40+++ b/lib/ftp.c
41@@ -2670,6 +2670,9 @@ static CURLcode ftp_statemach_act(struct connectdata *conn)
42 case FTP_AUTH:
43 /* we have gotten the response to a previous AUTH command */
44
45+ if(pp->cache_size)
46+ return CURLE_WEIRD_SERVER_REPLY; /* Forbid pipelining in response. */
47+
48 /* RFC2228 (page 5) says:
49 *
50 * If the server is willing to accept the named security mechanism,
51diff --git a/lib/imap.c b/lib/imap.c
52index 9880ce1..0ca700f 100644
53--- a/lib/imap.c
54+++ b/lib/imap.c
55@@ -946,6 +946,10 @@ static CURLcode imap_state_starttls_resp(struct connectdata *conn,
56
57 (void)instate; /* no use for this yet */
58
59+ /* Pipelining in response is forbidden. */
60+ if(data->conn->proto.imapc.pp.cache_size)
61+ return CURLE_WEIRD_SERVER_REPLY;
62+
63 if(imapcode != IMAP_RESP_OK) {
64 if(data->set.use_ssl != CURLUSESSL_TRY) {
65 failf(data, "STARTTLS denied");
66diff --git a/lib/pop3.c b/lib/pop3.c
67index 145b2b4..8a2d52e 100644
68--- a/lib/pop3.c
69+++ b/lib/pop3.c
70@@ -753,6 +753,10 @@ static CURLcode pop3_state_starttls_resp(struct connectdata *conn,
71
72 (void)instate; /* no use for this yet */
73
74+ /* Pipelining in response is forbidden. */
75+ if(data->conn->proto.pop3c.pp.cache_size)
76+ return CURLE_WEIRD_SERVER_REPLY;
77+
78 if(pop3code != '+') {
79 if(data->set.use_ssl != CURLUSESSL_TRY) {
80 failf(data, "STARTTLS denied");
81diff --git a/lib/smtp.c b/lib/smtp.c
82index e187287..66183e2 100644
83--- a/lib/smtp.c
84+++ b/lib/smtp.c
85@@ -820,6 +820,10 @@ static CURLcode smtp_state_starttls_resp(struct connectdata *conn,
86
87 (void)instate; /* no use for this yet */
88
89+ /* Pipelining in response is forbidden. */
90+ if(data->conn->proto.smtpc.pp.cache_size)
91+ return CURLE_WEIRD_SERVER_REPLY;
92+
93 if(smtpcode != 220) {
94 if(data->set.use_ssl != CURLUSESSL_TRY) {
95 failf(data, "STARTTLS denied, code %d", smtpcode);
96diff --git a/tests/data/Makefile.inc b/tests/data/Makefile.inc
97index 0fa6799..60e8176 100644
98--- a/tests/data/Makefile.inc
99+++ b/tests/data/Makefile.inc
100@@ -112,6 +112,8 @@ test945 test946 test947 test948 test949 test950 test951 test952 test953 \
101 test954 test955 test956 test957 test958 test959 test960 test961 test962 \
102 test963 test964 test965 test966 test967 test968 test969 \
103 \
104+test980 test981 test982 test983 \
105+\
106 test984 test985 test986 \
107 \
108 test1000 test1001 test1002 test1003 test1004 test1005 test1006 test1007 \
109diff --git a/tests/data/test980 b/tests/data/test980
110new file mode 100644
111index 0000000..97567f8
112--- /dev/null
113+++ b/tests/data/test980
114@@ -0,0 +1,52 @@
115+<testcase>
116+<info>
117+<keywords>
118+SMTP
119+STARTTLS
120+</keywords>
121+</info>
122+
123+#
124+# Server-side
125+<reply>
126+<servercmd>
127+CAPA STARTTLS
128+AUTH PLAIN
129+REPLY STARTTLS 454 currently unavailable\r\n235 Authenticated\r\n250 2.1.0 Sender ok\r\n250 2.1.5 Recipient ok\r\n354 Enter mail\r\n250 2.0.0 Accepted
130+REPLY AUTH 535 5.7.8 Authentication credentials invalid
131+</servercmd>
132+</reply>
133+
134+#
135+# Client-side
136+<client>
137+<features>
138+SSL
139+</features>
140+<server>
141+smtp
142+</server>
143+ <name>
144+SMTP STARTTLS pipelined server response
145+ </name>
146+<stdin>
147+mail body
148+</stdin>
149+ <command>
150+smtp://%HOSTIP:%SMTPPORT/%TESTNUMBER --mail-rcpt recipient@example.com --mail-from sender@example.com -u user:secret --ssl --sasl-ir -T -
151+</command>
152+</client>
153+
154+#
155+# Verify data after the test has been "shot"
156+<verify>
157+# 8 is CURLE_WEIRD_SERVER_REPLY
158+<errorcode>
159+8
160+</errorcode>
161+<protocol>
162+EHLO %TESTNUMBER
163+STARTTLS
164+</protocol>
165+</verify>
166+</testcase>
167diff --git a/tests/data/test981 b/tests/data/test981
168new file mode 100644
169index 0000000..2b98ce4
170--- /dev/null
171+++ b/tests/data/test981
172@@ -0,0 +1,59 @@
173+<testcase>
174+<info>
175+<keywords>
176+IMAP
177+STARTTLS
178+</keywords>
179+</info>
180+
181+#
182+# Server-side
183+<reply>
184+<servercmd>
185+CAPA STARTTLS
186+REPLY STARTTLS A002 BAD currently unavailable\r\nA003 OK Authenticated\r\nA004 OK Accepted
187+REPLY LOGIN A003 BAD Authentication credentials invalid
188+</servercmd>
189+</reply>
190+
191+#
192+# Client-side
193+<client>
194+<features>
195+SSL
196+</features>
197+<server>
198+imap
199+</server>
200+ <name>
201+IMAP STARTTLS pipelined server response
202+ </name>
203+ <command>
204+imap://%HOSTIP:%IMAPPORT/%TESTNUMBER -T log/upload%TESTNUMBER -u user:secret --ssl
205+</command>
206+<file name="log/upload%TESTNUMBER">
207+Date: Mon, 7 Feb 1994 21:52:25 -0800 (PST)
208+From: Fred Foobar <foobar@example.COM>
209+Subject: afternoon meeting
210+To: joe@example.com
211+Message-Id: <B27397-0100000@example.COM>
212+MIME-Version: 1.0
213+Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
214+
215+Hello Joe, do you think we can meet at 3:30 tomorrow?
216+</file>
217+</client>
218+
219+#
220+# Verify data after the test has been "shot"
221+<verify>
222+# 8 is CURLE_WEIRD_SERVER_REPLY
223+<errorcode>
224+8
225+</errorcode>
226+<protocol>
227+A001 CAPABILITY
228+A002 STARTTLS
229+</protocol>
230+</verify>
231+</testcase>
232diff --git a/tests/data/test982 b/tests/data/test982
233new file mode 100644
234index 0000000..9e07cc0
235--- /dev/null
236+++ b/tests/data/test982
237@@ -0,0 +1,57 @@
238+<testcase>
239+<info>
240+<keywords>
241+POP3
242+STARTTLS
243+</keywords>
244+</info>
245+
246+#
247+# Server-side
248+<reply>
249+<servercmd>
250+CAPA STLS USER
251+REPLY STLS -ERR currently unavailable\r\n+OK user accepted\r\n+OK authenticated
252+REPLY PASS -ERR Authentication credentials invalid
253+</servercmd>
254+<data nocheck="yes">
255+From: me@somewhere
256+To: fake@nowhere
257+
258+body
259+
260+--
261+ yours sincerely
262+</data>
263+</reply>
264+
265+#
266+# Client-side
267+<client>
268+<features>
269+SSL
270+</features>
271+<server>
272+pop3
273+</server>
274+ <name>
275+POP3 STARTTLS pipelined server response
276+ </name>
277+ <command>
278+pop3://%HOSTIP:%POP3PORT/%TESTNUMBER -u user:secret --ssl
279+ </command>
280+</client>
281+
282+#
283+# Verify data after the test has been "shot"
284+<verify>
285+# 8 is CURLE_WEIRD_SERVER_REPLY
286+<errorcode>
287+8
288+</errorcode>
289+<protocol>
290+CAPA
291+STLS
292+</protocol>
293+</verify>
294+</testcase>
295diff --git a/tests/data/test983 b/tests/data/test983
296new file mode 100644
297index 0000000..300ec45
298--- /dev/null
299+++ b/tests/data/test983
300@@ -0,0 +1,52 @@
301+<testcase>
302+<info>
303+<keywords>
304+FTP
305+STARTTLS
306+</keywords>
307+</info>
308+
309+#
310+# Server-side
311+<reply>
312+<servercmd>
313+REPLY AUTH 500 unknown command\r\n500 unknown command\r\n331 give password\r\n230 Authenticated\r\n257 "/"\r\n200 OK\r\n200 OK\r\n200 OK\r\n226 Transfer complete
314+REPLY PASS 530 Login incorrect
315+</servercmd>
316+</reply>
317+
318+# Client-side
319+<client>
320+<features>
321+SSL
322+</features>
323+<server>
324+ftp
325+</server>
326+ <name>
327+FTP STARTTLS pipelined server response
328+ </name>
329+<file name="log/test%TESTNUMBER.txt">
330+data
331+ to
332+ see
333+that FTPS
334+works
335+ so does it?
336+</file>
337+ <command>
338+--ssl --ftp-ssl-control ftp://%HOSTIP:%FTPPORT/%TESTNUMBER -T log/test%TESTNUMBER.txt -u user:secret -P %CLIENTIP
339+</command>
340+</client>
341+
342+# Verify data after the test has been "shot"
343+<verify>
344+# 8 is CURLE_WEIRD_SERVER_REPLY
345+<errorcode>
346+8
347+</errorcode>
348+<protocol>
349+AUTH SSL
350+</protocol>
351+</verify>
352+</testcase>
diff --git a/meta/recipes-support/curl/curl/CVE-2022-22576.patch b/meta/recipes-support/curl/curl/CVE-2022-22576.patch
new file mode 100644
index 0000000000..13479e7f0e
--- /dev/null
+++ b/meta/recipes-support/curl/curl/CVE-2022-22576.patch
@@ -0,0 +1,148 @@
1From 852aa5ad351ea53e5f01d2f44b5b4370c2bf5425 Mon Sep 17 00:00:00 2001
2From: Patrick Monnerat <patrick@monnerat.net>
3Date: Mon, 25 Apr 2022 11:44:05 +0200
4Subject: [PATCH] url: check sasl additional parameters for connection reuse.
5
6Also move static function safecmp() as non-static Curl_safecmp() since
7its purpose is needed at several places.
8
9Bug: https://curl.se/docs/CVE-2022-22576.html
10
11CVE-2022-22576
12
13Closes #8746
14---
15 lib/strcase.c | 10 ++++++++++
16 lib/strcase.h | 2 ++
17 lib/url.c | 13 ++++++++++++-
18 lib/urldata.h | 1 +
19 lib/vtls/vtls.c | 21 ++++++---------------
20 5 files changed, 31 insertions(+), 16 deletions(-)
21
22CVE: CVE-2022-22576
23Upstream-Status: Backport [https://github.com/curl/curl/commit/852aa5ad351ea53e5f01d2f44b5b4370c2bf5425.patch]
24Comment: Refreshed patch
25Signed-off-by: Sana.Kazi <Sana.Kazi@kpit.com>
26
27diff --git a/lib/strcase.c b/lib/strcase.c
28index dd46ca1ba0e5..692a3f14aee7 100644
29--- a/lib/strcase.c
30+++ b/lib/strcase.c
31@@ -251,6 +251,16 @@
32 } while(*src++ && --n);
33 }
34
35+/* Compare case-sensitive NUL-terminated strings, taking care of possible
36+ * null pointers. Return true if arguments match.
37+ */
38+bool Curl_safecmp(char *a, char *b)
39+{
40+ if(a && b)
41+ return !strcmp(a, b);
42+ return !a && !b;
43+}
44+
45 /* --- public functions --- */
46
47 int curl_strequal(const char *first, const char *second)
48diff --git a/lib/strcase.h b/lib/strcase.h
49index b234d3815220..2635f5117e99 100644
50--- a/lib/strcase.h
51+++ b/lib/strcase.h
52@@ -48,4 +48,6 @@
53 void Curl_strntoupper(char *dest, const char *src, size_t n);
54 void Curl_strntolower(char *dest, const char *src, size_t n);
55
56+bool Curl_safecmp(char *a, char *b);
57+
58 #endif /* HEADER_CURL_STRCASE_H */
59diff --git a/lib/url.c b/lib/url.c
60index 9a988b4d58d8..e1647b133854 100644
61--- a/lib/url.c
62+++ b/lib/url.c
63@@ -730,6 +730,7 @@
64 Curl_safefree(conn->allocptr.host);
65 Curl_safefree(conn->allocptr.cookiehost);
66 Curl_safefree(conn->allocptr.rtsp_transport);
67+ Curl_safefree(conn->oauth_bearer);
68 Curl_safefree(conn->trailer);
69 Curl_safefree(conn->host.rawalloc); /* host name buffer */
70 Curl_safefree(conn->conn_to_host.rawalloc); /* host name buffer */
71@@ -1251,7 +1252,9 @@
72 /* This protocol requires credentials per connection,
73 so verify that we're using the same name and password as well */
74 if(strcmp(needle->user, check->user) ||
75- strcmp(needle->passwd, check->passwd)) {
76+ strcmp(needle->passwd, check->passwd) ||
77+ !Curl_safecmp(needle->sasl_authzid, check->sasl_authzid) ||
78+ !Curl_safecmp(needle->oauth_bearer, check->oauth_bearer)) {
79 /* one of them was different */
80 continue;
81 }
82@@ -3392,6 +3395,14 @@
83 result = CURLE_OUT_OF_MEMORY;
84 goto out;
85 }
86+ }
87+
88+ if(data->set.str[STRING_BEARER]) {
89+ conn->oauth_bearer = strdup(data->set.str[STRING_BEARER]);
90+ if(!conn->oauth_bearer) {
91+ result = CURLE_OUT_OF_MEMORY;
92+ goto out;
93+ }
94 }
95
96 #ifdef USE_UNIX_SOCKETS
97diff --git a/lib/urldata.h b/lib/urldata.h
98index 07eb19b87034..1d89b8d7fa68 100644
99--- a/lib/urldata.h
100+++ b/lib/urldata.h
101@@ -949,6 +949,8 @@
102
103 char *sasl_authzid; /* authorisation identity string, allocated */
104
105+ char *oauth_bearer; /* OAUTH2 bearer, allocated */
106+
107 int httpversion; /* the HTTP version*10 reported by the server */
108 int rtspversion; /* the RTSP version*10 reported by the server */
109
110diff --git a/lib/vtls/vtls.c b/lib/vtls/vtls.c
111index 03b85ba065e5..a40ac06f684f 100644
112--- a/lib/vtls/vtls.c
113+++ b/lib/vtls/vtls.c
114@@ -82,15 +82,6 @@
115 else \
116 dest->var = NULL;
117
118-static bool safecmp(char *a, char *b)
119-{
120- if(a && b)
121- return !strcmp(a, b);
122- else if(!a && !b)
123- return TRUE; /* match */
124- return FALSE; /* no match */
125-}
126-
127
128 bool
129 Curl_ssl_config_matches(struct ssl_primary_config* data,
130@@ -101,12 +101,12 @@
131 (data->verifypeer == needle->verifypeer) &&
132 (data->verifyhost == needle->verifyhost) &&
133 (data->verifystatus == needle->verifystatus) &&
134- safecmp(data->CApath, needle->CApath) &&
135- safecmp(data->CAfile, needle->CAfile) &&
136- safecmp(data->issuercert, needle->issuercert) &&
137- safecmp(data->clientcert, needle->clientcert) &&
138- safecmp(data->random_file, needle->random_file) &&
139- safecmp(data->egdsocket, needle->egdsocket) &&
140+ Curl_safecmp(data->CApath, needle->CApath) &&
141+ Curl_safecmp(data->CAfile, needle->CAfile) &&
142+ Curl_safecmp(data->issuercert, needle->issuercert) &&
143+ Curl_safecmp(data->clientcert, needle->clientcert) &&
144+ Curl_safecmp(data->random_file, needle->random_file) &&
145+ Curl_safecmp(data->egdsocket, needle->egdsocket) &&
146 Curl_safe_strcasecompare(data->cipher_list, needle->cipher_list) &&
147 Curl_safe_strcasecompare(data->cipher_list13, needle->cipher_list13) &&
148 Curl_safe_strcasecompare(data->pinned_key, needle->pinned_key))
diff --git a/meta/recipes-support/curl/curl/CVE-2022-27774-1.patch b/meta/recipes-support/curl/curl/CVE-2022-27774-1.patch
new file mode 100644
index 0000000000..063c11712a
--- /dev/null
+++ b/meta/recipes-support/curl/curl/CVE-2022-27774-1.patch
@@ -0,0 +1,45 @@
1From 2a797e099731facf62a2c675396334bc2ad3bc7c Mon Sep 17 00:00:00 2001
2From: Daniel Stenberg <daniel@haxx.se>
3Date: Mon, 25 Apr 2022 16:24:33 +0200
4Subject: [PATCH] connect: store "conn_remote_port" in the info struct
5
6To make it available after the connection ended.
7
8Prerequisite for the patches that address CVE-2022-27774.
9
10Upstream-Status: Backport [https://github.com/curl/curl/commit/08b8ef4e726ba10f45081ecda5b3cea788d3c839]
11Signed-off-by: Robert Joslyn <robert.joslyn@redrectangle.org>
12---
13 lib/connect.c | 1 +
14 lib/urldata.h | 6 +++++-
15 2 files changed, 6 insertions(+), 1 deletion(-)
16
17diff --git a/lib/connect.c b/lib/connect.c
18index b3d4057..a977d67 100644
19--- a/lib/connect.c
20+++ b/lib/connect.c
21@@ -624,6 +624,7 @@ void Curl_persistconninfo(struct connectdata *conn)
22 conn->data->info.conn_scheme = conn->handler->scheme;
23 conn->data->info.conn_protocol = conn->handler->protocol;
24 conn->data->info.conn_primary_port = conn->primary_port;
25+ conn->data->info.conn_remote_port = conn->remote_port;
26 conn->data->info.conn_local_port = conn->local_port;
27 }
28
29diff --git a/lib/urldata.h b/lib/urldata.h
30index fafb7a3..ab1b267 100644
31--- a/lib/urldata.h
32+++ b/lib/urldata.h
33@@ -1148,7 +1148,11 @@ struct PureInfo {
34 reused, in the connection cache. */
35
36 char conn_primary_ip[MAX_IPADR_LEN];
37- long conn_primary_port;
38+ long conn_primary_port; /* this is the destination port to the connection,
39+ which might have been a proxy */
40+ long conn_remote_port; /* this is the "remote port", which is the port
41+ number of the used URL, independent of proxy or
42+ not */
43 char conn_local_ip[MAX_IPADR_LEN];
44 long conn_local_port;
45 const char *conn_scheme;
diff --git a/meta/recipes-support/curl/curl/CVE-2022-27774-2.patch b/meta/recipes-support/curl/curl/CVE-2022-27774-2.patch
new file mode 100644
index 0000000000..c64d614194
--- /dev/null
+++ b/meta/recipes-support/curl/curl/CVE-2022-27774-2.patch
@@ -0,0 +1,80 @@
1From 5c2f3b3a5f115625134669d90d591de9c5aafc8e Mon Sep 17 00:00:00 2001
2From: Daniel Stenberg <daniel@haxx.se>
3Date: Mon, 25 Apr 2022 16:24:33 +0200
4Subject: [PATCH] transfer: redirects to other protocols or ports clear auth
5
6... unless explicitly permitted.
7
8Bug: https://curl.se/docs/CVE-2022-27774.html
9Reported-by: Harry Sintonen
10Closes #8748
11
12Upstream-Status: Backport [https://github.com/curl/curl/commit/620ea21410030a9977396b4661806bc187231b79]
13Signed-off-by: Robert Joslyn <robert.joslyn@redrectangle.org>
14---
15 lib/transfer.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++++-
16 1 file changed, 48 insertions(+), 1 deletion(-)
17
18diff --git a/lib/transfer.c b/lib/transfer.c
19index 744e1c0..ac69d27 100644
20--- a/lib/transfer.c
21+++ b/lib/transfer.c
22@@ -1627,10 +1627,57 @@ CURLcode Curl_follow(struct Curl_easy *data,
23 return CURLE_OUT_OF_MEMORY;
24 }
25 else {
26-
27 uc = curl_url_get(data->state.uh, CURLUPART_URL, &newurl, 0);
28 if(uc)
29 return Curl_uc_to_curlcode(uc);
30+
31+ /* Clear auth if this redirects to a different port number or protocol,
32+ unless permitted */
33+ if(!data->set.allow_auth_to_other_hosts && (type != FOLLOW_FAKE)) {
34+ char *portnum;
35+ int port;
36+ bool clear = FALSE;
37+
38+ if(data->set.use_port && data->state.allow_port)
39+ /* a custom port is used */
40+ port = (int)data->set.use_port;
41+ else {
42+ uc = curl_url_get(data->state.uh, CURLUPART_PORT, &portnum,
43+ CURLU_DEFAULT_PORT);
44+ if(uc) {
45+ free(newurl);
46+ return Curl_uc_to_curlcode(uc);
47+ }
48+ port = atoi(portnum);
49+ free(portnum);
50+ }
51+ if(port != data->info.conn_remote_port) {
52+ infof(data, "Clear auth, redirects to port from %u to %u",
53+ data->info.conn_remote_port, port);
54+ clear = TRUE;
55+ }
56+ else {
57+ char *scheme;
58+ const struct Curl_handler *p;
59+ uc = curl_url_get(data->state.uh, CURLUPART_SCHEME, &scheme, 0);
60+ if(uc) {
61+ free(newurl);
62+ return Curl_uc_to_curlcode(uc);
63+ }
64+
65+ p = Curl_builtin_scheme(scheme);
66+ if(p && (p->protocol != data->info.conn_protocol)) {
67+ infof(data, "Clear auth, redirects scheme from %s to %s",
68+ data->info.conn_scheme, scheme);
69+ clear = TRUE;
70+ }
71+ free(scheme);
72+ }
73+ if(clear) {
74+ Curl_safefree(data->set.str[STRING_USERNAME]);
75+ Curl_safefree(data->set.str[STRING_PASSWORD]);
76+ }
77+ }
78 }
79
80 if(type == FOLLOW_FAKE) {
diff --git a/meta/recipes-support/curl/curl/CVE-2022-27774-3.patch b/meta/recipes-support/curl/curl/CVE-2022-27774-3.patch
new file mode 100644
index 0000000000..a585f6a8fa
--- /dev/null
+++ b/meta/recipes-support/curl/curl/CVE-2022-27774-3.patch
@@ -0,0 +1,83 @@
1From 5dccf21ad49eed925e8f76b0cb844877239ce23d Mon Sep 17 00:00:00 2001
2From: Daniel Stenberg <daniel@haxx.se>
3Date: Mon, 25 Apr 2022 17:59:15 +0200
4Subject: [PATCH] openssl: don't leak the SRP credentials in redirects either
5
6Follow-up to 620ea21410030
7
8Reported-by: Harry Sintonen
9Closes #8751
10
11Upstream-Status: Backport [https://github.com/curl/curl/commit/139a54ed0a172adaaf1a78d6f4fff50b2c3f9e08]
12Signed-off-by: Robert Joslyn <robert.joslyn@redrectangle.org>
13---
14 lib/http.c | 10 +++++-----
15 lib/http.h | 6 ++++++
16 lib/vtls/openssl.c | 3 ++-
17 3 files changed, 13 insertions(+), 6 deletions(-)
18
19diff --git a/lib/http.c b/lib/http.c
20index 8b16c09..5291c07 100644
21--- a/lib/http.c
22+++ b/lib/http.c
23@@ -732,10 +732,10 @@ output_auth_headers(struct connectdata *conn,
24 }
25
26 /*
27- * allow_auth_to_host() tells if autentication, cookies or other "sensitive
28- * data" can (still) be sent to this host.
29+ * Curl_allow_auth_to_host() tells if authentication, cookies or other
30+ * "sensitive data" can (still) be sent to this host.
31 */
32-static bool allow_auth_to_host(struct Curl_easy *data)
33+bool Curl_allow_auth_to_host(struct Curl_easy *data)
34 {
35 struct connectdata *conn = data->conn;
36 return (!data->state.this_is_a_follow ||
37@@ -816,7 +816,7 @@ Curl_http_output_auth(struct connectdata *conn,
38
39 /* To prevent the user+password to get sent to other than the original host
40 due to a location-follow */
41- if(allow_auth_to_host(data)
42+ if(Curl_allow_auth_to_host(data)
43 || conn->bits.netrc
44 )
45 result = output_auth_headers(conn, authhost, request, path, FALSE);
46@@ -1891,7 +1891,7 @@ CURLcode Curl_add_custom_headers(struct connectdata *conn,
47 checkprefix("Cookie:", compare)) &&
48 /* be careful of sending this potentially sensitive header to
49 other hosts */
50- !allow_auth_to_host(data))
51+ !Curl_allow_auth_to_host(data))
52 ;
53 else {
54 result = Curl_add_bufferf(&req_buffer, "%s\r\n", compare);
55diff --git a/lib/http.h b/lib/http.h
56index 4c1825f..4fbae1d 100644
57--- a/lib/http.h
58+++ b/lib/http.h
59@@ -273,4 +273,10 @@ Curl_http_output_auth(struct connectdata *conn,
60 bool proxytunnel); /* TRUE if this is the request setting
61 up the proxy tunnel */
62
63+/*
64+ * Curl_allow_auth_to_host() tells if authentication, cookies or other
65+ * "sensitive data" can (still) be sent to this host.
66+ */
67+bool Curl_allow_auth_to_host(struct Curl_easy *data);
68+
69 #endif /* HEADER_CURL_HTTP_H */
70diff --git a/lib/vtls/openssl.c b/lib/vtls/openssl.c
71index 006a8c8..a14cecc 100644
72--- a/lib/vtls/openssl.c
73+++ b/lib/vtls/openssl.c
74@@ -2739,7 +2739,8 @@ static CURLcode ossl_connect_step1(struct connectdata *conn, int sockindex)
75 #endif
76
77 #ifdef USE_TLS_SRP
78- if(ssl_authtype == CURL_TLSAUTH_SRP) {
79+ if((ssl_authtype == CURL_TLSAUTH_SRP) &&
80+ Curl_allow_auth_to_host(data)) {
81 char * const ssl_username = SSL_SET_OPTION(username);
82
83 infof(data, "Using TLS-SRP username: %s\n", ssl_username);
diff --git a/meta/recipes-support/curl/curl/CVE-2022-27774-4.patch b/meta/recipes-support/curl/curl/CVE-2022-27774-4.patch
new file mode 100644
index 0000000000..2258681cab
--- /dev/null
+++ b/meta/recipes-support/curl/curl/CVE-2022-27774-4.patch
@@ -0,0 +1,35 @@
1From 7395752e2f7b87dc8c8f2a7137075e2da554aaea Mon Sep 17 00:00:00 2001
2From: Daniel Stenberg <daniel@haxx.se>
3Date: Tue, 26 Apr 2022 07:46:19 +0200
4Subject: [PATCH] gnutls: don't leak the SRP credentials in redirects
5
6Follow-up to 620ea21410030 and 139a54ed0a172a
7
8Reported-by: Harry Sintonen
9Closes #8752
10
11Upstream-Status: Backport [https://github.com/curl/curl/commit/093531556203decd92d92bccd431edbe5561781c]
12Signed-off-by: Robert Joslyn <robert.joslyn@redrectangle.org>
13---
14 lib/vtls/gtls.c | 6 +++---
15 1 file changed, 3 insertions(+), 3 deletions(-)
16
17diff --git a/lib/vtls/gtls.c b/lib/vtls/gtls.c
18index 8c05102..3d0758d 100644
19--- a/lib/vtls/gtls.c
20+++ b/lib/vtls/gtls.c
21@@ -581,11 +581,11 @@ gtls_connect_step1(struct connectdata *conn,
22 }
23
24 #ifdef USE_TLS_SRP
25- if(SSL_SET_OPTION(authtype) == CURL_TLSAUTH_SRP) {
26+ if((SSL_SET_OPTION(authtype) == CURL_TLSAUTH_SRP) &&
27+ Curl_allow_auth_to_host(data)) {
28 infof(data, "Using TLS-SRP username: %s\n", SSL_SET_OPTION(username));
29
30- rc = gnutls_srp_allocate_client_credentials(
31- &BACKEND->srp_client_cred);
32+ rc = gnutls_srp_allocate_client_credentials(&BACKEND->srp_client_cred);
33 if(rc != GNUTLS_E_SUCCESS) {
34 failf(data, "gnutls_srp_allocate_client_cred() failed: %s",
35 gnutls_strerror(rc));
diff --git a/meta/recipes-support/curl/curl/CVE-2022-27775.patch b/meta/recipes-support/curl/curl/CVE-2022-27775.patch
new file mode 100644
index 0000000000..b3fe7b4494
--- /dev/null
+++ b/meta/recipes-support/curl/curl/CVE-2022-27775.patch
@@ -0,0 +1,39 @@
1From 058f98dc3fe595f21dc26a5b9b1699e519ba5705 Mon Sep 17 00:00:00 2001
2From: Daniel Stenberg <daniel@haxx.se>
3Date: Mon, 25 Apr 2022 11:48:00 +0200
4Subject: [PATCH] conncache: include the zone id in the "bundle" hashkey
5
6Make connections to two separate IPv6 zone ids create separate
7connections.
8
9Reported-by: Harry Sintonen
10Bug: https://curl.se/docs/CVE-2022-27775.html
11Closes #8747
12---
13 lib/conncache.c | 8 ++++++--
14 1 file changed, 6 insertions(+), 2 deletions(-)
15
16CVE: CVE-2022-27775
17Upstream-Status: Backport [https://github.com/curl/curl/commit/058f98dc3fe595f21dc26a5b9b1699e519ba5705.patch]
18Comment: Refreshed patch
19Signed-off-by: Sana.Kazi <Sana.Kazi@kpit.com>
20
21diff --git a/lib/conncache.c b/lib/conncache.c
22index ec669b971dc3..8948b53fa500 100644
23--- a/lib/conncache.c
24+++ b/lib/conncache.c
25@@ -156,8 +156,12 @@
26 /* report back which name we used */
27 *hostp = hostname;
28
29- /* put the number first so that the hostname gets cut off if too long */
30- msnprintf(buf, len, "%ld%s", port, hostname);
31+ /* put the numbers first so that the hostname gets cut off if too long */
32+#ifdef ENABLE_IPV6
33+ msnprintf(buf, len, "%u/%ld/%s", conn->scope_id, port, hostname);
34+#else
35+ msnprintf(buf, len, "%ld/%s", port, hostname);
36+#endif
37 }
38
39 /* Returns number of connections currently held in the connection cache.
diff --git a/meta/recipes-support/curl/curl/CVE-2022-27776.patch b/meta/recipes-support/curl/curl/CVE-2022-27776.patch
new file mode 100644
index 0000000000..1a13df2d95
--- /dev/null
+++ b/meta/recipes-support/curl/curl/CVE-2022-27776.patch
@@ -0,0 +1,114 @@
1From 6e659993952aa5f90f48864be84a1bbb047fc258 Mon Sep 17 00:00:00 2001
2From: Daniel Stenberg <daniel@haxx.se>
3Date: Mon, 25 Apr 2022 13:05:40 +0200
4Subject: [PATCH] http: avoid auth/cookie on redirects same host diff port
5
6CVE-2022-27776
7
8Reported-by: Harry Sintonen
9Bug: https://curl.se/docs/CVE-2022-27776.html
10Closes #8749
11---
12 lib/http.c | 34 ++++++++++++++++++++++------------
13 lib/urldata.h | 16 +++++++++-------
14 2 files changed, 31 insertions(+), 19 deletions(-)
15
16CVE: CVE-2022-27776
17Upstream-Status: Backport [https://github.com/curl/curl/commit/6e659993952aa5f90f48864be84a1bbb047fc258.patch]
18Comment: Refreshed patch
19Signed-off-by: Sana.Kazi <Sana.Kazi@kpit.com>
20
21diff --git a/lib/http.c b/lib/http.c
22index ce79fc4e31c8..f0476f3b9272 100644
23--- a/lib/http.c
24+++ b/lib/http.c
25@@ -731,6 +731,21 @@
26 return CURLE_OK;
27 }
28
29+/*
30+ * allow_auth_to_host() tells if autentication, cookies or other "sensitive
31+ * data" can (still) be sent to this host.
32+ */
33+static bool allow_auth_to_host(struct Curl_easy *data)
34+{
35+ struct connectdata *conn = data->conn;
36+ return (!data->state.this_is_a_follow ||
37+ data->set.allow_auth_to_other_hosts ||
38+ (data->state.first_host &&
39+ strcasecompare(data->state.first_host, conn->host.name) &&
40+ (data->state.first_remote_port == conn->remote_port) &&
41+ (data->state.first_remote_protocol == conn->handler->protocol)));
42+}
43+
44 /**
45 * Curl_http_output_auth() setups the authentication headers for the
46 * host/proxy and the correct authentication
47@@ -799,15 +799,12 @@
48 with it */
49 authproxy->done = TRUE;
50
51- /* To prevent the user+password to get sent to other than the original
52- host due to a location-follow, we do some weirdo checks here */
53- if(!data->state.this_is_a_follow ||
54- conn->bits.netrc ||
55- !data->state.first_host ||
56- data->set.allow_auth_to_other_hosts ||
57- strcasecompare(data->state.first_host, conn->host.name)) {
58+ /* To prevent the user+password to get sent to other than the original host
59+ due to a location-follow */
60+ if(allow_auth_to_host(data)
61+ || conn->bits.netrc
62+ )
63 result = output_auth_headers(conn, authhost, request, path, FALSE);
64- }
65 else
66 authhost->done = TRUE;
67
68@@ -1879,10 +1891,7 @@
69 checkprefix("Cookie:", compare)) &&
70 /* be careful of sending this potentially sensitive header to
71 other hosts */
72- (data->state.this_is_a_follow &&
73- data->state.first_host &&
74- !data->set.allow_auth_to_other_hosts &&
75- !strcasecompare(data->state.first_host, conn->host.name)))
76+ !allow_auth_to_host(data))
77 ;
78 else {
79 result = Curl_add_bufferf(&req_buffer, "%s\r\n", compare);
80@@ -2065,6 +2074,7 @@
81 return CURLE_OUT_OF_MEMORY;
82
83 data->state.first_remote_port = conn->remote_port;
84+ data->state.first_remote_protocol = conn->handler->protocol;
85 }
86
87 if((conn->handler->protocol&(PROTO_FAMILY_HTTP|CURLPROTO_FTP)) &&
88diff --git a/lib/urldata.h b/lib/urldata.h
89index 1d89b8d7fa68..ef2174d9e727 100644
90--- a/lib/urldata.h
91+++ b/lib/urldata.h
92@@ -1342,13 +1342,15 @@
93 char *ulbuf; /* allocated upload buffer or NULL */
94 curl_off_t current_speed; /* the ProgressShow() function sets this,
95 bytes / second */
96- char *first_host; /* host name of the first (not followed) request.
97- if set, this should be the host name that we will
98- sent authorization to, no else. Used to make Location:
99- following not keep sending user+password... This is
100- strdup() data.
101- */
102- int first_remote_port; /* remote port of the first (not followed) request */
103+
104+ /* host name, port number and protocol of the first (not followed) request.
105+ if set, this should be the host name that we will sent authorization to,
106+ no else. Used to make Location: following not keep sending user+password.
107+ This is strdup()ed data. */
108+ char *first_host;
109+ int first_remote_port;
110+ unsigned int first_remote_protocol;
111+
112 struct curl_ssl_session *session; /* array of 'max_ssl_sessions' size */
113 long sessionage; /* number of the most recent session */
114 unsigned int tempcount; /* number of entries in use in tempwrite, 0 - 3 */
diff --git a/meta/recipes-support/curl/curl/CVE-2022-27781.patch b/meta/recipes-support/curl/curl/CVE-2022-27781.patch
new file mode 100644
index 0000000000..ea1bc22928
--- /dev/null
+++ b/meta/recipes-support/curl/curl/CVE-2022-27781.patch
@@ -0,0 +1,46 @@
1From 7a1f183039a6a6c9099a114f5e5c94777413c767 Mon Sep 17 00:00:00 2001
2From: Daniel Stenberg <daniel@haxx.se>
3Date: Mon, 9 May 2022 10:07:15 +0200
4Subject: [PATCH] nss: return error if seemingly stuck in a cert loop
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9CVE-2022-27781
10
11Reported-by: Florian Kohnhäuser
12Bug: https://curl.se/docs/CVE-2022-27781.html
13Closes #8822
14
15Upstream-Status: Backport [https://github.com/curl/curl/commit/5c7da89d404bf59c8dd82a001119a16d18365917]
16Signed-off-by: Robert Joslyn <robert.joslyn@redrectangle.org>
17---
18 lib/vtls/nss.c | 8 ++++++++
19 1 file changed, 8 insertions(+)
20
21diff --git a/lib/vtls/nss.c b/lib/vtls/nss.c
22index 375c78b..86102f7 100644
23--- a/lib/vtls/nss.c
24+++ b/lib/vtls/nss.c
25@@ -950,6 +950,9 @@ static void display_cert_info(struct Curl_easy *data,
26 PR_Free(common_name);
27 }
28
29+/* A number of certs that will never occur in a real server handshake */
30+#define TOO_MANY_CERTS 300
31+
32 static CURLcode display_conn_info(struct connectdata *conn, PRFileDesc *sock)
33 {
34 CURLcode result = CURLE_OK;
35@@ -986,6 +989,11 @@ static CURLcode display_conn_info(struct connectdata *conn, PRFileDesc *sock)
36 cert2 = CERT_FindCertIssuer(cert, now, certUsageSSLCA);
37 while(cert2) {
38 i++;
39+ if(i >= TOO_MANY_CERTS) {
40+ CERT_DestroyCertificate(cert2);
41+ failf(data, "certificate loop");
42+ return CURLE_SSL_CERTPROBLEM;
43+ }
44 if(cert2->isRoot) {
45 CERT_DestroyCertificate(cert2);
46 break;
diff --git a/meta/recipes-support/curl/curl/CVE-2022-27782-1.patch b/meta/recipes-support/curl/curl/CVE-2022-27782-1.patch
new file mode 100644
index 0000000000..6b6d0e1938
--- /dev/null
+++ b/meta/recipes-support/curl/curl/CVE-2022-27782-1.patch
@@ -0,0 +1,363 @@
1From 907a16c832d9ce0ffa7e9b2297548063095a7242 Mon Sep 17 00:00:00 2001
2From: Daniel Stenberg <daniel@haxx.se>
3Date: Mon, 9 May 2022 23:13:53 +0200
4Subject: [PATCH] tls: check more TLS details for connection reuse
5
6CVE-2022-27782
7
8Reported-by: Harry Sintonen
9Bug: https://curl.se/docs/CVE-2022-27782.html
10Closes #8825
11
12Upstream-Status: Backport [https://github.com/curl/curl/commit/f18af4f874cecab82a9797e8c7541e0990c7a64c]
13Signed-off-by: Robert Joslyn <robert.joslyn@redrectangle.org>
14---
15 lib/setopt.c | 29 +++++++++++++++++------------
16 lib/url.c | 17 ++++++++++-------
17 lib/urldata.h | 13 +++++++------
18 lib/vtls/gtls.c | 30 ++++++++++++++++--------------
19 lib/vtls/mbedtls.c | 2 +-
20 lib/vtls/nss.c | 6 +++---
21 lib/vtls/openssl.c | 10 +++++-----
22 lib/vtls/vtls.c | 1 +
23 8 files changed, 60 insertions(+), 48 deletions(-)
24
25diff --git a/lib/setopt.c b/lib/setopt.c
26index 4648c87..bebb2e4 100644
27--- a/lib/setopt.c
28+++ b/lib/setopt.c
29@@ -2130,6 +2130,7 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
30
31 case CURLOPT_SSL_OPTIONS:
32 arg = va_arg(param, long);
33+ data->set.ssl.primary.ssl_options = (unsigned char)(arg & 0xff);
34 data->set.ssl.enable_beast =
35 (bool)((arg&CURLSSLOPT_ALLOW_BEAST) ? TRUE : FALSE);
36 data->set.ssl.no_revoke = !!(arg & CURLSSLOPT_NO_REVOKE);
37@@ -2139,6 +2140,7 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
38 #ifndef CURL_DISABLE_PROXY
39 case CURLOPT_PROXY_SSL_OPTIONS:
40 arg = va_arg(param, long);
41+ data->set.proxy_ssl.primary.ssl_options = (unsigned char)(arg & 0xff);
42 data->set.proxy_ssl.enable_beast =
43 (bool)((arg&CURLSSLOPT_ALLOW_BEAST) ? TRUE : FALSE);
44 data->set.proxy_ssl.no_revoke = !!(arg & CURLSSLOPT_NO_REVOKE);
45@@ -2541,44 +2543,47 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
46 case CURLOPT_TLSAUTH_USERNAME:
47 result = Curl_setstropt(&data->set.str[STRING_TLSAUTH_USERNAME_ORIG],
48 va_arg(param, char *));
49- if(data->set.str[STRING_TLSAUTH_USERNAME_ORIG] && !data->set.ssl.authtype)
50- data->set.ssl.authtype = CURL_TLSAUTH_SRP; /* default to SRP */
51+ if(data->set.str[STRING_TLSAUTH_USERNAME_ORIG] &&
52+ !data->set.ssl.primary.authtype)
53+ data->set.ssl.primary.authtype = CURL_TLSAUTH_SRP; /* default to SRP */
54 break;
55 case CURLOPT_PROXY_TLSAUTH_USERNAME:
56 result = Curl_setstropt(&data->set.str[STRING_TLSAUTH_USERNAME_PROXY],
57 va_arg(param, char *));
58 if(data->set.str[STRING_TLSAUTH_USERNAME_PROXY] &&
59- !data->set.proxy_ssl.authtype)
60- data->set.proxy_ssl.authtype = CURL_TLSAUTH_SRP; /* default to SRP */
61+ !data->set.proxy_ssl.primary.authtype)
62+ data->set.proxy_ssl.primary.authtype = CURL_TLSAUTH_SRP; /* default to
63+ SRP */
64 break;
65 case CURLOPT_TLSAUTH_PASSWORD:
66 result = Curl_setstropt(&data->set.str[STRING_TLSAUTH_PASSWORD_ORIG],
67 va_arg(param, char *));
68- if(data->set.str[STRING_TLSAUTH_USERNAME_ORIG] && !data->set.ssl.authtype)
69- data->set.ssl.authtype = CURL_TLSAUTH_SRP; /* default to SRP */
70+ if(data->set.str[STRING_TLSAUTH_USERNAME_ORIG] &&
71+ !data->set.ssl.primary.authtype)
72+ data->set.ssl.primary.authtype = CURL_TLSAUTH_SRP; /* default to SRP */
73 break;
74 case CURLOPT_PROXY_TLSAUTH_PASSWORD:
75 result = Curl_setstropt(&data->set.str[STRING_TLSAUTH_PASSWORD_PROXY],
76 va_arg(param, char *));
77 if(data->set.str[STRING_TLSAUTH_USERNAME_PROXY] &&
78- !data->set.proxy_ssl.authtype)
79- data->set.proxy_ssl.authtype = CURL_TLSAUTH_SRP; /* default to SRP */
80+ !data->set.proxy_ssl.primary.authtype)
81+ data->set.proxy_ssl.primary.authtype = CURL_TLSAUTH_SRP; /* default */
82 break;
83 case CURLOPT_TLSAUTH_TYPE:
84 argptr = va_arg(param, char *);
85 if(!argptr ||
86 strncasecompare(argptr, "SRP", strlen("SRP")))
87- data->set.ssl.authtype = CURL_TLSAUTH_SRP;
88+ data->set.ssl.primary.authtype = CURL_TLSAUTH_SRP;
89 else
90- data->set.ssl.authtype = CURL_TLSAUTH_NONE;
91+ data->set.ssl.primary.authtype = CURL_TLSAUTH_NONE;
92 break;
93 case CURLOPT_PROXY_TLSAUTH_TYPE:
94 argptr = va_arg(param, char *);
95 if(!argptr ||
96 strncasecompare(argptr, "SRP", strlen("SRP")))
97- data->set.proxy_ssl.authtype = CURL_TLSAUTH_SRP;
98+ data->set.proxy_ssl.primary.authtype = CURL_TLSAUTH_SRP;
99 else
100- data->set.proxy_ssl.authtype = CURL_TLSAUTH_NONE;
101+ data->set.proxy_ssl.primary.authtype = CURL_TLSAUTH_NONE;
102 break;
103 #endif
104 #ifdef USE_ARES
105diff --git a/lib/url.c b/lib/url.c
106index efa3dc7..6518be9 100644
107--- a/lib/url.c
108+++ b/lib/url.c
109@@ -482,7 +482,7 @@ CURLcode Curl_init_userdefined(struct Curl_easy *data)
110 set->ssl.primary.verifypeer = TRUE;
111 set->ssl.primary.verifyhost = TRUE;
112 #ifdef USE_TLS_SRP
113- set->ssl.authtype = CURL_TLSAUTH_NONE;
114+ set->ssl.primary.authtype = CURL_TLSAUTH_NONE;
115 #endif
116 set->ssh_auth_types = CURLSSH_AUTH_DEFAULT; /* defaults to any auth
117 type */
118@@ -3594,8 +3594,9 @@ static CURLcode create_conn(struct Curl_easy *data,
119 data->set.proxy_ssl.primary.pinned_key =
120 data->set.str[STRING_SSL_PINNEDPUBLICKEY_PROXY];
121
122- data->set.ssl.CRLfile = data->set.str[STRING_SSL_CRLFILE_ORIG];
123- data->set.proxy_ssl.CRLfile = data->set.str[STRING_SSL_CRLFILE_PROXY];
124+ data->set.ssl.primary.CRLfile = data->set.str[STRING_SSL_CRLFILE_ORIG];
125+ data->set.proxy_ssl.primary.CRLfile =
126+ data->set.str[STRING_SSL_CRLFILE_PROXY];
127 data->set.ssl.cert = data->set.str[STRING_CERT_ORIG];
128 data->set.proxy_ssl.cert = data->set.str[STRING_CERT_PROXY];
129 data->set.ssl.cert_type = data->set.str[STRING_CERT_TYPE_ORIG];
130@@ -3609,10 +3610,12 @@ static CURLcode create_conn(struct Curl_easy *data,
131 data->set.ssl.primary.clientcert = data->set.str[STRING_CERT_ORIG];
132 data->set.proxy_ssl.primary.clientcert = data->set.str[STRING_CERT_PROXY];
133 #ifdef USE_TLS_SRP
134- data->set.ssl.username = data->set.str[STRING_TLSAUTH_USERNAME_ORIG];
135- data->set.proxy_ssl.username = data->set.str[STRING_TLSAUTH_USERNAME_PROXY];
136- data->set.ssl.password = data->set.str[STRING_TLSAUTH_PASSWORD_ORIG];
137- data->set.proxy_ssl.password = data->set.str[STRING_TLSAUTH_PASSWORD_PROXY];
138+ data->set.ssl.primary.username = data->set.str[STRING_TLSAUTH_USERNAME_ORIG];
139+ data->set.proxy_ssl.primary.username =
140+ data->set.str[STRING_TLSAUTH_USERNAME_PROXY];
141+ data->set.ssl.primary.password = data->set.str[STRING_TLSAUTH_PASSWORD_ORIG];
142+ data->set.proxy_ssl.primary.password =
143+ data->set.str[STRING_TLSAUTH_PASSWORD_PROXY];
144 #endif
145
146 if(!Curl_clone_primary_ssl_config(&data->set.ssl.primary,
147diff --git a/lib/urldata.h b/lib/urldata.h
148index ab1b267..ad0ef8f 100644
149--- a/lib/urldata.h
150+++ b/lib/urldata.h
151@@ -231,6 +231,13 @@ struct ssl_primary_config {
152 char *cipher_list; /* list of ciphers to use */
153 char *cipher_list13; /* list of TLS 1.3 cipher suites to use */
154 char *pinned_key;
155+ char *CRLfile; /* CRL to check certificate revocation */
156+ #ifdef USE_TLS_SRP
157+ char *username; /* TLS username (for, e.g., SRP) */
158+ char *password; /* TLS password (for, e.g., SRP) */
159+ enum CURL_TLSAUTH authtype; /* TLS authentication type (default SRP) */
160+ #endif
161+ unsigned char ssl_options; /* the CURLOPT_SSL_OPTIONS bitmask */
162 BIT(verifypeer); /* set TRUE if this is desired */
163 BIT(verifyhost); /* set TRUE if CN/SAN must match hostname */
164 BIT(verifystatus); /* set TRUE if certificate status must be checked */
165@@ -240,7 +247,6 @@ struct ssl_primary_config {
166 struct ssl_config_data {
167 struct ssl_primary_config primary;
168 long certverifyresult; /* result from the certificate verification */
169- char *CRLfile; /* CRL to check certificate revocation */
170 curl_ssl_ctx_callback fsslctx; /* function to initialize ssl ctx */
171 void *fsslctxp; /* parameter for call back */
172 char *cert; /* client certificate file name */
173@@ -248,11 +254,6 @@ struct ssl_config_data {
174 char *key; /* private key file name */
175 char *key_type; /* format for private key (default: PEM) */
176 char *key_passwd; /* plain text private key password */
177-#ifdef USE_TLS_SRP
178- char *username; /* TLS username (for, e.g., SRP) */
179- char *password; /* TLS password (for, e.g., SRP) */
180- enum CURL_TLSAUTH authtype; /* TLS authentication type (default SRP) */
181-#endif
182 BIT(certinfo); /* gather lots of certificate info */
183 BIT(falsestart);
184 BIT(enable_beast); /* allow this flaw for interoperability's sake*/
185diff --git a/lib/vtls/gtls.c b/lib/vtls/gtls.c
186index 3d0758d..92c301c 100644
187--- a/lib/vtls/gtls.c
188+++ b/lib/vtls/gtls.c
189@@ -581,9 +581,10 @@ gtls_connect_step1(struct connectdata *conn,
190 }
191
192 #ifdef USE_TLS_SRP
193- if((SSL_SET_OPTION(authtype) == CURL_TLSAUTH_SRP) &&
194+ if((SSL_SET_OPTION(primary.authtype) == CURL_TLSAUTH_SRP) &&
195 Curl_allow_auth_to_host(data)) {
196- infof(data, "Using TLS-SRP username: %s\n", SSL_SET_OPTION(username));
197+ infof(data, "Using TLS-SRP username: %s\n",
198+ SSL_SET_OPTION(primary.username));
199
200 rc = gnutls_srp_allocate_client_credentials(&BACKEND->srp_client_cred);
201 if(rc != GNUTLS_E_SUCCESS) {
202@@ -593,8 +594,8 @@ gtls_connect_step1(struct connectdata *conn,
203 }
204
205 rc = gnutls_srp_set_client_credentials(BACKEND->srp_client_cred,
206- SSL_SET_OPTION(username),
207- SSL_SET_OPTION(password));
208+ SSL_SET_OPTION(primary.username),
209+ SSL_SET_OPTION(primary.password));
210 if(rc != GNUTLS_E_SUCCESS) {
211 failf(data, "gnutls_srp_set_client_cred() failed: %s",
212 gnutls_strerror(rc));
213@@ -648,19 +649,19 @@ gtls_connect_step1(struct connectdata *conn,
214 }
215 #endif
216
217- if(SSL_SET_OPTION(CRLfile)) {
218+ if(SSL_SET_OPTION(primary.CRLfile)) {
219 /* set the CRL list file */
220 rc = gnutls_certificate_set_x509_crl_file(BACKEND->cred,
221- SSL_SET_OPTION(CRLfile),
222+ SSL_SET_OPTION(primary.CRLfile),
223 GNUTLS_X509_FMT_PEM);
224 if(rc < 0) {
225 failf(data, "error reading crl file %s (%s)",
226- SSL_SET_OPTION(CRLfile), gnutls_strerror(rc));
227+ SSL_SET_OPTION(primary.CRLfile), gnutls_strerror(rc));
228 return CURLE_SSL_CRL_BADFILE;
229 }
230 else
231 infof(data, "found %d CRL in %s\n",
232- rc, SSL_SET_OPTION(CRLfile));
233+ rc, SSL_SET_OPTION(primary.CRLfile));
234 }
235
236 /* Initialize TLS session as a client */
237@@ -879,7 +880,7 @@ gtls_connect_step1(struct connectdata *conn,
238
239 #ifdef USE_TLS_SRP
240 /* put the credentials to the current session */
241- if(SSL_SET_OPTION(authtype) == CURL_TLSAUTH_SRP) {
242+ if(SSL_SET_OPTION(primary.authtype) == CURL_TLSAUTH_SRP) {
243 rc = gnutls_credentials_set(session, GNUTLS_CRD_SRP,
244 BACKEND->srp_client_cred);
245 if(rc != GNUTLS_E_SUCCESS) {
246@@ -1061,8 +1062,8 @@ gtls_connect_step3(struct connectdata *conn,
247 SSL_CONN_CONFIG(verifyhost) ||
248 SSL_CONN_CONFIG(issuercert)) {
249 #ifdef USE_TLS_SRP
250- if(SSL_SET_OPTION(authtype) == CURL_TLSAUTH_SRP
251- && SSL_SET_OPTION(username) != NULL
252+ if(SSL_SET_OPTION(primary.authtype) == CURL_TLSAUTH_SRP
253+ && SSL_SET_OPTION(primary.username) != NULL
254 && !SSL_CONN_CONFIG(verifypeer)
255 && gnutls_cipher_get(session)) {
256 /* no peer cert, but auth is ok if we have SRP user and cipher and no
257@@ -1116,7 +1117,8 @@ gtls_connect_step3(struct connectdata *conn,
258 failf(data, "server certificate verification failed. CAfile: %s "
259 "CRLfile: %s", SSL_CONN_CONFIG(CAfile) ? SSL_CONN_CONFIG(CAfile):
260 "none",
261- SSL_SET_OPTION(CRLfile)?SSL_SET_OPTION(CRLfile):"none");
262+ SSL_SET_OPTION(primary.CRLfile) ?
263+ SSL_SET_OPTION(primary.CRLfile) : "none");
264 return CURLE_PEER_FAILED_VERIFICATION;
265 }
266 else
267@@ -1703,8 +1705,8 @@ static int Curl_gtls_shutdown(struct connectdata *conn, int sockindex)
268 gnutls_certificate_free_credentials(BACKEND->cred);
269
270 #ifdef USE_TLS_SRP
271- if(SSL_SET_OPTION(authtype) == CURL_TLSAUTH_SRP
272- && SSL_SET_OPTION(username) != NULL)
273+ if(SSL_SET_OPTION(primary.authtype) == CURL_TLSAUTH_SRP
274+ && SSL_SET_OPTION(primary.username) != NULL)
275 gnutls_srp_free_client_credentials(BACKEND->srp_client_cred);
276 #endif
277
278diff --git a/lib/vtls/mbedtls.c b/lib/vtls/mbedtls.c
279index 19df847..62d2b00 100644
280--- a/lib/vtls/mbedtls.c
281+++ b/lib/vtls/mbedtls.c
282@@ -245,7 +245,7 @@ mbed_connect_step1(struct connectdata *conn,
283 const bool verifypeer = SSL_CONN_CONFIG(verifypeer);
284 const char * const ssl_capath = SSL_CONN_CONFIG(CApath);
285 char * const ssl_cert = SSL_SET_OPTION(cert);
286- const char * const ssl_crlfile = SSL_SET_OPTION(CRLfile);
287+ const char * const ssl_crlfile = SSL_SET_OPTION(primary.CRLfile);
288 const char * const hostname = SSL_IS_PROXY() ? conn->http_proxy.host.name :
289 conn->host.name;
290 const long int port = SSL_IS_PROXY() ? conn->port : conn->remote_port;
291diff --git a/lib/vtls/nss.c b/lib/vtls/nss.c
292index 86102f7..62fd7a2 100644
293--- a/lib/vtls/nss.c
294+++ b/lib/vtls/nss.c
295@@ -1955,13 +1955,13 @@ static CURLcode nss_setup_connect(struct connectdata *conn, int sockindex)
296 }
297 }
298
299- if(SSL_SET_OPTION(CRLfile)) {
300- const CURLcode rv = nss_load_crl(SSL_SET_OPTION(CRLfile));
301+ if(SSL_SET_OPTION(primary.CRLfile)) {
302+ const CURLcode rv = nss_load_crl(SSL_SET_OPTION(primary.CRLfile));
303 if(rv) {
304 result = rv;
305 goto error;
306 }
307- infof(data, " CRLfile: %s\n", SSL_SET_OPTION(CRLfile));
308+ infof(data, " CRLfile: %s\n", SSL_SET_OPTION(primary.CRLfile));
309 }
310
311 if(SSL_SET_OPTION(cert)) {
312diff --git a/lib/vtls/openssl.c b/lib/vtls/openssl.c
313index a14cecc..ec5a8f5 100644
314--- a/lib/vtls/openssl.c
315+++ b/lib/vtls/openssl.c
316@@ -2454,14 +2454,14 @@ static CURLcode ossl_connect_step1(struct connectdata *conn, int sockindex)
317 &data->set.proxy_ssl.certverifyresult : &data->set.ssl.certverifyresult;
318 const long int ssl_version = SSL_CONN_CONFIG(version);
319 #ifdef USE_TLS_SRP
320- const enum CURL_TLSAUTH ssl_authtype = SSL_SET_OPTION(authtype);
321+ const enum CURL_TLSAUTH ssl_authtype = SSL_SET_OPTION(primary.authtype);
322 #endif
323 char * const ssl_cert = SSL_SET_OPTION(cert);
324 const char * const ssl_cert_type = SSL_SET_OPTION(cert_type);
325 const char * const ssl_cafile = SSL_CONN_CONFIG(CAfile);
326 const char * const ssl_capath = SSL_CONN_CONFIG(CApath);
327 const bool verifypeer = SSL_CONN_CONFIG(verifypeer);
328- const char * const ssl_crlfile = SSL_SET_OPTION(CRLfile);
329+ const char * const ssl_crlfile = SSL_SET_OPTION(primary.CRLfile);
330 char error_buffer[256];
331
332 DEBUGASSERT(ssl_connect_1 == connssl->connecting_state);
333@@ -2741,15 +2741,15 @@ static CURLcode ossl_connect_step1(struct connectdata *conn, int sockindex)
334 #ifdef USE_TLS_SRP
335 if((ssl_authtype == CURL_TLSAUTH_SRP) &&
336 Curl_allow_auth_to_host(data)) {
337- char * const ssl_username = SSL_SET_OPTION(username);
338-
339+ char * const ssl_username = SSL_SET_OPTION(primary.username);
340+ char * const ssl_password = SSL_SET_OPTION(primary.password);
341 infof(data, "Using TLS-SRP username: %s\n", ssl_username);
342
343 if(!SSL_CTX_set_srp_username(BACKEND->ctx, ssl_username)) {
344 failf(data, "Unable to set SRP user name");
345 return CURLE_BAD_FUNCTION_ARGUMENT;
346 }
347- if(!SSL_CTX_set_srp_password(BACKEND->ctx, SSL_SET_OPTION(password))) {
348+ if(!SSL_CTX_set_srp_password(BACKEND->ctx, ssl_password)) {
349 failf(data, "failed setting SRP password");
350 return CURLE_BAD_FUNCTION_ARGUMENT;
351 }
352diff --git a/lib/vtls/vtls.c b/lib/vtls/vtls.c
353index e38f74e..e8cb70f 100644
354--- a/lib/vtls/vtls.c
355+++ b/lib/vtls/vtls.c
356@@ -89,6 +89,7 @@ Curl_ssl_config_matches(struct ssl_primary_config* data,
357 {
358 if((data->version == needle->version) &&
359 (data->version_max == needle->version_max) &&
360+ (data->ssl_options == needle->ssl_options) &&
361 (data->verifypeer == needle->verifypeer) &&
362 (data->verifyhost == needle->verifyhost) &&
363 (data->verifystatus == needle->verifystatus) &&
diff --git a/meta/recipes-support/curl/curl/CVE-2022-27782-2.patch b/meta/recipes-support/curl/curl/CVE-2022-27782-2.patch
new file mode 100644
index 0000000000..3d56025210
--- /dev/null
+++ b/meta/recipes-support/curl/curl/CVE-2022-27782-2.patch
@@ -0,0 +1,71 @@
1From 0a115a8903dffc7f723d1d4d71fb821d69eb8761 Mon Sep 17 00:00:00 2001
2From: Daniel Stenberg <daniel@haxx.se>
3Date: Mon, 9 May 2022 23:13:53 +0200
4Subject: [PATCH] url: check SSH config match on connection reuse
5
6CVE-2022-27782
7
8Reported-by: Harry Sintonen
9Bug: https://curl.se/docs/CVE-2022-27782.html
10Closes #8825
11
12Upstream-Status: Backport [https://github.com/curl/curl/commit/1645e9b44505abd5cbaf65da5282c3f33b5924a5]
13Signed-off-by: Robert Joslyn <robert.joslyn@redrectangle.org>
14---
15 lib/url.c | 11 +++++++++++
16 lib/vssh/ssh.h | 6 +++---
17 2 files changed, 14 insertions(+), 3 deletions(-)
18
19diff --git a/lib/url.c b/lib/url.c
20index 6518be9..8da0245 100644
21--- a/lib/url.c
22+++ b/lib/url.c
23@@ -1027,6 +1027,12 @@ static void prune_dead_connections(struct Curl_easy *data)
24 }
25 }
26
27+static bool ssh_config_matches(struct connectdata *one,
28+ struct connectdata *two)
29+{
30+ return (Curl_safecmp(one->proto.sshc.rsa, two->proto.sshc.rsa) &&
31+ Curl_safecmp(one->proto.sshc.rsa_pub, two->proto.sshc.rsa_pub));
32+}
33 /*
34 * Given one filled in connection struct (named needle), this function should
35 * detect if there already is one that has all the significant details
36@@ -1260,6 +1266,11 @@ ConnectionExists(struct Curl_easy *data,
37 }
38 }
39
40+ if(get_protocol_family(needle->handler->protocol) == PROTO_FAMILY_SSH) {
41+ if(!ssh_config_matches(needle, check))
42+ continue;
43+ }
44+
45 if(!needle->bits.httpproxy || (needle->handler->flags&PROTOPT_SSL) ||
46 needle->bits.tunnel_proxy) {
47 /* The requested connection does not use a HTTP proxy or it uses SSL or
48diff --git a/lib/vssh/ssh.h b/lib/vssh/ssh.h
49index 0d4ee52..8f2632e 100644
50--- a/lib/vssh/ssh.h
51+++ b/lib/vssh/ssh.h
52@@ -7,7 +7,7 @@
53 * | (__| |_| | _ <| |___
54 * \___|\___/|_| \_\_____|
55 *
56- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
57+ * Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
58 *
59 * This software is licensed as described in the file COPYING, which
60 * you should have received as part of this distribution. The terms
61@@ -120,8 +120,8 @@ struct ssh_conn {
62
63 /* common */
64 const char *passphrase; /* pass-phrase to use */
65- char *rsa_pub; /* path name */
66- char *rsa; /* path name */
67+ char *rsa_pub; /* strdup'ed public key file */
68+ char *rsa; /* strdup'ed private key file */
69 bool authed; /* the connection has been authenticated fine */
70 sshstate state; /* always use ssh.c:state() to change state! */
71 sshstate nextstate; /* the state to goto after stopping */
diff --git a/meta/recipes-support/curl/curl/CVE-2022-32206.patch b/meta/recipes-support/curl/curl/CVE-2022-32206.patch
new file mode 100644
index 0000000000..3d76aeb43d
--- /dev/null
+++ b/meta/recipes-support/curl/curl/CVE-2022-32206.patch
@@ -0,0 +1,52 @@
1From 25e7be39be5f8ed696b6085ced9cf6c17e6128f4 Mon Sep 17 00:00:00 2001
2From: Daniel Stenberg <daniel@haxx.se>
3Date: Mon, 16 May 2022 16:28:13 +0200
4Subject: [PATCH] content_encoding: return error on too many compression steps
5
6The max allowed steps is arbitrarily set to 5.
7
8Bug: https://curl.se/docs/CVE-2022-32206.html
9CVE-2022-32206
10Reported-by: Harry Sintonen
11Closes #9049
12
13Upstream-Status: Backport [https://github.com/curl/curl/commit/3a09fbb7f264c67c43]
14Signed-off-by: Robert Joslyn <robert.joslyn@redrectangle.org>
15---
16 lib/content_encoding.c | 9 +++++++++
17 1 file changed, 9 insertions(+)
18
19diff --git a/lib/content_encoding.c b/lib/content_encoding.c
20index 6d47537..91e621f 100644
21--- a/lib/content_encoding.c
22+++ b/lib/content_encoding.c
23@@ -934,6 +934,9 @@ static const content_encoding *find_encoding(const char *name, size_t len)
24 return NULL;
25 }
26
27+/* allow no more than 5 "chained" compression steps */
28+#define MAX_ENCODE_STACK 5
29+
30 /* Set-up the unencoding stack from the Content-Encoding header value.
31 * See RFC 7231 section 3.1.2.2. */
32 CURLcode Curl_build_unencoding_stack(struct connectdata *conn,
33@@ -941,6 +944,7 @@ CURLcode Curl_build_unencoding_stack(struct connectdata *conn,
34 {
35 struct Curl_easy *data = conn->data;
36 struct SingleRequest *k = &data->req;
37+ int counter = 0;
38
39 do {
40 const char *name;
41@@ -975,6 +979,11 @@ CURLcode Curl_build_unencoding_stack(struct connectdata *conn,
42 if(!encoding)
43 encoding = &error_encoding; /* Defer error at stack use. */
44
45+ if(++counter >= MAX_ENCODE_STACK) {
46+ failf(data, "Reject response due to %u content encodings",
47+ counter);
48+ return CURLE_BAD_CONTENT_ENCODING;
49+ }
50 /* Stack the unencoding stage. */
51 writer = new_unencoding_writer(conn, encoding, k->writer_stack);
52 if(!writer)
diff --git a/meta/recipes-support/curl/curl/CVE-2022-32207.patch b/meta/recipes-support/curl/curl/CVE-2022-32207.patch
new file mode 100644
index 0000000000..f75aaecd64
--- /dev/null
+++ b/meta/recipes-support/curl/curl/CVE-2022-32207.patch
@@ -0,0 +1,284 @@
1From af92181055d7d64dfc0bc9d5a13c8b98af3196be Mon Sep 17 00:00:00 2001
2From: Daniel Stenberg <daniel@haxx.se>
3Date: Wed, 25 May 2022 10:09:53 +0200
4Subject: [PATCH] fopen: add Curl_fopen() for better overwriting of files
5
6Bug: https://curl.se/docs/CVE-2022-32207.html
7CVE-2022-32207
8Reported-by: Harry Sintonen
9Closes #9050
10
11Upstream-Status: Backport [https://github.com/curl/curl/commit/20f9dd6bae50b]
12Signed-off-by: Robert Joslyn <robert.joslyn@redrectangle.org>
13---
14 CMakeLists.txt | 1 +
15 configure.ac | 1 +
16 lib/Makefile.inc | 4 +-
17 lib/cookie.c | 19 ++-----
18 lib/curl_config.h.cmake | 3 ++
19 lib/fopen.c | 113 ++++++++++++++++++++++++++++++++++++++++
20 lib/fopen.h | 30 +++++++++++
21 7 files changed, 155 insertions(+), 16 deletions(-)
22 create mode 100644 lib/fopen.c
23 create mode 100644 lib/fopen.h
24
25diff --git a/CMakeLists.txt b/CMakeLists.txt
26index 73b053b..cc587b0 100644
27--- a/CMakeLists.txt
28+++ b/CMakeLists.txt
29@@ -869,6 +869,7 @@ elseif(HAVE_LIBSOCKET)
30 set(CMAKE_REQUIRED_LIBRARIES socket)
31 endif()
32
33+check_symbol_exists(fchmod "${CURL_INCLUDES}" HAVE_FCHMOD)
34 check_symbol_exists(basename "${CURL_INCLUDES}" HAVE_BASENAME)
35 check_symbol_exists(socket "${CURL_INCLUDES}" HAVE_SOCKET)
36 check_symbol_exists(select "${CURL_INCLUDES}" HAVE_SELECT)
37diff --git a/configure.ac b/configure.ac
38index d090622..7071077 100755
39--- a/configure.ac
40+++ b/configure.ac
41@@ -4059,6 +4059,7 @@ AC_CHECK_DECLS([getpwuid_r], [], [AC_DEFINE(HAVE_DECL_GETPWUID_R_MISSING, 1, "Se
42
43
44 AC_CHECK_FUNCS([fnmatch \
45+ fchmod \
46 geteuid \
47 getpass_r \
48 getppid \
49diff --git a/lib/Makefile.inc b/lib/Makefile.inc
50index 46ded90..79307d8 100644
51--- a/lib/Makefile.inc
52+++ b/lib/Makefile.inc
53@@ -63,7 +63,7 @@ LIB_CFILES = file.c timeval.c base64.c hostip.c progress.c formdata.c \
54 curl_multibyte.c hostcheck.c conncache.c dotdot.c \
55 x509asn1.c http2.c smb.c curl_endian.c curl_des.c system_win32.c \
56 mime.c sha256.c setopt.c curl_path.c curl_ctype.c curl_range.c psl.c \
57- doh.c urlapi.c curl_get_line.c altsvc.c socketpair.c rename.c
58+ doh.c urlapi.c curl_get_line.c altsvc.c socketpair.c rename.c fopen.c
59
60 LIB_HFILES = arpa_telnet.h netrc.h file.h timeval.h hostip.h progress.h \
61 formdata.h cookie.h http.h sendf.h ftp.h url.h dict.h if2ip.h \
62@@ -84,7 +84,7 @@ LIB_HFILES = arpa_telnet.h netrc.h file.h timeval.h hostip.h progress.h \
63 x509asn1.h http2.h sigpipe.h smb.h curl_endian.h curl_des.h \
64 curl_printf.h system_win32.h rand.h mime.h curl_sha256.h setopt.h \
65 curl_path.h curl_ctype.h curl_range.h psl.h doh.h urlapi-int.h \
66- curl_get_line.h altsvc.h quic.h socketpair.h rename.h
67+ curl_get_line.h altsvc.h quic.h socketpair.h rename.h fopen.h
68
69 LIB_RCFILES = libcurl.rc
70
71diff --git a/lib/cookie.c b/lib/cookie.c
72index 68054e1..a9ad20a 100644
73--- a/lib/cookie.c
74+++ b/lib/cookie.c
75@@ -97,8 +97,8 @@ Example set of cookies:
76 #include "curl_memrchr.h"
77 #include "inet_pton.h"
78 #include "parsedate.h"
79-#include "rand.h"
80 #include "rename.h"
81+#include "fopen.h"
82
83 /* The last 3 #include files should be in this order */
84 #include "curl_printf.h"
85@@ -1524,18 +1524,9 @@ static int cookie_output(struct Curl_easy *data,
86 use_stdout = TRUE;
87 }
88 else {
89- unsigned char randsuffix[9];
90-
91- if(Curl_rand_hex(data, randsuffix, sizeof(randsuffix)))
92- return 2;
93-
94- tempstore = aprintf("%s.%s.tmp", filename, randsuffix);
95- if(!tempstore)
96- return 1;
97-
98- out = fopen(tempstore, FOPEN_WRITETEXT);
99- if(!out)
100- goto error;
101+ error = Curl_fopen(data, filename, &out, &tempstore);
102+ if(error)
103+ goto error;
104 }
105
106 fputs("# Netscape HTTP Cookie File\n"
107@@ -1581,7 +1572,7 @@ static int cookie_output(struct Curl_easy *data,
108 if(!use_stdout) {
109 fclose(out);
110 out = NULL;
111- if(Curl_rename(tempstore, filename)) {
112+ if(tempstore && Curl_rename(tempstore, filename)) {
113 unlink(tempstore);
114 goto error;
115 }
116diff --git a/lib/curl_config.h.cmake b/lib/curl_config.h.cmake
117index 98cdf51..fe43751 100644
118--- a/lib/curl_config.h.cmake
119+++ b/lib/curl_config.h.cmake
120@@ -124,6 +124,9 @@
121 /* Define to 1 if you have the <assert.h> header file. */
122 #cmakedefine HAVE_ASSERT_H 1
123
124+/* Define to 1 if you have the `fchmod' function. */
125+#cmakedefine HAVE_FCHMOD 1
126+
127 /* Define to 1 if you have the `basename' function. */
128 #cmakedefine HAVE_BASENAME 1
129
130diff --git a/lib/fopen.c b/lib/fopen.c
131new file mode 100644
132index 0000000..ad3691b
133--- /dev/null
134+++ b/lib/fopen.c
135@@ -0,0 +1,113 @@
136+/***************************************************************************
137+ * _ _ ____ _
138+ * Project ___| | | | _ \| |
139+ * / __| | | | |_) | |
140+ * | (__| |_| | _ <| |___
141+ * \___|\___/|_| \_\_____|
142+ *
143+ * Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
144+ *
145+ * This software is licensed as described in the file COPYING, which
146+ * you should have received as part of this distribution. The terms
147+ * are also available at https://curl.se/docs/copyright.html.
148+ *
149+ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
150+ * copies of the Software, and permit persons to whom the Software is
151+ * furnished to do so, under the terms of the COPYING file.
152+ *
153+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
154+ * KIND, either express or implied.
155+ *
156+ * SPDX-License-Identifier: curl
157+ *
158+ ***************************************************************************/
159+
160+#include "curl_setup.h"
161+
162+#if !defined(CURL_DISABLE_COOKIES) || !defined(CURL_DISABLE_ALTSVC) || \
163+ !defined(CURL_DISABLE_HSTS)
164+
165+#ifdef HAVE_FCNTL_H
166+#include <fcntl.h>
167+#endif
168+
169+#include "urldata.h"
170+#include "rand.h"
171+#include "fopen.h"
172+/* The last 3 #include files should be in this order */
173+#include "curl_printf.h"
174+#include "curl_memory.h"
175+#include "memdebug.h"
176+
177+/*
178+ * Curl_fopen() opens a file for writing with a temp name, to be renamed
179+ * to the final name when completed. If there is an existing file using this
180+ * name at the time of the open, this function will clone the mode from that
181+ * file. if 'tempname' is non-NULL, it needs a rename after the file is
182+ * written.
183+ */
184+CURLcode Curl_fopen(struct Curl_easy *data, const char *filename,
185+ FILE **fh, char **tempname)
186+{
187+ CURLcode result = CURLE_WRITE_ERROR;
188+ unsigned char randsuffix[9];
189+ char *tempstore = NULL;
190+ struct_stat sb;
191+ int fd = -1;
192+ *tempname = NULL;
193+
194+ if(stat(filename, &sb) == -1 || !S_ISREG(sb.st_mode)) {
195+ /* a non-regular file, fallback to direct fopen() */
196+ *fh = fopen(filename, FOPEN_WRITETEXT);
197+ if(*fh)
198+ return CURLE_OK;
199+ goto fail;
200+ }
201+
202+ result = Curl_rand_hex(data, randsuffix, sizeof(randsuffix));
203+ if(result)
204+ goto fail;
205+
206+ tempstore = aprintf("%s.%s.tmp", filename, randsuffix);
207+ if(!tempstore) {
208+ result = CURLE_OUT_OF_MEMORY;
209+ goto fail;
210+ }
211+
212+ result = CURLE_WRITE_ERROR;
213+ fd = open(tempstore, O_WRONLY | O_CREAT | O_EXCL, 0600);
214+ if(fd == -1)
215+ goto fail;
216+
217+#ifdef HAVE_FCHMOD
218+ {
219+ struct_stat nsb;
220+ if((fstat(fd, &nsb) != -1) &&
221+ (nsb.st_uid == sb.st_uid) && (nsb.st_gid == sb.st_gid)) {
222+ /* if the user and group are the same, clone the original mode */
223+ if(fchmod(fd, sb.st_mode) == -1)
224+ goto fail;
225+ }
226+ }
227+#endif
228+
229+ *fh = fdopen(fd, FOPEN_WRITETEXT);
230+ if(!*fh)
231+ goto fail;
232+
233+ *tempname = tempstore;
234+ return CURLE_OK;
235+
236+fail:
237+ if(fd != -1) {
238+ close(fd);
239+ unlink(tempstore);
240+ }
241+
242+ free(tempstore);
243+
244+ *tempname = NULL;
245+ return result;
246+}
247+
248+#endif /* ! disabled */
249diff --git a/lib/fopen.h b/lib/fopen.h
250new file mode 100644
251index 0000000..289e55f
252--- /dev/null
253+++ b/lib/fopen.h
254@@ -0,0 +1,30 @@
255+#ifndef HEADER_CURL_FOPEN_H
256+#define HEADER_CURL_FOPEN_H
257+/***************************************************************************
258+ * _ _ ____ _
259+ * Project ___| | | | _ \| |
260+ * / __| | | | |_) | |
261+ * | (__| |_| | _ <| |___
262+ * \___|\___/|_| \_\_____|
263+ *
264+ * Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
265+ *
266+ * This software is licensed as described in the file COPYING, which
267+ * you should have received as part of this distribution. The terms
268+ * are also available at https://curl.se/docs/copyright.html.
269+ *
270+ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
271+ * copies of the Software, and permit persons to whom the Software is
272+ * furnished to do so, under the terms of the COPYING file.
273+ *
274+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
275+ * KIND, either express or implied.
276+ *
277+ * SPDX-License-Identifier: curl
278+ *
279+ ***************************************************************************/
280+
281+CURLcode Curl_fopen(struct Curl_easy *data, const char *filename,
282+ FILE **fh, char **tempname);
283+
284+#endif
diff --git a/meta/recipes-support/curl/curl/CVE-2022-32208.patch b/meta/recipes-support/curl/curl/CVE-2022-32208.patch
new file mode 100644
index 0000000000..2939314d09
--- /dev/null
+++ b/meta/recipes-support/curl/curl/CVE-2022-32208.patch
@@ -0,0 +1,72 @@
1From 3b90f0b2a7a84645acce151c86b40d25b5de6615 Mon Sep 17 00:00:00 2001
2From: Daniel Stenberg <daniel@haxx.se>
3Date: Thu, 9 Jun 2022 09:27:24 +0200
4Subject: [PATCH] krb5: return error properly on decode errors
5
6Bug: https://curl.se/docs/CVE-2022-32208.html
7CVE-2022-32208
8Reported-by: Harry Sintonen
9Closes #9051
10
11Upstream-Status: Backport [https://github.com/curl/curl/commit/6ecdf5136b52af7]
12Signed-off-by: Robert Joslyn <robert.joslyn@redrectangle.org>
13---
14 lib/krb5.c | 5 +----
15 lib/security.c | 13 ++++++++++---
16 2 files changed, 11 insertions(+), 7 deletions(-)
17
18diff --git a/lib/krb5.c b/lib/krb5.c
19index f50287a..5b77e35 100644
20--- a/lib/krb5.c
21+++ b/lib/krb5.c
22@@ -86,11 +86,8 @@ krb5_decode(void *app_data, void *buf, int len,
23 enc.value = buf;
24 enc.length = len;
25 maj = gss_unwrap(&min, *context, &enc, &dec, NULL, NULL);
26- if(maj != GSS_S_COMPLETE) {
27- if(len >= 4)
28- strcpy(buf, "599 ");
29+ if(maj != GSS_S_COMPLETE)
30 return -1;
31- }
32
33 memcpy(buf, dec.value, dec.length);
34 len = curlx_uztosi(dec.length);
35diff --git a/lib/security.c b/lib/security.c
36index fbfa707..3542210 100644
37--- a/lib/security.c
38+++ b/lib/security.c
39@@ -192,6 +192,7 @@ static CURLcode read_data(struct connectdata *conn,
40 {
41 int len;
42 CURLcode result;
43+ int nread;
44
45 result = socket_read(fd, &len, sizeof(len));
46 if(result)
47@@ -200,7 +201,10 @@ static CURLcode read_data(struct connectdata *conn,
48 if(len) {
49 /* only realloc if there was a length */
50 len = ntohl(len);
51- buf->data = Curl_saferealloc(buf->data, len);
52+ if(len > CURL_MAX_INPUT_LENGTH)
53+ len = 0;
54+ else
55+ buf->data = Curl_saferealloc(buf->data, len);
56 }
57 if(!len || !buf->data)
58 return CURLE_OUT_OF_MEMORY;
59@@ -208,8 +212,11 @@ static CURLcode read_data(struct connectdata *conn,
60 result = socket_read(fd, buf->data, len);
61 if(result)
62 return result;
63- buf->size = conn->mech->decode(conn->app_data, buf->data, len,
64- conn->data_prot, conn);
65+ nread = buf->size = conn->mech->decode(conn->app_data, buf->data, len,
66+ conn->data_prot, conn);
67+ if(nread < 0)
68+ return CURLE_RECV_ERROR;
69+ buf->size = (size_t)nread;
70 buf->index = 0;
71 return CURLE_OK;
72 }
diff --git a/meta/recipes-support/curl/curl/CVE-2022-32221.patch b/meta/recipes-support/curl/curl/CVE-2022-32221.patch
new file mode 100644
index 0000000000..8e662abd3a
--- /dev/null
+++ b/meta/recipes-support/curl/curl/CVE-2022-32221.patch
@@ -0,0 +1,29 @@
1From 75c04a3e75e8e3025a17ca3033ca307da9691cd0 Mon Sep 17 00:00:00 2001
2From: Vivek Kumbhar <vkumbhar@mvista.com>
3Date: Fri, 11 Nov 2022 10:49:58 +0530
4Subject: [PATCH] CVE-2022-32221
5
6Upstream-Status: Backport [https://github.com/curl/curl/commit/a64e3e59938abd7d6]
7CVE: CVE-2022-32221
8Signed-off-by: Vivek Kumbhar <vkumbhar@mvista.com>
9
10setopt: when POST is set, reset the 'upload' field.
11---
12 lib/setopt.c | 1 +
13 1 file changed, 1 insertion(+)
14
15diff --git a/lib/setopt.c b/lib/setopt.c
16index bebb2e4..4d96f6b 100644
17--- a/lib/setopt.c
18+++ b/lib/setopt.c
19@@ -486,6 +486,7 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
20 }
21 else
22 data->set.httpreq = HTTPREQ_GET;
23+ data->set.upload = FALSE;
24 break;
25
26 case CURLOPT_COPYPOSTFIELDS:
27--
282.25.1
29
diff --git a/meta/recipes-support/curl/curl/CVE-2022-35252.patch b/meta/recipes-support/curl/curl/CVE-2022-35252.patch
new file mode 100644
index 0000000000..a5160c01f4
--- /dev/null
+++ b/meta/recipes-support/curl/curl/CVE-2022-35252.patch
@@ -0,0 +1,72 @@
1From c9212bdb21f0cc90a1a60dfdbb716deefe78fd40 Mon Sep 17 00:00:00 2001
2From: Daniel Stenberg <daniel@haxx.se>
3Date: Mon, 29 Aug 2022 00:09:17 +0200
4Subject: [PATCH] cookie: reject cookies with "control bytes"
5
6Rejects 0x01 - 0x1f (except 0x09) plus 0x7f
7
8Reported-by: Axel Chong
9
10Bug: https://curl.se/docs/CVE-2022-35252.html
11
12CVE-2022-35252
13
14Closes #9381
15
16Upstream-Status: Backport [https://github.com/curl/curl/commit/8dfc93e573ca740544a2d79ebb]
17
18Signed-off-by: Robert Joslyn <robert.joslyn@redrectangle.org>
19---
20 lib/cookie.c | 29 +++++++++++++++++++++++++++++
21 1 file changed, 29 insertions(+)
22
23diff --git a/lib/cookie.c b/lib/cookie.c
24index a9ad20a..66c7715 100644
25--- a/lib/cookie.c
26+++ b/lib/cookie.c
27@@ -412,6 +412,30 @@ static bool bad_domain(const char *domain)
28 return !strchr(domain, '.') && !strcasecompare(domain, "localhost");
29 }
30
31+/*
32+ RFC 6265 section 4.1.1 says a server should accept this range:
33+
34+ cookie-octet = %x21 / %x23-2B / %x2D-3A / %x3C-5B / %x5D-7E
35+
36+ But Firefox and Chrome as of June 2022 accept space, comma and double-quotes
37+ fine. The prime reason for filtering out control bytes is that some HTTP
38+ servers return 400 for requests that contain such.
39+*/
40+static int invalid_octets(const char *p)
41+{
42+ /* Reject all bytes \x01 - \x1f (*except* \x09, TAB) + \x7f */
43+ static const char badoctets[] = {
44+ "\x01\x02\x03\x04\x05\x06\x07\x08\x0a"
45+ "\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14"
46+ "\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\x7f"
47+ };
48+ size_t vlen, len;
49+ /* scan for all the octets that are *not* in cookie-octet */
50+ len = strcspn(p, badoctets);
51+ vlen = strlen(p);
52+ return (len != vlen);
53+}
54+
55 /****************************************************************************
56 *
57 * Curl_cookie_add()
58@@ -558,6 +582,11 @@ Curl_cookie_add(struct Curl_easy *data,
59 badcookie = TRUE;
60 break;
61 }
62+ if(invalid_octets(whatptr) || invalid_octets(name)) {
63+ infof(data, "invalid octets in name/value, cookie dropped");
64+ badcookie = TRUE;
65+ break;
66+ }
67 }
68 else if(!len) {
69 /* this was a "<name>=" with no content, and we must allow
70--
712.35.1
72
diff --git a/meta/recipes-support/curl/curl/CVE-2022-35260.patch b/meta/recipes-support/curl/curl/CVE-2022-35260.patch
new file mode 100644
index 0000000000..476c996b0a
--- /dev/null
+++ b/meta/recipes-support/curl/curl/CVE-2022-35260.patch
@@ -0,0 +1,68 @@
1From 3ff3989ec53d9ddcf4bdd99f5d5788dd87486768 Mon Sep 17 00:00:00 2001
2From: Daniel Stenberg <daniel@haxx.se>
3Date: Tue, 4 Oct 2022 14:37:24 +0200
4Subject: [PATCH] netrc: replace fgets with Curl_get_line
5
6Upstream-Status: Backport
7CVE: CVE-2022-35260
8Reference to upstream patch: https://github.com/curl/curl/commit/c97ec984fb2bc919a3aa863e0476dffa377b184c
9
10Make the parser only accept complete lines and avoid problems with
11overly long lines.
12
13Reported-by: Hiroki Kurosawa
14
15Closes #9789
16---
17 lib/curl_get_line.c | 4 ++--
18 lib/netrc.c | 5 +++--
19 2 files changed, 5 insertions(+), 4 deletions(-)
20
21diff --git a/lib/curl_get_line.c b/lib/curl_get_line.c
22index c4194851ae09..4b9eea9e631c 100644
23--- a/lib/curl_get_line.c
24+++ b/lib/curl_get_line.c
25@@ -28,8 +28,8 @@
26 #include "memdebug.h"
27
28 /*
29- * get_line() makes sure to only return complete whole lines that fit in 'len'
30- * bytes and end with a newline.
31+ * Curl_get_line() makes sure to only return complete whole lines that fit in
32+ * 'len' bytes and end with a newline.
33 */
34 char *Curl_get_line(char *buf, int len, FILE *input)
35 {
36diff --git a/lib/netrc.c b/lib/netrc.c
37index 1c9da31993c9..93239132c9d8 100644
38--- a/lib/netrc.c
39+++ b/lib/netrc.c
40@@ -31,6 +31,7 @@
41 #include "netrc.h"
42 #include "strtok.h"
43 #include "strcase.h"
44+#include "curl_get_line.h"
45
46 /* The last 3 #include files should be in this order */
47 #include "curl_printf.h"
48@@ -83,7 +84,7 @@ static int parsenetrc(const char *host,
49 char netrcbuffer[4096];
50 int netrcbuffsize = (int)sizeof(netrcbuffer);
51
52- while(!done && fgets(netrcbuffer, netrcbuffsize, file)) {
53+ while(!done && Curl_get_line(netrcbuffer, netrcbuffsize, file)) {
54 tok = strtok_r(netrcbuffer, " \t\n", &tok_buf);
55 if(tok && *tok == '#')
56 /* treat an initial hash as a comment line */
57@@ -169,7 +170,7 @@ static int parsenetrc(const char *host,
58
59 tok = strtok_r(NULL, " \t\n", &tok_buf);
60 } /* while(tok) */
61- } /* while fgets() */
62+ } /* while Curl_get_line() */
63
64 out:
65 if(!retcode) {
66--
672.34.1
68
diff --git a/meta/recipes-support/curl/curl/CVE-2022-43552.patch b/meta/recipes-support/curl/curl/CVE-2022-43552.patch
new file mode 100644
index 0000000000..d729441454
--- /dev/null
+++ b/meta/recipes-support/curl/curl/CVE-2022-43552.patch
@@ -0,0 +1,82 @@
1rom 4f20188ac644afe174be6005ef4f6ffba232b8b2 Mon Sep 17 00:00:00 2001
2From: Daniel Stenberg <daniel@haxx.se>
3Date: Mon, 19 Dec 2022 08:38:37 +0100
4Subject: [PATCH] smb/telnet: do not free the protocol struct in *_done()
5
6It is managed by the generic layer.
7
8Reported-by: Trail of Bits
9
10Closes #10112
11
12CVE: CVE-2022-43552
13Upstream-Status: Backport [https://github.com/curl/curl/commit/4f20188ac644afe174be6005ef4f6ffba232b8b2]
14Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
15---
16 lib/smb.c | 14 ++------------
17 lib/telnet.c | 3 ---
18 2 files changed, 2 insertions(+), 15 deletions(-)
19
20diff --git a/lib/smb.c b/lib/smb.c
21index 12f9925..8db3b27 100644
22--- a/lib/smb.c
23+++ b/lib/smb.c
24@@ -61,8 +61,6 @@ static CURLcode smb_connect(struct connectdata *conn, bool *done);
25 static CURLcode smb_connection_state(struct connectdata *conn, bool *done);
26 static CURLcode smb_do(struct connectdata *conn, bool *done);
27 static CURLcode smb_request_state(struct connectdata *conn, bool *done);
28-static CURLcode smb_done(struct connectdata *conn, CURLcode status,
29- bool premature);
30 static CURLcode smb_disconnect(struct connectdata *conn, bool dead);
31 static int smb_getsock(struct connectdata *conn, curl_socket_t *socks);
32 static CURLcode smb_parse_url_path(struct connectdata *conn);
33@@ -74,7 +72,7 @@ const struct Curl_handler Curl_handler_smb = {
34 "SMB", /* scheme */
35 smb_setup_connection, /* setup_connection */
36 smb_do, /* do_it */
37- smb_done, /* done */
38+ ZERO_NULL, /* done */
39 ZERO_NULL, /* do_more */
40 smb_connect, /* connect_it */
41 smb_connection_state, /* connecting */
42@@ -99,7 +97,7 @@ const struct Curl_handler Curl_handler_smbs = {
43 "SMBS", /* scheme */
44 smb_setup_connection, /* setup_connection */
45 smb_do, /* do_it */
46- smb_done, /* done */
47+ ZERO_NULL, /* done */
48 ZERO_NULL, /* do_more */
49 smb_connect, /* connect_it */
50 smb_connection_state, /* connecting */
51@@ -919,14 +917,6 @@ static CURLcode smb_request_state(struct connectdata *conn, bool *done)
52 return CURLE_OK;
53 }
54
55-static CURLcode smb_done(struct connectdata *conn, CURLcode status,
56- bool premature)
57-{
58- (void) premature;
59- Curl_safefree(conn->data->req.protop);
60- return status;
61-}
62-
63 static CURLcode smb_disconnect(struct connectdata *conn, bool dead)
64 {
65 struct smb_conn *smbc = &conn->proto.smbc;
66diff --git a/lib/telnet.c b/lib/telnet.c
67index 3347ad6..e3b9208 100644
68--- a/lib/telnet.c
69+++ b/lib/telnet.c
70@@ -1294,9 +1294,6 @@ static CURLcode telnet_done(struct connectdata *conn,
71
72 curl_slist_free_all(tn->telnet_vars);
73 tn->telnet_vars = NULL;
74-
75- Curl_safefree(conn->data->req.protop);
76-
77 return CURLE_OK;
78 }
79
80--
812.25.1
82
diff --git a/meta/recipes-support/curl/curl/CVE-2023-23916.patch b/meta/recipes-support/curl/curl/CVE-2023-23916.patch
new file mode 100644
index 0000000000..054615963e
--- /dev/null
+++ b/meta/recipes-support/curl/curl/CVE-2023-23916.patch
@@ -0,0 +1,231 @@
1From 119fb187192a9ea13dc90d9d20c215fc82799ab9 Mon Sep 17 00:00:00 2001
2From: Patrick Monnerat <patrick@monnerat.net>
3Date: Mon, 13 Feb 2023 08:33:09 +0100
4Subject: [PATCH] content_encoding: do not reset stage counter for each header
5
6Test 418 verifies
7
8Closes #10492
9
10Upstream-Status: Backport [https://github.com/curl/curl/commit/119fb187192a9ea13dc90d9d20c215fc82799ab9]
11CVE: CVE-2023-23916
12Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
13---
14 lib/content_encoding.c | 7 +-
15 lib/urldata.h | 1 +
16 tests/data/Makefile.inc | 2 +-
17 tests/data/test418 | 152 ++++++++++++++++++++++++++++++++++++++++
18 4 files changed, 157 insertions(+), 5 deletions(-)
19 create mode 100644 tests/data/test418
20
21diff --git a/lib/content_encoding.c b/lib/content_encoding.c
22index 91e621f..7e098a5 100644
23--- a/lib/content_encoding.c
24+++ b/lib/content_encoding.c
25@@ -944,7 +944,6 @@ CURLcode Curl_build_unencoding_stack(struct connectdata *conn,
26 {
27 struct Curl_easy *data = conn->data;
28 struct SingleRequest *k = &data->req;
29- int counter = 0;
30
31 do {
32 const char *name;
33@@ -979,9 +978,9 @@ CURLcode Curl_build_unencoding_stack(struct connectdata *conn,
34 if(!encoding)
35 encoding = &error_encoding; /* Defer error at stack use. */
36
37- if(++counter >= MAX_ENCODE_STACK) {
38- failf(data, "Reject response due to %u content encodings",
39- counter);
40+ if(k->writer_stack_depth++ >= MAX_ENCODE_STACK) {
41+ failf(data, "Reject response due to more than %u content encodings",
42+ MAX_ENCODE_STACK);
43 return CURLE_BAD_CONTENT_ENCODING;
44 }
45 /* Stack the unencoding stage. */
46diff --git a/lib/urldata.h b/lib/urldata.h
47index ad0ef8f..168f874 100644
48--- a/lib/urldata.h
49+++ b/lib/urldata.h
50@@ -648,6 +648,7 @@ struct SingleRequest {
51 #ifndef CURL_DISABLE_DOH
52 struct dohdata doh; /* DoH specific data for this request */
53 #endif
54+ unsigned char writer_stack_depth; /* Unencoding stack depth. */
55 BIT(header); /* incoming data has HTTP header */
56 BIT(content_range); /* set TRUE if Content-Range: was found */
57 BIT(upload_done); /* set to TRUE when doing chunked transfer-encoding
58diff --git a/tests/data/Makefile.inc b/tests/data/Makefile.inc
59index 60e8176..40de8bc 100644
60--- a/tests/data/Makefile.inc
61+++ b/tests/data/Makefile.inc
62@@ -63,7 +63,7 @@ test350 test351 test352 test353 test354 test355 test356 test357 \
63 test393 test394 test395 \
64 \
65 test400 test401 test402 test403 test404 test405 test406 test407 test408 \
66-test409 \
67+test409 test418 \
68 \
69 test490 test491 test492 \
70 \
71diff --git a/tests/data/test418 b/tests/data/test418
72new file mode 100644
73index 0000000..50e974e
74--- /dev/null
75+++ b/tests/data/test418
76@@ -0,0 +1,152 @@
77+<testcase>
78+<info>
79+<keywords>
80+HTTP
81+gzip
82+</keywords>
83+</info>
84+
85+#
86+# Server-side
87+<reply>
88+<data nocheck="yes">
89+HTTP/1.1 200 OK
90+Transfer-Encoding: gzip
91+Transfer-Encoding: gzip
92+Transfer-Encoding: gzip
93+Transfer-Encoding: gzip
94+Transfer-Encoding: gzip
95+Transfer-Encoding: gzip
96+Transfer-Encoding: gzip
97+Transfer-Encoding: gzip
98+Transfer-Encoding: gzip
99+Transfer-Encoding: gzip
100+Transfer-Encoding: gzip
101+Transfer-Encoding: gzip
102+Transfer-Encoding: gzip
103+Transfer-Encoding: gzip
104+Transfer-Encoding: gzip
105+Transfer-Encoding: gzip
106+Transfer-Encoding: gzip
107+Transfer-Encoding: gzip
108+Transfer-Encoding: gzip
109+Transfer-Encoding: gzip
110+Transfer-Encoding: gzip
111+Transfer-Encoding: gzip
112+Transfer-Encoding: gzip
113+Transfer-Encoding: gzip
114+Transfer-Encoding: gzip
115+Transfer-Encoding: gzip
116+Transfer-Encoding: gzip
117+Transfer-Encoding: gzip
118+Transfer-Encoding: gzip
119+Transfer-Encoding: gzip
120+Transfer-Encoding: gzip
121+Transfer-Encoding: gzip
122+Transfer-Encoding: gzip
123+Transfer-Encoding: gzip
124+Transfer-Encoding: gzip
125+Transfer-Encoding: gzip
126+Transfer-Encoding: gzip
127+Transfer-Encoding: gzip
128+Transfer-Encoding: gzip
129+Transfer-Encoding: gzip
130+Transfer-Encoding: gzip
131+Transfer-Encoding: gzip
132+Transfer-Encoding: gzip
133+Transfer-Encoding: gzip
134+Transfer-Encoding: gzip
135+Transfer-Encoding: gzip
136+Transfer-Encoding: gzip
137+Transfer-Encoding: gzip
138+Transfer-Encoding: gzip
139+Transfer-Encoding: gzip
140+Transfer-Encoding: gzip
141+Transfer-Encoding: gzip
142+Transfer-Encoding: gzip
143+Transfer-Encoding: gzip
144+Transfer-Encoding: gzip
145+Transfer-Encoding: gzip
146+Transfer-Encoding: gzip
147+Transfer-Encoding: gzip
148+Transfer-Encoding: gzip
149+Transfer-Encoding: gzip
150+Transfer-Encoding: gzip
151+Transfer-Encoding: gzip
152+Transfer-Encoding: gzip
153+Transfer-Encoding: gzip
154+Transfer-Encoding: gzip
155+Transfer-Encoding: gzip
156+Transfer-Encoding: gzip
157+Transfer-Encoding: gzip
158+Transfer-Encoding: gzip
159+Transfer-Encoding: gzip
160+Transfer-Encoding: gzip
161+Transfer-Encoding: gzip
162+Transfer-Encoding: gzip
163+Transfer-Encoding: gzip
164+Transfer-Encoding: gzip
165+Transfer-Encoding: gzip
166+Transfer-Encoding: gzip
167+Transfer-Encoding: gzip
168+Transfer-Encoding: gzip
169+Transfer-Encoding: gzip
170+Transfer-Encoding: gzip
171+Transfer-Encoding: gzip
172+Transfer-Encoding: gzip
173+Transfer-Encoding: gzip
174+Transfer-Encoding: gzip
175+Transfer-Encoding: gzip
176+Transfer-Encoding: gzip
177+Transfer-Encoding: gzip
178+Transfer-Encoding: gzip
179+Transfer-Encoding: gzip
180+Transfer-Encoding: gzip
181+Transfer-Encoding: gzip
182+Transfer-Encoding: gzip
183+Transfer-Encoding: gzip
184+Transfer-Encoding: gzip
185+Transfer-Encoding: gzip
186+Transfer-Encoding: gzip
187+Transfer-Encoding: gzip
188+Transfer-Encoding: gzip
189+Transfer-Encoding: gzip
190+
191+-foo-
192+</data>
193+</reply>
194+
195+#
196+# Client-side
197+<client>
198+<server>
199+http
200+</server>
201+ <name>
202+Response with multiple Transfer-Encoding headers
203+ </name>
204+ <command>
205+http://%HOSTIP:%HTTPPORT/%TESTNUMBER -sS
206+</command>
207+</client>
208+
209+#
210+# Verify data after the test has been "shot"
211+<verify>
212+<protocol crlf="yes">
213+GET /%TESTNUMBER HTTP/1.1
214+Host: %HOSTIP:%HTTPPORT
215+User-Agent: curl/%VERSION
216+Accept: */*
217+
218+</protocol>
219+
220+# CURLE_BAD_CONTENT_ENCODING is 61
221+<errorcode>
222+61
223+</errorcode>
224+<stderr mode="text">
225+curl: (61) Reject response due to more than 5 content encodings
226+</stderr>
227+</verify>
228+</testcase>
229--
2302.25.1
231
diff --git a/meta/recipes-support/curl/curl/CVE-2023-27533.patch b/meta/recipes-support/curl/curl/CVE-2023-27533.patch
new file mode 100644
index 0000000000..64ba135056
--- /dev/null
+++ b/meta/recipes-support/curl/curl/CVE-2023-27533.patch
@@ -0,0 +1,59 @@
1Backport of:
2
3From 538b1e79a6e7b0bb829ab4cecc828d32105d0684 Mon Sep 17 00:00:00 2001
4From: Daniel Stenberg <daniel@haxx.se>
5Date: Mon, 6 Mar 2023 12:07:33 +0100
6Subject: [PATCH] telnet: only accept option arguments in ascii
7
8To avoid embedded telnet negotiation commands etc.
9
10Reported-by: Harry Sintonen
11Closes #10728
12
13Upstream-Status: Backport [import from ubuntu https://git.launchpad.net/ubuntu/+source/curl/tree/debian/patches/CVE-2023-27533.patch?h=ubuntu/focal-security
14Upstream commit https://github.com/curl/curl/commit/538b1e79a6e7b0bb829ab4cecc828d32105d0684]
15CVE: CVE-2023-27533
16Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
17---
18 lib/telnet.c | 15 +++++++++++++++
19 1 file changed, 15 insertions(+)
20
21--- a/lib/telnet.c
22+++ b/lib/telnet.c
23@@ -815,6 +815,17 @@ static void printsub(struct Curl_easy *d
24 }
25 }
26
27+static bool str_is_nonascii(const char *str)
28+{
29+ size_t len = strlen(str);
30+ while(len--) {
31+ if(*str & 0x80)
32+ return TRUE;
33+ str++;
34+ }
35+ return FALSE;
36+}
37+
38 static CURLcode check_telnet_options(struct connectdata *conn)
39 {
40 struct curl_slist *head;
41@@ -829,6 +840,8 @@ static CURLcode check_telnet_options(str
42 /* Add the user name as an environment variable if it
43 was given on the command line */
44 if(conn->bits.user_passwd) {
45+ if(str_is_nonascii(data->conn->user))
46+ return CURLE_BAD_FUNCTION_ARGUMENT;
47 msnprintf(option_arg, sizeof(option_arg), "USER,%s", conn->user);
48 beg = curl_slist_append(tn->telnet_vars, option_arg);
49 if(!beg) {
50@@ -844,6 +857,9 @@ static CURLcode check_telnet_options(str
51 if(sscanf(head->data, "%127[^= ]%*[ =]%255s",
52 option_keyword, option_arg) == 2) {
53
54+ if(str_is_nonascii(option_arg))
55+ continue;
56+
57 /* Terminal type */
58 if(strcasecompare(option_keyword, "TTYPE")) {
59 strncpy(tn->subopt_ttype, option_arg, 31);
diff --git a/meta/recipes-support/curl/curl/CVE-2023-27534-pre1.patch b/meta/recipes-support/curl/curl/CVE-2023-27534-pre1.patch
new file mode 100644
index 0000000000..46c57afb73
--- /dev/null
+++ b/meta/recipes-support/curl/curl/CVE-2023-27534-pre1.patch
@@ -0,0 +1,51 @@
1From 6c51adeb71da076c5c40a45e339e06bb4394a86b Mon Sep 17 00:00:00 2001
2From: Eric Vigeant <evigeant@gmail.com>
3Date: Wed, 2 Nov 2022 11:47:09 -0400
4Subject: [PATCH] cur_path: do not add '/' if homedir ends with one
5
6When using SFTP and a path relative to the user home, do not add a
7trailing '/' to the user home dir if it already ends with one.
8
9Closes #9844
10
11CVE: CVE-2023-27534
12Note:
13- The upstream patch for CVE-2023-27534 does three things:
141) creates new path with dynbuf(dynamic buffer)
152) solves the tilde error which causes CVE-2023-27534
163) modifies the below added functionality to not add a trailing "/" to the user home dir if it already ends with one with dynbuf.
17- dynbuf functionalities are added in curl in later versions and are not essential to fix the vulnerability but does add extra feature in later versions.
18- This patch completes the 3rd task of the patch which was implemented without using dynbuf
19Upstream-Status: Backport from [https://github.com/curl/curl/commit/6c51adeb71da076c5c40a45e339e06bb4394a86b]
20
21Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
22Signed-off-by: Siddharth Doshi <sdoshi@mvista.com>
23---
24 lib/curl_path.c | 10 +++++++---
25 1 file changed, 7 insertions(+), 3 deletions(-)
26
27diff --git a/lib/curl_path.c b/lib/curl_path.c
28index f429634..40b92ee 100644
29--- a/lib/curl_path.c
30+++ b/lib/curl_path.c
31@@ -70,10 +70,14 @@ CURLcode Curl_getworkingpath(struct connectdata *conn,
32 /* It is referenced to the home directory, so strip the
33 leading '/' */
34 memcpy(real_path, homedir, homelen);
35- real_path[homelen] = '/';
36- real_path[homelen + 1] = '\0';
37+ /* Only add a trailing '/' if homedir does not end with one */
38+ if(homelen == 0 || real_path[homelen - 1] != '/') {
39+ real_path[homelen] = '/';
40+ homelen++;
41+ real_path[homelen] = '\0';
42+ }
43 if(working_path_len > 3) {
44- memcpy(real_path + homelen + 1, working_path + 3,
45+ memcpy(real_path + homelen, working_path + 3,
46 1 + working_path_len -3);
47 }
48 }
49--
502.24.4
51
diff --git a/meta/recipes-support/curl/curl/CVE-2023-27534.patch b/meta/recipes-support/curl/curl/CVE-2023-27534.patch
new file mode 100644
index 0000000000..3ecd181290
--- /dev/null
+++ b/meta/recipes-support/curl/curl/CVE-2023-27534.patch
@@ -0,0 +1,33 @@
1From 4e2b52b5f7a3bf50a0f1494155717b02cc1df6d6 Mon Sep 17 00:00:00 2001
2From: Daniel Stenberg <daniel@haxx.se>
3Date: Thu, 9 Mar 2023 16:22:11 +0100
4Subject: [PATCH] curl_path: create the new path with dynbuf
5
6Closes #10729
7
8CVE: CVE-2023-27534
9Note: This patch is needed to backport CVE-2023-27534
10Upstream-Status: Backport from [https://github.com/curl/curl/commit/4e2b52b5f7a3bf50a0f1494155717b02cc1df6d6]
11
12Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
13Signed-off-by: Siddharth Doshi <sdoshi@mvista.com>
14---
15 lib/curl_path.c | 2 +-
16 1 file changed, 1 insertion(+), 1 deletion(-)
17
18diff --git a/lib/curl_path.c b/lib/curl_path.c
19index 40b92ee..598c5dd 100644
20--- a/lib/curl_path.c
21+++ b/lib/curl_path.c
22@@ -60,7 +60,7 @@ CURLcode Curl_getworkingpath(struct connectdata *conn,
23 memcpy(real_path, working_path, 1 + working_path_len);
24 }
25 else if(conn->handler->protocol & CURLPROTO_SFTP) {
26- if((working_path_len > 1) && (working_path[1] == '~')) {
27+ if((working_path_len > 2) && !memcmp(working_path, "/~/", 3)) {
28 size_t homelen = strlen(homedir);
29 real_path = malloc(homelen + working_path_len + 1);
30 if(real_path == NULL) {
31--
322.24.4
33
diff --git a/meta/recipes-support/curl/curl/CVE-2023-27535-pre1.patch b/meta/recipes-support/curl/curl/CVE-2023-27535-pre1.patch
new file mode 100644
index 0000000000..034b72f7e6
--- /dev/null
+++ b/meta/recipes-support/curl/curl/CVE-2023-27535-pre1.patch
@@ -0,0 +1,236 @@
1From ed5095ed94281989e103c72e032200b83be37878 Mon Sep 17 00:00:00 2001
2From: Daniel Stenberg <daniel@haxx.se>
3Date: Thu, 6 Oct 2022 00:49:10 +0200
4Subject: [PATCH] strcase: add and use Curl_timestrcmp
5
6This is a strcmp() alternative function for comparing "secrets",
7designed to take the same time no matter the content to not leak
8match/non-match info to observers based on how fast it is.
9
10The time this function takes is only a function of the shortest input
11string.
12
13Reported-by: Trail of Bits
14
15Closes #9658
16
17Upstream-Status: Backport from [https://github.com/curl/curl/commit/ed5095ed94281989e103c72e032200b83be37878 & https://github.com/curl/curl/commit/f18af4f874cecab82a9797e8c7541e0990c7a64c]
18Comment: to backport fix for CVE-2023-27535, add function Curl_timestrcmp.
19Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
20---
21 lib/netrc.c | 6 +++---
22 lib/strcase.c | 22 ++++++++++++++++++++++
23 lib/strcase.h | 1 +
24 lib/url.c | 33 +++++++++++++--------------------
25 lib/vauth/digest_sspi.c | 4 ++--
26 lib/vtls/vtls.c | 21 ++++++++++++++++++++-
27 6 files changed, 61 insertions(+), 26 deletions(-)
28
29diff --git a/lib/netrc.c b/lib/netrc.c
30index 9323913..fe3fd1e 100644
31--- a/lib/netrc.c
32+++ b/lib/netrc.c
33@@ -124,9 +124,9 @@ static int parsenetrc(const char *host,
34 /* we are now parsing sub-keywords concerning "our" host */
35 if(state_login) {
36 if(specific_login) {
37- state_our_login = strcasecompare(login, tok);
38+ state_our_login = !Curl_timestrcmp(login, tok);
39 }
40- else if(!login || strcmp(login, tok)) {
41+ else if(!login || Curl_timestrcmp(login, tok)) {
42 if(login_alloc) {
43 free(login);
44 login_alloc = FALSE;
45@@ -142,7 +142,7 @@ static int parsenetrc(const char *host,
46 }
47 else if(state_password) {
48 if((state_our_login || !specific_login)
49- && (!password || strcmp(password, tok))) {
50+ && (!password || Curl_timestrcmp(password, tok))) {
51 if(password_alloc) {
52 free(password);
53 password_alloc = FALSE;
54diff --git a/lib/strcase.c b/lib/strcase.c
55index 70bf21c..ec776b3 100644
56--- a/lib/strcase.c
57+++ b/lib/strcase.c
58@@ -261,6 +261,28 @@ bool Curl_safecmp(char *a, char *b)
59 return !a && !b;
60 }
61
62+/*
63+ * Curl_timestrcmp() returns 0 if the two strings are identical. The time this
64+ * function spends is a function of the shortest string, not of the contents.
65+ */
66+int Curl_timestrcmp(const char *a, const char *b)
67+{
68+ int match = 0;
69+ int i = 0;
70+
71+ if(a && b) {
72+ while(1) {
73+ match |= a[i]^b[i];
74+ if(!a[i] || !b[i])
75+ break;
76+ i++;
77+ }
78+ }
79+ else
80+ return a || b;
81+ return match;
82+}
83+
84 /* --- public functions --- */
85
86 int curl_strequal(const char *first, const char *second)
87diff --git a/lib/strcase.h b/lib/strcase.h
88index 8929a53..8077108 100644
89--- a/lib/strcase.h
90+++ b/lib/strcase.h
91@@ -49,5 +49,6 @@ void Curl_strntoupper(char *dest, const char *src, size_t n);
92 void Curl_strntolower(char *dest, const char *src, size_t n);
93
94 bool Curl_safecmp(char *a, char *b);
95+int Curl_timestrcmp(const char *first, const char *second);
96
97 #endif /* HEADER_CURL_STRCASE_H */
98diff --git a/lib/url.c b/lib/url.c
99index 9f14a7b..dfbde3b 100644
100--- a/lib/url.c
101+++ b/lib/url.c
102@@ -886,19 +886,10 @@ socks_proxy_info_matches(const struct proxy_info* data,
103 /* the user information is case-sensitive
104 or at least it is not defined as case-insensitive
105 see https://tools.ietf.org/html/rfc3986#section-3.2.1 */
106- if((data->user == NULL) != (needle->user == NULL))
107- return FALSE;
108- /* curl_strequal does a case insentive comparison, so do not use it here! */
109- if(data->user &&
110- needle->user &&
111- strcmp(data->user, needle->user) != 0)
112- return FALSE;
113- if((data->passwd == NULL) != (needle->passwd == NULL))
114- return FALSE;
115+
116 /* curl_strequal does a case insentive comparison, so do not use it here! */
117- if(data->passwd &&
118- needle->passwd &&
119- strcmp(data->passwd, needle->passwd) != 0)
120+ if(Curl_timestrcmp(data->user, needle->user) ||
121+ Curl_timestrcmp(data->passwd, needle->passwd))
122 return FALSE;
123 return TRUE;
124 }
125@@ -1257,10 +1248,10 @@ ConnectionExists(struct Curl_easy *data,
126 if(!(needle->handler->flags & PROTOPT_CREDSPERREQUEST)) {
127 /* This protocol requires credentials per connection,
128 so verify that we're using the same name and password as well */
129- if(strcmp(needle->user, check->user) ||
130- strcmp(needle->passwd, check->passwd) ||
131- !Curl_safecmp(needle->sasl_authzid, check->sasl_authzid) ||
132- !Curl_safecmp(needle->oauth_bearer, check->oauth_bearer)) {
133+ if(Curl_timestrcmp(needle->user, check->user) ||
134+ Curl_timestrcmp(needle->passwd, check->passwd) ||
135+ Curl_timestrcmp(needle->sasl_authzid, check->sasl_authzid) ||
136+ Curl_timestrcmp(needle->oauth_bearer, check->oauth_bearer)) {
137 /* one of them was different */
138 continue;
139 }
140@@ -1326,8 +1317,8 @@ ConnectionExists(struct Curl_easy *data,
141 possible. (Especially we must not reuse the same connection if
142 partway through a handshake!) */
143 if(wantNTLMhttp) {
144- if(strcmp(needle->user, check->user) ||
145- strcmp(needle->passwd, check->passwd)) {
146+ if(Curl_timestrcmp(needle->user, check->user) ||
147+ Curl_timestrcmp(needle->passwd, check->passwd)) {
148
149 /* we prefer a credential match, but this is at least a connection
150 that can be reused and "upgraded" to NTLM */
151@@ -1348,8 +1339,10 @@ ConnectionExists(struct Curl_easy *data,
152 if(!check->http_proxy.user || !check->http_proxy.passwd)
153 continue;
154
155- if(strcmp(needle->http_proxy.user, check->http_proxy.user) ||
156- strcmp(needle->http_proxy.passwd, check->http_proxy.passwd))
157+ if(Curl_timestrcmp(needle->http_proxy.user,
158+ check->http_proxy.user) ||
159+ Curl_timestrcmp(needle->http_proxy.passwd,
160+ check->http_proxy.passwd))
161 continue;
162 }
163 else if(check->proxy_ntlm_state != NTLMSTATE_NONE) {
164diff --git a/lib/vauth/digest_sspi.c b/lib/vauth/digest_sspi.c
165index a109056..3986386 100644
166--- a/lib/vauth/digest_sspi.c
167+++ b/lib/vauth/digest_sspi.c
168@@ -450,8 +450,8 @@ CURLcode Curl_auth_create_digest_http_message(struct Curl_easy *data,
169 has changed then delete that context. */
170 if((userp && !digest->user) || (!userp && digest->user) ||
171 (passwdp && !digest->passwd) || (!passwdp && digest->passwd) ||
172- (userp && digest->user && strcmp(userp, digest->user)) ||
173- (passwdp && digest->passwd && strcmp(passwdp, digest->passwd))) {
174+ (userp && digest->user && Curl_timestrcmp(userp, digest->user)) ||
175+ (passwdp && digest->passwd && Curl_timestrcmp(passwdp, digest->passwd))) {
176 if(digest->http_context) {
177 s_pSecFn->DeleteSecurityContext(digest->http_context);
178 Curl_safefree(digest->http_context);
179diff --git a/lib/vtls/vtls.c b/lib/vtls/vtls.c
180index e8cb70f..70a9391 100644
181--- a/lib/vtls/vtls.c
182+++ b/lib/vtls/vtls.c
183@@ -98,9 +98,15 @@ Curl_ssl_config_matches(struct ssl_primary_config* data,
184 Curl_safecmp(data->issuercert, needle->issuercert) &&
185 Curl_safecmp(data->clientcert, needle->clientcert) &&
186 Curl_safecmp(data->random_file, needle->random_file) &&
187- Curl_safecmp(data->egdsocket, needle->egdsocket) &&
188+ Curl_safecmp(data->egdsocket, needle->egdsocket) &&
189+#ifdef USE_TLS_SRP
190+ !Curl_timestrcmp(data->username, needle->username) &&
191+ !Curl_timestrcmp(data->password, needle->password) &&
192+ (data->authtype == needle->authtype) &&
193+#endif
194 Curl_safe_strcasecompare(data->cipher_list, needle->cipher_list) &&
195 Curl_safe_strcasecompare(data->cipher_list13, needle->cipher_list13) &&
196+ Curl_safe_strcasecompare(data->CRLfile, needle->CRLfile) &&
197 Curl_safe_strcasecompare(data->pinned_key, needle->pinned_key))
198 return TRUE;
199
200@@ -117,6 +123,9 @@ Curl_clone_primary_ssl_config(struct ssl_primary_config *source,
201 dest->verifyhost = source->verifyhost;
202 dest->verifystatus = source->verifystatus;
203 dest->sessionid = source->sessionid;
204+#ifdef USE_TLS_SRP
205+ dest->authtype = source->authtype;
206+#endif
207
208 CLONE_STRING(CApath);
209 CLONE_STRING(CAfile);
210@@ -127,6 +136,11 @@ Curl_clone_primary_ssl_config(struct ssl_primary_config *source,
211 CLONE_STRING(cipher_list);
212 CLONE_STRING(cipher_list13);
213 CLONE_STRING(pinned_key);
214+ CLONE_STRING(CRLfile);
215+#ifdef USE_TLS_SRP
216+ CLONE_STRING(username);
217+ CLONE_STRING(password);
218+#endif
219
220 return TRUE;
221 }
222@@ -142,6 +156,11 @@ void Curl_free_primary_ssl_config(struct ssl_primary_config* sslc)
223 Curl_safefree(sslc->cipher_list);
224 Curl_safefree(sslc->cipher_list13);
225 Curl_safefree(sslc->pinned_key);
226+ Curl_safefree(sslc->CRLfile);
227+#ifdef USE_TLS_SRP
228+ Curl_safefree(sslc->username);
229+ Curl_safefree(sslc->password);
230+#endif
231 }
232
233 #ifdef USE_SSL
234--
2352.25.1
236
diff --git a/meta/recipes-support/curl/curl/CVE-2023-27535.patch b/meta/recipes-support/curl/curl/CVE-2023-27535.patch
new file mode 100644
index 0000000000..e38390a57c
--- /dev/null
+++ b/meta/recipes-support/curl/curl/CVE-2023-27535.patch
@@ -0,0 +1,170 @@
1From 8f4608468b890dce2dad9f91d5607ee7e9c1aba1 Mon Sep 17 00:00:00 2001
2From: Daniel Stenberg <daniel@haxx.se>
3Date: Thu, 9 Mar 2023 17:47:06 +0100
4Subject: [PATCH] ftp: add more conditions for connection reuse
5
6Reported-by: Harry Sintonen
7Closes #10730
8
9Upstream-Status: Backport [import from ubuntu https://git.launchpad.net/ubuntu/+source/curl/tree/debian/patches/CVE-2023-27535.patch?h=ubuntu/focal-security
10Upstream commit https://github.com/curl/curl/commit/8f4608468b890dce2dad9f91d5607ee7e9c1aba1]
11CVE: CVE-2023-27535
12Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
13---
14 lib/ftp.c | 30 ++++++++++++++++++++++++++++--
15 lib/ftp.h | 5 +++++
16 lib/setopt.c | 2 +-
17 lib/url.c | 16 +++++++++++++++-
18 lib/urldata.h | 4 ++--
19 5 files changed, 51 insertions(+), 6 deletions(-)
20
21diff --git a/lib/ftp.c b/lib/ftp.c
22index 31a34e8..7a82a74 100644
23--- a/lib/ftp.c
24+++ b/lib/ftp.c
25@@ -4059,6 +4059,10 @@ static CURLcode ftp_disconnect(struct connectdata *conn, bool dead_connection)
26 }
27
28 freedirs(ftpc);
29+ free(ftpc->account);
30+ ftpc->account = NULL;
31+ free(ftpc->alternative_to_user);
32+ ftpc->alternative_to_user = NULL;
33 free(ftpc->prevpath);
34 ftpc->prevpath = NULL;
35 free(ftpc->server_os);
36@@ -4326,11 +4330,31 @@ static CURLcode ftp_setup_connection(struct connectdata *conn)
37 struct Curl_easy *data = conn->data;
38 char *type;
39 struct FTP *ftp;
40+ struct ftp_conn *ftpc = &conn->proto.ftpc;
41
42- conn->data->req.protop = ftp = calloc(sizeof(struct FTP), 1);
43+ ftp = calloc(sizeof(struct FTP), 1);
44 if(NULL == ftp)
45 return CURLE_OUT_OF_MEMORY;
46
47+ /* clone connection related data that is FTP specific */
48+ if(data->set.str[STRING_FTP_ACCOUNT]) {
49+ ftpc->account = strdup(data->set.str[STRING_FTP_ACCOUNT]);
50+ if(!ftpc->account) {
51+ free(ftp);
52+ return CURLE_OUT_OF_MEMORY;
53+ }
54+ }
55+ if(data->set.str[STRING_FTP_ALTERNATIVE_TO_USER]) {
56+ ftpc->alternative_to_user =
57+ strdup(data->set.str[STRING_FTP_ALTERNATIVE_TO_USER]);
58+ if(!ftpc->alternative_to_user) {
59+ Curl_safefree(ftpc->account);
60+ free(ftp);
61+ return CURLE_OUT_OF_MEMORY;
62+ }
63+ }
64+ conn->data->req.protop = ftp;
65+
66 ftp->path = &data->state.up.path[1]; /* don't include the initial slash */
67
68 /* FTP URLs support an extension like ";type=<typecode>" that
69@@ -4366,7 +4390,9 @@ static CURLcode ftp_setup_connection(struct connectdata *conn)
70 /* get some initial data into the ftp struct */
71 ftp->transfer = FTPTRANSFER_BODY;
72 ftp->downloadsize = 0;
73- conn->proto.ftpc.known_filesize = -1; /* unknown size for now */
74+ ftpc->known_filesize = -1; /* unknown size for now */
75+ ftpc->use_ssl = data->set.use_ssl;
76+ ftpc->ccc = data->set.ftp_ccc;
77
78 return CURLE_OK;
79 }
80diff --git a/lib/ftp.h b/lib/ftp.h
81index 984347f..163dcb3 100644
82--- a/lib/ftp.h
83+++ b/lib/ftp.h
84@@ -116,6 +116,8 @@ struct FTP {
85 struct */
86 struct ftp_conn {
87 struct pingpong pp;
88+ char *account;
89+ char *alternative_to_user;
90 char *entrypath; /* the PWD reply when we logged on */
91 char **dirs; /* realloc()ed array for path components */
92 int dirdepth; /* number of entries used in the 'dirs' array */
93@@ -141,6 +143,9 @@ struct ftp_conn {
94 ftpstate state; /* always use ftp.c:state() to change state! */
95 ftpstate state_saved; /* transfer type saved to be reloaded after
96 data connection is established */
97+ unsigned char use_ssl; /* if AUTH TLS is to be attempted etc, for FTP or
98+ IMAP or POP3 or others! (type: curl_usessl)*/
99+ unsigned char ccc; /* ccc level for this connection */
100 curl_off_t retr_size_saved; /* Size of retrieved file saved */
101 char *server_os; /* The target server operating system. */
102 curl_off_t known_filesize; /* file size is different from -1, if wildcard
103diff --git a/lib/setopt.c b/lib/setopt.c
104index 4d96f6b..a91bb70 100644
105--- a/lib/setopt.c
106+++ b/lib/setopt.c
107@@ -2126,7 +2126,7 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param)
108 arg = va_arg(param, long);
109 if((arg < CURLUSESSL_NONE) || (arg >= CURLUSESSL_LAST))
110 return CURLE_BAD_FUNCTION_ARGUMENT;
111- data->set.use_ssl = (curl_usessl)arg;
112+ data->set.use_ssl = (unsigned char)arg;
113 break;
114
115 case CURLOPT_SSL_OPTIONS:
116diff --git a/lib/url.c b/lib/url.c
117index dfbde3b..f84375c 100644
118--- a/lib/url.c
119+++ b/lib/url.c
120@@ -1257,10 +1257,24 @@ ConnectionExists(struct Curl_easy *data,
121 }
122 }
123
124- if(get_protocol_family(needle->handler->protocol) & PROTO_FAMILY_SSH) {
125+#ifdef USE_SSH
126+ else if(get_protocol_family(needle->handler->protocol) & PROTO_FAMILY_SSH) {
127 if(!ssh_config_matches(needle, check))
128 continue;
129 }
130+#endif
131+#ifndef CURL_DISABLE_FTP
132+ else if(get_protocol_family(needle->handler->protocol) & PROTO_FAMILY_FTP) {
133+ /* Also match ACCOUNT, ALTERNATIVE-TO-USER, USE_SSL and CCC options */
134+ if(Curl_timestrcmp(needle->proto.ftpc.account,
135+ check->proto.ftpc.account) ||
136+ Curl_timestrcmp(needle->proto.ftpc.alternative_to_user,
137+ check->proto.ftpc.alternative_to_user) ||
138+ (needle->proto.ftpc.use_ssl != check->proto.ftpc.use_ssl) ||
139+ (needle->proto.ftpc.ccc != check->proto.ftpc.ccc))
140+ continue;
141+ }
142+#endif
143
144 if(!needle->bits.httpproxy || (needle->handler->flags&PROTOPT_SSL) ||
145 needle->bits.tunnel_proxy) {
146diff --git a/lib/urldata.h b/lib/urldata.h
147index 168f874..51b793b 100644
148--- a/lib/urldata.h
149+++ b/lib/urldata.h
150@@ -1730,8 +1730,6 @@ struct UserDefined {
151 void *ssh_keyfunc_userp; /* custom pointer to callback */
152 enum CURL_NETRC_OPTION
153 use_netrc; /* defined in include/curl.h */
154- curl_usessl use_ssl; /* if AUTH TLS is to be attempted etc, for FTP or
155- IMAP or POP3 or others! */
156 long new_file_perms; /* Permissions to use when creating remote files */
157 long new_directory_perms; /* Permissions to use when creating remote dirs */
158 long ssh_auth_types; /* allowed SSH auth types */
159@@ -1851,6 +1849,8 @@ struct UserDefined {
160 BIT(http09_allowed); /* allow HTTP/0.9 responses */
161 BIT(mail_rcpt_allowfails); /* allow RCPT TO command to fail for some
162 recipients */
163+ unsigned char use_ssl; /* if AUTH TLS is to be attempted etc, for FTP or
164+ IMAP or POP3 or others! (type: curl_usessl)*/
165 };
166
167 struct Names {
168--
1692.25.1
170
diff --git a/meta/recipes-support/curl/curl/CVE-2023-27536.patch b/meta/recipes-support/curl/curl/CVE-2023-27536.patch
new file mode 100644
index 0000000000..b04a77de25
--- /dev/null
+++ b/meta/recipes-support/curl/curl/CVE-2023-27536.patch
@@ -0,0 +1,55 @@
1From cb49e67303dbafbab1cebf4086e3ec15b7d56ee5 Mon Sep 17 00:00:00 2001
2From: Daniel Stenberg <daniel@haxx.se>
3Date: Fri, 10 Mar 2023 09:22:43 +0100
4Subject: [PATCH] url: only reuse connections with same GSS delegation
5
6Reported-by: Harry Sintonen
7Closes #10731
8
9Upstream-Status: Backport [https://github.com/curl/curl/commit/cb49e67303dbafbab1cebf4086e3ec15b7d56ee5]
10CVE: CVE-2023-27536
11Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
12---
13 lib/url.c | 6 ++++++
14 lib/urldata.h | 1 +
15 2 files changed, 7 insertions(+)
16
17diff --git a/lib/url.c b/lib/url.c
18index f84375c..87f4eb0 100644
19--- a/lib/url.c
20+++ b/lib/url.c
21@@ -1257,6 +1257,11 @@ ConnectionExists(struct Curl_easy *data,
22 }
23 }
24
25+ /* GSS delegation differences do not actually affect every connection
26+ and auth method, but this check takes precaution before efficiency */
27+ if(needle->gssapi_delegation != check->gssapi_delegation)
28+ continue;
29+
30 #ifdef USE_SSH
31 else if(get_protocol_family(needle->handler->protocol) & PROTO_FAMILY_SSH) {
32 if(!ssh_config_matches(needle, check))
33@@ -1708,6 +1713,7 @@ static struct connectdata *allocate_conn(struct Curl_easy *data)
34 conn->fclosesocket = data->set.fclosesocket;
35 conn->closesocket_client = data->set.closesocket_client;
36 conn->lastused = Curl_now(); /* used now */
37+ conn->gssapi_delegation = data->set.gssapi_delegation;
38
39 return conn;
40 error:
41diff --git a/lib/urldata.h b/lib/urldata.h
42index 51b793b..b8a611b 100644
43--- a/lib/urldata.h
44+++ b/lib/urldata.h
45@@ -1118,6 +1118,7 @@ struct connectdata {
46 handle */
47 BIT(sock_accepted); /* TRUE if the SECONDARYSOCKET was created with
48 accept() */
49+ long gssapi_delegation; /* inherited from set.gssapi_delegation */
50 };
51
52 /* The end of connectdata. */
53--
542.25.1
55
diff --git a/meta/recipes-support/curl/curl/CVE-2023-27538.patch b/meta/recipes-support/curl/curl/CVE-2023-27538.patch
new file mode 100644
index 0000000000..6c40989d3b
--- /dev/null
+++ b/meta/recipes-support/curl/curl/CVE-2023-27538.patch
@@ -0,0 +1,31 @@
1From af369db4d3833272b8ed443f7fcc2e757a0872eb Mon Sep 17 00:00:00 2001
2From: Daniel Stenberg <daniel@haxx.se>
3Date: Fri, 10 Mar 2023 08:22:51 +0100
4Subject: [PATCH] url: fix the SSH connection reuse check
5
6Reported-by: Harry Sintonen
7Closes #10735
8
9CVE: CVE-2023-27538
10Upstream-Status: Backport [https://github.com/curl/curl/commit/af369db4d3833272b8ed443f7fcc2e757a0872eb]
11Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
12---
13 lib/url.c | 2 +-
14 1 file changed, 1 insertion(+), 1 deletion(-)
15
16diff --git a/lib/url.c b/lib/url.c
17index 8da0245..9f14a7b 100644
18--- a/lib/url.c
19+++ b/lib/url.c
20@@ -1266,7 +1266,7 @@ ConnectionExists(struct Curl_easy *data,
21 }
22 }
23
24- if(get_protocol_family(needle->handler->protocol) == PROTO_FAMILY_SSH) {
25+ if(get_protocol_family(needle->handler->protocol) & PROTO_FAMILY_SSH) {
26 if(!ssh_config_matches(needle, check))
27 continue;
28 }
29--
302.25.1
31
diff --git a/meta/recipes-support/curl/curl/CVE-2023-28320-fol1.patch b/meta/recipes-support/curl/curl/CVE-2023-28320-fol1.patch
new file mode 100644
index 0000000000..eaa6fdc327
--- /dev/null
+++ b/meta/recipes-support/curl/curl/CVE-2023-28320-fol1.patch
@@ -0,0 +1,197 @@
1From f446258f0269a62289cca0210157cb8558d0edc3 Mon Sep 17 00:00:00 2001
2From: Daniel Stenberg <daniel@haxx.se>
3Date: Tue, 16 May 2023 23:40:42 +0200
4Subject: [PATCH] hostip: include easy_lock.h before using
5 GLOBAL_INIT_IS_THREADSAFE
6
7Since that header file is the only place that define can be defined.
8
9Reported-by: Marc Deslauriers
10
11Follow-up to 13718030ad4b3209
12
13Closes #11121
14
15Upstream-Status: Backport [https://github.com/curl/curl/commit/f446258f0269a62289cca0210157cb8558d0edc3]
16CVE: CVE-2023-28320
17Signed-off-by: Vivek Kumbhar <vkumbhar@mvista.com>
18---
19 lib/easy_lock.h | 109 ++++++++++++++++++++++++++++++++++++++++++++++++
20 lib/hostip.c | 10 ++---
21 lib/hostip.h | 9 ----
22 3 files changed, 113 insertions(+), 15 deletions(-)
23 create mode 100644 lib/easy_lock.h
24
25diff --git a/lib/easy_lock.h b/lib/easy_lock.h
26new file mode 100644
27index 0000000..6399a39
28--- /dev/null
29+++ b/lib/easy_lock.h
30@@ -0,0 +1,109 @@
31+#ifndef HEADER_CURL_EASY_LOCK_H
32+#define HEADER_CURL_EASY_LOCK_H
33+/***************************************************************************
34+ * _ _ ____ _
35+ * Project ___| | | | _ \| |
36+ * / __| | | | |_) | |
37+ * | (__| |_| | _ <| |___
38+ * \___|\___/|_| \_\_____|
39+ *
40+ * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
41+ *
42+ * This software is licensed as described in the file COPYING, which
43+ * you should have received as part of this distribution. The terms
44+ * are also available at https://curl.se/docs/copyright.html.
45+ *
46+ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
47+ * copies of the Software, and permit persons to whom the Software is
48+ * furnished to do so, under the terms of the COPYING file.
49+ *
50+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
51+ * KIND, either express or implied.
52+ *
53+ * SPDX-License-Identifier: curl
54+ *
55+ ***************************************************************************/
56+
57+#include "curl_setup.h"
58+
59+#define GLOBAL_INIT_IS_THREADSAFE
60+
61+#if defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x600
62+
63+#ifdef __MINGW32__
64+#ifndef __MINGW64_VERSION_MAJOR
65+#if (__MINGW32_MAJOR_VERSION < 5) || \
66+ (__MINGW32_MAJOR_VERSION == 5 && __MINGW32_MINOR_VERSION == 0)
67+/* mingw >= 5.0.1 defines SRWLOCK, and slightly different from MS define */
68+typedef PVOID SRWLOCK, *PSRWLOCK;
69+#endif
70+#endif
71+#ifndef SRWLOCK_INIT
72+#define SRWLOCK_INIT NULL
73+#endif
74+#endif /* __MINGW32__ */
75+
76+#define curl_simple_lock SRWLOCK
77+#define CURL_SIMPLE_LOCK_INIT SRWLOCK_INIT
78+
79+#define curl_simple_lock_lock(m) AcquireSRWLockExclusive(m)
80+#define curl_simple_lock_unlock(m) ReleaseSRWLockExclusive(m)
81+
82+#elif defined(HAVE_ATOMIC) && defined(HAVE_STDATOMIC_H)
83+#include <stdatomic.h>
84+#if defined(HAVE_SCHED_YIELD)
85+#include <sched.h>
86+#endif
87+
88+#define curl_simple_lock atomic_int
89+#define CURL_SIMPLE_LOCK_INIT 0
90+
91+/* a clang-thing */
92+#ifndef __has_builtin
93+#define __has_builtin(x) 0
94+#endif
95+
96+#ifndef __INTEL_COMPILER
97+/* The Intel compiler tries to look like GCC *and* clang *and* lies in its
98+ __has_builtin() function, so override it. */
99+
100+/* if GCC on i386/x86_64 or if the built-in is present */
101+#if ( (defined(__GNUC__) && !defined(__clang__)) && \
102+ (defined(__i386__) || defined(__x86_64__))) || \
103+ __has_builtin(__builtin_ia32_pause)
104+#define HAVE_BUILTIN_IA32_PAUSE
105+#endif
106+
107+#endif
108+
109+static inline void curl_simple_lock_lock(curl_simple_lock *lock)
110+{
111+ for(;;) {
112+ if(!atomic_exchange_explicit(lock, true, memory_order_acquire))
113+ break;
114+ /* Reduce cache coherency traffic */
115+ while(atomic_load_explicit(lock, memory_order_relaxed)) {
116+ /* Reduce load (not mandatory) */
117+#ifdef HAVE_BUILTIN_IA32_PAUSE
118+ __builtin_ia32_pause();
119+#elif defined(__aarch64__)
120+ __asm__ volatile("yield" ::: "memory");
121+#elif defined(HAVE_SCHED_YIELD)
122+ sched_yield();
123+#endif
124+ }
125+ }
126+}
127+
128+static inline void curl_simple_lock_unlock(curl_simple_lock *lock)
129+{
130+ atomic_store_explicit(lock, false, memory_order_release);
131+}
132+
133+#else
134+
135+#undef GLOBAL_INIT_IS_THREADSAFE
136+
137+#endif
138+
139+#endif /* HEADER_CURL_EASY_LOCK_H */
140diff --git a/lib/hostip.c b/lib/hostip.c
141index 5231a74..d5bf881 100644
142--- a/lib/hostip.c
143+++ b/lib/hostip.c
144@@ -68,6 +68,8 @@
145 #include "curl_memory.h"
146 #include "memdebug.h"
147
148+#include "easy_lock.h"
149+
150 #if defined(CURLRES_SYNCH) && \
151 defined(HAVE_ALARM) && \
152 defined(SIGALRM) && \
153@@ -77,10 +79,6 @@
154 #define USE_ALARM_TIMEOUT
155 #endif
156
157-#ifdef USE_ALARM_TIMEOUT
158-#include "easy_lock.h"
159-#endif
160-
161 #define MAX_HOSTCACHE_LEN (255 + 7) /* max FQDN + colon + port number + zero */
162
163 /*
164@@ -259,8 +257,8 @@ void Curl_hostcache_prune(struct Curl_easy *data)
165 /* Beware this is a global and unique instance. This is used to store the
166 return address that we can jump back to from inside a signal handler. This
167 is not thread-safe stuff. */
168-sigjmp_buf curl_jmpenv;
169-curl_simple_lock curl_jmpenv_lock;
170+static sigjmp_buf curl_jmpenv;
171+static curl_simple_lock curl_jmpenv_lock;
172 #endif
173
174 /* lookup address, returns entry if found and not stale */
175diff --git a/lib/hostip.h b/lib/hostip.h
176index baf1e58..d7f73d9 100644
177--- a/lib/hostip.h
178+++ b/lib/hostip.h
179@@ -196,15 +196,6 @@ Curl_cache_addr(struct Curl_easy *data, Curl_addrinfo *addr,
180 #define CURL_INADDR_NONE INADDR_NONE
181 #endif
182
183-#ifdef HAVE_SIGSETJMP
184-/* Forward-declaration of variable defined in hostip.c. Beware this
185- * is a global and unique instance. This is used to store the return
186- * address that we can jump back to from inside a signal handler.
187- * This is not thread-safe stuff.
188- */
189-extern sigjmp_buf curl_jmpenv;
190-#endif
191-
192 /*
193 * Function provided by the resolver backend to set DNS servers to use.
194 */
195--
1962.25.1
197
diff --git a/meta/recipes-support/curl/curl/CVE-2023-28320.patch b/meta/recipes-support/curl/curl/CVE-2023-28320.patch
new file mode 100644
index 0000000000..0c9b67440a
--- /dev/null
+++ b/meta/recipes-support/curl/curl/CVE-2023-28320.patch
@@ -0,0 +1,86 @@
1From 13718030ad4b3209a7583b4f27f683cd3a6fa5f2 Mon Sep 17 00:00:00 2001
2From: Harry Sintonen <sintonen@iki.fi>
3Date: Tue, 25 Apr 2023 09:22:26 +0200
4Subject: [PATCH] hostip: add locks around use of global buffer for alarm()
5
6When building with the sync name resolver and timeout ability we now
7require thread-safety to be present to enable it.
8
9Closes #11030
10
11Upstream-Status: Backport [https://github.com/curl/curl/commit/13718030ad4b3209a7583b4f27f683cd3a6fa5f2]
12CVE: CVE-2023-28320
13Signed-off-by: Vivek Kumbhar <vkumbhar@mvista.com>
14---
15 lib/hostip.c | 19 +++++++++++++++----
16 1 file changed, 15 insertions(+), 4 deletions(-)
17
18diff --git a/lib/hostip.c b/lib/hostip.c
19index f5bb634..5231a74 100644
20--- a/lib/hostip.c
21+++ b/lib/hostip.c
22@@ -68,12 +68,19 @@
23 #include "curl_memory.h"
24 #include "memdebug.h"
25
26-#if defined(CURLRES_SYNCH) && \
27- defined(HAVE_ALARM) && defined(SIGALRM) && defined(HAVE_SIGSETJMP)
28+#if defined(CURLRES_SYNCH) && \
29+ defined(HAVE_ALARM) && \
30+ defined(SIGALRM) && \
31+ defined(HAVE_SIGSETJMP) && \
32+ defined(GLOBAL_INIT_IS_THREADSAFE)
33 /* alarm-based timeouts can only be used with all the dependencies satisfied */
34 #define USE_ALARM_TIMEOUT
35 #endif
36
37+#ifdef USE_ALARM_TIMEOUT
38+#include "easy_lock.h"
39+#endif
40+
41 #define MAX_HOSTCACHE_LEN (255 + 7) /* max FQDN + colon + port number + zero */
42
43 /*
44@@ -248,11 +255,12 @@ void Curl_hostcache_prune(struct Curl_easy *data)
45 Curl_share_unlock(data, CURL_LOCK_DATA_DNS);
46 }
47
48-#ifdef HAVE_SIGSETJMP
49+#ifdef USE_ALARM_TIMEOUT
50 /* Beware this is a global and unique instance. This is used to store the
51 return address that we can jump back to from inside a signal handler. This
52 is not thread-safe stuff. */
53 sigjmp_buf curl_jmpenv;
54+curl_simple_lock curl_jmpenv_lock;
55 #endif
56
57 /* lookup address, returns entry if found and not stale */
58@@ -614,7 +622,6 @@ enum resolve_t Curl_resolv(struct connectdata *conn,
59 static
60 RETSIGTYPE alarmfunc(int sig)
61 {
62- /* this is for "-ansi -Wall -pedantic" to stop complaining! (rabe) */
63 (void)sig;
64 siglongjmp(curl_jmpenv, 1);
65 }
66@@ -695,6 +702,8 @@ enum resolve_t Curl_resolv_timeout(struct connectdata *conn,
67 This should be the last thing we do before calling Curl_resolv(),
68 as otherwise we'd have to worry about variables that get modified
69 before we invoke Curl_resolv() (and thus use "volatile"). */
70+ curl_simple_lock_lock(&curl_jmpenv_lock);
71+
72 if(sigsetjmp(curl_jmpenv, 1)) {
73 /* this is coming from a siglongjmp() after an alarm signal */
74 failf(data, "name lookup timed out");
75@@ -763,6 +772,8 @@ clean_up:
76 #endif
77 #endif /* HAVE_SIGACTION */
78
79+ curl_simple_lock_unlock(&curl_jmpenv_lock);
80+
81 /* switch back the alarm() to either zero or to what it was before minus
82 the time we spent until now! */
83 if(prev_alarm) {
84--
852.25.1
86
diff --git a/meta/recipes-support/curl/curl/CVE-2023-28321.patch b/meta/recipes-support/curl/curl/CVE-2023-28321.patch
new file mode 100644
index 0000000000..da1d1fdcd6
--- /dev/null
+++ b/meta/recipes-support/curl/curl/CVE-2023-28321.patch
@@ -0,0 +1,272 @@
1Upstream-Status: Backport [import from ubuntu curl_7.68.0-1ubuntu2.20 with
2minor change to tests/data/test1397 part so the patch can be apply.
3upstream: https://github.com/curl/curl/commit/199f2d440d8659b42 ]
4CVE: CVE-2023-28321
5Signed-off-by: Lee Chee Yang <chee.yang.lee@intel.com>
6
7This backport was obtained from SUSE.
8
9From 199f2d440d8659b42670c1b796220792b01a97bf Mon Sep 17 00:00:00 2001
10From: Daniel Stenberg <daniel@haxx.se>
11Date: Mon, 24 Apr 2023 21:07:02 +0200
12Subject: [PATCH] hostcheck: fix host name wildcard checking
13
14The leftmost "label" of the host name can now only match against single
15'*'. Like the browsers have worked for a long time.
16
17- extended unit test 1397 for this
18- move some SOURCE variables from unit/Makefile.am to unit/Makefile.inc
19
20Reported-by: Hiroki Kurosawa
21Closes #11018
22---
23 lib/hostcheck.c | 50 +++++++--------
24 tests/data/test1397 | 10 ++-
25 tests/unit/Makefile.am | 94 ----------------------------
26 tests/unit/Makefile.inc | 94 ++++++++++++++++++++++++++++
27 tests/unit/unit1397.c | 134 ++++++++++++++++++++++++----------------
28 5 files changed, 202 insertions(+), 180 deletions(-)
29
30--- a/lib/hostcheck.c
31+++ b/lib/hostcheck.c
32@@ -58,15 +58,19 @@
33 * apparent distinction between a name and an IP. We need to detect the use of
34 * an IP address and not wildcard match on such names.
35 *
36+ * Only match on "*" being used for the leftmost label, not "a*", "a*b" nor
37+ * "*b".
38+ *
39+ * @unittest: 1397
40+ *
41 * NOTE: hostmatch() gets called with copied buffers so that it can modify the
42 * contents at will.
43 */
44
45 static int hostmatch(char *hostname, char *pattern)
46 {
47- const char *pattern_label_end, *pattern_wildcard, *hostname_label_end;
48- int wildcard_enabled;
49- size_t prefixlen, suffixlen;
50+ const char *pattern_label_end, *hostname_label_end;
51+ size_t suffixlen;
52 struct in_addr ignored;
53 #ifdef ENABLE_IPV6
54 struct sockaddr_in6 si6;
55@@ -80,13 +84,12 @@ static int hostmatch(char *hostname, cha
56 if(pattern[len-1]=='.')
57 pattern[len-1] = 0;
58
59- pattern_wildcard = strchr(pattern, '*');
60- if(pattern_wildcard == NULL)
61+ if(strncmp(pattern, "*.", 2))
62 return strcasecompare(pattern, hostname) ?
63 CURL_HOST_MATCH : CURL_HOST_NOMATCH;
64
65 /* detect IP address as hostname and fail the match if so */
66- if(Curl_inet_pton(AF_INET, hostname, &ignored) > 0)
67+ else if(Curl_inet_pton(AF_INET, hostname, &ignored) > 0)
68 return CURL_HOST_NOMATCH;
69 #ifdef ENABLE_IPV6
70 if(Curl_inet_pton(AF_INET6, hostname, &si6.sin6_addr) > 0)
71@@ -95,14 +98,9 @@ static int hostmatch(char *hostname, cha
72
73 /* We require at least 2 dots in pattern to avoid too wide wildcard
74 match. */
75- wildcard_enabled = 1;
76 pattern_label_end = strchr(pattern, '.');
77- if(pattern_label_end == NULL || strchr(pattern_label_end + 1, '.') == NULL ||
78- pattern_wildcard > pattern_label_end ||
79- strncasecompare(pattern, "xn--", 4)) {
80- wildcard_enabled = 0;
81- }
82- if(!wildcard_enabled)
83+ if(pattern_label_end == NULL ||
84+ strchr(pattern_label_end + 1, '.') == NULL)
85 return strcasecompare(pattern, hostname) ?
86 CURL_HOST_MATCH : CURL_HOST_NOMATCH;
87
88@@ -117,11 +115,9 @@ static int hostmatch(char *hostname, cha
89 if(hostname_label_end - hostname < pattern_label_end - pattern)
90 return CURL_HOST_NOMATCH;
91
92- prefixlen = pattern_wildcard - pattern;
93- suffixlen = pattern_label_end - (pattern_wildcard + 1);
94- return strncasecompare(pattern, hostname, prefixlen) &&
95- strncasecompare(pattern_wildcard + 1, hostname_label_end - suffixlen,
96- suffixlen) ?
97+ suffixlen = pattern_label_end - (pattern + 1);
98+ return strncasecompare(pattern + 1, hostname_label_end - suffixlen,
99+ suffixlen) ?
100 CURL_HOST_MATCH : CURL_HOST_NOMATCH;
101 }
102
103--- a/tests/data/test1397
104+++ b/tests/data/test1397
105@@ -2,8 +2,7 @@
106 <info>
107 <keywords>
108 unittest
109-ssl
110-wildcard
111+Curl_cert_hostcheck
112 </keywords>
113 </info>
114
115@@ -16,9 +15,8 @@ none
116 <features>
117 unittest
118 </features>
119- <name>
120-Check wildcard certificate matching function Curl_cert_hostcheck
121- </name>
122+<name>
123+Curl_cert_hostcheck unit tests
124+</name>
125 </client>
126-
127 </testcase>
128--- a/tests/unit/unit1397.c
129+++ b/tests/unit/unit1397.c
130@@ -21,8 +21,6 @@
131 ***************************************************************************/
132 #include "curlcheck.h"
133
134-#include "hostcheck.h" /* from the lib dir */
135-
136 static CURLcode unit_setup(void)
137 {
138 return CURLE_OK;
139@@ -30,50 +28,94 @@ static CURLcode unit_setup(void)
140
141 static void unit_stop(void)
142 {
143- /* done before shutting down and exiting */
144 }
145
146-UNITTEST_START
147+* only these backends define the tested functions */
148+#if defined(USE_OPENSSL) || defined(USE_GSKIT) || \
149+ defined(USE_SCHANNEL)
150+#include "hostcheck.h"
151+struct testcase {
152+ const char *host;
153+ const char *pattern;
154+ bool match;
155+};
156+
157+static struct testcase tests[] = {
158+ {"", "", FALSE},
159+ {"a", "", FALSE},
160+ {"", "b", FALSE},
161+ {"a", "b", FALSE},
162+ {"aa", "bb", FALSE},
163+ {"\xff", "\xff", TRUE},
164+ {"aa.aa.aa", "aa.aa.bb", FALSE},
165+ {"aa.aa.aa", "aa.aa.aa", TRUE},
166+ {"aa.aa.aa", "*.aa.bb", FALSE},
167+ {"aa.aa.aa", "*.aa.aa", TRUE},
168+ {"192.168.0.1", "192.168.0.1", TRUE},
169+ {"192.168.0.1", "*.168.0.1", FALSE},
170+ {"192.168.0.1", "*.0.1", FALSE},
171+ {"h.ello", "*.ello", FALSE},
172+ {"h.ello.", "*.ello", FALSE},
173+ {"h.ello", "*.ello.", FALSE},
174+ {"h.e.llo", "*.e.llo", TRUE},
175+ {"h.e.llo", " *.e.llo", FALSE},
176+ {" h.e.llo", "*.e.llo", TRUE},
177+ {"h.e.llo.", "*.e.llo", TRUE},
178+ {"*.e.llo.", "*.e.llo", TRUE},
179+ {"************.e.llo.", "*.e.llo", TRUE},
180+ {"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
181+ "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB"
182+ "CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC"
183+ "DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD"
184+ "EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE"
185+ ".e.llo.", "*.e.llo", TRUE},
186+ {"\xfe\xfe.e.llo.", "*.e.llo", TRUE},
187+ {"h.e.llo.", "*.e.llo.", TRUE},
188+ {"h.e.llo", "*.e.llo.", TRUE},
189+ {".h.e.llo", "*.e.llo.", FALSE},
190+ {"h.e.llo", "*.*.llo.", FALSE},
191+ {"h.e.llo", "h.*.llo", FALSE},
192+ {"h.e.llo", "h.e.*", FALSE},
193+ {"hello", "*.ello", FALSE},
194+ {"hello", "**llo", FALSE},
195+ {"bar.foo.example.com", "*.example.com", FALSE},
196+ {"foo.example.com", "*.example.com", TRUE},
197+ {"baz.example.net", "b*z.example.net", FALSE},
198+ {"foobaz.example.net", "*baz.example.net", FALSE},
199+ {"xn--l8j.example.local", "x*.example.local", FALSE},
200+ {"xn--l8j.example.net", "*.example.net", TRUE},
201+ {"xn--l8j.example.net", "*j.example.net", FALSE},
202+ {"xn--l8j.example.net", "xn--l8j.example.net", TRUE},
203+ {"xn--l8j.example.net", "xn--l8j.*.net", FALSE},
204+ {"xl8j.example.net", "*.example.net", TRUE},
205+ {"fe80::3285:a9ff:fe46:b619", "*::3285:a9ff:fe46:b619", FALSE},
206+ {"fe80::3285:a9ff:fe46:b619", "fe80::3285:a9ff:fe46:b619", TRUE},
207+ {NULL, NULL, FALSE}
208+};
209
210-/* only these backends define the tested functions */
211-#if defined(USE_OPENSSL) || defined(USE_GSKIT)
212+UNITTEST_START
213+{
214+ int i;
215+ for(i = 0; tests[i].host; i++) {
216+ if(tests[i].match != Curl_cert_hostcheck(tests[i].pattern,
217+ tests[i].host)) {
218+ fprintf(stderr,
219+ "HOST: %s\n"
220+ "PTRN: %s\n"
221+ "did %sMATCH\n",
222+ tests[i].host,
223+ tests[i].pattern,
224+ tests[i].match ? "NOT ": "");
225+ unitfail++;
226+ }
227+ }
228+}
229
230- /* here you start doing things and checking that the results are good */
231+UNITTEST_STOP
232+#else
233
234-fail_unless(Curl_cert_hostcheck("www.example.com", "www.example.com"),
235- "good 1");
236-fail_unless(Curl_cert_hostcheck("*.example.com", "www.example.com"),
237- "good 2");
238-fail_unless(Curl_cert_hostcheck("xxx*.example.com", "xxxwww.example.com"),
239- "good 3");
240-fail_unless(Curl_cert_hostcheck("f*.example.com", "foo.example.com"),
241- "good 4");
242-fail_unless(Curl_cert_hostcheck("192.168.0.0", "192.168.0.0"),
243- "good 5");
244-
245-fail_if(Curl_cert_hostcheck("xxx.example.com", "www.example.com"), "bad 1");
246-fail_if(Curl_cert_hostcheck("*", "www.example.com"), "bad 2");
247-fail_if(Curl_cert_hostcheck("*.*.com", "www.example.com"), "bad 3");
248-fail_if(Curl_cert_hostcheck("*.example.com", "baa.foo.example.com"), "bad 4");
249-fail_if(Curl_cert_hostcheck("f*.example.com", "baa.example.com"), "bad 5");
250-fail_if(Curl_cert_hostcheck("*.com", "example.com"), "bad 6");
251-fail_if(Curl_cert_hostcheck("*fail.com", "example.com"), "bad 7");
252-fail_if(Curl_cert_hostcheck("*.example.", "www.example."), "bad 8");
253-fail_if(Curl_cert_hostcheck("*.example.", "www.example"), "bad 9");
254-fail_if(Curl_cert_hostcheck("", "www"), "bad 10");
255-fail_if(Curl_cert_hostcheck("*", "www"), "bad 11");
256-fail_if(Curl_cert_hostcheck("*.168.0.0", "192.168.0.0"), "bad 12");
257-fail_if(Curl_cert_hostcheck("www.example.com", "192.168.0.0"), "bad 13");
258-
259-#ifdef ENABLE_IPV6
260-fail_if(Curl_cert_hostcheck("*::3285:a9ff:fe46:b619",
261- "fe80::3285:a9ff:fe46:b619"), "bad 14");
262-fail_unless(Curl_cert_hostcheck("fe80::3285:a9ff:fe46:b619",
263- "fe80::3285:a9ff:fe46:b619"), "good 6");
264-#endif
265+UNITTEST_START
266
267+UNITTEST_STOP
268 #endif
269
270- /* you end the test code like this: */
271-
272-UNITTEST_STOP
diff --git a/meta/recipes-support/curl/curl/CVE-2023-28322.patch b/meta/recipes-support/curl/curl/CVE-2023-28322.patch
new file mode 100644
index 0000000000..9351a2c286
--- /dev/null
+++ b/meta/recipes-support/curl/curl/CVE-2023-28322.patch
@@ -0,0 +1,380 @@
1CVE: CVE-2023-28322
2Upstream-Status: Backport [ import patch from ubuntu curl_7.68.0-1ubuntu2.20
3upstream https://github.com/curl/curl/commit/7815647d6582c0a4900be2e1de ]
4Signed-off-by: Lee Chee Yang <chee.yang.lee@intel.com>
5
6Backport of:
7
8From 7815647d6582c0a4900be2e1de6c5e61272c496b Mon Sep 17 00:00:00 2001
9From: Daniel Stenberg <daniel@haxx.se>
10Date: Tue, 25 Apr 2023 08:28:01 +0200
11Subject: [PATCH] lib: unify the upload/method handling
12
13By making sure we set state.upload based on the set.method value and not
14independently as set.upload, we reduce confusion and mixup risks, both
15internally and externally.
16
17Closes #11017
18---
19 lib/curl_rtmp.c | 4 ++--
20 lib/file.c | 4 ++--
21 lib/ftp.c | 8 ++++----
22 lib/http.c | 4 ++--
23 lib/imap.c | 6 +++---
24 lib/rtsp.c | 4 ++--
25 lib/setopt.c | 6 ++----
26 lib/smb.c | 6 +++---
27 lib/smtp.c | 4 ++--
28 lib/tftp.c | 8 ++++----
29 lib/transfer.c | 4 ++--
30 lib/urldata.h | 2 +-
31 lib/vssh/libssh.c | 6 +++---
32 lib/vssh/libssh2.c | 6 +++---
33 lib/vssh/wolfssh.c | 2 +-
34 15 files changed, 36 insertions(+), 38 deletions(-)
35
36--- a/lib/curl_rtmp.c
37+++ b/lib/curl_rtmp.c
38@@ -213,7 +213,7 @@ static CURLcode rtmp_connect(struct conn
39 /* We have to know if it's a write before we send the
40 * connect request packet
41 */
42- if(conn->data->set.upload)
43+ if(conn->data->state.upload)
44 r->Link.protocol |= RTMP_FEATURE_WRITE;
45
46 /* For plain streams, use the buffer toggle trick to keep data flowing */
47@@ -245,7 +245,7 @@ static CURLcode rtmp_do(struct connectda
48 if(!RTMP_ConnectStream(r, 0))
49 return CURLE_FAILED_INIT;
50
51- if(conn->data->set.upload) {
52+ if(conn->data->state.upload) {
53 Curl_pgrsSetUploadSize(data, data->state.infilesize);
54 Curl_setup_transfer(data, -1, -1, FALSE, FIRSTSOCKET);
55 }
56--- a/lib/file.c
57+++ b/lib/file.c
58@@ -198,7 +198,7 @@ static CURLcode file_connect(struct conn
59 file->freepath = real_path; /* free this when done */
60
61 file->fd = fd;
62- if(!data->set.upload && (fd == -1)) {
63+ if(!data->state.upload && (fd == -1)) {
64 failf(data, "Couldn't open file %s", data->state.up.path);
65 file_done(conn, CURLE_FILE_COULDNT_READ_FILE, FALSE);
66 return CURLE_FILE_COULDNT_READ_FILE;
67@@ -390,7 +390,7 @@ static CURLcode file_do(struct connectda
68
69 Curl_pgrsStartNow(data);
70
71- if(data->set.upload)
72+ if(data->state.upload)
73 return file_upload(conn);
74
75 file = conn->data->req.protop;
76--- a/lib/ftp.c
77+++ b/lib/ftp.c
78@@ -1371,7 +1371,7 @@ static CURLcode ftp_state_prepare_transf
79 data->set.str[STRING_CUSTOMREQUEST]:
80 (data->set.ftp_list_only?"NLST":"LIST"));
81 }
82- else if(data->set.upload) {
83+ else if(data->state.upload) {
84 PPSENDF(&conn->proto.ftpc.pp, "PRET STOR %s", conn->proto.ftpc.file);
85 }
86 else {
87@@ -3303,7 +3303,7 @@ static CURLcode ftp_done(struct connectd
88 /* the response code from the transfer showed an error already so no
89 use checking further */
90 ;
91- else if(data->set.upload) {
92+ else if(data->state.upload) {
93 if((-1 != data->state.infilesize) &&
94 (data->state.infilesize != data->req.writebytecount) &&
95 !data->set.crlf &&
96@@ -3570,7 +3570,7 @@ static CURLcode ftp_do_more(struct conne
97 connected back to us */
98 }
99 }
100- else if(data->set.upload) {
101+ else if(data->state.upload) {
102 result = ftp_nb_type(conn, data->set.prefer_ascii, FTP_STOR_TYPE);
103 if(result)
104 return result;
105@@ -4209,7 +4209,7 @@ CURLcode ftp_parse_url_path(struct conne
106 ftpc->file = NULL; /* instead of point to a zero byte,
107 we make it a NULL pointer */
108
109- if(data->set.upload && !ftpc->file && (ftp->transfer == FTPTRANSFER_BODY)) {
110+ if(data->state.upload && !ftpc->file && (ftp->transfer == FTPTRANSFER_BODY)) {
111 /* We need a file name when uploading. Return error! */
112 failf(data, "Uploading to a URL without a file name!");
113 free(rawPath);
114--- a/lib/http.c
115+++ b/lib/http.c
116@@ -2080,7 +2080,7 @@ CURLcode Curl_http(struct connectdata *c
117 }
118
119 if((conn->handler->protocol&(PROTO_FAMILY_HTTP|CURLPROTO_FTP)) &&
120- data->set.upload) {
121+ data->state.upload) {
122 httpreq = HTTPREQ_PUT;
123 }
124
125@@ -2261,7 +2261,7 @@ CURLcode Curl_http(struct connectdata *c
126 if((conn->handler->protocol & PROTO_FAMILY_HTTP) &&
127 (((httpreq == HTTPREQ_POST_MIME || httpreq == HTTPREQ_POST_FORM) &&
128 http->postsize < 0) ||
129- ((data->set.upload || httpreq == HTTPREQ_POST) &&
130+ ((data->state.upload || httpreq == HTTPREQ_POST) &&
131 data->state.infilesize == -1))) {
132 if(conn->bits.authneg)
133 /* don't enable chunked during auth neg */
134--- a/lib/imap.c
135+++ b/lib/imap.c
136@@ -1469,11 +1469,11 @@ static CURLcode imap_done(struct connect
137 result = status; /* use the already set error code */
138 }
139 else if(!data->set.connect_only && !imap->custom &&
140- (imap->uid || imap->mindex || data->set.upload ||
141+ (imap->uid || imap->mindex || data->state.upload ||
142 data->set.mimepost.kind != MIMEKIND_NONE)) {
143 /* Handle responses after FETCH or APPEND transfer has finished */
144
145- if(!data->set.upload && data->set.mimepost.kind == MIMEKIND_NONE)
146+ if(!data->state.upload && data->set.mimepost.kind == MIMEKIND_NONE)
147 state(conn, IMAP_FETCH_FINAL);
148 else {
149 /* End the APPEND command first by sending an empty line */
150@@ -1539,7 +1539,7 @@ static CURLcode imap_perform(struct conn
151 selected = TRUE;
152
153 /* Start the first command in the DO phase */
154- if(conn->data->set.upload || data->set.mimepost.kind != MIMEKIND_NONE)
155+ if(conn->data->state.upload || data->set.mimepost.kind != MIMEKIND_NONE)
156 /* APPEND can be executed directly */
157 result = imap_perform_append(conn);
158 else if(imap->custom && (selected || !imap->mailbox))
159--- a/lib/rtsp.c
160+++ b/lib/rtsp.c
161@@ -499,7 +499,7 @@ static CURLcode rtsp_do(struct connectda
162 rtspreq == RTSPREQ_SET_PARAMETER ||
163 rtspreq == RTSPREQ_GET_PARAMETER) {
164
165- if(data->set.upload) {
166+ if(data->state.upload) {
167 putsize = data->state.infilesize;
168 data->set.httpreq = HTTPREQ_PUT;
169
170@@ -518,7 +518,7 @@ static CURLcode rtsp_do(struct connectda
171 result =
172 Curl_add_bufferf(&req_buffer,
173 "Content-Length: %" CURL_FORMAT_CURL_OFF_T"\r\n",
174- (data->set.upload ? putsize : postsize));
175+ (data->state.upload ? putsize : postsize));
176 if(result)
177 return result;
178 }
179--- a/lib/setopt.c
180+++ b/lib/setopt.c
181@@ -258,8 +258,8 @@ CURLcode Curl_vsetopt(struct Curl_easy *
182 * We want to sent data to the remote host. If this is HTTP, that equals
183 * using the PUT request.
184 */
185- data->set.upload = (0 != va_arg(param, long)) ? TRUE : FALSE;
186- if(data->set.upload) {
187+ arg = va_arg(param, long);
188+ if(arg) {
189 /* If this is HTTP, PUT is what's needed to "upload" */
190 data->set.httpreq = HTTPREQ_PUT;
191 data->set.opt_no_body = FALSE; /* this is implied */
192@@ -486,7 +486,6 @@ CURLcode Curl_vsetopt(struct Curl_easy *
193 }
194 else
195 data->set.httpreq = HTTPREQ_GET;
196- data->set.upload = FALSE;
197 break;
198
199 case CURLOPT_COPYPOSTFIELDS:
200@@ -797,7 +796,6 @@ CURLcode Curl_vsetopt(struct Curl_easy *
201 */
202 if(va_arg(param, long)) {
203 data->set.httpreq = HTTPREQ_GET;
204- data->set.upload = FALSE; /* switch off upload */
205 data->set.opt_no_body = FALSE; /* this is implied */
206 }
207 break;
208--- a/lib/smb.c
209+++ b/lib/smb.c
210@@ -516,7 +516,7 @@ static CURLcode smb_send_open(struct con
211 byte_count = strlen(req->path);
212 msg.name_length = smb_swap16((unsigned short)byte_count);
213 msg.share_access = smb_swap32(SMB_FILE_SHARE_ALL);
214- if(conn->data->set.upload) {
215+ if(conn->data->state.upload) {
216 msg.access = smb_swap32(SMB_GENERIC_READ | SMB_GENERIC_WRITE);
217 msg.create_disposition = smb_swap32(SMB_FILE_OVERWRITE_IF);
218 }
219@@ -792,7 +792,7 @@ static CURLcode smb_request_state(struct
220 smb_m = (const struct smb_nt_create_response*) msg;
221 req->fid = smb_swap16(smb_m->fid);
222 conn->data->req.offset = 0;
223- if(conn->data->set.upload) {
224+ if(conn->data->state.upload) {
225 conn->data->req.size = conn->data->state.infilesize;
226 Curl_pgrsSetUploadSize(conn->data, conn->data->req.size);
227 next_state = SMB_UPLOAD;
228--- a/lib/smtp.c
229+++ b/lib/smtp.c
230@@ -1210,7 +1210,7 @@ static CURLcode smtp_done(struct connect
231 result = status; /* use the already set error code */
232 }
233 else if(!data->set.connect_only && data->set.mail_rcpt &&
234- (data->set.upload || data->set.mimepost.kind)) {
235+ (data->state.upload || data->set.mimepost.kind)) {
236 /* Calculate the EOB taking into account any terminating CRLF from the
237 previous line of the email or the CRLF of the DATA command when there
238 is "no mail data". RFC-5321, sect. 4.1.1.4.
239@@ -1297,7 +1297,7 @@ static CURLcode smtp_perform(struct conn
240 smtp->eob = 2;
241
242 /* Start the first command in the DO phase */
243- if((data->set.upload || data->set.mimepost.kind) && data->set.mail_rcpt)
244+ if((data->state.upload || data->set.mimepost.kind) && data->set.mail_rcpt)
245 /* MAIL transfer */
246 result = smtp_perform_mail(conn);
247 else
248--- a/lib/tftp.c
249+++ b/lib/tftp.c
250@@ -390,7 +390,7 @@ static CURLcode tftp_parse_option_ack(tf
251
252 /* tsize should be ignored on upload: Who cares about the size of the
253 remote file? */
254- if(!data->set.upload) {
255+ if(!data->state.upload) {
256 if(!tsize) {
257 failf(data, "invalid tsize -:%s:- value in OACK packet", value);
258 return CURLE_TFTP_ILLEGAL;
259@@ -470,7 +470,7 @@ static CURLcode tftp_send_first(tftp_sta
260 return result;
261 }
262
263- if(data->set.upload) {
264+ if(data->state.upload) {
265 /* If we are uploading, send an WRQ */
266 setpacketevent(&state->spacket, TFTP_EVENT_WRQ);
267 state->conn->data->req.upload_fromhere =
268@@ -505,7 +505,7 @@ static CURLcode tftp_send_first(tftp_sta
269 if(!data->set.tftp_no_options) {
270 char buf[64];
271 /* add tsize option */
272- if(data->set.upload && (data->state.infilesize != -1))
273+ if(data->state.upload && (data->state.infilesize != -1))
274 msnprintf(buf, sizeof(buf), "%" CURL_FORMAT_CURL_OFF_T,
275 data->state.infilesize);
276 else
277@@ -559,7 +559,7 @@ static CURLcode tftp_send_first(tftp_sta
278 break;
279
280 case TFTP_EVENT_OACK:
281- if(data->set.upload) {
282+ if(data->state.upload) {
283 result = tftp_connect_for_tx(state, event);
284 }
285 else {
286--- a/lib/transfer.c
287+++ b/lib/transfer.c
288@@ -1405,6 +1405,7 @@ void Curl_init_CONNECT(struct Curl_easy
289 {
290 data->state.fread_func = data->set.fread_func_set;
291 data->state.in = data->set.in_set;
292+ data->state.upload = (data->set.httpreq == HTTPREQ_PUT);
293 }
294
295 /*
296@@ -1816,7 +1817,7 @@ CURLcode Curl_retry_request(struct conne
297
298 /* if we're talking upload, we can't do the checks below, unless the protocol
299 is HTTP as when uploading over HTTP we will still get a response */
300- if(data->set.upload &&
301+ if(data->state.upload &&
302 !(conn->handler->protocol&(PROTO_FAMILY_HTTP|CURLPROTO_RTSP)))
303 return CURLE_OK;
304
305--- a/lib/urldata.h
306+++ b/lib/urldata.h
307@@ -1427,6 +1427,7 @@ struct UrlState {
308 BIT(stream_depends_e); /* set or don't set the Exclusive bit */
309 BIT(previouslypending); /* this transfer WAS in the multi->pending queue */
310 BIT(cookie_engine);
311+ BIT(upload); /* upload request */
312 };
313
314
315@@ -1762,7 +1763,6 @@ struct UserDefined {
316 BIT(http_auto_referer); /* set "correct" referer when following
317 location: */
318 BIT(opt_no_body); /* as set with CURLOPT_NOBODY */
319- BIT(upload); /* upload request */
320 BIT(verbose); /* output verbosity */
321 BIT(krb); /* Kerberos connection requested */
322 BIT(reuse_forbid); /* forbidden to be reused, close after use */
323--- a/lib/vssh/libssh.c
324+++ b/lib/vssh/libssh.c
325@@ -1076,7 +1076,7 @@ static CURLcode myssh_statemach_act(stru
326 }
327
328 case SSH_SFTP_TRANS_INIT:
329- if(data->set.upload)
330+ if(data->state.upload)
331 state(conn, SSH_SFTP_UPLOAD_INIT);
332 else {
333 if(protop->path[strlen(protop->path)-1] == '/')
334@@ -1686,7 +1686,7 @@ static CURLcode myssh_statemach_act(stru
335 /* Functions from the SCP subsystem cannot handle/return SSH_AGAIN */
336 ssh_set_blocking(sshc->ssh_session, 1);
337
338- if(data->set.upload) {
339+ if(data->state.upload) {
340 if(data->state.infilesize < 0) {
341 failf(data, "SCP requires a known file size for upload");
342 sshc->actualcode = CURLE_UPLOAD_FAILED;
343@@ -1787,7 +1787,7 @@ static CURLcode myssh_statemach_act(stru
344 break;
345 }
346 case SSH_SCP_DONE:
347- if(data->set.upload)
348+ if(data->state.upload)
349 state(conn, SSH_SCP_SEND_EOF);
350 else
351 state(conn, SSH_SCP_CHANNEL_FREE);
352--- a/lib/vssh/libssh2.c
353+++ b/lib/vssh/libssh2.c
354@@ -1664,7 +1664,7 @@ static CURLcode ssh_statemach_act(struct
355 }
356
357 case SSH_SFTP_TRANS_INIT:
358- if(data->set.upload)
359+ if(data->state.upload)
360 state(conn, SSH_SFTP_UPLOAD_INIT);
361 else {
362 if(sftp_scp->path[strlen(sftp_scp->path)-1] == '/')
363@@ -2366,7 +2366,7 @@ static CURLcode ssh_statemach_act(struct
364 break;
365 }
366
367- if(data->set.upload) {
368+ if(data->state.upload) {
369 if(data->state.infilesize < 0) {
370 failf(data, "SCP requires a known file size for upload");
371 sshc->actualcode = CURLE_UPLOAD_FAILED;
372@@ -2504,7 +2504,7 @@ static CURLcode ssh_statemach_act(struct
373 break;
374
375 case SSH_SCP_DONE:
376- if(data->set.upload)
377+ if(data->state.upload)
378 state(conn, SSH_SCP_SEND_EOF);
379 else
380 state(conn, SSH_SCP_CHANNEL_FREE);
diff --git a/meta/recipes-support/curl/curl/CVE-2023-32001.patch b/meta/recipes-support/curl/curl/CVE-2023-32001.patch
new file mode 100644
index 0000000000..f533992bcd
--- /dev/null
+++ b/meta/recipes-support/curl/curl/CVE-2023-32001.patch
@@ -0,0 +1,38 @@
1From 0c667188e0c6cda615a036b8a2b4125f2c404dde Mon Sep 17 00:00:00 2001
2From: SaltyMilk <soufiane.elmelcaoui@gmail.com>
3Date: Mon, 10 Jul 2023 21:43:28 +0200
4Subject: [PATCH] fopen: optimize
5
6Closes #11419
7
8Upstream-Status: Backport [https://github.com/curl/curl/commit/0c667188e0c6cda615a036b8a2b4125f2c404dde]
9CVE: CVE-2023-32001
10Signed-off-by: Ashish Sharma <asharma@mvista.com>
11
12 lib/fopen.c | 12 ++++++------
13 1 file changed, 6 insertions(+), 6 deletions(-)
14
15diff --git a/lib/fopen.c b/lib/fopen.c
16index c9c9e3d6e73a2..b6e3cadddef65 100644
17--- a/lib/fopen.c
18+++ b/lib/fopen.c
19@@ -56,13 +56,13 @@ CURLcode Curl_fopen(struct Curl_easy *data, const char *filename,
20 int fd = -1;
21 *tempname = NULL;
22
23- if(stat(filename, &sb) == -1 || !S_ISREG(sb.st_mode)) {
24- /* a non-regular file, fallback to direct fopen() */
25- *fh = fopen(filename, FOPEN_WRITETEXT);
26- if(*fh)
27- return CURLE_OK;
28+ *fh = fopen(filename, FOPEN_WRITETEXT);
29+ if(!*fh)
30 goto fail;
31- }
32+ if(fstat(fileno(*fh), &sb) == -1 || !S_ISREG(sb.st_mode))
33+ return CURLE_OK;
34+ fclose(*fh);
35+ *fh = NULL;
36
37 result = Curl_rand_hex(data, randsuffix, sizeof(randsuffix));
38 if(result)
diff --git a/meta/recipes-support/curl/curl/CVE-2023-38545.patch b/meta/recipes-support/curl/curl/CVE-2023-38545.patch
new file mode 100644
index 0000000000..c6b6726886
--- /dev/null
+++ b/meta/recipes-support/curl/curl/CVE-2023-38545.patch
@@ -0,0 +1,148 @@
1From 600a1caeb2312fdee5ef1caf7d613c12a8b2424a Mon Sep 17 00:00:00 2001
2From: Mike Crowe <mac@mcrowe.com>
3Date: Wed, 11 Oct 2023 20:50:28 +0100
4Subject: [PATCH] socks: return error if hostname too long for remote resolve
5To: libcurl development <curl-library@cool.haxx.se>
6
7Prior to this change the state machine attempted to change the remote
8resolve to a local resolve if the hostname was longer than 255
9characters. Unfortunately that did not work as intended and caused a
10security issue.
11
12Name resolvers cannot resolve hostnames longer than 255 characters.
13
14Bug: https://curl.se/docs/CVE-2023-38545.html
15
16Unfortunately CURLE_PROXY and CURLPX_LONG_HOSTNAME were introduced in
177.73.0 so they can't be used in 7.69.1. Let's use
18CURLE_COULDNT_RESOLVE_HOST as the best available alternative and update
19the test appropriately.
20
21libcurl's test support has been improved considerably since 7.69.1 which
22means that the test must be modified to remove use of %VERSION and
23%TESTNUMBER and the stderr output can no longer be checked.
24
25CVE: CVE-2023-38545
26Upstream-Status: Backport [fb4415d8aee6c1045be932a34fe6107c2f5ed147]
27Signed-off-by: Mike Crowe <mac@mcrowe.com>
28---
29 lib/socks.c | 13 +++++----
30 tests/data/Makefile.inc | 2 +-
31 tests/data/test728 | 60 +++++++++++++++++++++++++++++++++++++++++
32 3 files changed, 69 insertions(+), 6 deletions(-)
33 create mode 100644 tests/data/test728
34
35diff --git a/lib/socks.c b/lib/socks.c
36index 37099130e..f3bf40533 100644
37--- a/lib/socks.c
38+++ b/lib/socks.c
39@@ -521,11 +521,14 @@ CURLcode Curl_SOCKS5(const char *proxy_user,
40 infof(conn->data, "SOCKS5: connecting to HTTP proxy %s port %d\n",
41 hostname, remote_port);
42
43- /* RFC1928 chapter 5 specifies max 255 chars for domain name in packet */
44+ /* RFC1928 chapter 5 specifies max 255 chars for domain name in packet. */
45 if(!socks5_resolve_local && hostname_len > 255) {
46- infof(conn->data, "SOCKS5: server resolving disabled for hostnames of "
47- "length > 255 [actual len=%zu]\n", hostname_len);
48- socks5_resolve_local = TRUE;
49+ failf(data, "SOCKS5: the destination hostname is too long to be "
50+ "resolved remotely by the proxy.");
51+ /* This version of libcurl doesn't have CURLE_PROXY and
52+ * therefore CURLPX_LONG_HOSTNAME, so let's report the best we
53+ * can. */
54+ return CURLE_COULDNT_RESOLVE_HOST;
55 }
56
57 if(auth & ~(CURLAUTH_BASIC | CURLAUTH_GSSAPI))
58@@ -837,7 +840,7 @@ CURLcode Curl_SOCKS5(const char *proxy_user,
59
60 if(!socks5_resolve_local) {
61 socksreq[len++] = 3; /* ATYP: domain name = 3 */
62- socksreq[len++] = (char) hostname_len; /* one byte address length */
63+ socksreq[len++] = (unsigned char) hostname_len; /* one byte length */
64 memcpy(&socksreq[len], hostname, hostname_len); /* address w/o NULL */
65 len += hostname_len;
66 infof(data, "SOCKS5 connect to %s:%d (remotely resolved)\n",
67diff --git a/tests/data/Makefile.inc b/tests/data/Makefile.inc
68index 3d8565c36..5ee2284ff 100644
69--- a/tests/data/Makefile.inc
70+++ b/tests/data/Makefile.inc
71@@ -89,7 +89,7 @@ test662 test663 test664 test665 test666 test667 test668 \
72 test670 test671 test672 test673 \
73 \
74 test700 test701 test702 test703 test704 test705 test706 test707 test708 \
75-test709 test710 test711 test712 test713 test714 test715 test716 test717 \
76+test709 test710 test711 test712 test713 test714 test715 test716 test717 test728 \
77 \
78 test800 test801 test802 test803 test804 test805 test806 test807 test808 \
79 test809 test810 test811 test812 test813 test814 test815 test816 test817 \
80diff --git a/tests/data/test728 b/tests/data/test728
81new file mode 100644
82index 000000000..7b1d8b2f3
83--- /dev/null
84+++ b/tests/data/test728
85@@ -0,0 +1,60 @@
86+<testcase>
87+<info>
88+<keywords>
89+HTTP
90+HTTP GET
91+SOCKS5
92+SOCKS5h
93+followlocation
94+</keywords>
95+</info>
96+
97+#
98+# Server-side
99+<reply>
100+# The hostname in this redirect is 256 characters and too long (> 255) for
101+# SOCKS5 remote resolve. curl must return error CURLE_PROXY in this case.
102+<data>
103+HTTP/1.1 301 Moved Permanently
104+Location: http://AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/
105+Content-Length: 0
106+Connection: close
107+
108+</data>
109+</reply>
110+
111+#
112+# Client-side
113+<client>
114+<features>
115+proxy
116+</features>
117+<server>
118+http
119+socks5
120+</server>
121+ <name>
122+SOCKS5h with HTTP redirect to hostname too long
123+ </name>
124+ <command>
125+--no-progress-meter --location --proxy socks5h://%HOSTIP:%SOCKSPORT http://%HOSTIP:%HTTPPORT/728
126+</command>
127+</client>
128+
129+#
130+# Verify data after the test has been "shot"
131+<verify>
132+<strip>
133+^User-Agent:.*
134+</strip>
135+<protocol>
136+GET /728 HTTP/1.1
137+Host: %HOSTIP:%HTTPPORT
138+Accept: */*
139+
140+</protocol>
141+<errorcode>
142+6
143+</errorcode>
144+</verify>
145+</testcase>
146--
1472.39.2
148
diff --git a/meta/recipes-support/curl/curl/CVE-2023-38546.patch b/meta/recipes-support/curl/curl/CVE-2023-38546.patch
new file mode 100644
index 0000000000..30ef2fd038
--- /dev/null
+++ b/meta/recipes-support/curl/curl/CVE-2023-38546.patch
@@ -0,0 +1,132 @@
1From 7b67721f12cbe6ed1a41e7332f3b5a7186a5e23f Mon Sep 17 00:00:00 2001
2From: Daniel Stenberg <daniel@haxx.se>
3Date: Thu, 14 Sep 2023 23:28:32 +0200
4Subject: [PATCH] cookie: remove unnecessary struct fields
5To: libcurl development <curl-library@cool.haxx.se>
6
7Plus: reduce the hash table size from 256 to 63. It seems unlikely to
8make much of a speed difference for most use cases but saves 1.5KB of
9data per instance.
10
11Closes #11862
12
13This patch taken from Debian's 7.64.0-4+deb10u7 package which applied with
14only a little fuzz.
15
16CVE: CVE-2023-38546
17Upstream-Status: Backport [61275672b46d9abb32857404]
18Signed-off-by: Mike Crowe <mac@mcrowe.com>
19---
20 lib/cookie.c | 13 +------------
21 lib/cookie.h | 7 ++-----
22 lib/easy.c | 4 +---
23 3 files changed, 4 insertions(+), 20 deletions(-)
24
25diff --git a/lib/cookie.c b/lib/cookie.c
26index 68054e1c4..a378f28e1 100644
27--- a/lib/cookie.c
28+++ b/lib/cookie.c
29@@ -114,7 +114,6 @@ static void freecookie(struct Cookie *co)
30 free(co->name);
31 free(co->value);
32 free(co->maxage);
33- free(co->version);
34 free(co);
35 }
36
37@@ -641,11 +640,7 @@ Curl_cookie_add(struct Curl_easy *data,
38 }
39 }
40 else if(strcasecompare("version", name)) {
41- strstore(&co->version, whatptr);
42- if(!co->version) {
43- badcookie = TRUE;
44- break;
45- }
46+ /* just ignore */
47 }
48 else if(strcasecompare("max-age", name)) {
49 /* Defined in RFC2109:
50@@ -1042,7 +1037,6 @@ Curl_cookie_add(struct Curl_easy *data,
51 free(clist->path);
52 free(clist->spath);
53 free(clist->expirestr);
54- free(clist->version);
55 free(clist->maxage);
56
57 *clist = *co; /* then store all the new data */
58@@ -1111,9 +1105,6 @@ struct CookieInfo *Curl_cookie_init(struct Curl_easy *data,
59 c = calloc(1, sizeof(struct CookieInfo));
60 if(!c)
61 return NULL; /* failed to get memory */
62- c->filename = strdup(file?file:"none"); /* copy the name just in case */
63- if(!c->filename)
64- goto fail; /* failed to get memory */
65 }
66 else {
67 /* we got an already existing one, use that */
68@@ -1241,7 +1232,6 @@ static struct Cookie *dup_cookie(struct Cookie *src)
69 CLONE(name);
70 CLONE(value);
71 CLONE(maxage);
72- CLONE(version);
73 d->expires = src->expires;
74 d->tailmatch = src->tailmatch;
75 d->secure = src->secure;
76@@ -1457,7 +1447,6 @@ void Curl_cookie_cleanup(struct CookieInfo *c)
77 {
78 if(c) {
79 unsigned int i;
80- free(c->filename);
81 for(i = 0; i < COOKIE_HASH_SIZE; i++)
82 Curl_cookie_freelist(c->cookies[i]);
83 free(c); /* free the base struct as well */
84diff --git a/lib/cookie.h b/lib/cookie.h
85index b3865e601..2e667cda0 100644
86--- a/lib/cookie.h
87+++ b/lib/cookie.h
88@@ -36,8 +36,6 @@ struct Cookie {
89 char *expirestr; /* the plain text version */
90 bool tailmatch; /* whether we do tail-matching of the domain name */
91
92- /* RFC 2109 keywords. Version=1 means 2109-compliant cookie sending */
93- char *version; /* Version = <value> */
94 char *maxage; /* Max-Age = <value> */
95
96 bool secure; /* whether the 'secure' keyword was used */
97@@ -54,15 +52,14 @@ struct Cookie {
98 #define COOKIE_PREFIX__SECURE (1<<0)
99 #define COOKIE_PREFIX__HOST (1<<1)
100
101-#define COOKIE_HASH_SIZE 256
102+#define COOKIE_HASH_SIZE 63
103
104 struct CookieInfo {
105 /* linked list of cookies we know of */
106 struct Cookie *cookies[COOKIE_HASH_SIZE];
107
108- char *filename; /* file we read from/write to */
109 bool running; /* state info, for cookie adding information */
110- long numcookies; /* number of cookies in the "jar" */
111+ int numcookies; /* number of cookies in the "jar" */
112 bool newsession; /* new session, discard session cookies on load */
113 int lastct; /* last creation-time used in the jar */
114 };
115diff --git a/lib/easy.c b/lib/easy.c
116index b648e80c1..cdca0fb03 100644
117--- a/lib/easy.c
118+++ b/lib/easy.c
119@@ -840,9 +840,7 @@ struct Curl_easy *curl_easy_duphandle(struct Curl_easy *data)
120 if(data->cookies) {
121 /* If cookies are enabled in the parent handle, we enable them
122 in the clone as well! */
123- outcurl->cookies = Curl_cookie_init(data,
124- data->cookies->filename,
125- outcurl->cookies,
126+ outcurl->cookies = Curl_cookie_init(data, NULL, outcurl->cookies,
127 data->set.cookiesession);
128 if(!outcurl->cookies)
129 goto fail;
130--
1312.39.2
132
diff --git a/meta/recipes-support/curl/curl/CVE-2023-46218.patch b/meta/recipes-support/curl/curl/CVE-2023-46218.patch
new file mode 100644
index 0000000000..c9677b6a84
--- /dev/null
+++ b/meta/recipes-support/curl/curl/CVE-2023-46218.patch
@@ -0,0 +1,52 @@
1CVE: CVE-2023-46218
2Upstream-Status: Backport [ import from ubuntu http://archive.ubuntu.com/ubuntu/pool/main/c/curl/curl_7.68.0-1ubuntu2.21.debian.tar.xz upstream https://github.com/curl/curl/commit/2b0994c29a721c91c57 ]
3Signed-off-by: Lee Chee Yang <chee.yang.lee@intel.com>
4
5Backport of:
6
7From 2b0994c29a721c91c572cff7808c572a24d251eb Mon Sep 17 00:00:00 2001
8From: Daniel Stenberg <daniel@haxx.se>
9Date: Thu, 23 Nov 2023 08:15:47 +0100
10Subject: [PATCH] cookie: lowercase the domain names before PSL checks
11
12Reported-by: Harry Sintonen
13
14Closes #12387
15---
16 lib/cookie.c | 24 ++++++++++++++++--------
17 1 file changed, 16 insertions(+), 8 deletions(-)
18
19--- a/lib/cookie.c
20+++ b/lib/cookie.c
21@@ -967,15 +967,23 @@ Curl_cookie_add(struct Curl_easy *data,
22 #ifdef USE_LIBPSL
23 /* Check if the domain is a Public Suffix and if yes, ignore the cookie. */
24 if(domain && co->domain && !isip(co->domain)) {
25- const psl_ctx_t *psl = Curl_psl_use(data);
26- int acceptable;
27-
28- if(psl) {
29- acceptable = psl_is_cookie_domain_acceptable(psl, domain, co->domain);
30- Curl_psl_release(data);
31+ bool acceptable = FALSE;
32+ char lcase[256];
33+ char lcookie[256];
34+ size_t dlen = strlen(domain);
35+ size_t clen = strlen(co->domain);
36+ if((dlen < sizeof(lcase)) && (clen < sizeof(lcookie))) {
37+ const psl_ctx_t *psl = Curl_psl_use(data);
38+ if(psl) {
39+ /* the PSL check requires lowercase domain name and pattern */
40+ Curl_strntolower(lcase, domain, dlen + 1);
41+ Curl_strntolower(lcookie, co->domain, clen + 1);
42+ acceptable = psl_is_cookie_domain_acceptable(psl, lcase, lcookie);
43+ Curl_psl_release(data);
44+ }
45+ else
46+ acceptable = !bad_domain(domain);
47 }
48- else
49- acceptable = !bad_domain(domain);
50
51 if(!acceptable) {
52 infof(data, "cookie '%s' dropped, domain '%s' must not "
diff --git a/meta/recipes-support/curl/curl/CVE-2024-2398.patch b/meta/recipes-support/curl/curl/CVE-2024-2398.patch
new file mode 100644
index 0000000000..a3840336f0
--- /dev/null
+++ b/meta/recipes-support/curl/curl/CVE-2024-2398.patch
@@ -0,0 +1,88 @@
1Backport of:
2
3From deca8039991886a559b67bcd6701db800a5cf764 Mon Sep 17 00:00:00 2001
4From: Stefan Eissing <stefan@eissing.org>
5Date: Wed, 6 Mar 2024 09:36:08 +0100
6Subject: [PATCH] http2: push headers better cleanup
7
8- provide common cleanup method for push headers
9
10Closes #13054
11
12Upstream-Status: Backport [import from ubuntu https://git.launchpad.net/ubuntu/+source/curl/tree/debian/patches/CVE-2024-2398.patch?h=ubuntu/focal-security
13Upstream commit https://github.com/curl/curl/commit/deca8039991886a559b67bcd6701db800a5cf764]
14CVE: CVE-2024-2398
15Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
16---
17 lib/http2.c | 34 +++++++++++++++-------------------
18 1 file changed, 15 insertions(+), 19 deletions(-)
19
20--- a/lib/http2.c
21+++ b/lib/http2.c
22@@ -515,6 +515,15 @@ static struct Curl_easy *duphandle(struc
23 }
24
25
26+static void free_push_headers(struct HTTP *stream)
27+{
28+ size_t i;
29+ for(i = 0; i<stream->push_headers_used; i++)
30+ free(stream->push_headers[i]);
31+ Curl_safefree(stream->push_headers);
32+ stream->push_headers_used = 0;
33+}
34+
35 static int push_promise(struct Curl_easy *data,
36 struct connectdata *conn,
37 const nghttp2_push_promise *frame)
38@@ -528,7 +537,6 @@ static int push_promise(struct Curl_easy
39 struct curl_pushheaders heads;
40 CURLMcode rc;
41 struct http_conn *httpc;
42- size_t i;
43 /* clone the parent */
44 struct Curl_easy *newhandle = duphandle(data);
45 if(!newhandle) {
46@@ -557,11 +565,7 @@ static int push_promise(struct Curl_easy
47 Curl_set_in_callback(data, false);
48
49 /* free the headers again */
50- for(i = 0; i<stream->push_headers_used; i++)
51- free(stream->push_headers[i]);
52- free(stream->push_headers);
53- stream->push_headers = NULL;
54- stream->push_headers_used = 0;
55+ free_push_headers(stream);
56
57 if(rv) {
58 /* denied, kill off the new handle again */
59@@ -995,10 +999,10 @@ static int on_header(nghttp2_session *se
60 stream->push_headers_alloc) {
61 char **headp;
62 stream->push_headers_alloc *= 2;
63- headp = Curl_saferealloc(stream->push_headers,
64- stream->push_headers_alloc * sizeof(char *));
65+ headp = realloc(stream->push_headers,
66+ stream->push_headers_alloc * sizeof(char *));
67 if(!headp) {
68- stream->push_headers = NULL;
69+ free_push_headers(stream);
70 return NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE;
71 }
72 stream->push_headers = headp;
73@@ -1179,14 +1183,7 @@ void Curl_http2_done(struct Curl_easy *d
74 if(http->header_recvbuf) {
75 Curl_add_buffer_free(&http->header_recvbuf);
76 Curl_add_buffer_free(&http->trailer_recvbuf);
77- if(http->push_headers) {
78- /* if they weren't used and then freed before */
79- for(; http->push_headers_used > 0; --http->push_headers_used) {
80- free(http->push_headers[http->push_headers_used - 1]);
81- }
82- free(http->push_headers);
83- http->push_headers = NULL;
84- }
85+ free_push_headers(http);
86 }
87
88 if(!httpc->h2) /* not HTTP/2 ? */
diff --git a/meta/recipes-support/curl/curl_7.69.1.bb b/meta/recipes-support/curl/curl_7.69.1.bb
index c3d629108a..2f351d585a 100644
--- a/meta/recipes-support/curl/curl_7.69.1.bb
+++ b/meta/recipes-support/curl/curl_7.69.1.bb
@@ -1,4 +1,8 @@
1SUMMARY = "Command line tool and library for client-side URL transfers" 1SUMMARY = "Command line tool and library for client-side URL transfers"
2DESCRIPTION = "It uses URL syntax to transfer data to and from servers. \
3curl is a widely used because of its ability to be flexible and complete \
4complex tasks. For example, you can use curl for things like user authentication, \
5HTTP post, SSL connections, proxy support, FTP uploads, and more!"
2HOMEPAGE = "http://curl.haxx.se/" 6HOMEPAGE = "http://curl.haxx.se/"
3BUGTRACKER = "http://curl.haxx.se/mail/list.cgi?list=curl-tracker" 7BUGTRACKER = "http://curl.haxx.se/mail/list.cgi?list=curl-tracker"
4SECTION = "console/network" 8SECTION = "console/network"
@@ -13,6 +17,48 @@ SRC_URI = "https://curl.haxx.se/download/curl-${PV}.tar.bz2 \
13 file://CVE-2020-8284.patch \ 17 file://CVE-2020-8284.patch \
14 file://CVE-2020-8285.patch \ 18 file://CVE-2020-8285.patch \
15 file://CVE-2020-8286.patch \ 19 file://CVE-2020-8286.patch \
20 file://CVE-2021-22876.patch \
21 file://CVE-2021-22890.patch \
22 file://CVE-2021-22898.patch \
23 file://CVE-2021-22924.patch \
24 file://CVE-2021-22925.patch \
25 file://CVE-2021-22946-pre1.patch \
26 file://CVE-2021-22946.patch \
27 file://CVE-2021-22947.patch \
28 file://CVE-2022-27776.patch \
29 file://CVE-2022-27775.patch \
30 file://CVE-2022-22576.patch \
31 file://CVE-2022-27774-1.patch \
32 file://CVE-2022-27774-2.patch \
33 file://CVE-2022-27774-3.patch \
34 file://CVE-2022-27774-4.patch \
35 file://CVE-2022-27781.patch \
36 file://CVE-2022-27782-1.patch \
37 file://CVE-2022-27782-2.patch \
38 file://CVE-2022-32206.patch \
39 file://CVE-2022-32207.patch \
40 file://CVE-2022-32208.patch \
41 file://CVE-2022-35252.patch \
42 file://CVE-2022-32221.patch \
43 file://CVE-2022-35260.patch \
44 file://CVE-2022-43552.patch \
45 file://CVE-2023-23916.patch \
46 file://CVE-2023-27534-pre1.patch \
47 file://CVE-2023-27534.patch \
48 file://CVE-2023-27538.patch \
49 file://CVE-2023-27533.patch \
50 file://CVE-2023-27535-pre1.patch \
51 file://CVE-2023-27535.patch \
52 file://CVE-2023-27536.patch \
53 file://CVE-2023-28320.patch \
54 file://CVE-2023-28320-fol1.patch \
55 file://CVE-2023-32001.patch \
56 file://CVE-2023-38545.patch \
57 file://CVE-2023-38546.patch \
58 file://CVE-2023-28321.patch \
59 file://CVE-2023-28322.patch \
60 file://CVE-2023-46218.patch \
61 file://CVE-2024-2398.patch \
16" 62"
17 63
18SRC_URI[md5sum] = "ec5fc263f898a3dfef08e805f1ecca42" 64SRC_URI[md5sum] = "ec5fc263f898a3dfef08e805f1ecca42"
@@ -20,6 +66,15 @@ SRC_URI[sha256sum] = "2ff5e5bd507adf6aa88ff4bbafd4c7af464867ffb688be93b9930717a5
20 66
21# Curl has used many names over the years... 67# Curl has used many names over the years...
22CVE_PRODUCT = "haxx:curl haxx:libcurl curl:curl curl:libcurl libcurl:libcurl daniel_stenberg:curl" 68CVE_PRODUCT = "haxx:curl haxx:libcurl curl:curl curl:libcurl libcurl:libcurl daniel_stenberg:curl"
69CVE_CHECK_WHITELIST = "CVE-2021-22922 CVE-2021-22923 CVE-2021-22926 CVE-2021-22945"
70
71# As per link https://security-tracker.debian.org/tracker/CVE-2021-22897
72# and https://ubuntu.com/security/CVE-2021-22897
73# This CVE issue affects Windows only Hence whitelisting this CVE
74CVE_CHECK_WHITELIST += "CVE-2021-22897"
75
76# This CVE reports that apple had to upgrade curl because of other already reported CVEs
77CVE_CHECK_WHITELIST += "CVE-2023-42915"
23 78
24inherit autotools pkgconfig binconfig multilib_header 79inherit autotools pkgconfig binconfig multilib_header
25 80
diff --git a/meta/recipes-support/db/db_5.3.28.bb b/meta/recipes-support/db/db_5.3.28.bb
index 318efcb61d..b2ae98f05c 100644
--- a/meta/recipes-support/db/db_5.3.28.bb
+++ b/meta/recipes-support/db/db_5.3.28.bb
@@ -10,11 +10,12 @@
10# same system at the same time if really necessary. 10# same system at the same time if really necessary.
11SECTION = "libs" 11SECTION = "libs"
12SUMMARY = "Berkeley Database v5" 12SUMMARY = "Berkeley Database v5"
13DESCRIPTION = "Provides the foundational storage services for your application, no matter how demanding and unique your requirements may seem to be"
13HOMEPAGE = "https://www.oracle.com/database/technologies/related/berkeleydb.html" 14HOMEPAGE = "https://www.oracle.com/database/technologies/related/berkeleydb.html"
14LICENSE = "Sleepycat" 15LICENSE = "Sleepycat"
15RCONFLICTS_${PN} = "db3" 16RCONFLICTS_${PN} = "db3"
16 17
17CVE_PRODUCT = "oracle_berkeley_db" 18CVE_PRODUCT = "oracle_berkeley_db berkeley_db"
18CVE_VERSION = "11.2.${PV}" 19CVE_VERSION = "11.2.${PV}"
19 20
20PR = "r1" 21PR = "r1"
diff --git a/meta/recipes-support/debianutils/debianutils_4.9.1.bb b/meta/recipes-support/debianutils/debianutils_4.9.1.bb
index 904c52780f..8603fecbd0 100644
--- a/meta/recipes-support/debianutils/debianutils_4.9.1.bb
+++ b/meta/recipes-support/debianutils/debianutils_4.9.1.bb
@@ -1,4 +1,9 @@
1SUMMARY = "Miscellaneous utilities specific to Debian" 1SUMMARY = "Miscellaneous utilities specific to Debian"
2DESCRIPTION = "Provides a number of small utilities which are used \
3primarily by the installation scripts of Debian packages, although \
4you may use them directly. "
5HOMEPAGE = "https://packages.debian.org/sid/debianutils"
6BUGTRACKER = "https://bugs.debian.org/cgi-bin/pkgreport.cgi?pkg=debianutils;dist=unstable"
2SECTION = "base" 7SECTION = "base"
3LICENSE = "GPLv2 & SMAIL_GPL" 8LICENSE = "GPLv2 & SMAIL_GPL"
4LIC_FILES_CHKSUM = "file://debian/copyright;md5=f01a5203d50512fc4830b4332b696a9f" 9LIC_FILES_CHKSUM = "file://debian/copyright;md5=f01a5203d50512fc4830b4332b696a9f"
diff --git a/meta/recipes-support/diffoscope/diffoscope_136.bb b/meta/recipes-support/diffoscope/diffoscope_172.bb
index 3e3e1dfc00..b26713c47f 100644
--- a/meta/recipes-support/diffoscope/diffoscope_136.bb
+++ b/meta/recipes-support/diffoscope/diffoscope_172.bb
@@ -7,12 +7,19 @@ PYPI_PACKAGE = "diffoscope"
7 7
8inherit pypi setuptools3 8inherit pypi setuptools3
9 9
10SRC_URI[md5sum] = "c84d8d308a40176ba2f5dc4abdbf6f73" 10SRC_URI[sha256sum] = "5ffe7f38555c6409bc7e7edc277ed77dd78641fe1306fc38d153dbbe445ddea4"
11SRC_URI[sha256sum] = "0d6486d6eb6e0445ba21fee2e8bdd3a366ce786bfac98e00e5a95038b7815f15"
12 11
13RDEPENDS_${PN} += "binutils vim squashfs-tools python3-libarchive-c python3-magic" 12RDEPENDS_${PN} += "binutils vim squashfs-tools python3-libarchive-c python3-magic"
14 13
15# Dependencies don't build for musl 14# Dependencies don't build for musl
16COMPATIBLE_HOST_libc-musl = 'null' 15COMPATIBLE_HOST_libc-musl = 'null'
17 16
17do_install_append_class-native() {
18 create_wrapper ${D}${bindir}/diffoscope \
19 MAGIC=${STAGING_DIR_NATIVE}${datadir_native}/misc/magic.mgc \
20 RPM_CONFIGDIR=${STAGING_LIBDIR_NATIVE}/rpm \
21 LD_LIBRARY_PATH=${STAGING_LIBDIR_NATIVE} \
22 RPM_ETCCONFIGDIR=${STAGING_DIR_NATIVE}
23}
24
18BBCLASSEXTEND = "native" 25BBCLASSEXTEND = "native"
diff --git a/meta/recipes-support/dos2unix/dos2unix_7.4.1.bb b/meta/recipes-support/dos2unix/dos2unix_7.4.1.bb
index 1623285fd0..ea34e4c7a3 100644
--- a/meta/recipes-support/dos2unix/dos2unix_7.4.1.bb
+++ b/meta/recipes-support/dos2unix/dos2unix_7.4.1.bb
@@ -8,7 +8,7 @@ SECTION = "support"
8LICENSE = "BSD-2-Clause" 8LICENSE = "BSD-2-Clause"
9LIC_FILES_CHKSUM = "file://COPYING.txt;md5=0c977b18f0a384d03597a517d7d03e32" 9LIC_FILES_CHKSUM = "file://COPYING.txt;md5=0c977b18f0a384d03597a517d7d03e32"
10 10
11SRC_URI = "git://git.code.sf.net/p/dos2unix/dos2unix" 11SRC_URI = "git://git.code.sf.net/p/dos2unix/dos2unix;branch=master"
12UPSTREAM_CHECK_GITTAGREGEX = "dos2unix-(?P<pver>(\d+(\.\d+)+))" 12UPSTREAM_CHECK_GITTAGREGEX = "dos2unix-(?P<pver>(\d+(\.\d+)+))"
13 13
14SRCREV = "0490f0723b1a0851b17343f6164915f3474b5197" 14SRCREV = "0490f0723b1a0851b17343f6164915f3474b5197"
diff --git a/meta/recipes-support/enchant/enchant2_2.2.8.bb b/meta/recipes-support/enchant/enchant2_2.2.8.bb
index 4ddbe55da5..7c624efea3 100644
--- a/meta/recipes-support/enchant/enchant2_2.2.8.bb
+++ b/meta/recipes-support/enchant/enchant2_2.2.8.bb
@@ -1,6 +1,9 @@
1SUMMARY = "Enchant Spell checker API Library" 1SUMMARY = "Enchant Spell checker API Library"
2DESCRIPTION = "A library (and command-line program) that wraps a number of \
3different spelling libraries and programs with a consistent interface."
2SECTION = "libs" 4SECTION = "libs"
3HOMEPAGE = "https://abiword.github.io/enchant/" 5HOMEPAGE = "https://abiword.github.io/enchant/"
6BUGTRACKER = "https://github.com/AbiWord/enchant/issues/"
4LICENSE = "LGPLv2.1+" 7LICENSE = "LGPLv2.1+"
5LIC_FILES_CHKSUM = "file://COPYING.LIB;md5=a916467b91076e631dd8edb7424769c7" 8LIC_FILES_CHKSUM = "file://COPYING.LIB;md5=a916467b91076e631dd8edb7424769c7"
6 9
diff --git a/meta/recipes-support/fribidi/fribidi/CVE-2022-25308.patch b/meta/recipes-support/fribidi/fribidi/CVE-2022-25308.patch
new file mode 100644
index 0000000000..8f2c2ade0e
--- /dev/null
+++ b/meta/recipes-support/fribidi/fribidi/CVE-2022-25308.patch
@@ -0,0 +1,50 @@
1From ad3a19e6372b1e667128ed1ea2f49919884587e1 Mon Sep 17 00:00:00 2001
2From: Akira TAGOH <akira@tagoh.org>
3Date: Thu, 17 Feb 2022 17:30:12 +0900
4Subject: [PATCH] Fix the stack buffer overflow issue
5
6strlen() could returns 0. Without a conditional check for len,
7accessing S_ pointer with len - 1 may causes a stack buffer overflow.
8
9AddressSanitizer reports this like:
10==1219243==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7ffdce043c1f at pc 0x000000403547 bp 0x7ffdce0
1143b30 sp 0x7ffdce043b28
12READ of size 1 at 0x7ffdce043c1f thread T0
13 #0 0x403546 in main ../bin/fribidi-main.c:393
14 #1 0x7f226804e58f in __libc_start_call_main (/lib64/libc.so.6+0x2d58f)
15 #2 0x7f226804e648 in __libc_start_main_impl (/lib64/libc.so.6+0x2d648)
16 #3 0x4036f4 in _start (/tmp/fribidi/build/bin/fribidi+0x4036f4)
17
18Address 0x7ffdce043c1f is located in stack of thread T0 at offset 63 in frame
19 #0 0x4022bf in main ../bin/fribidi-main.c:193
20
21 This frame has 5 object(s):
22 [32, 36) 'option_index' (line 233)
23 [48, 52) 'base' (line 386)
24 [64, 65064) 'S_' (line 375) <== Memory access at offset 63 underflows this variable
25 [65328, 130328) 'outstring' (line 385)
26 [130592, 390592) 'logical' (line 384)
27
28This fixes https://github.com/fribidi/fribidi/issues/181
29
30CVE: CVE-2022-25308
31Upstream-Status: Backport [https://github.com/fribidi/fribidi/commit/ad3a19e6372b1e667128ed1ea2f49919884587e1]
32Signed-off-by: Pawan Badganchi <Pawan.Badganchi@kpit.com>
33
34---
35 bin/fribidi-main.c | 2 +-
36 1 file changed, 1 insertion(+), 1 deletion(-)
37
38diff --git a/bin/fribidi-main.c b/bin/fribidi-main.c
39index 3cf9fe1..3ae4fb6 100644
40--- a/bin/fribidi-main.c
41+++ b/bin/fribidi-main.c
42@@ -390,7 +390,7 @@ FRIBIDI_END_IGNORE_DEPRECATIONS
43 S_[sizeof (S_) - 1] = 0;
44 len = strlen (S_);
45 /* chop */
46- if (S_[len - 1] == '\n')
47+ if (len > 0 && S_[len - 1] == '\n')
48 {
49 len--;
50 S_[len] = '\0';
diff --git a/meta/recipes-support/fribidi/fribidi/CVE-2022-25309.patch b/meta/recipes-support/fribidi/fribidi/CVE-2022-25309.patch
new file mode 100644
index 0000000000..0efba3d05c
--- /dev/null
+++ b/meta/recipes-support/fribidi/fribidi/CVE-2022-25309.patch
@@ -0,0 +1,31 @@
1From f22593b82b5d1668d1997dbccd10a9c31ffea3b3 Mon Sep 17 00:00:00 2001
2From: Dov Grobgeld <dov.grobgeld@gmail.com>
3Date: Fri, 25 Mar 2022 09:09:49 +0300
4Subject: [PATCH] Protected against garbage in the CapRTL encoder
5
6CVE: CVE-2022-25309
7Upstream-Status: Backport [https://github.com/fribidi/fribidi/commit/f22593b82b5d1668d1997dbccd10a9c31ffea3b3]
8Signed-off-by: Pawan Badganchi <Pawan.Badganchi@kpit.com>
9
10---
11 lib/fribidi-char-sets-cap-rtl.c | 7 ++++++-
12 1 file changed, 6 insertions(+), 1 deletion(-)
13
14diff --git a/lib/fribidi-char-sets-cap-rtl.c b/lib/fribidi-char-sets-cap-rtl.c
15index b0c0e4a..f74e010 100644
16--- a/lib/fribidi-char-sets-cap-rtl.c
17+++ b/lib/fribidi-char-sets-cap-rtl.c
18@@ -232,7 +232,12 @@ fribidi_cap_rtl_to_unicode (
19 }
20 }
21 else
22- us[j++] = caprtl_to_unicode[(int) s[i]];
23+ {
24+ if ((int)s[i] < 0)
25+ us[j++] = '?';
26+ else
27+ us[j++] = caprtl_to_unicode[(int) s[i]];
28+ }
29 }
30
31 return j;
diff --git a/meta/recipes-support/fribidi/fribidi/CVE-2022-25310.patch b/meta/recipes-support/fribidi/fribidi/CVE-2022-25310.patch
new file mode 100644
index 0000000000..d79a82d648
--- /dev/null
+++ b/meta/recipes-support/fribidi/fribidi/CVE-2022-25310.patch
@@ -0,0 +1,30 @@
1From 175850b03e1af251d705c1d04b2b9b3c1c06e48f Mon Sep 17 00:00:00 2001
2From: Akira TAGOH <akira@tagoh.org>
3Date: Thu, 17 Feb 2022 19:06:10 +0900
4Subject: [PATCH] Fix SEGV issue in fribidi_remove_bidi_marks
5
6Escape from fribidi_remove_bidi_marks() immediately if str is null.
7
8This fixes https://github.com/fribidi/fribidi/issues/183
9
10CVE: CVE-2022-25310
11Upstream-Status: Backport [https://github.com/fribidi/fribidi/commit/175850b03e1af251d705c1d04b2b9b3c1c06e48f]
12Signed-off-by: Pawan Badganchi <Pawan.Badganchi@kpit.com>
13
14---
15 lib/fribidi.c | 2 +-
16 1 file changed, 1 insertion(+), 1 deletion(-)
17
18diff --git a/lib/fribidi.c b/lib/fribidi.c
19index f5da0da..70bdab2 100644
20--- a/lib/fribidi.c
21+++ b/lib/fribidi.c
22@@ -74,7 +74,7 @@ fribidi_remove_bidi_marks (
23 fribidi_boolean status = false;
24
25 if UNLIKELY
26- (len == 0)
27+ (len == 0 || str == NULL)
28 {
29 status = true;
30 goto out;
diff --git a/meta/recipes-support/fribidi/fribidi_1.0.9.bb b/meta/recipes-support/fribidi/fribidi_1.0.9.bb
index 0654b07dc7..62b7d72812 100644
--- a/meta/recipes-support/fribidi/fribidi_1.0.9.bb
+++ b/meta/recipes-support/fribidi/fribidi_1.0.9.bb
@@ -1,9 +1,18 @@
1SUMMARY = "Free Implementation of the Unicode Bidirectional Algorithm" 1SUMMARY = "Free Implementation of the Unicode Bidirectional Algorithm"
2DESCRIPTION = "It provides utility functions to aid in the development \
3of interactive editors and widgets that implement BiDi functionality. \
4The BiDi algorithm is a prerequisite for supporting right-to-left scripts such \
5as Hebrew, Arabic, Syriac, and Thaana. "
2SECTION = "libs" 6SECTION = "libs"
7HOMEPAGE = "http://fribidi.org/"
8BUGTRACKER = "https://github.com/fribidi/fribidi/issues"
3LICENSE = "LGPLv2.1+" 9LICENSE = "LGPLv2.1+"
4LIC_FILES_CHKSUM = "file://COPYING;md5=a916467b91076e631dd8edb7424769c7" 10LIC_FILES_CHKSUM = "file://COPYING;md5=a916467b91076e631dd8edb7424769c7"
5 11
6SRC_URI = "https://github.com/${BPN}/${BPN}/releases/download/v${PV}/${BP}.tar.xz \ 12SRC_URI = "https://github.com/${BPN}/${BPN}/releases/download/v${PV}/${BP}.tar.xz \
13 file://CVE-2022-25308.patch \
14 file://CVE-2022-25309.patch \
15 file://CVE-2022-25310.patch \
7 " 16 "
8SRC_URI[md5sum] = "1b767c259c3cd8e0c8496970f63c22dc" 17SRC_URI[md5sum] = "1b767c259c3cd8e0c8496970f63c22dc"
9SRC_URI[sha256sum] = "c5e47ea9026fb60da1944da9888b4e0a18854a0e2410bbfe7ad90a054d36e0c7" 18SRC_URI[sha256sum] = "c5e47ea9026fb60da1944da9888b4e0a18854a0e2410bbfe7ad90a054d36e0c7"
diff --git a/meta/recipes-support/gdbm/gdbm_1.18.1.bb b/meta/recipes-support/gdbm/gdbm_1.18.1.bb
index fbb1fe72d7..bfc9ee8f85 100644
--- a/meta/recipes-support/gdbm/gdbm_1.18.1.bb
+++ b/meta/recipes-support/gdbm/gdbm_1.18.1.bb
@@ -1,4 +1,7 @@
1SUMMARY = "Key/value database library with extensible hashing" 1SUMMARY = "Key/value database library with extensible hashing"
2DESCRIPTION = "Library of database functions that use extensible hashing \
3and work similar to the standard UNIX dbm. These routines are provided \
4to a programmer needing to create and manipulate a hashed database."
2HOMEPAGE = "http://www.gnu.org/software/gdbm/" 5HOMEPAGE = "http://www.gnu.org/software/gdbm/"
3SECTION = "libs" 6SECTION = "libs"
4LICENSE = "GPLv3" 7LICENSE = "GPLv3"
diff --git a/meta/recipes-support/gmp/gmp/cve-2021-43618.patch b/meta/recipes-support/gmp/gmp/cve-2021-43618.patch
new file mode 100644
index 0000000000..095fb21eaa
--- /dev/null
+++ b/meta/recipes-support/gmp/gmp/cve-2021-43618.patch
@@ -0,0 +1,27 @@
1CVE: CVE-2021-43618
2Upstream-Status: Backport
3Signed-off-by: Ross Burton <ross.burton@arm.com>
4
5# HG changeset patch
6# User Marco Bodrato <bodrato@mail.dm.unipi.it>
7# Date 1634836009 -7200
8# Node ID 561a9c25298e17bb01896801ff353546c6923dbd
9# Parent e1fd9db13b475209a864577237ea4b9105b3e96e
10mpz/inp_raw.c: Avoid bit size overflows
11
12diff -r e1fd9db13b47 -r 561a9c25298e mpz/inp_raw.c
13--- a/mpz/inp_raw.c Tue Dec 22 23:49:51 2020 +0100
14+++ b/mpz/inp_raw.c Thu Oct 21 19:06:49 2021 +0200
15@@ -88,8 +88,11 @@
16
17 abs_csize = ABS (csize);
18
19+ if (UNLIKELY (abs_csize > ~(mp_bitcnt_t) 0 / 8))
20+ return 0; /* Bit size overflows */
21+
22 /* round up to a multiple of limbs */
23- abs_xsize = BITS_TO_LIMBS (abs_csize*8);
24+ abs_xsize = BITS_TO_LIMBS ((mp_bitcnt_t) abs_csize * 8);
25
26 if (abs_xsize != 0)
27 {
diff --git a/meta/recipes-support/gmp/gmp_6.2.0.bb b/meta/recipes-support/gmp/gmp_6.2.0.bb
index a19c74fca8..d29b74f829 100644
--- a/meta/recipes-support/gmp/gmp_6.2.0.bb
+++ b/meta/recipes-support/gmp/gmp_6.2.0.bb
@@ -12,6 +12,7 @@ SRC_URI = "https://gmplib.org/download/${BPN}/${BP}${REVISION}.tar.bz2 \
12 file://use-includedir.patch \ 12 file://use-includedir.patch \
13 file://0001-Append-the-user-provided-flags-to-the-auto-detected-.patch \ 13 file://0001-Append-the-user-provided-flags-to-the-auto-detected-.patch \
14 file://0001-confiure.ac-Believe-the-cflags-from-environment.patch \ 14 file://0001-confiure.ac-Believe-the-cflags-from-environment.patch \
15 file://cve-2021-43618.patch \
15 " 16 "
16SRC_URI[md5sum] = "c24161e0dd44cae78cd5f67193492a21" 17SRC_URI[md5sum] = "c24161e0dd44cae78cd5f67193492a21"
17SRC_URI[sha256sum] = "f51c99cb114deb21a60075ffb494c1a210eb9d7cb729ed042ddb7de9534451ea" 18SRC_URI[sha256sum] = "f51c99cb114deb21a60075ffb494c1a210eb9d7cb729ed042ddb7de9534451ea"
diff --git a/meta/recipes-support/gnome-desktop-testing/gnome-desktop-testing_2018.1.bb b/meta/recipes-support/gnome-desktop-testing/gnome-desktop-testing_2018.1.bb
index 0defebeb15..19f32e8d1f 100644
--- a/meta/recipes-support/gnome-desktop-testing/gnome-desktop-testing_2018.1.bb
+++ b/meta/recipes-support/gnome-desktop-testing/gnome-desktop-testing_2018.1.bb
@@ -1,11 +1,15 @@
1SUMMARY = "Test runner for GNOME-style installed tests" 1SUMMARY = "Test runner for GNOME-style installed tests"
2DESCRIPTION = "Runner provides an execution harness for GNOME installed tests. \
3These tests are useful for verifying the functionality of software as \
4installed and packaged, and complement rather than replace build-time \
5('make check') tests."
2HOMEPAGE = "https://wiki.gnome.org/GnomeGoals/InstalledTests" 6HOMEPAGE = "https://wiki.gnome.org/GnomeGoals/InstalledTests"
3LICENSE = "LGPLv2+" 7LICENSE = "LGPLv2+"
4 8
5LIC_FILES_CHKSUM = "file://COPYING;md5=3bf50002aefd002f49e7bb854063f7e7 \ 9LIC_FILES_CHKSUM = "file://COPYING;md5=3bf50002aefd002f49e7bb854063f7e7 \
6 file://src/gnome-desktop-testing-runner.c;beginline=1;endline=20;md5=7ef3ad9da2ffcf7707dc11151fe007f4" 10 file://src/gnome-desktop-testing-runner.c;beginline=1;endline=20;md5=7ef3ad9da2ffcf7707dc11151fe007f4"
7 11
8SRC_URI = "git://gitlab.gnome.org/GNOME/gnome-desktop-testing.git;protocol=http" 12SRC_URI = "git://gitlab.gnome.org/GNOME/gnome-desktop-testing.git;protocol=http;branch=master"
9SRCREV = "4decade67b29ad170fcf3de148e41695fc459f48" 13SRCREV = "4decade67b29ad170fcf3de148e41695fc459f48"
10 14
11DEPENDS = "glib-2.0" 15DEPENDS = "glib-2.0"
diff --git a/meta/recipes-support/gnupg/gnupg/0001-configure.ac-use-a-custom-value-for-the-location-of-.patch b/meta/recipes-support/gnupg/gnupg/0001-configure.ac-use-a-custom-value-for-the-location-of-.patch
index 2c204e0245..a0af2d48dc 100644
--- a/meta/recipes-support/gnupg/gnupg/0001-configure.ac-use-a-custom-value-for-the-location-of-.patch
+++ b/meta/recipes-support/gnupg/gnupg/0001-configure.ac-use-a-custom-value-for-the-location-of-.patch
@@ -1,4 +1,4 @@
1From e7ad11cf54475e455fdb84d118e4782961698567 Mon Sep 17 00:00:00 2001 1From abc5c396aaddaef2e6811362e3e0cc0da28c2b34 Mon Sep 17 00:00:00 2001
2From: Alexander Kanavin <alex.kanavin@gmail.com> 2From: Alexander Kanavin <alex.kanavin@gmail.com>
3Date: Mon, 22 Jan 2018 18:00:21 +0200 3Date: Mon, 22 Jan 2018 18:00:21 +0200
4Subject: [PATCH] configure.ac: use a custom value for the location of 4Subject: [PATCH] configure.ac: use a custom value for the location of
@@ -14,10 +14,10 @@ Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
14 1 file changed, 1 insertion(+), 1 deletion(-) 14 1 file changed, 1 insertion(+), 1 deletion(-)
15 15
16diff --git a/configure.ac b/configure.ac 16diff --git a/configure.ac b/configure.ac
17index 919ab31..cd58fdb 100644 17index 64cb8c6..3fe9027 100644
18--- a/configure.ac 18--- a/configure.ac
19+++ b/configure.ac 19+++ b/configure.ac
20@@ -1855,7 +1855,7 @@ AC_DEFINE_UNQUOTED(GPGCONF_DISP_NAME, "GPGConf", 20@@ -1824,7 +1824,7 @@ AC_DEFINE_UNQUOTED(GPGCONF_DISP_NAME, "GPGConf",
21 21
22 AC_DEFINE_UNQUOTED(GPGTAR_NAME, "gpgtar", [The name of the gpgtar tool]) 22 AC_DEFINE_UNQUOTED(GPGTAR_NAME, "gpgtar", [The name of the gpgtar tool])
23 23
diff --git a/meta/recipes-support/gnupg/gnupg/0003-dirmngr-uses-libgpg-error.patch b/meta/recipes-support/gnupg/gnupg/0003-dirmngr-uses-libgpg-error.patch
index 3e798efd06..a13b4d5fb5 100644
--- a/meta/recipes-support/gnupg/gnupg/0003-dirmngr-uses-libgpg-error.patch
+++ b/meta/recipes-support/gnupg/gnupg/0003-dirmngr-uses-libgpg-error.patch
@@ -1,7 +1,7 @@
1From 9c3858ffda6246bf9e1e6aeeb920532a56b19408 Mon Sep 17 00:00:00 2001 1From 6c75656b68cb6e38b039ae532bd39437cd6daec5 Mon Sep 17 00:00:00 2001
2From: Saul Wold <sgw@linux.intel.com> 2From: Saul Wold <sgw@linux.intel.com>
3Date: Wed, 16 Aug 2017 11:18:01 +0800 3Date: Wed, 16 Aug 2017 11:18:01 +0800
4Subject: [PATCH 3/4] dirmngr uses libgpg error 4Subject: [PATCH] dirmngr uses libgpg error
5 5
6Upstream-Status: Pending 6Upstream-Status: Pending
7Signed-off-by: Saul Wold <sgw@linux.intel.com> 7Signed-off-by: Saul Wold <sgw@linux.intel.com>
@@ -9,24 +9,20 @@ Signed-off-by: Saul Wold <sgw@linux.intel.com>
9Rebase to 2.1.23 9Rebase to 2.1.23
10 10
11Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> 11Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
12
12--- 13---
13 dirmngr/Makefile.am | 3 ++- 14 dirmngr/Makefile.am | 1 +
14 1 file changed, 2 insertions(+), 1 deletion(-) 15 1 file changed, 1 insertion(+)
15 16
16diff --git a/dirmngr/Makefile.am b/dirmngr/Makefile.am 17diff --git a/dirmngr/Makefile.am b/dirmngr/Makefile.am
17index b404165..d3f916e 100644 18index 00d3c42..450d873 100644
18--- a/dirmngr/Makefile.am 19--- a/dirmngr/Makefile.am
19+++ b/dirmngr/Makefile.am 20+++ b/dirmngr/Makefile.am
20@@ -82,7 +82,8 @@ endif 21@@ -101,6 +101,7 @@ dirmngr_LDADD = $(libcommonpth) \
21 dirmngr_LDADD = $(libcommonpth) \
22 $(DNSLIBS) $(LIBASSUAN_LIBS) \ 22 $(DNSLIBS) $(LIBASSUAN_LIBS) \
23 $(LIBGCRYPT_LIBS) $(KSBA_LIBS) $(NPTH_LIBS) \ 23 $(LIBGCRYPT_LIBS) $(KSBA_LIBS) $(NPTH_LIBS) \
24- $(NTBTLS_LIBS) $(LIBGNUTLS_LIBS) $(LIBINTL) $(LIBICONV) 24 $(NTBTLS_LIBS) $(LIBGNUTLS_LIBS) $(LIBINTL) $(LIBICONV) $(NETLIBS) \
25+ $(NTBTLS_LIBS) $(LIBGNUTLS_LIBS) $(LIBINTL) $(LIBICONV) \ 25+ $(GPG_ERROR_LIBS) \
26+ $(GPG_ERROR_LIBS) 26 $(dirmngr_robj)
27 if USE_LDAP 27 if USE_LDAP
28 dirmngr_LDADD += $(ldaplibs) 28 dirmngr_LDADD += $(ldaplibs)
29 endif
30--
311.8.3.1
32
diff --git a/meta/recipes-support/gnupg/gnupg/CVE-2022-34903.patch b/meta/recipes-support/gnupg/gnupg/CVE-2022-34903.patch
new file mode 100644
index 0000000000..5992949d35
--- /dev/null
+++ b/meta/recipes-support/gnupg/gnupg/CVE-2022-34903.patch
@@ -0,0 +1,44 @@
1From 2f05fc96b1332caf97176841b1152da3f0aa16a8 Mon Sep 17 00:00:00 2001
2From: Hitendra Prajapati <hprajapati@mvista.com>
3Date: Fri, 22 Jul 2022 17:52:36 +0530
4Subject: [PATCH] CVE-2022-34903
5
6Upstream-Status: Backport [https://git.gnupg.org/cgi-bin/gitweb.cgi?p=gnupg.git;a=commit;h=34c649b3601383cd11dbc76221747ec16fd68e1b]
7CVE: CVE-2022-34903
8Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
9---
10 g10/cpr.c | 13 ++++---------
11 1 file changed, 4 insertions(+), 9 deletions(-)
12
13diff --git a/g10/cpr.c b/g10/cpr.c
14index d502e8b..bc4b715 100644
15--- a/g10/cpr.c
16+++ b/g10/cpr.c
17@@ -328,20 +328,15 @@ write_status_text_and_buffer (int no, const char *string,
18 }
19 first = 0;
20 }
21- for (esc=0, s=buffer, n=len; n && !esc; s++, n--)
22+ for (esc=0, s=buffer, n=len; n; s++, n--)
23 {
24 if (*s == '%' || *(const byte*)s <= lower_limit
25 || *(const byte*)s == 127 )
26 esc = 1;
27 if (wrap && ++count > wrap)
28- {
29- dowrap=1;
30- break;
31- }
32- }
33- if (esc)
34- {
35- s--; n++;
36+ dowrap=1;
37+ if (esc || dowrap)
38+ break;
39 }
40 if (s != buffer)
41 es_fwrite (buffer, s-buffer, 1, statusfp);
42--
432.25.1
44
diff --git a/meta/recipes-support/gnupg/gnupg/relocate.patch b/meta/recipes-support/gnupg/gnupg/relocate.patch
index e5a82aa76d..7f7812cd46 100644
--- a/meta/recipes-support/gnupg/gnupg/relocate.patch
+++ b/meta/recipes-support/gnupg/gnupg/relocate.patch
@@ -1,4 +1,4 @@
1From 59c077f32e81190955910cae02599c7a3edfa7fb Mon Sep 17 00:00:00 2001 1From bd66af2ac7bb6d9294ac8055a55462ba7c4f9c9b Mon Sep 17 00:00:00 2001
2From: Ross Burton <ross.burton@intel.com> 2From: Ross Burton <ross.burton@intel.com>
3Date: Wed, 19 Sep 2018 14:44:40 +0100 3Date: Wed, 19 Sep 2018 14:44:40 +0100
4Subject: [PATCH] Allow the environment to override where gnupg looks for its 4Subject: [PATCH] Allow the environment to override where gnupg looks for its
@@ -12,10 +12,10 @@ Signed-off-by: Ross Burton <ross.burton@intel.com>
12 1 file changed, 8 insertions(+), 8 deletions(-) 12 1 file changed, 8 insertions(+), 8 deletions(-)
13 13
14diff --git a/common/homedir.c b/common/homedir.c 14diff --git a/common/homedir.c b/common/homedir.c
15index e9e75d0..19140aa 100644 15index 4b6e46e..58989b4 100644
16--- a/common/homedir.c 16--- a/common/homedir.c
17+++ b/common/homedir.c 17+++ b/common/homedir.c
18@@ -760,7 +760,7 @@ gnupg_socketdir (void) 18@@ -763,7 +763,7 @@ gnupg_socketdir (void)
19 if (!name) 19 if (!name)
20 { 20 {
21 unsigned int dummy; 21 unsigned int dummy;
@@ -24,7 +24,7 @@ index e9e75d0..19140aa 100644
24 } 24 }
25 25
26 return name; 26 return name;
27@@ -786,7 +786,7 @@ gnupg_sysconfdir (void) 27@@ -789,7 +789,7 @@ gnupg_sysconfdir (void)
28 } 28 }
29 return name; 29 return name;
30 #else /*!HAVE_W32_SYSTEM*/ 30 #else /*!HAVE_W32_SYSTEM*/
@@ -33,7 +33,7 @@ index e9e75d0..19140aa 100644
33 #endif /*!HAVE_W32_SYSTEM*/ 33 #endif /*!HAVE_W32_SYSTEM*/
34 } 34 }
35 35
36@@ -815,7 +815,7 @@ gnupg_bindir (void) 36@@ -818,7 +818,7 @@ gnupg_bindir (void)
37 else 37 else
38 return rdir; 38 return rdir;
39 #else /*!HAVE_W32_SYSTEM*/ 39 #else /*!HAVE_W32_SYSTEM*/
@@ -42,7 +42,7 @@ index e9e75d0..19140aa 100644
42 #endif /*!HAVE_W32_SYSTEM*/ 42 #endif /*!HAVE_W32_SYSTEM*/
43 } 43 }
44 44
45@@ -828,7 +828,7 @@ gnupg_libexecdir (void) 45@@ -831,7 +831,7 @@ gnupg_libexecdir (void)
46 #ifdef HAVE_W32_SYSTEM 46 #ifdef HAVE_W32_SYSTEM
47 return gnupg_bindir (); 47 return gnupg_bindir ();
48 #else /*!HAVE_W32_SYSTEM*/ 48 #else /*!HAVE_W32_SYSTEM*/
@@ -51,7 +51,7 @@ index e9e75d0..19140aa 100644
51 #endif /*!HAVE_W32_SYSTEM*/ 51 #endif /*!HAVE_W32_SYSTEM*/
52 } 52 }
53 53
54@@ -842,7 +842,7 @@ gnupg_libdir (void) 54@@ -845,7 +845,7 @@ gnupg_libdir (void)
55 name = xstrconcat (w32_rootdir (), DIRSEP_S "lib" DIRSEP_S "gnupg", NULL); 55 name = xstrconcat (w32_rootdir (), DIRSEP_S "lib" DIRSEP_S "gnupg", NULL);
56 return name; 56 return name;
57 #else /*!HAVE_W32_SYSTEM*/ 57 #else /*!HAVE_W32_SYSTEM*/
@@ -60,7 +60,7 @@ index e9e75d0..19140aa 100644
60 #endif /*!HAVE_W32_SYSTEM*/ 60 #endif /*!HAVE_W32_SYSTEM*/
61 } 61 }
62 62
63@@ -856,7 +856,7 @@ gnupg_datadir (void) 63@@ -859,7 +859,7 @@ gnupg_datadir (void)
64 name = xstrconcat (w32_rootdir (), DIRSEP_S "share" DIRSEP_S "gnupg", NULL); 64 name = xstrconcat (w32_rootdir (), DIRSEP_S "share" DIRSEP_S "gnupg", NULL);
65 return name; 65 return name;
66 #else /*!HAVE_W32_SYSTEM*/ 66 #else /*!HAVE_W32_SYSTEM*/
@@ -69,7 +69,7 @@ index e9e75d0..19140aa 100644
69 #endif /*!HAVE_W32_SYSTEM*/ 69 #endif /*!HAVE_W32_SYSTEM*/
70 } 70 }
71 71
72@@ -872,7 +872,7 @@ gnupg_localedir (void) 72@@ -875,7 +875,7 @@ gnupg_localedir (void)
73 NULL); 73 NULL);
74 return name; 74 return name;
75 #else /*!HAVE_W32_SYSTEM*/ 75 #else /*!HAVE_W32_SYSTEM*/
@@ -78,7 +78,7 @@ index e9e75d0..19140aa 100644
78 #endif /*!HAVE_W32_SYSTEM*/ 78 #endif /*!HAVE_W32_SYSTEM*/
79 } 79 }
80 80
81@@ -940,7 +940,7 @@ gnupg_cachedir (void) 81@@ -943,7 +943,7 @@ gnupg_cachedir (void)
82 } 82 }
83 return dir; 83 return dir;
84 #else /*!HAVE_W32_SYSTEM*/ 84 #else /*!HAVE_W32_SYSTEM*/
diff --git a/meta/recipes-support/gnupg/gnupg_2.2.20.bb b/meta/recipes-support/gnupg/gnupg_2.2.27.bb
index f754573c88..bd09b02017 100644
--- a/meta/recipes-support/gnupg/gnupg_2.2.20.bb
+++ b/meta/recipes-support/gnupg/gnupg_2.2.27.bb
@@ -1,4 +1,9 @@
1SUMMARY = "GNU Privacy Guard - encryption and signing tools (2.x)" 1SUMMARY = "GNU Privacy Guard - encryption and signing tools (2.x)"
2DESCRIPTION = "A complete and free implementation of the OpenPGP standard \
3as defined by RFC4880 (also known as PGP). GnuPG allows you to encrypt \
4and sign your data and communications; it features a versatile key \
5management system, along with access modules for all kinds of public \
6key directories."
2HOMEPAGE = "http://www.gnupg.org/" 7HOMEPAGE = "http://www.gnupg.org/"
3LICENSE = "GPLv3 & LGPLv3" 8LICENSE = "GPLv3 & LGPLv3"
4LIC_FILES_CHKSUM = "file://COPYING;md5=189af8afca6d6075ba6c9e0aa8077626 \ 9LIC_FILES_CHKSUM = "file://COPYING;md5=189af8afca6d6075ba6c9e0aa8077626 \
@@ -15,19 +20,20 @@ SRC_URI = "${GNUPG_MIRROR}/${BPN}/${BPN}-${PV}.tar.bz2 \
15 file://0003-dirmngr-uses-libgpg-error.patch \ 20 file://0003-dirmngr-uses-libgpg-error.patch \
16 file://0004-autogen.sh-fix-find-version-for-beta-checking.patch \ 21 file://0004-autogen.sh-fix-find-version-for-beta-checking.patch \
17 file://0001-Woverride-init-is-not-needed-with-gcc-9.patch \ 22 file://0001-Woverride-init-is-not-needed-with-gcc-9.patch \
23 file://CVE-2022-34903.patch \
18 " 24 "
19SRC_URI_append_class-native = " file://0001-configure.ac-use-a-custom-value-for-the-location-of-.patch \ 25SRC_URI_append_class-native = " file://0001-configure.ac-use-a-custom-value-for-the-location-of-.patch \
20 file://relocate.patch" 26 file://relocate.patch"
21SRC_URI_append_class-nativesdk = " file://relocate.patch" 27SRC_URI_append_class-nativesdk = " file://relocate.patch"
22 28
23SRC_URI[md5sum] = "4ff88920cf52b35db0dedaee87bdbbb1" 29SRC_URI[sha256sum] = "34e60009014ea16402069136e0a5f63d9b65f90096244975db5cea74b3d02399"
24SRC_URI[sha256sum] = "04a7c9d48b74c399168ee8270e548588ddbe52218c337703d7f06373d326ca30"
25 30
26EXTRA_OECONF = "--disable-ldap \ 31EXTRA_OECONF = "--disable-ldap \
27 --disable-ccid-driver \ 32 --disable-ccid-driver \
28 --with-zlib=${STAGING_LIBDIR}/.. \ 33 --with-zlib=${STAGING_LIBDIR}/.. \
29 --with-bzip2=${STAGING_LIBDIR}/.. \ 34 --with-bzip2=${STAGING_LIBDIR}/.. \
30 --with-readline=${STAGING_LIBDIR}/.. \ 35 --with-readline=${STAGING_LIBDIR}/.. \
36 --with-mailprog=${sbindir}/sendmail \
31 --enable-gpg-is-gpg2 \ 37 --enable-gpg-is-gpg2 \
32 " 38 "
33 39
diff --git a/meta/recipes-support/gnutls/gnutls/CVE-2021-20231.patch b/meta/recipes-support/gnutls/gnutls/CVE-2021-20231.patch
new file mode 100644
index 0000000000..6fe7a21e33
--- /dev/null
+++ b/meta/recipes-support/gnutls/gnutls/CVE-2021-20231.patch
@@ -0,0 +1,67 @@
1From 15beb4b193b2714d88107e7dffca781798684e7e Mon Sep 17 00:00:00 2001
2From: Daiki Ueno <ueno@gnu.org>
3Date: Fri, 29 Jan 2021 14:06:32 +0100
4Subject: [PATCH] key_share: avoid use-after-free around realloc
5
6Signed-off-by: Daiki Ueno <ueno@gnu.org>
7
8https://gitlab.com/gnutls/gnutls/-/commit/15beb4b193b2714d88107e7dffca781798684e7e
9Upstream-Status: Backport
10CVE: CVE-2021-CVE-2021-20231
11Signed-off-by: Chee Yang Lee <chee.yang.lee@intel.com>
12---
13 lib/ext/key_share.c | 12 +++++-------
14 1 file changed, 5 insertions(+), 7 deletions(-)
15
16diff --git a/lib/ext/key_share.c b/lib/ext/key_share.c
17index ab8abf8fe6..a8c4bb5cff 100644
18--- a/lib/ext/key_share.c
19+++ b/lib/ext/key_share.c
20@@ -664,14 +664,14 @@ key_share_send_params(gnutls_session_t session,
21 {
22 unsigned i;
23 int ret;
24- unsigned char *lengthp;
25- unsigned int cur_length;
26 unsigned int generated = 0;
27 const gnutls_group_entry_st *group;
28 const version_entry_st *ver;
29
30 /* this extension is only being sent on client side */
31 if (session->security_parameters.entity == GNUTLS_CLIENT) {
32+ unsigned int length_pos;
33+
34 ver = _gnutls_version_max(session);
35 if (unlikely(ver == NULL || ver->key_shares == 0))
36 return 0;
37@@ -679,16 +679,13 @@ key_share_send_params(gnutls_session_t session,
38 if (!have_creds_for_tls13(session))
39 return 0;
40
41- /* write the total length later */
42- lengthp = &extdata->data[extdata->length];
43+ length_pos = extdata->length;
44
45 ret =
46 _gnutls_buffer_append_prefix(extdata, 16, 0);
47 if (ret < 0)
48 return gnutls_assert_val(ret);
49
50- cur_length = extdata->length;
51-
52 if (session->internals.hsk_flags & HSK_HRR_RECEIVED) { /* we know the group */
53 group = get_group(session);
54 if (unlikely(group == NULL))
55@@ -736,7 +733,8 @@ key_share_send_params(gnutls_session_t session,
56 }
57
58 /* copy actual length */
59- _gnutls_write_uint16(extdata->length - cur_length, lengthp);
60+ _gnutls_write_uint16(extdata->length - length_pos - 2,
61+ &extdata->data[length_pos]);
62
63 } else { /* server */
64 ver = get_version(session);
65--
66GitLab
67
diff --git a/meta/recipes-support/gnutls/gnutls/CVE-2021-20232.patch b/meta/recipes-support/gnutls/gnutls/CVE-2021-20232.patch
new file mode 100644
index 0000000000..e13917cddb
--- /dev/null
+++ b/meta/recipes-support/gnutls/gnutls/CVE-2021-20232.patch
@@ -0,0 +1,65 @@
1From 75a937d97f4fefc6f9b08e3791f151445f551cb3 Mon Sep 17 00:00:00 2001
2From: Daiki Ueno <ueno@gnu.org>
3Date: Fri, 29 Jan 2021 14:06:50 +0100
4Subject: [PATCH] pre_shared_key: avoid use-after-free around realloc
5
6Signed-off-by: Daiki Ueno <ueno@gnu.org>
7
8https://gitlab.com/gnutls/gnutls/-/commit/75a937d97f4fefc6f9b08e3791f151445f551cb3
9Upstream-Status: Backport
10CVE: CVE-2021-CVE-2021-20232
11Signed-off-by: Chee Yang Lee <chee.yang.lee@intel.com>
12---
13 lib/ext/pre_shared_key.c | 15 ++++++++++++---
14 1 file changed, 12 insertions(+), 3 deletions(-)
15
16diff --git a/lib/ext/pre_shared_key.c b/lib/ext/pre_shared_key.c
17index a042c6488e..380bf39ed5 100644
18--- a/lib/ext/pre_shared_key.c
19+++ b/lib/ext/pre_shared_key.c
20@@ -267,7 +267,7 @@ client_send_params(gnutls_session_t session,
21 size_t spos;
22 gnutls_datum_t username = {NULL, 0};
23 gnutls_datum_t user_key = {NULL, 0}, rkey = {NULL, 0};
24- gnutls_datum_t client_hello;
25+ unsigned client_hello_len;
26 unsigned next_idx;
27 const mac_entry_st *prf_res = NULL;
28 const mac_entry_st *prf_psk = NULL;
29@@ -428,8 +428,7 @@ client_send_params(gnutls_session_t session,
30 assert(extdata->length >= sizeof(mbuffer_st));
31 assert(ext_offset >= (ssize_t)sizeof(mbuffer_st));
32 ext_offset -= sizeof(mbuffer_st);
33- client_hello.data = extdata->data+sizeof(mbuffer_st);
34- client_hello.size = extdata->length-sizeof(mbuffer_st);
35+ client_hello_len = extdata->length-sizeof(mbuffer_st);
36
37 next_idx = 0;
38
39@@ -440,6 +439,11 @@ client_send_params(gnutls_session_t session,
40 }
41
42 if (prf_res && rkey.size > 0) {
43+ gnutls_datum_t client_hello;
44+
45+ client_hello.data = extdata->data+sizeof(mbuffer_st);
46+ client_hello.size = client_hello_len;
47+
48 ret = compute_psk_binder(session, prf_res,
49 binders_len, binders_pos,
50 ext_offset, &rkey, &client_hello, 1,
51@@ -474,6 +478,11 @@ client_send_params(gnutls_session_t session,
52 }
53
54 if (prf_psk && user_key.size > 0 && info) {
55+ gnutls_datum_t client_hello;
56+
57+ client_hello.data = extdata->data+sizeof(mbuffer_st);
58+ client_hello.size = client_hello_len;
59+
60 ret = compute_psk_binder(session, prf_psk,
61 binders_len, binders_pos,
62 ext_offset, &user_key, &client_hello, 0,
63--
64GitLab
65
diff --git a/meta/recipes-support/gnutls/gnutls/CVE-2021-4209.patch b/meta/recipes-support/gnutls/gnutls/CVE-2021-4209.patch
new file mode 100644
index 0000000000..0bcb55e573
--- /dev/null
+++ b/meta/recipes-support/gnutls/gnutls/CVE-2021-4209.patch
@@ -0,0 +1,37 @@
1From 3db352734472d851318944db13be73da61300568 Mon Sep 17 00:00:00 2001
2From: Daiki Ueno <ueno@gnu.org>
3Date: Wed, 22 Dec 2021 09:12:25 +0100
4Subject: [PATCH] wrap_nettle_hash_fast: avoid calling _update with zero-length
5 input
6
7As Nettle's hash update functions internally call memcpy, providing
8zero-length input may cause undefined behavior.
9
10Signed-off-by: Daiki Ueno <ueno@gnu.org>
11
12https://gitlab.com/gnutls/gnutls/-/commit/3db352734472d851318944db13be73da61300568
13Upstream-Status: Backport
14CVE: CVE-2021-4209
15Signed-off-by: Chee Yang Lee <chee.yang.lee@intel.com>
16---
17 lib/nettle/mac.c | 4 +++-
18 1 file changed, 3 insertions(+), 1 deletion(-)
19
20diff --git a/lib/nettle/mac.c b/lib/nettle/mac.c
21index f9d4d7a8df..35e070fab0 100644
22--- a/lib/nettle/mac.c
23+++ b/lib/nettle/mac.c
24@@ -788,7 +788,9 @@ static int wrap_nettle_hash_fast(gnutls_digest_algorithm_t algo,
25 if (ret < 0)
26 return gnutls_assert_val(ret);
27
28- ctx.update(&ctx, text_size, text);
29+ if (text_size > 0) {
30+ ctx.update(&ctx, text_size, text);
31+ }
32 ctx.digest(&ctx, ctx.length, digest);
33
34 return 0;
35--
36GitLab
37
diff --git a/meta/recipes-support/gnutls/gnutls/CVE-2022-2509.patch b/meta/recipes-support/gnutls/gnutls/CVE-2022-2509.patch
new file mode 100644
index 0000000000..f8954945d0
--- /dev/null
+++ b/meta/recipes-support/gnutls/gnutls/CVE-2022-2509.patch
@@ -0,0 +1,282 @@
1From 9835638d4e1f37781a47e777c76d5bb14218929b Mon Sep 17 00:00:00 2001
2From: Hitendra Prajapati <hprajapati@mvista.com>
3Date: Tue, 16 Aug 2022 12:23:14 +0530
4Subject: [PATCH] CVE-2022-2509
5
6Upstream-Status: Backport [https://gitlab.com/gnutls/gnutls/-/commit/ce37f9eb265dbe9b6d597f5767449e8ee95848e2]
7CVE: CVE-2022-2509
8Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
9---
10 NEWS | 4 +
11 lib/x509/pkcs7.c | 3 +-
12 tests/Makefile.am | 2 +-
13 tests/pkcs7-verify-double-free.c | 215 +++++++++++++++++++++++++++++++
14 4 files changed, 222 insertions(+), 2 deletions(-)
15 create mode 100644 tests/pkcs7-verify-double-free.c
16
17diff --git a/NEWS b/NEWS
18index 755a67c..ba70bb3 100644
19--- a/NEWS
20+++ b/NEWS
21@@ -7,6 +7,10 @@ See the end for copying conditions.
22
23 * Version 3.6.14 (released 2020-06-03)
24
25+** libgnutls: Fixed double free during verification of pkcs7 signatures.
26+ Reported by Jaak Ristioja (#1383). [GNUTLS-SA-2022-07-07, CVSS: medium]
27+ [CVE-2022-2509]
28+
29 ** libgnutls: Fixed insecure session ticket key construction, since 3.6.4.
30 The TLS server would not bind the session ticket encryption key with a
31 value supplied by the application until the initial key rotation, allowing
32diff --git a/lib/x509/pkcs7.c b/lib/x509/pkcs7.c
33index 98669e8..ccbc69d 100644
34--- a/lib/x509/pkcs7.c
35+++ b/lib/x509/pkcs7.c
36@@ -1318,7 +1318,8 @@ gnutls_x509_crt_t find_signer(gnutls_pkcs7_t pkcs7, gnutls_x509_trust_list_t tl,
37 issuer = find_verified_issuer_of(pkcs7, issuer, purpose, vflags);
38
39 if (issuer != NULL && gnutls_x509_crt_check_issuer(issuer, issuer)) {
40- if (prev) gnutls_x509_crt_deinit(prev);
41+ if (prev && prev != signer)
42+ gnutls_x509_crt_deinit(prev);
43 prev = issuer;
44 break;
45 }
46diff --git a/tests/Makefile.am b/tests/Makefile.am
47index 11a083c..cd43a0f 100644
48--- a/tests/Makefile.am
49+++ b/tests/Makefile.am
50@@ -219,7 +219,7 @@ ctests += mini-record-2 simple gnutls_hmac_fast set_pkcs12_cred cert certuniquei
51 tls-record-size-limit-asym dh-compute ecdh-compute sign-verify-data-newapi \
52 sign-verify-newapi sign-verify-deterministic iov aead-cipher-vec \
53 tls13-without-timeout-func buffer status-request-revoked \
54- set_x509_ocsp_multi_cli kdf-api keylog-func \
55+ set_x509_ocsp_multi_cli kdf-api keylog-func pkcs7-verify-double-free \
56 dtls_hello_random_value tls_hello_random_value x509cert-dntypes
57
58 if HAVE_SECCOMP_TESTS
59diff --git a/tests/pkcs7-verify-double-free.c b/tests/pkcs7-verify-double-free.c
60new file mode 100644
61index 0000000..fadf307
62--- /dev/null
63+++ b/tests/pkcs7-verify-double-free.c
64@@ -0,0 +1,215 @@
65+/*
66+ * Copyright (C) 2022 Red Hat, Inc.
67+ *
68+ * Author: Zoltan Fridrich
69+ *
70+ * This file is part of GnuTLS.
71+ *
72+ * GnuTLS is free software: you can redistribute it and/or modify it
73+ * under the terms of the GNU General Public License as published by
74+ * the Free Software Foundation, either version 3 of the License, or
75+ * (at your option) any later version.
76+ *
77+ * GnuTLS is distributed in the hope that it will be useful, but
78+ * WITHOUT ANY WARRANTY; without even the implied warranty of
79+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
80+ * General Public License for more details.
81+ *
82+ * You should have received a copy of the GNU General Public License
83+ * along with GnuTLS. If not, see <https://www.gnu.org/licenses/>.
84+ */
85+
86+#ifdef HAVE_CONFIG_H
87+#include <config.h>
88+#endif
89+
90+#include <stdio.h>
91+#include <gnutls/pkcs7.h>
92+#include <gnutls/x509.h>
93+
94+#include "utils.h"
95+
96+static char rca_pem[] =
97+ "-----BEGIN CERTIFICATE-----\n"
98+ "MIIDCjCCAfKgAwIBAgIBATANBgkqhkiG9w0BAQsFADAVMRMwEQYDVQQKDApFeGFt\n"
99+ "cGxlIENBMCAXDTE3MDcyMTE0NDMzNloYDzIyMjIwNzIxMTQ0MzM2WjAVMRMwEQYD\n"
100+ "VQQKDApFeGFtcGxlIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA\n"
101+ "v8hnKPJ/IA0SQB/A/a0Uh+npZ67vsgIMrtTQo0r0kJkmkBz5323xO3DVuJfB3QmX\n"
102+ "v9zvoeCQLuDvWar5Aixfxgm6s5Q+yPvJj9t3NebDrU+Y4+qyewBIJUF8EF/5iBPC\n"
103+ "ZHONmzbfIRWvQWGGgb2CRcOHp2J7AY/QLB6LsWPaLjs/DHva28Q13JaTTHIpdu8v\n"
104+ "t6vHr0nXf66DN4MvtoF3N+o+v3snJCMsfXOqASi4tbWR7gtOfCfiz9uBjh0W2Dut\n"
105+ "/jclBQkJkLe6esNSM+f4YiOpctVDjmfj8yoHCp394vt0wFqhG38wsTFAyVP6qIcf\n"
106+ "5zoSu9ovEt2cTkhnZHjiiwIDAQABo2MwYTAPBgNVHRMBAf8EBTADAQH/MA4GA1Ud\n"
107+ "DwEB/wQEAwIBBjAdBgNVHQ4EFgQUhjeO6Uc5imbjOl2I2ltVA27Hu9YwHwYDVR0j\n"
108+ "BBgwFoAUhjeO6Uc5imbjOl2I2ltVA27Hu9YwDQYJKoZIhvcNAQELBQADggEBAD+r\n"
109+ "i/7FsbG0OFKGF2+JOnth6NjJQcMfM8LiglqAuBUijrv7vltoZ0Z3FJH1Vi4OeMXn\n"
110+ "l7X/9tWUve0uFl75MfjDrf0+lCEdYRY1LCba2BrUgpbbkLywVUdnbsvndehegCgS\n"
111+ "jss2/zys3Hlo3ZaHlTMQ/NQ4nrxcxkjOvkZSEOqgxJTLpzm6pr7YUts4k6c6lNiB\n"
112+ "FSiJiDzsJCmWR9C3fBbUlfDfTJYGN3JwqX270KchXDElo8gNoDnF7jBMpLFFSEKm\n"
113+ "MyfbNLX/srh+CEfZaN/OZV4A3MQ0L8vQEp6M4CJhvRLIuMVabZ2coJ0AzystrOMU\n"
114+ "LirBWjg89RoAjFQ7bTE=\n"
115+ "-----END CERTIFICATE-----\n";
116+
117+static char ca_pem[] =
118+ "-----BEGIN CERTIFICATE-----\n"
119+ "MIIDFzCCAf+gAwIBAgIBAjANBgkqhkiG9w0BAQsFADAVMRMwEQYDVQQKDApFeGFt\n"
120+ "cGxlIENBMCAXDTE3MDcyMTE0NDQzNFoYDzIyMjIwNzIxMTQ0NDM0WjAiMSAwHgYD\n"
121+ "VQQKDBdFeGFtcGxlIGludGVybWVkaWF0ZSBDQTCCASIwDQYJKoZIhvcNAQEBBQAD\n"
122+ "ggEPADCCAQoCggEBAKb9ACB8u//sP6MfNU1OsVw68xz3eTPLgKxS0vpqexm6iGVg\n"
123+ "ug/o9uYRLzqiEukv/eyz9WzHmY7sqlOJjOFdv92+SaNg79Jc51WHPFXgea4/qyfr\n"
124+ "4y14PGs0SNxm6T44sXurUs7cXydQVUgnq2VCaWFOTUdxXoAWkV8r8GaUoPD/klVz\n"
125+ "RqxSZVETmX1XBKhsMnnov41kRwVph2C+VfUspsbaUZaz/o/S1/nokhXRACzKsMBr\n"
126+ "obqiGxbY35uVzsmbAW5ErhQz98AWJL3Bub1fsEMXg6OEMmPH4AtX888dTIYZNw0E\n"
127+ "bUIESspz1kjJQTtVQDHTprhwz16YiSVeUonlLgMCAwEAAaNjMGEwDwYDVR0TAQH/\n"
128+ "BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFPBjxDWjMhjXERirKF9O\n"
129+ "o/5Cllc5MB8GA1UdIwQYMBaAFIY3julHOYpm4zpdiNpbVQNux7vWMA0GCSqGSIb3\n"
130+ "DQEBCwUAA4IBAQCTm+vv3hBa6lL5IT+Fw8aTxQ2Ne7mZ5oyazhvXYwwfKNMX3SML\n"
131+ "W2JdPaL64ZwbxxxYvW401o5Z0CEgru3YFrsqB/hEdl0Uf8UWWJmE1rRa+miTmbjt\n"
132+ "lrLNCWdrs6CiwvsPITTHg7jevB4KyZYsTSxQFcyr3N3xF+6EmOTC4IkhPPnXYXcp\n"
133+ "248ih+WOavSYoRvzgB/Dip1WnPYU2mfIV3O8JReRryngA0TzWCLPLUoWR3R4jwtC\n"
134+ "+1uSLoqaenz3qv3F1WEbke37az9YJuXx/5D8CqFQiZ62TUUtI6fYd8mkMBM4Qfh6\n"
135+ "NW9XrCkI9wlpL5K9HllhuW0BhKeJkuPpyQ2p\n"
136+ "-----END CERTIFICATE-----\n";
137+
138+static char ee_pem[] =
139+ "-----BEGIN CERTIFICATE-----\n"
140+ "MIIDIjCCAgqgAwIBAgIBATANBgkqhkiG9w0BAQsFADAiMSAwHgYDVQQKDBdFeGFt\n"
141+ "cGxlIGludGVybWVkaWF0ZSBDQTAgFw0yMjA3MjExNDQ1MzdaGA8yMjIyMDcyMTE0\n"
142+ "NDUzN1owFTETMBEGA1UEAwwKSm9obiBTbWl0aDCCASIwDQYJKoZIhvcNAQEBBQAD\n"
143+ "ggEPADCCAQoCggEBAMb1uuxppBFY+WVD45iyHUq7DkIJNNOI/JRaybVJfPktWq2E\n"
144+ "eNe7XhV05KKnqZTbDO2iYqNHqGhZ8pz/IstDRTZP3z/q1vXTG0P9Gx28rEy5TaUY\n"
145+ "QjtD+ZoFUQm0ORMDBjd8jikqtJ87hKeuOPMH4rzdydotMaPQSm7KLzHBGBr6gg7z\n"
146+ "g1IxPWkhMyHapoMqqrhjwjzoTY97UIXpZTEoIA+KpEC8f9CciBtL0i1MPBjWozB6\n"
147+ "Jma9q5iEwZXuRr3cnPYeIPlK2drgDZCMuSFcYiT8ApLw5OhKqY1m2EvfZ2ox2s9R\n"
148+ "68/HzYdPi3kZwiNEtlBvMlpt5yKBJAflp76d7DkCAwEAAaNuMGwwCwYDVR0PBAQD\n"
149+ "AgWgMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAdBgNVHQ4EFgQUc+Mi\n"
150+ "kr8WMCk00SQo+P2iggp/oQkwHwYDVR0jBBgwFoAU8GPENaMyGNcRGKsoX06j/kKW\n"
151+ "VzkwDQYJKoZIhvcNAQELBQADggEBAKU9+CUR0Jcfybd1+8Aqgh1RH96yQygnVuyt\n"
152+ "Na9rFz4fM3ij9tGXDHXrkZw8bW1dWLU9quu8zeTxKxc3aiDIw739Alz0tukttDo7\n"
153+ "dW7YqIb77zsIsWB9p7G9dlxT6ieUy+5IKk69BbeK8KR0vAciAG4KVQxPhuPy/LGX\n"
154+ "PzqlJIJ4h61s3UOroReHPB1keLZgpORqrvtpClOmABH9TLFRJA/WFg8Q2XYB/p0x\n"
155+ "l/pWiaoBC+8wK9cDoMUK5yOwXeuCLffCb+UlAD0+z/qxJ2pisE8E9X8rRKRrWI+i\n"
156+ "G7LtJCEn86EQK8KuRlJxKgj8lClZhoULB0oL4jbblBuNow9WRmM=\n"
157+ "-----END CERTIFICATE-----\n";
158+
159+static char msg_pem[] =
160+ "-----BEGIN PKCS7-----\n"
161+ "MIIK2QYJKoZIhvcNAQcCoIIKyjCCCsYCAQExDTALBglghkgBZQMEAgEwCwYJKoZI\n"
162+ "hvcNAQcBoIIJTzCCAwowggHyoAMCAQICAQEwDQYJKoZIhvcNAQELBQAwFTETMBEG\n"
163+ "A1UECgwKRXhhbXBsZSBDQTAgFw0xNzA3MjExNDQzMjFaGA8yMjIyMDcyMTE0NDMy\n"
164+ "MVowFTETMBEGA1UECgwKRXhhbXBsZSBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEP\n"
165+ "ADCCAQoCggEBAL51eyE4j8wAKQKMGlO9HEY2iaGvsdPSJmidSdmCi1jnNK39Lx4Y\n"
166+ "31h279hSHF5wtI6VM91HHfeLf1mjEZHlKrXXJQzBPLpbHWapD778drHBitOP8e56\n"
167+ "fDMIfofLV4tkMk8690vPe4cJH1UHGspMyz6EQF9kPRaW80XtMV/6dalgL/9Esmaw\n"
168+ "XBNPJAS1VutDuXQkJ/3/rWFLmkpYHHtGPjX782YRmT1s+VOVTsLqmKx0TEL8A381\n"
169+ "bbElHPUAMjPcyWR5qqA8KWnS5Dwqk3LwI0AvuhQytCq0S7Xl4DXauvxwTRXv0UU7\n"
170+ "W8r3MLAw9DnlnJiD/RFjw5rbGO3wMePk/qUCAwEAAaNjMGEwDwYDVR0TAQH/BAUw\n"
171+ "AwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFIh2KRoKJoe2VtpOwWMkRAkR\n"
172+ "mLWKMB8GA1UdIwQYMBaAFIh2KRoKJoe2VtpOwWMkRAkRmLWKMA0GCSqGSIb3DQEB\n"
173+ "CwUAA4IBAQBovvlOjoy0MCT5U0eWfcPQQjY4Ssrn3IiPNlVkqSNo+FHX+2baTLVQ\n"
174+ "5QTHxwXwzdIJiwtjFWDdGEQXqmuIvnFG+u/whGbeg6oQygfnQ5Y+q6epOxCsPgLQ\n"
175+ "mKKEaF7mvh8DauUx4QSbYCNGCctOZuB1vlN9bJ3/5QbH+2pFPOfCr5CAyPDwHo6S\n"
176+ "qO3yPcutRwT9xS7gXEHM9HhLp+DmdCGh4eVBPiFilyZm1d92lWxU8oxoSfXgzDT/\n"
177+ "GCzlMykNZNs4JD9QmiRClP/3U0dQbOhah/Fda+N+L90xaqEgGcvwKKZa3pzo59pl\n"
178+ "BbkcIP4YPyHeinwkgAn5UVJg9DOxNCS0MIIDFzCCAf+gAwIBAgIBAjANBgkqhkiG\n"
179+ "9w0BAQsFADAVMRMwEQYDVQQKDApFeGFtcGxlIENBMCAXDTE3MDcyMTE0NDQxM1oY\n"
180+ "DzIyMjIwNzIxMTQ0NDEzWjAiMSAwHgYDVQQKDBdFeGFtcGxlIGludGVybWVkaWF0\n"
181+ "ZSBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMPFDEvDANwvhviu\n"
182+ "pwXTvaKyxyX94jVu1wgAhIRyQBVRiMbrn8MEufLG8oA0vKd8s92gv/lWe1jFb2rn\n"
183+ "91jMkZWsjWjiJFD6SzqFfBo+XxOGikEqO1MAf92UqavmSGlXVRG1Vy7T7dWibZP0\n"
184+ "WODhHYWayR0Y6owSz5IqNfrHXzDME+lSJxHgRFI7pK+b0OgiVmvyXDKFPvyU6GrP\n"
185+ "lxXDi/XbjyPvC5gpiwtTgm+s8KERwmdlfZUNjkh2PpHx1g1joijHT3wIvO/Pek1E\n"
186+ "C+Xs6w3XxGgL6TTL7FDuv4AjZVX9KK66/yBhX3aN8bkqAg+hs9XNk3zzWC0XEFOS\n"
187+ "Qoh2va0CAwEAAaNjMGEwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYw\n"
188+ "HQYDVR0OBBYEFHwi/7dUWGjkMWJctOm7MCjjQj1cMB8GA1UdIwQYMBaAFIh2KRoK\n"
189+ "Joe2VtpOwWMkRAkRmLWKMA0GCSqGSIb3DQEBCwUAA4IBAQCF6sHCBdYRwBwvfCve\n"
190+ "og9cPnmPqZrG4AtmSvtoSsMvgvKb/4z3/gG8oPtTBkeRcAHoMoEp/oA+B2ylwIAc\n"
191+ "S5U7jx+lYH/Pqih0X/OcOLbaMv8uzGSGQxk+L9LuuIT6E/THfRRIPEvkDkzC+/uk\n"
192+ "7vUbG17bSEWeF0o/6sjzAY2aH1jnbCDyu0UC78GXkc6bZ5QlH98uLMDMrOmqcZjS\n"
193+ "JFfvuRDQyKV5yBdBkYaobsIWSQDsgYxJzf/2y8c3r+HXqT+jhrXPWJ3btgMPxpu7\n"
194+ "E8KmoFgp9EM+48oYlXJ66rk08/KjaVmgN7R+Hm3e2+MFT2kme4fBKalLjcazTe3x\n"
195+ "0FisMIIDIjCCAgqgAwIBAgIBATANBgkqhkiG9w0BAQsFADAiMSAwHgYDVQQKDBdF\n"
196+ "eGFtcGxlIGludGVybWVkaWF0ZSBDQTAgFw0yMjA3MjExNDQ1MzBaGA8yMjIyMDcy\n"
197+ "MTE0NDUzMVowFTETMBEGA1UEAwwKSm9obiBTbWl0aDCCASIwDQYJKoZIhvcNAQEB\n"
198+ "BQADggEPADCCAQoCggEBAMjhSqhdD5RjmOm6W3hG7zkgKBP9whRN/SipcdEMlkgc\n"
199+ "F/U3QMu66qIfKwheNdWalC1JLtruLDWP92ysa6Vw+CCG8aSax1AgB//RKQB7kgPA\n"
200+ "9js9hi/oCdBmCv2HJxhWSLz+MVoxgzW4C7S9FenI+btxe/99Uw4nOw7kwjsYDLKr\n"
201+ "tMw8myv7aCW/63CuBYGtohiZupM3RI3kKFcZots+KRPLlZpjv+I2h9xSln8VxKNb\n"
202+ "XiMrYwGfHB7iX7ghe1TvFjKatEUhsqa7AvIq7nfe/cyq97f0ODQO814njgZtk5iQ\n"
203+ "JVavXHdhTVaypt1HdAFMuHX5UATylHxx9tRCgSIijUsCAwEAAaNuMGwwCwYDVR0P\n"
204+ "BAQDAgWgMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAdBgNVHQ4EFgQU\n"
205+ "31+vHl4E/2Jpnwinbzf+d7usshcwHwYDVR0jBBgwFoAUfCL/t1RYaOQxYly06bsw\n"
206+ "KONCPVwwDQYJKoZIhvcNAQELBQADggEBAAWe63DcNwmleQ3INFGDJZ/m2I/R/cBa\n"
207+ "nnrxgR5Ey1ljHdA/x1z1JLTGmGVwqGExs5DNG9Q//Pmc9pZ1yPa8J4Xf8AvFcmkY\n"
208+ "mWoH1HvW0xu/RF1UN5SAoD2PRQ+Vq4OSPD58IlEu/u4o1wZV7Wl91Cv6VNpiAb63\n"
209+ "j9PA1YacOpOtcRqG59Vuj9HFm9f30ejHVo2+KJcpo290cR3Zg4fOm8mtjeMdt/QS\n"
210+ "Atq+RqPAQ7yxqvEEv8zPIZj2kAOQm3mh/yYqBrR68lQUD/dBTP7ApIZkhUK3XK6U\n"
211+ "nf9JvoF6Fn2+Cnqb//FLBgHSnoeqeQNwDLUXTsD02iYxHzJrhokSY4YxggFQMIIB\n"
212+ "TAIBATAnMCIxIDAeBgNVBAoMF0V4YW1wbGUgaW50ZXJtZWRpYXRlIENBAgEBMAsG\n"
213+ "CWCGSAFlAwQCATANBgkqhkiG9w0BAQEFAASCAQATHg6wNsBcs/Ub1GQfKwTpKCk5\n"
214+ "8QXuNnZ0u7b6mKgrSY2Gf47fpL2aRgaR+BAQncbctu5EH/IL38pWjaGtOhFAj/5q\n"
215+ "7luVQW11kuyJN3Bd/dtLqawWOwMmAIEigw6X50l5ZHnEVzFfxt+RKTNhk4XWVtbi\n"
216+ "2iIlITOplW0rnvxYAwCxKL9ocaB7etK8au7ixMxbFp75Ts4iLX8dhlAFdCuFCk8k\n"
217+ "B8mi9HHuwr3QYRqMPW61hu1wBL3yB8eoZNOwPXb0gkIh6ZvgptxgQzm/cc+Iw9fP\n"
218+ "QkR0fTM7ElJ5QZmSV98AUbZDHmDvpmcjcUxfSPMc3IoT8T300usRu7QHqKJi\n"
219+ "-----END PKCS7-----\n";
220+
221+const gnutls_datum_t rca_datum = { (void *)rca_pem, sizeof(rca_pem) - 1 };
222+const gnutls_datum_t ca_datum = { (void *)ca_pem, sizeof(ca_pem) - 1 };
223+const gnutls_datum_t ee_datum = { (void *)ee_pem, sizeof(ee_pem) - 1 };
224+const gnutls_datum_t msg_datum = { (void *)msg_pem, sizeof(msg_pem) - 1 };
225+
226+static void tls_log_func(int level, const char *str)
227+{
228+ fprintf(stderr, "%s |<%d>| %s", "err", level, str);
229+}
230+
231+#define CHECK(X)\
232+{\
233+ r = X;\
234+ if (r < 0)\
235+ fail("error in %d: %s\n", __LINE__, gnutls_strerror(r));\
236+}\
237+
238+void doit(void)
239+{
240+ int r;
241+ gnutls_x509_crt_t rca_cert = NULL;
242+ gnutls_x509_crt_t ca_cert = NULL;
243+ gnutls_x509_crt_t ee_cert = NULL;
244+ gnutls_x509_trust_list_t tlist = NULL;
245+ gnutls_pkcs7_t pkcs7 = NULL;
246+ gnutls_datum_t data = { (unsigned char *)"xxx", 3 };
247+
248+ if (debug) {
249+ gnutls_global_set_log_function(tls_log_func);
250+ gnutls_global_set_log_level(4711);
251+ }
252+
253+ // Import certificates
254+ CHECK(gnutls_x509_crt_init(&rca_cert));
255+ CHECK(gnutls_x509_crt_import(rca_cert, &rca_datum, GNUTLS_X509_FMT_PEM));
256+ CHECK(gnutls_x509_crt_init(&ca_cert));
257+ CHECK(gnutls_x509_crt_import(ca_cert, &ca_datum, GNUTLS_X509_FMT_PEM));
258+ CHECK(gnutls_x509_crt_init(&ee_cert));
259+ CHECK(gnutls_x509_crt_import(ee_cert, &ee_datum, GNUTLS_X509_FMT_PEM));
260+
261+ // Setup trust store
262+ CHECK(gnutls_x509_trust_list_init(&tlist, 0));
263+ CHECK(gnutls_x509_trust_list_add_named_crt(tlist, rca_cert, "rca", 3, 0));
264+ CHECK(gnutls_x509_trust_list_add_named_crt(tlist, ca_cert, "ca", 2, 0));
265+ CHECK(gnutls_x509_trust_list_add_named_crt(tlist, ee_cert, "ee", 2, 0));
266+
267+ // Setup pkcs7 structure
268+ CHECK(gnutls_pkcs7_init(&pkcs7));
269+ CHECK(gnutls_pkcs7_import(pkcs7, &msg_datum, GNUTLS_X509_FMT_PEM));
270+
271+ // Signature verification
272+ gnutls_pkcs7_verify(pkcs7, tlist, NULL, 0, 0, &data, 0);
273+
274+ gnutls_x509_crt_deinit(rca_cert);
275+ gnutls_x509_crt_deinit(ca_cert);
276+ gnutls_x509_crt_deinit(ee_cert);
277+ gnutls_x509_trust_list_deinit(tlist, 0);
278+ gnutls_pkcs7_deinit(pkcs7);
279+}
280--
2812.25.1
282
diff --git a/meta/recipes-support/gnutls/gnutls/CVE-2023-0361.patch b/meta/recipes-support/gnutls/gnutls/CVE-2023-0361.patch
new file mode 100644
index 0000000000..943f4ca704
--- /dev/null
+++ b/meta/recipes-support/gnutls/gnutls/CVE-2023-0361.patch
@@ -0,0 +1,85 @@
1From 80a6ce8ddb02477cd724cd5b2944791aaddb702a Mon Sep 17 00:00:00 2001
2From: Alexander Sosedkin <asosedkin@redhat.com>
3Date: Tue, 9 Aug 2022 16:05:53 +0200
4Subject: [PATCH] auth/rsa: side-step potential side-channel
5
6Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
7Signed-off-by: Hubert Kario <hkario@redhat.com>
8Tested-by: Hubert Kario <hkario@redhat.com>
9Upstream-Status: Backport [https://gitlab.com/gnutls/gnutls/-/commit/80a6ce8ddb02477cd724cd5b2944791aaddb702a
10 https://gitlab.com/gnutls/gnutls/-/commit/4b7ff428291c7ed77c6d2635577c83a43bbae558]
11CVE: CVE-2023-0361
12Signed-off-by: Vivek Kumbhar <vkumbhar@mvista.com>
13---
14 lib/auth/rsa.c | 30 +++---------------------------
15 1 file changed, 3 insertions(+), 27 deletions(-)
16
17diff --git a/lib/auth/rsa.c b/lib/auth/rsa.c
18index 8108ee8..858701f 100644
19--- a/lib/auth/rsa.c
20+++ b/lib/auth/rsa.c
21@@ -155,13 +155,10 @@ static int
22 proc_rsa_client_kx(gnutls_session_t session, uint8_t * data,
23 size_t _data_size)
24 {
25- const char attack_error[] = "auth_rsa: Possible PKCS #1 attack\n";
26 gnutls_datum_t ciphertext;
27 int ret, dsize;
28 ssize_t data_size = _data_size;
29 volatile uint8_t ver_maj, ver_min;
30- volatile uint8_t check_ver_min;
31- volatile uint32_t ok;
32
33 #ifdef ENABLE_SSL3
34 if (get_num_version(session) == GNUTLS_SSL3) {
35@@ -187,7 +184,6 @@ proc_rsa_client_kx(gnutls_session_t session, uint8_t * data,
36
37 ver_maj = _gnutls_get_adv_version_major(session);
38 ver_min = _gnutls_get_adv_version_minor(session);
39- check_ver_min = (session->internals.allow_wrong_pms == 0);
40
41 session->key.key.data = gnutls_malloc(GNUTLS_MASTER_SIZE);
42 if (session->key.key.data == NULL) {
43@@ -206,10 +202,9 @@ proc_rsa_client_kx(gnutls_session_t session, uint8_t * data,
44 return ret;
45 }
46
47- ret =
48- gnutls_privkey_decrypt_data2(session->internals.selected_key,
49- 0, &ciphertext, session->key.key.data,
50- session->key.key.size);
51+ gnutls_privkey_decrypt_data2(session->internals.selected_key,
52+ 0, &ciphertext, session->key.key.data,
53+ session->key.key.size);
54 /* After this point, any conditional on failure that cause differences
55 * in execution may create a timing or cache access pattern side
56 * channel that can be used as an oracle, so treat very carefully */
57@@ -225,25 +220,6 @@ proc_rsa_client_kx(gnutls_session_t session, uint8_t * data,
58 * Vlastimil Klima, Ondej Pokorny and Tomas Rosa.
59 */
60
61- /* ok is 0 in case of error and 1 in case of success. */
62-
63- /* if ret < 0 */
64- ok = CONSTCHECK_EQUAL(ret, 0);
65- /* session->key.key.data[0] must equal ver_maj */
66- ok &= CONSTCHECK_EQUAL(session->key.key.data[0], ver_maj);
67- /* if check_ver_min then session->key.key.data[1] must equal ver_min */
68- ok &= CONSTCHECK_NOT_EQUAL(check_ver_min, 0) &
69- CONSTCHECK_EQUAL(session->key.key.data[1], ver_min);
70-
71- if (ok) {
72- /* call logging function unconditionally so all branches are
73- * indistinguishable for timing and cache access when debug
74- * logging is disabled */
75- _gnutls_no_log("%s", attack_error);
76- } else {
77- _gnutls_debug_log("%s", attack_error);
78- }
79-
80 /* This is here to avoid the version check attack
81 * discussed above.
82 */
83--
842.25.1
85
diff --git a/meta/recipes-support/gnutls/gnutls/CVE-2023-5981.patch b/meta/recipes-support/gnutls/gnutls/CVE-2023-5981.patch
new file mode 100644
index 0000000000..c518cfa0ac
--- /dev/null
+++ b/meta/recipes-support/gnutls/gnutls/CVE-2023-5981.patch
@@ -0,0 +1,206 @@
1Backport of:
2
3From 29d6298d0b04cfff970b993915db71ba3f580b6d Mon Sep 17 00:00:00 2001
4From: Daiki Ueno <ueno@gnu.org>
5Date: Mon, 23 Oct 2023 09:26:57 +0900
6Subject: [PATCH] auth/rsa_psk: side-step potential side-channel
7
8This removes branching that depends on secret data, porting changes
9for regular RSA key exchange from
104804febddc2ed958e5ae774de2a8f85edeeff538 and
1180a6ce8ddb02477cd724cd5b2944791aaddb702a. This also removes the
12allow_wrong_pms as it was used sorely to control debug output
13depending on the branching.
14
15Signed-off-by: Daiki Ueno <ueno@gnu.org>
16
17Upstream-Status: Backport [https://launchpad.net/ubuntu/+archive/primary/+sourcefiles/gnutls28/3.6.13-2ubuntu1.9/gnutls28_3.6.13-2ubuntu1.9.debian.tar.xz
18Upstream-Commit: https://gitlab.com/gnutls/gnutls/-/commit/29d6298d0b04cfff970b993915db71ba3f580b6d]
19CVE: CVE-2023-5981
20Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
21---
22 lib/auth/rsa.c | 2 +-
23 lib/auth/rsa_psk.c | 90 ++++++++++++++++++----------------------------
24 lib/gnutls_int.h | 4 ---
25 lib/priority.c | 1 -
26 4 files changed, 35 insertions(+), 62 deletions(-)
27
28--- a/lib/auth/rsa.c
29+++ b/lib/auth/rsa.c
30@@ -207,7 +207,7 @@ proc_rsa_client_kx(gnutls_session_t sess
31 session->key.key.size);
32 /* After this point, any conditional on failure that cause differences
33 * in execution may create a timing or cache access pattern side
34- * channel that can be used as an oracle, so treat very carefully */
35+ * channel that can be used as an oracle, so tread carefully */
36
37 /* Error handling logic:
38 * In case decryption fails then don't inform the peer. Just use the
39--- a/lib/auth/rsa_psk.c
40+++ b/lib/auth/rsa_psk.c
41@@ -264,14 +264,13 @@ _gnutls_proc_rsa_psk_client_kx(gnutls_se
42 {
43 gnutls_datum_t username;
44 psk_auth_info_t info;
45- gnutls_datum_t plaintext;
46 gnutls_datum_t ciphertext;
47 gnutls_datum_t pwd_psk = { NULL, 0 };
48 int ret, dsize;
49- int randomize_key = 0;
50 ssize_t data_size = _data_size;
51 gnutls_psk_server_credentials_t cred;
52 gnutls_datum_t premaster_secret = { NULL, 0 };
53+ volatile uint8_t ver_maj, ver_min;
54
55 cred = (gnutls_psk_server_credentials_t)
56 _gnutls_get_cred(session, GNUTLS_CRD_PSK);
57@@ -327,71 +326,47 @@ _gnutls_proc_rsa_psk_client_kx(gnutls_se
58 }
59 ciphertext.size = dsize;
60
61- ret =
62- gnutls_privkey_decrypt_data(session->internals.selected_key, 0,
63- &ciphertext, &plaintext);
64- if (ret < 0 || plaintext.size != GNUTLS_MASTER_SIZE) {
65- /* In case decryption fails then don't inform
66- * the peer. Just use a random key. (in order to avoid
67- * attack against pkcs-1 formatting).
68- */
69- gnutls_assert();
70- _gnutls_debug_log
71- ("auth_rsa_psk: Possible PKCS #1 format attack\n");
72- if (ret >= 0) {
73- gnutls_free(plaintext.data);
74- }
75- randomize_key = 1;
76- } else {
77- /* If the secret was properly formatted, then
78- * check the version number.
79- */
80- if (_gnutls_get_adv_version_major(session) !=
81- plaintext.data[0]
82- || (session->internals.allow_wrong_pms == 0
83- && _gnutls_get_adv_version_minor(session) !=
84- plaintext.data[1])) {
85- /* No error is returned here, if the version number check
86- * fails. We proceed normally.
87- * That is to defend against the attack described in the paper
88- * "Attacking RSA-based sessions in SSL/TLS" by Vlastimil Klima,
89- * Ondej Pokorny and Tomas Rosa.
90- */
91- gnutls_assert();
92- _gnutls_debug_log
93- ("auth_rsa: Possible PKCS #1 version check format attack\n");
94- }
95- }
96+ ver_maj = _gnutls_get_adv_version_major(session);
97+ ver_min = _gnutls_get_adv_version_minor(session);
98
99+ premaster_secret.data = gnutls_malloc(GNUTLS_MASTER_SIZE);
100+ if (premaster_secret.data == NULL) {
101+ gnutls_assert();
102+ return GNUTLS_E_MEMORY_ERROR;
103+ }
104+ premaster_secret.size = GNUTLS_MASTER_SIZE;
105
106- if (randomize_key != 0) {
107- premaster_secret.size = GNUTLS_MASTER_SIZE;
108- premaster_secret.data =
109- gnutls_malloc(premaster_secret.size);
110- if (premaster_secret.data == NULL) {
111- gnutls_assert();
112- return GNUTLS_E_MEMORY_ERROR;
113- }
114-
115- /* we do not need strong random numbers here.
116- */
117- ret = gnutls_rnd(GNUTLS_RND_NONCE, premaster_secret.data,
118- premaster_secret.size);
119- if (ret < 0) {
120- gnutls_assert();
121- goto cleanup;
122- }
123- } else {
124- premaster_secret.data = plaintext.data;
125- premaster_secret.size = plaintext.size;
126+ /* Fallback value when decryption fails. Needs to be unpredictable. */
127+ ret = gnutls_rnd(GNUTLS_RND_NONCE, premaster_secret.data,
128+ premaster_secret.size);
129+ if (ret < 0) {
130+ gnutls_assert();
131+ goto cleanup;
132 }
133
134+ gnutls_privkey_decrypt_data2(session->internals.selected_key, 0,
135+ &ciphertext, premaster_secret.data,
136+ premaster_secret.size);
137+ /* After this point, any conditional on failure that cause differences
138+ * in execution may create a timing or cache access pattern side
139+ * channel that can be used as an oracle, so tread carefully */
140+
141+ /* Error handling logic:
142+ * In case decryption fails then don't inform the peer. Just use the
143+ * random key previously generated. (in order to avoid attack against
144+ * pkcs-1 formatting).
145+ *
146+ * If we get version mismatches no error is returned either. We
147+ * proceed normally. This is to defend against the attack described
148+ * in the paper "Attacking RSA-based sessions in SSL/TLS" by
149+ * Vlastimil Klima, Ondej Pokorny and Tomas Rosa.
150+ */
151+
152 /* This is here to avoid the version check attack
153 * discussed above.
154 */
155-
156- premaster_secret.data[0] = _gnutls_get_adv_version_major(session);
157- premaster_secret.data[1] = _gnutls_get_adv_version_minor(session);
158+ premaster_secret.data[0] = ver_maj;
159+ premaster_secret.data[1] = ver_min;
160
161 /* find the key of this username
162 */
163--- a/lib/gnutls_int.h
164+++ b/lib/gnutls_int.h
165@@ -989,7 +989,6 @@ struct gnutls_priority_st {
166 bool _no_etm;
167 bool _no_ext_master_secret;
168 bool _allow_key_usage_violation;
169- bool _allow_wrong_pms;
170 bool _dumbfw;
171 unsigned int _dh_prime_bits; /* old (deprecated) variable */
172
173@@ -1007,7 +1006,6 @@ struct gnutls_priority_st {
174 (x)->no_etm = 1; \
175 (x)->no_ext_master_secret = 1; \
176 (x)->allow_key_usage_violation = 1; \
177- (x)->allow_wrong_pms = 1; \
178 (x)->dumbfw = 1
179
180 #define ENABLE_PRIO_COMPAT(x) \
181@@ -1016,7 +1014,6 @@ struct gnutls_priority_st {
182 (x)->_no_etm = 1; \
183 (x)->_no_ext_master_secret = 1; \
184 (x)->_allow_key_usage_violation = 1; \
185- (x)->_allow_wrong_pms = 1; \
186 (x)->_dumbfw = 1
187
188 /* DH and RSA parameters types.
189@@ -1141,7 +1138,6 @@ typedef struct {
190 bool no_etm;
191 bool no_ext_master_secret;
192 bool allow_key_usage_violation;
193- bool allow_wrong_pms;
194 bool dumbfw;
195
196 /* old (deprecated) variable. This is used for both srp_prime_bits
197--- a/lib/priority.c
198+++ b/lib/priority.c
199@@ -681,7 +681,6 @@ gnutls_priority_set(gnutls_session_t ses
200 COPY_TO_INTERNALS(no_etm);
201 COPY_TO_INTERNALS(no_ext_master_secret);
202 COPY_TO_INTERNALS(allow_key_usage_violation);
203- COPY_TO_INTERNALS(allow_wrong_pms);
204 COPY_TO_INTERNALS(dumbfw);
205 COPY_TO_INTERNALS(dh_prime_bits);
206
diff --git a/meta/recipes-support/gnutls/gnutls/CVE-2024-0553.patch b/meta/recipes-support/gnutls/gnutls/CVE-2024-0553.patch
new file mode 100644
index 0000000000..f15c470879
--- /dev/null
+++ b/meta/recipes-support/gnutls/gnutls/CVE-2024-0553.patch
@@ -0,0 +1,125 @@
1From 40dbbd8de499668590e8af51a15799fbc430595e Mon Sep 17 00:00:00 2001
2From: Daiki Ueno <ueno@gnu.org>
3Date: Wed, 10 Jan 2024 19:13:17 +0900
4Subject: [PATCH] rsa-psk: minimize branching after decryption
5
6This moves any non-trivial code between gnutls_privkey_decrypt_data2
7and the function return in _gnutls_proc_rsa_psk_client_kx up until the
8decryption. This also avoids an extra memcpy to session->key.key.
9
10Signed-off-by: Daiki Ueno <ueno@gnu.org>
11
12Upstream-Status: Backport [https://gitlab.com/gnutls/gnutls/-/commit/40dbbd8de499668590e8af51a15799fbc430595e]
13CVE: CVE-2024-0553
14Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
15---
16 lib/auth/rsa_psk.c | 68 ++++++++++++++++++++++++----------------------
17 1 file changed, 35 insertions(+), 33 deletions(-)
18
19diff --git a/lib/auth/rsa_psk.c b/lib/auth/rsa_psk.c
20index 93c2dc9..c6cfb92 100644
21--- a/lib/auth/rsa_psk.c
22+++ b/lib/auth/rsa_psk.c
23@@ -269,7 +269,6 @@ _gnutls_proc_rsa_psk_client_kx(gnutls_session_t session, uint8_t * data,
24 int ret, dsize;
25 ssize_t data_size = _data_size;
26 gnutls_psk_server_credentials_t cred;
27- gnutls_datum_t premaster_secret = { NULL, 0 };
28 volatile uint8_t ver_maj, ver_min;
29
30 cred = (gnutls_psk_server_credentials_t)
31@@ -329,24 +328,48 @@ _gnutls_proc_rsa_psk_client_kx(gnutls_session_t session, uint8_t * data,
32 ver_maj = _gnutls_get_adv_version_major(session);
33 ver_min = _gnutls_get_adv_version_minor(session);
34
35- premaster_secret.data = gnutls_malloc(GNUTLS_MASTER_SIZE);
36- if (premaster_secret.data == NULL) {
37+ /* Find the key of this username. A random value will be
38+ * filled in if the key is not found.
39+ */
40+ ret = _gnutls_psk_pwd_find_entry(session, info->username,
41+ strlen(info->username), &pwd_psk);
42+ if (ret < 0)
43+ return gnutls_assert_val(ret);
44+
45+ /* Allocate memory for premaster secret, and fill in the
46+ * fields except the decryption result.
47+ */
48+ session->key.key.size = 2 + GNUTLS_MASTER_SIZE + 2 + pwd_psk.size;
49+ session->key.key.data = gnutls_malloc(session->key.key.size);
50+ if (session->key.key.data == NULL) {
51 gnutls_assert();
52+ _gnutls_free_key_datum(&pwd_psk);
53+ /* No need to zeroize, as the secret is not copied in yet */
54+ _gnutls_free_datum(&session->key.key);
55 return GNUTLS_E_MEMORY_ERROR;
56 }
57- premaster_secret.size = GNUTLS_MASTER_SIZE;
58
59 /* Fallback value when decryption fails. Needs to be unpredictable. */
60- ret = gnutls_rnd(GNUTLS_RND_NONCE, premaster_secret.data,
61- premaster_secret.size);
62+ ret = gnutls_rnd(GNUTLS_RND_NONCE, session->key.key.data + 2,
63+ GNUTLS_MASTER_SIZE);
64 if (ret < 0) {
65 gnutls_assert();
66- goto cleanup;
67+ _gnutls_free_key_datum(&pwd_psk);
68+ /* No need to zeroize, as the secret is not copied in yet */
69+ _gnutls_free_datum(&session->key.key);
70+ return ret;
71 }
72
73+ _gnutls_write_uint16(GNUTLS_MASTER_SIZE, session->key.key.data);
74+ _gnutls_write_uint16(pwd_psk.size,
75+ &session->key.key.data[2 + GNUTLS_MASTER_SIZE]);
76+ memcpy(&session->key.key.data[2 + GNUTLS_MASTER_SIZE + 2], pwd_psk.data,
77+ pwd_psk.size);
78+ _gnutls_free_key_datum(&pwd_psk);
79+
80 gnutls_privkey_decrypt_data2(session->internals.selected_key, 0,
81- &ciphertext, premaster_secret.data,
82- premaster_secret.size);
83+ &ciphertext, session->key.key.data + 2,
84+ GNUTLS_MASTER_SIZE);
85 /* After this point, any conditional on failure that cause differences
86 * in execution may create a timing or cache access pattern side
87 * channel that can be used as an oracle, so tread carefully */
88@@ -365,31 +388,10 @@ _gnutls_proc_rsa_psk_client_kx(gnutls_session_t session, uint8_t * data,
89 /* This is here to avoid the version check attack
90 * discussed above.
91 */
92- premaster_secret.data[0] = ver_maj;
93- premaster_secret.data[1] = ver_min;
94+ session->key.key.data[2] = ver_maj;
95+ session->key.key.data[3] = ver_min;
96
97- /* find the key of this username
98- */
99- ret =
100- _gnutls_psk_pwd_find_entry(session, info->username, strlen(info->username), &pwd_psk);
101- if (ret < 0) {
102- gnutls_assert();
103- goto cleanup;
104- }
105-
106- ret =
107- set_rsa_psk_session_key(session, &pwd_psk, &premaster_secret);
108- if (ret < 0) {
109- gnutls_assert();
110- goto cleanup;
111- }
112-
113- ret = 0;
114- cleanup:
115- _gnutls_free_key_datum(&pwd_psk);
116- _gnutls_free_temp_key_datum(&premaster_secret);
117-
118- return ret;
119+ return 0;
120 }
121
122 static int
123--
1242.25.1
125
diff --git a/meta/recipes-support/gnutls/gnutls_3.6.14.bb b/meta/recipes-support/gnutls/gnutls_3.6.14.bb
index 51578b4b3b..a1451daf2c 100644
--- a/meta/recipes-support/gnutls/gnutls_3.6.14.bb
+++ b/meta/recipes-support/gnutls/gnutls_3.6.14.bb
@@ -1,5 +1,7 @@
1SUMMARY = "GNU Transport Layer Security Library" 1SUMMARY = "GNU Transport Layer Security Library"
2HOMEPAGE = "http://www.gnu.org/software/gnutls/" 2DESCRIPTION = "a secure communications library implementing the SSL, \
3TLS and DTLS protocols and technologies around them."
4HOMEPAGE = "https://gnutls.org/"
3BUGTRACKER = "https://savannah.gnu.org/support/?group=gnutls" 5BUGTRACKER = "https://savannah.gnu.org/support/?group=gnutls"
4 6
5LICENSE = "GPLv3+ & LGPLv2.1+" 7LICENSE = "GPLv3+ & LGPLv2.1+"
@@ -21,6 +23,13 @@ SRC_URI = "https://www.gnupg.org/ftp/gcrypt/gnutls/v${SHRT_VER}/gnutls-${PV}.tar
21 file://arm_eabi.patch \ 23 file://arm_eabi.patch \
22 file://0001-Modied-the-license-to-GPLv2.1-to-keep-with-LICENSE-f.patch \ 24 file://0001-Modied-the-license-to-GPLv2.1-to-keep-with-LICENSE-f.patch \
23 file://CVE-2020-24659.patch \ 25 file://CVE-2020-24659.patch \
26 file://CVE-2021-20231.patch \
27 file://CVE-2021-20232.patch \
28 file://CVE-2022-2509.patch \
29 file://CVE-2021-4209.patch \
30 file://CVE-2023-0361.patch \
31 file://CVE-2023-5981.patch \
32 file://CVE-2024-0553.patch \
24" 33"
25 34
26SRC_URI[sha256sum] = "5630751adec7025b8ef955af4d141d00d252a985769f51b4059e5affa3d39d63" 35SRC_URI[sha256sum] = "5630751adec7025b8ef955af4d141d00d252a985769f51b4059e5affa3d39d63"
diff --git a/meta/recipes-support/gnutls/libtasn1/CVE-2021-46848.patch b/meta/recipes-support/gnutls/libtasn1/CVE-2021-46848.patch
new file mode 100644
index 0000000000..9a8ceecbe7
--- /dev/null
+++ b/meta/recipes-support/gnutls/libtasn1/CVE-2021-46848.patch
@@ -0,0 +1,45 @@
1From 22fd12b290adea788122044cb58dc9e77754644f Mon Sep 17 00:00:00 2001
2From: Vivek Kumbhar <vkumbhar@mvista.com>
3Date: Thu, 17 Nov 2022 12:07:50 +0530
4Subject: [PATCH] CVE-2021-46848
5
6Upstream-Status: Backport [https://gitlab.com/gnutls/libtasn1/-/commit/44a700d2051a666235748970c2df047ff207aeb5]
7CVE: CVE-2021-46848
8Signed-off-by: Vivek Kumbhar <vkumbhar@mvista.com>
9
10Fix ETYPE_OK off by one array size check.
11---
12 NEWS | 4 ++++
13 lib/int.h | 2 +-
14 2 files changed, 5 insertions(+), 1 deletion(-)
15
16diff --git a/NEWS b/NEWS
17index f042481..d8f684e 100644
18--- a/NEWS
19+++ b/NEWS
20@@ -1,5 +1,9 @@
21 GNU Libtasn1 NEWS -*- outline -*-
22
23+* Noteworthy changes in release ?.? (????-??-??) [?]
24+- Fix ETYPE_OK out of bounds read. Closes: #32.
25+- Update gnulib files and various maintenance fixes.
26+
27 * Noteworthy changes in release 4.16.0 (released 2020-02-01) [stable]
28 - asn1_decode_simple_ber: added support for constructed definite
29 octet strings. This allows this function decode the whole set of
30diff --git a/lib/int.h b/lib/int.h
31index ea16257..c877282 100644
32--- a/lib/int.h
33+++ b/lib/int.h
34@@ -97,7 +97,7 @@ typedef struct tag_and_class_st
35 #define ETYPE_TAG(etype) (_asn1_tags[etype].tag)
36 #define ETYPE_CLASS(etype) (_asn1_tags[etype].class)
37 #define ETYPE_OK(etype) (((etype) != ASN1_ETYPE_INVALID && \
38- (etype) <= _asn1_tags_size && \
39+ (etype) < _asn1_tags_size && \
40 _asn1_tags[(etype)].desc != NULL)?1:0)
41
42 #define ETYPE_IS_STRING(etype) ((etype == ASN1_ETYPE_GENERALSTRING || \
43--
442.25.1
45
diff --git a/meta/recipes-support/gnutls/libtasn1_4.16.0.bb b/meta/recipes-support/gnutls/libtasn1_4.16.0.bb
index 8337b70241..d2b3c492ec 100644
--- a/meta/recipes-support/gnutls/libtasn1_4.16.0.bb
+++ b/meta/recipes-support/gnutls/libtasn1_4.16.0.bb
@@ -1,4 +1,6 @@
1SUMMARY = "Library for ASN.1 and DER manipulation" 1SUMMARY = "Library for ASN.1 and DER manipulation"
2DESCRIPTION = "A highly portable C library that encodes and decodes \
3DER/BER data following an ASN.1 schema. "
2HOMEPAGE = "http://www.gnu.org/software/libtasn1/" 4HOMEPAGE = "http://www.gnu.org/software/libtasn1/"
3 5
4LICENSE = "GPLv3+ & LGPLv2.1+" 6LICENSE = "GPLv3+ & LGPLv2.1+"
@@ -10,6 +12,7 @@ LIC_FILES_CHKSUM = "file://doc/COPYING;md5=d32239bcb673463ab874e80d47fae504 \
10 12
11SRC_URI = "${GNU_MIRROR}/libtasn1/libtasn1-${PV}.tar.gz \ 13SRC_URI = "${GNU_MIRROR}/libtasn1/libtasn1-${PV}.tar.gz \
12 file://dont-depend-on-help2man.patch \ 14 file://dont-depend-on-help2man.patch \
15 file://CVE-2021-46848.patch \
13 " 16 "
14 17
15DEPENDS = "bison-native" 18DEPENDS = "bison-native"
diff --git a/meta/recipes-support/gpgme/gpgme/0001-use-closefrom-on-linux-and-glibc-2.34.patch b/meta/recipes-support/gpgme/gpgme/0001-use-closefrom-on-linux-and-glibc-2.34.patch
new file mode 100644
index 0000000000..1c46684c6d
--- /dev/null
+++ b/meta/recipes-support/gpgme/gpgme/0001-use-closefrom-on-linux-and-glibc-2.34.patch
@@ -0,0 +1,24 @@
1From adb1d4e5498a19e9d591ac8f42f9ddfdb23a1354 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Thu, 15 Jul 2021 12:33:13 -0700
4Subject: [PATCH] use closefrom() on linux and glibc 2.34+
5
6Upstream-Status: Pending
7Signed-off-by: Khem Raj <raj.khem@gmail.com>
8---
9 src/posix-io.c | 2 +-
10 1 file changed, 1 insertion(+), 1 deletion(-)
11
12diff --git a/src/posix-io.c b/src/posix-io.c
13index e712ef2..ab8ded9 100644
14--- a/src/posix-io.c
15+++ b/src/posix-io.c
16@@ -570,7 +570,7 @@ _gpgme_io_spawn (const char *path, char *const argv[], unsigned int flags,
17 if (fd_list[i].fd > fd)
18 fd = fd_list[i].fd;
19 fd++;
20-#if defined(__sun) || defined(__FreeBSD__)
21+#if defined(__sun) || defined(__FreeBSD__) || (defined(__GLIBC__) && __GNUC_PREREQ(2, 34))
22 closefrom (fd);
23 max_fds = fd;
24 #else /*!__sun */
diff --git a/meta/recipes-support/gpgme/gpgme_1.13.1.bb b/meta/recipes-support/gpgme/gpgme_1.13.1.bb
index 6e945d3165..dacc9896e4 100644
--- a/meta/recipes-support/gpgme/gpgme_1.13.1.bb
+++ b/meta/recipes-support/gpgme/gpgme_1.13.1.bb
@@ -20,7 +20,8 @@ SRC_URI = "${GNUPG_MIRROR}/gpgme/${BP}.tar.bz2 \
20 file://0006-fix-build-path-issue.patch \ 20 file://0006-fix-build-path-issue.patch \
21 file://0007-python-Add-variables-to-tests.patch \ 21 file://0007-python-Add-variables-to-tests.patch \
22 file://0008-do-not-auto-check-var-PYTHON.patch \ 22 file://0008-do-not-auto-check-var-PYTHON.patch \
23 " 23 file://0001-use-closefrom-on-linux-and-glibc-2.34.patch \
24 "
24 25
25SRC_URI[md5sum] = "198f0a908ec3cd8f0ce9a4f3a4489645" 26SRC_URI[md5sum] = "198f0a908ec3cd8f0ce9a4f3a4489645"
26SRC_URI[sha256sum] = "c4e30b227682374c23cddc7fdb9324a99694d907e79242a25a4deeedb393be46" 27SRC_URI[sha256sum] = "c4e30b227682374c23cddc7fdb9324a99694d907e79242a25a4deeedb393be46"
diff --git a/meta/recipes-support/iso-codes/iso-codes_4.4.bb b/meta/recipes-support/iso-codes/iso-codes_4.4.bb
index 4767dea84c..e8210eca9b 100644
--- a/meta/recipes-support/iso-codes/iso-codes_4.4.bb
+++ b/meta/recipes-support/iso-codes/iso-codes_4.4.bb
@@ -1,11 +1,14 @@
1SUMMARY = "ISO language, territory, currency, script codes and their translations" 1SUMMARY = "ISO language, territory, currency, script codes and their translations"
2DESCRIPTION = "Provides lists of various ISO standards (e.g. country, \
3language, language scripts, and currency names) in one place, rather \
4than repeated in many programs throughout the system."
2HOMEPAGE = "https://salsa.debian.org/iso-codes-team/iso-codes" 5HOMEPAGE = "https://salsa.debian.org/iso-codes-team/iso-codes"
3BUGTRACKER = "https://salsa.debian.org/iso-codes-team/iso-codes/issues" 6BUGTRACKER = "https://salsa.debian.org/iso-codes-team/iso-codes/issues"
4 7
5LICENSE = "LGPLv2.1" 8LICENSE = "LGPLv2.1"
6LIC_FILES_CHKSUM = "file://COPYING;md5=4fbd65380cdd255951079008b364516c" 9LIC_FILES_CHKSUM = "file://COPYING;md5=4fbd65380cdd255951079008b364516c"
7 10
8SRC_URI = "git://salsa.debian.org/iso-codes-team/iso-codes.git;protocol=http;branch=main;" 11SRC_URI = "git://salsa.debian.org/iso-codes-team/iso-codes.git;protocol=https;branch=main;"
9SRCREV = "38edb926592954b87eb527124da0ec68d2a748f3" 12SRCREV = "38edb926592954b87eb527124da0ec68d2a748f3"
10 13
11# inherit gettext cannot be used, because it adds gettext-native to BASEDEPENDS which 14# inherit gettext cannot be used, because it adds gettext-native to BASEDEPENDS which
diff --git a/meta/recipes-support/itstool/itstool_2.0.6.bb b/meta/recipes-support/itstool/itstool_2.0.6.bb
index 5f358f463d..54105af5f0 100644
--- a/meta/recipes-support/itstool/itstool_2.0.6.bb
+++ b/meta/recipes-support/itstool/itstool_2.0.6.bb
@@ -1,4 +1,8 @@
1SUMMARY = "ITS Tool allows you to translate your XML documents with PO files" 1SUMMARY = "ITS Tool allows you to translate your XML documents with PO files"
2DESCRIPTION = "It extracts messages from XML files and outputs PO template \
3files, then merges translations from MO files to create translated \
4XML files. It determines what to translate and how to chunk it into \
5messages using the W3C Internationalization Tag Set (ITS). "
2HOMEPAGE = "http://itstool.org/" 6HOMEPAGE = "http://itstool.org/"
3LICENSE = "GPLv3" 7LICENSE = "GPLv3"
4LIC_FILES_CHKSUM = "file://COPYING;md5=59c57b95fd7d0e9e238ebbc7ad47c5a5" 8LIC_FILES_CHKSUM = "file://COPYING;md5=59c57b95fd7d0e9e238ebbc7ad47c5a5"
diff --git a/meta/recipes-support/libassuan/libassuan_2.5.3.bb b/meta/recipes-support/libassuan/libassuan_2.5.3.bb
index 52b4c0f1b9..9ef5074120 100644
--- a/meta/recipes-support/libassuan/libassuan_2.5.3.bb
+++ b/meta/recipes-support/libassuan/libassuan_2.5.3.bb
@@ -1,4 +1,7 @@
1SUMMARY = "IPC library used by GnuPG and GPGME" 1SUMMARY = "IPC library used by GnuPG and GPGME"
2DESCRIPTION = "A small library implementing the so-called Assuan protocol. \
3This protocol is used for IPC between most newer GnuPG components. \
4Both, server and client side functions are provided. "
2HOMEPAGE = "http://www.gnupg.org/related_software/libassuan/" 5HOMEPAGE = "http://www.gnupg.org/related_software/libassuan/"
3BUGTRACKER = "https://bugs.g10code.com/gnupg/index" 6BUGTRACKER = "https://bugs.g10code.com/gnupg/index"
4 7
diff --git a/meta/recipes-support/libatomic-ops/libatomic-ops_7.6.10.bb b/meta/recipes-support/libatomic-ops/libatomic-ops_7.6.10.bb
index 7628eedb1b..3089d1f7ff 100644
--- a/meta/recipes-support/libatomic-ops/libatomic-ops_7.6.10.bb
+++ b/meta/recipes-support/libatomic-ops/libatomic-ops_7.6.10.bb
@@ -1,4 +1,5 @@
1SUMMARY = "A library for atomic integer operations" 1SUMMARY = "A library for atomic integer operations"
2DESCRIPTION = "Package provides semi-portable access to hardware-provided atomic memory update operations on a number of architectures."
2HOMEPAGE = "https://github.com/ivmai/libatomic_ops/" 3HOMEPAGE = "https://github.com/ivmai/libatomic_ops/"
3SECTION = "optional" 4SECTION = "optional"
4PROVIDES += "libatomics-ops" 5PROVIDES += "libatomics-ops"
diff --git a/meta/recipes-support/libbsd/libbsd_0.10.0.bb b/meta/recipes-support/libbsd/libbsd_0.10.0.bb
index 5b32b9af41..58925738cb 100644
--- a/meta/recipes-support/libbsd/libbsd_0.10.0.bb
+++ b/meta/recipes-support/libbsd/libbsd_0.10.0.bb
@@ -29,6 +29,12 @@ HOMEPAGE = "https://libbsd.freedesktop.org/wiki/"
29# License: public-domain-Colin-Plumb 29# License: public-domain-Colin-Plumb
30LICENSE = "BSD-3-Clause & BSD-4-Clause & ISC & PD" 30LICENSE = "BSD-3-Clause & BSD-4-Clause & ISC & PD"
31LICENSE_${PN} = "BSD-3-Clause & ISC & PD" 31LICENSE_${PN} = "BSD-3-Clause & ISC & PD"
32LICENSE:${PN}-dbg = "BSD-3-Clause & ISC & PD"
33LICENSE:${PN}-dev = "BSD-3-Clause & ISC & PD"
34LICENSE:${PN}-doc = "BSD-3-Clause & BSD-4-Clause & ISC & PD"
35LICENSE:${PN}-locale = "BSD-3-Clause & ISC & PD"
36LICENSE:${PN}-src = "BSD-3-Clause & ISC & PD"
37LICENSE:${PN}-staticdev = "BSD-3-Clause & ISC & PD"
32LIC_FILES_CHKSUM = "file://COPYING;md5=2120be0173469a06ed185b688e0e1ae0" 38LIC_FILES_CHKSUM = "file://COPYING;md5=2120be0173469a06ed185b688e0e1ae0"
33SECTION = "libs" 39SECTION = "libs"
34 40
diff --git a/meta/recipes-support/libcap/files/CVE-2023-2602.patch b/meta/recipes-support/libcap/files/CVE-2023-2602.patch
new file mode 100644
index 0000000000..ca04d7297a
--- /dev/null
+++ b/meta/recipes-support/libcap/files/CVE-2023-2602.patch
@@ -0,0 +1,52 @@
1Backport of:
2
3From bc6b36682f188020ee4770fae1d41bde5b2c97bb Mon Sep 17 00:00:00 2001
4From: "Andrew G. Morgan" <morgan@kernel.org>
5Date: Wed, 3 May 2023 19:18:36 -0700
6Subject: Correct the check of pthread_create()'s return value.
7
8This function returns a positive number (errno) on error, so the code
9wasn't previously freeing some memory in this situation.
10
11Discussion:
12
13 https://stackoverflow.com/a/3581020/14760867
14
15Credit for finding this bug in libpsx goes to David Gstir of
16X41 D-Sec GmbH (https://x41-dsec.de/) who performed a security
17audit of the libcap source code in April of 2023. The audit
18was sponsored by the Open Source Technology Improvement Fund
19(https://ostif.org/).
20
21Audit ref: LCAP-CR-23-01 (CVE-2023-2602)
22
23Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
24
25Upstream-Status: Backport [import from ubuntu https://git.launchpad.net/ubuntu/+source/libcap2/tree/debian/patches/CVE-2023-2602.patch?h=ubuntu/focal-security
26Upstream commit https://git.kernel.org/pub/scm/libs/libcap/libcap.git/commit/?id=bc6b36682f188020ee4770fae1d41bde5b2c97bb]
27CVE: CVE-2023-2602
28Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
29---
30 psx/psx.c | 2 +-
31 1 file changed, 1 insertion(+), 1 deletion(-)
32
33--- a/libcap/psx.c
34+++ b/libcap/psx.c
35@@ -272,7 +272,7 @@ int psx_pthread_create(pthread_t *thread
36
37 psx_wait_for_idle();
38 int ret = pthread_create(thread, attr, start_routine, arg);
39- if (ret != -1) {
40+ if (ret == 0) {
41 psx_do_registration(*thread);
42 }
43 psx_resume_idle();
44@@ -287,7 +287,7 @@ int __wrap_pthread_create(pthread_t *thr
45 void *(*start_routine) (void *), void *arg) {
46 psx_wait_for_idle();
47 int ret = __real_pthread_create(thread, attr, start_routine, arg);
48- if (ret != -1) {
49+ if (ret == 0) {
50 psx_do_registration(*thread);
51 }
52 psx_resume_idle();
diff --git a/meta/recipes-support/libcap/files/CVE-2023-2603.patch b/meta/recipes-support/libcap/files/CVE-2023-2603.patch
new file mode 100644
index 0000000000..cf86ac2a46
--- /dev/null
+++ b/meta/recipes-support/libcap/files/CVE-2023-2603.patch
@@ -0,0 +1,58 @@
1Backport of:
2
3From 422bec25ae4a1ab03fd4d6f728695ed279173b18 Mon Sep 17 00:00:00 2001
4From: "Andrew G. Morgan" <morgan@kernel.org>
5Date: Wed, 3 May 2023 19:44:22 -0700
6Subject: Large strings can confuse libcap's internal strdup code.
7
8Avoid something subtle with really long strings: 1073741823 should
9be enough for anybody. This is an improved fix over something attempted
10in libcap-2.55 to address some static analysis findings.
11
12Reviewing the library, cap_proc_root() and cap_launcher_set_chroot()
13are the only two calls where the library is potentially exposed to a
14user controlled string input.
15
16Credit for finding this bug in libcap goes to Richard Weinberger of
17X41 D-Sec GmbH (https://x41-dsec.de/) who performed a security audit
18of the libcap source code in April of 2023. The audit was sponsored
19by the Open Source Technology Improvement Fund (https://ostif.org/).
20
21Audit ref: LCAP-CR-23-02 (CVE-2023-2603)
22
23Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
24
25Upstream-Status: Backport [import from ubuntu https://git.launchpad.net/ubuntu/+source/libcap2/tree/debian/patches/CVE-2023-2603.patch?h=ubuntu/focal-security
26Upstream commit https://git.kernel.org/pub/scm/libs/libcap/libcap.git/commit/?id=422bec25ae4a1ab03fd4d6f728695ed279173b18]
27CVE: CVE-2023-2603
28Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
29---
30 libcap/cap_alloc.c | 12 +++++++-----
31 1 file changed, 7 insertions(+), 5 deletions(-)
32
33--- a/libcap/cap_alloc.c
34+++ b/libcap/cap_alloc.c
35@@ -76,13 +76,22 @@ cap_t cap_init(void)
36 char *_libcap_strdup(const char *old)
37 {
38 __u32 *raw_data;
39+ size_t len;
40
41 if (old == NULL) {
42 errno = EINVAL;
43 return NULL;
44 }
45
46- raw_data = malloc( sizeof(__u32) + strlen(old) + 1 );
47+ len = strlen(old);
48+ if ((len & 0x3fffffff) != len) {
49+ _cap_debug("len is too long for libcap to manage");
50+ errno = EINVAL;
51+ return NULL;
52+ }
53+ len += sizeof(__u32) + 1;
54+
55+ raw_data = malloc(len);
56 if (raw_data == NULL) {
57 errno = ENOMEM;
58 return NULL;
diff --git a/meta/recipes-support/libcap/libcap_2.32.bb b/meta/recipes-support/libcap/libcap_2.32.bb
index d78a58f7d2..64d5190aa7 100644
--- a/meta/recipes-support/libcap/libcap_2.32.bb
+++ b/meta/recipes-support/libcap/libcap_2.32.bb
@@ -1,8 +1,10 @@
1SUMMARY = "Library for getting/setting POSIX.1e capabilities" 1SUMMARY = "Library for getting/setting POSIX.1e capabilities"
2DESCRIPTION = "A library providing the API to access POSIX capabilities. \
3These allow giving various kinds of specific privileges to individual \
4users, without giving them full root permissions."
2HOMEPAGE = "http://sites.google.com/site/fullycapable/" 5HOMEPAGE = "http://sites.google.com/site/fullycapable/"
3
4# no specific GPL version required 6# no specific GPL version required
5LICENSE = "BSD | GPLv2" 7LICENSE = "BSD-3-Clause | GPLv2"
6LIC_FILES_CHKSUM = "file://License;md5=3f84fd6f29d453a56514cb7e4ead25f1" 8LIC_FILES_CHKSUM = "file://License;md5=3f84fd6f29d453a56514cb7e4ead25f1"
7 9
8DEPENDS = "hostperl-runtime-native gperf-native" 10DEPENDS = "hostperl-runtime-native gperf-native"
@@ -11,6 +13,8 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/libs/security/linux-privs/${BPN}2/${BPN}-${
11 file://0001-ensure-the-XATTR_NAME_CAPS-is-defined-when-it-is-use.patch \ 13 file://0001-ensure-the-XATTR_NAME_CAPS-is-defined-when-it-is-use.patch \
12 file://0002-tests-do-not-run-target-executables.patch \ 14 file://0002-tests-do-not-run-target-executables.patch \
13 file://0001-tests-do-not-statically-link-a-test.patch \ 15 file://0001-tests-do-not-statically-link-a-test.patch \
16 file://CVE-2023-2602.patch \
17 file://CVE-2023-2603.patch \
14 " 18 "
15SRC_URI[md5sum] = "7416119c9fdcfd0e8dd190a432c668e9" 19SRC_URI[md5sum] = "7416119c9fdcfd0e8dd190a432c668e9"
16SRC_URI[sha256sum] = "1005e3d227f2340ad1e3360ef8b69d15e3c72a29c09f4894d7aac038bd26e2be" 20SRC_URI[sha256sum] = "1005e3d227f2340ad1e3360ef8b69d15e3c72a29c09f4894d7aac038bd26e2be"
diff --git a/meta/recipes-support/libcheck/libcheck_0.14.0.bb b/meta/recipes-support/libcheck/libcheck_0.14.0.bb
index a88f009cdb..57963d83d4 100644
--- a/meta/recipes-support/libcheck/libcheck_0.14.0.bb
+++ b/meta/recipes-support/libcheck/libcheck_0.14.0.bb
@@ -1,4 +1,9 @@
1SUMMARY = "Check - unit testing framework for C code" 1SUMMARY = "Check - unit testing framework for C code"
2DESCRIPTION = "It features a simple interface for defining unit tests, \
3putting little in the way of the developer. Tests are run in a separate \
4address space, so both assertion failures and code errors that cause \
5segmentation faults or other signals can be caught. Test results are \
6reportable in the following: Subunit, TAP, XML, and a generic logging format."
2HOMEPAGE = "https://libcheck.github.io/check/" 7HOMEPAGE = "https://libcheck.github.io/check/"
3SECTION = "devel" 8SECTION = "devel"
4 9
diff --git a/meta/recipes-support/libcroco/libcroco_0.6.13.bb b/meta/recipes-support/libcroco/libcroco_0.6.13.bb
index a443ff23fe..66ee647ffa 100644
--- a/meta/recipes-support/libcroco/libcroco_0.6.13.bb
+++ b/meta/recipes-support/libcroco/libcroco_0.6.13.bb
@@ -1,4 +1,7 @@
1SUMMARY = "Cascading Style Sheet (CSS) parsing and manipulation toolkit" 1SUMMARY = "Cascading Style Sheet (CSS) parsing and manipulation toolkit"
2DESCRIPTION = "The Libcroco project is an effort to build a generic \
3Cascading Style Sheet (CSS) parsing and manipulation toolkit that can be \
4used by GNOME applications in need of CSS support."
2HOMEPAGE = "http://www.gnome.org/" 5HOMEPAGE = "http://www.gnome.org/"
3BUGTRACKER = "https://bugzilla.gnome.org/" 6BUGTRACKER = "https://bugzilla.gnome.org/"
4 7
diff --git a/meta/recipes-support/libdaemon/libdaemon_0.14.bb b/meta/recipes-support/libdaemon/libdaemon_0.14.bb
index 070ee1890e..85a30bcac3 100644
--- a/meta/recipes-support/libdaemon/libdaemon_0.14.bb
+++ b/meta/recipes-support/libdaemon/libdaemon_0.14.bb
@@ -1,4 +1,8 @@
1SUMMARY = "Lightweight C library which eases the writing of UNIX daemons" 1SUMMARY = "Lightweight C library which eases the writing of UNIX daemons"
2DESCRIPTION = "Lightweight daemon framework for OpenBSD. It provides \
3facilities for logging and a signal handler to enable graceful shutdown, \
4as well as file locking to ensure that only a single copy of a given daemon \
5is running at a time."
2SECTION = "libs" 6SECTION = "libs"
3AUTHOR = "Lennart Poettering <lennart@poettering.net>" 7AUTHOR = "Lennart Poettering <lennart@poettering.net>"
4HOMEPAGE = "http://0pointer.de/lennart/projects/libdaemon/" 8HOMEPAGE = "http://0pointer.de/lennart/projects/libdaemon/"
diff --git a/meta/recipes-support/libevdev/libevdev/determinism.patch b/meta/recipes-support/libevdev/libevdev/determinism.patch
index 33a6076b78..06128a8e7e 100644
--- a/meta/recipes-support/libevdev/libevdev/determinism.patch
+++ b/meta/recipes-support/libevdev/libevdev/determinism.patch
@@ -4,7 +4,8 @@ Sort to remove this inconsistency.
4RP 2020/2/7 4RP 2020/2/7
5 5
6Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> 6Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
7Upstream-Status: Pending 7Submitted: https://lists.freedesktop.org/archives/input-tools/2021-February/001560.html
8Upstream-Status: Backport [https://gitlab.freedesktop.org/libevdev/libevdev/-/commit/8d70f449892c6f7659e07bb0f06b8347677bb7d8]
8 9
9Index: a/libevdev/make-event-names.py 10Index: a/libevdev/make-event-names.py
10=================================================================== 11===================================================================
diff --git a/meta/recipes-support/libevdev/libevdev_1.8.0.bb b/meta/recipes-support/libevdev/libevdev_1.8.0.bb
index 3523dc0968..fd7dd15c26 100644
--- a/meta/recipes-support/libevdev/libevdev_1.8.0.bb
+++ b/meta/recipes-support/libevdev/libevdev_1.8.0.bb
@@ -1,4 +1,7 @@
1SUMMARY = "Wrapper library for evdev devices" 1SUMMARY = "Wrapper library for evdev devices"
2DESCRIPTION = "A library for handling evdev kernel devices. It abstracts \
3the evdev ioctls through type-safe interfaces and provides functions \
4to change the appearance of the device."
2HOMEPAGE = "http://www.freedesktop.org/wiki/Software/libevdev/" 5HOMEPAGE = "http://www.freedesktop.org/wiki/Software/libevdev/"
3SECTION = "libs" 6SECTION = "libs"
4 7
diff --git a/meta/recipes-support/libevent/libevent/0002-test-regress.h-Increase-default-timeval-tolerance-50.patch b/meta/recipes-support/libevent/libevent/0002-test-regress.h-Increase-default-timeval-tolerance-50.patch
new file mode 100644
index 0000000000..0b20eda3c0
--- /dev/null
+++ b/meta/recipes-support/libevent/libevent/0002-test-regress.h-Increase-default-timeval-tolerance-50.patch
@@ -0,0 +1,33 @@
1From dff8fd27edb23bc1486809186c6a4fe1f75f2179 Mon Sep 17 00:00:00 2001
2From: Yi Fan Yu <yifan.yu@windriver.com>
3Date: Thu, 22 Apr 2021 22:35:59 -0400
4Subject: [PATCH] test/regress.h: Increase default timeval tolerance 50 ms ->
5 100 ms
6
7The default timeout tolerance is 50 ms,
8which causes intermittent failure in many the
9related tests in arm64 QEMU.
10
11See: https://bugzilla.yoctoproject.org/show_bug.cgi?id=14163
12(The root cause seems to be a heavy load)
13
14Upstream-Status: Submitted [https://github.com/libevent/libevent/pull/1157]
15
16Signed-off-by: Yi Fan Yu <yifan.yu@windriver.com>
17---
18 test/regress.h | 2 +-
19 1 file changed, 1 insertion(+), 1 deletion(-)
20
21diff --git a/test/regress.h b/test/regress.h
22index f06a7669..829af4a7 100644
23--- a/test/regress.h
24+++ b/test/regress.h
25@@ -127,7 +127,7 @@ int test_ai_eq_(const struct evutil_addrinfo *ai, const char *sockaddr_port,
26 tt_int_op(labs(timeval_msec_diff((tv1), (tv2)) - diff), <=, tolerance)
27
28 #define test_timeval_diff_eq(tv1, tv2, diff) \
29- test_timeval_diff_leq((tv1), (tv2), (diff), 50)
30+ test_timeval_diff_leq((tv1), (tv2), (diff), 100)
31
32 long timeval_msec_diff(const struct timeval *start, const struct timeval *end);
33
diff --git a/meta/recipes-support/libevent/libevent_2.1.11.bb b/meta/recipes-support/libevent/libevent_2.1.11.bb
index fb186eb89f..75f9979c5b 100644
--- a/meta/recipes-support/libevent/libevent_2.1.11.bb
+++ b/meta/recipes-support/libevent/libevent_2.1.11.bb
@@ -1,4 +1,9 @@
1SUMMARY = "An asynchronous event notification library" 1SUMMARY = "An asynchronous event notification library"
2DESCRIPTION = "A software library that provides asynchronous event \
3notification. The libevent API provides a mechanism to execute a callback \
4function when a specific event occurs on a file descriptor or after a \
5timeout has been reached. libevent also supports callbacks triggered \
6by signals and regular timeouts"
2HOMEPAGE = "http://libevent.org/" 7HOMEPAGE = "http://libevent.org/"
3BUGTRACKER = "https://github.com/libevent/libevent/issues" 8BUGTRACKER = "https://github.com/libevent/libevent/issues"
4SECTION = "libs" 9SECTION = "libs"
@@ -10,6 +15,7 @@ SRC_URI = "https://github.com/libevent/libevent/releases/download/release-${PV}-
10 file://Makefile-missing-test-dir.patch \ 15 file://Makefile-missing-test-dir.patch \
11 file://run-ptest \ 16 file://run-ptest \
12 file://0001-test-regress_dns.c-patch-out-tests-that-require-a-wo.patch \ 17 file://0001-test-regress_dns.c-patch-out-tests-that-require-a-wo.patch \
18 file://0002-test-regress.h-Increase-default-timeval-tolerance-50.patch \
13 " 19 "
14 20
15SRC_URI[md5sum] = "7f35cfe69b82d879111ec0d7b7b1c531" 21SRC_URI[md5sum] = "7f35cfe69b82d879111ec0d7b7b1c531"
diff --git a/meta/recipes-support/libexif/libexif_0.6.22.bb b/meta/recipes-support/libexif/libexif_0.6.22.bb
index 3b08dc52be..86d4464253 100644
--- a/meta/recipes-support/libexif/libexif_0.6.22.bb
+++ b/meta/recipes-support/libexif/libexif_0.6.22.bb
@@ -1,4 +1,7 @@
1SUMMARY = "Library for reading extended image information (EXIF) from JPEG files" 1SUMMARY = "Library for reading extended image information (EXIF) from JPEG files"
2DESCRIPTION = "libexif is a library for parsing, editing, and saving EXIF data. It is \
3intended to replace lots of redundant implementations in command-line \
4utilities and programs with GUIs."
2HOMEPAGE = "https://libexif.github.io/" 5HOMEPAGE = "https://libexif.github.io/"
3SECTION = "libs" 6SECTION = "libs"
4LICENSE = "LGPLv2.1" 7LICENSE = "LGPLv2.1"
diff --git a/meta/recipes-support/libfm/libfm-extra_1.3.1.bb b/meta/recipes-support/libfm/libfm-extra_1.3.1.bb
index 85102a1a3d..8971486715 100644
--- a/meta/recipes-support/libfm/libfm-extra_1.3.1.bb
+++ b/meta/recipes-support/libfm/libfm-extra_1.3.1.bb
@@ -1,4 +1,5 @@
1SUMMARY = "Library for file management" 1SUMMARY = "Library for file management"
2DESCRIPTION = "Contains a library and other files required by menu-cache-gen libexec of menu-cache-1.1.0. "
2HOMEPAGE = "http://pcmanfm.sourceforge.net/" 3HOMEPAGE = "http://pcmanfm.sourceforge.net/"
3 4
4LICENSE = "LGPLv2+" 5LICENSE = "LGPLv2+"
diff --git a/meta/recipes-support/libfm/libfm_1.3.1.bb b/meta/recipes-support/libfm/libfm_1.3.1.bb
index 63ae7874b9..b6f9df0c55 100644
--- a/meta/recipes-support/libfm/libfm_1.3.1.bb
+++ b/meta/recipes-support/libfm/libfm_1.3.1.bb
@@ -1,4 +1,6 @@
1SUMMARY = "Library for file management" 1SUMMARY = "Library for file management"
2DESCRIPTION = "LibFM provides file management functions built on top of Glib/GIO \
3giving a convenient higher-level API."
2HOMEPAGE = "http://pcmanfm.sourceforge.net/" 4HOMEPAGE = "http://pcmanfm.sourceforge.net/"
3 5
4LICENSE = "GPLv2+ & LGPLv2+" 6LICENSE = "GPLv2+ & LGPLv2+"
diff --git a/meta/recipes-support/libgcrypt/files/CVE-2021-33560.patch b/meta/recipes-support/libgcrypt/files/CVE-2021-33560.patch
new file mode 100644
index 0000000000..bf26486d8b
--- /dev/null
+++ b/meta/recipes-support/libgcrypt/files/CVE-2021-33560.patch
@@ -0,0 +1,77 @@
1From e8b7f10be275bcedb5fc05ed4837a89bfd605c61 Mon Sep 17 00:00:00 2001
2From: NIIBE Yutaka <gniibe@fsij.org>
3Date: Tue, 13 Apr 2021 10:00:00 +0900
4Subject: [PATCH] cipher: Hardening ElGamal by introducing exponent blinding
5 too.
6
7* cipher/elgamal.c (do_encrypt): Also do exponent blinding.
8
9--
10
11Base blinding had been introduced with USE_BLINDING. This patch add
12exponent blinding as well to mitigate side-channel attack on mpi_powm.
13
14GnuPG-bug-id: 5328
15Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
16
17Upstream-Status: Backport
18CVE: CVE-2021-33560
19Signed-off-by: Marta Rybczynska <marta.rybczynska@huawei.com>
20---
21 cipher/elgamal.c | 20 +++++++++++++++++---
22 1 file changed, 17 insertions(+), 3 deletions(-)
23
24diff --git a/cipher/elgamal.c b/cipher/elgamal.c
25index 4eb52d62..9835122f 100644
26--- a/cipher/elgamal.c
27+++ b/cipher/elgamal.c
28@@ -522,8 +522,9 @@ do_encrypt(gcry_mpi_t a, gcry_mpi_t b, gcry_mpi_t input, ELG_public_key *pkey )
29 static void
30 decrypt (gcry_mpi_t output, gcry_mpi_t a, gcry_mpi_t b, ELG_secret_key *skey )
31 {
32- gcry_mpi_t t1, t2, r;
33+ gcry_mpi_t t1, t2, r, r1, h;
34 unsigned int nbits = mpi_get_nbits (skey->p);
35+ gcry_mpi_t x_blind;
36
37 mpi_normalize (a);
38 mpi_normalize (b);
39@@ -534,20 +535,33 @@ decrypt (gcry_mpi_t output, gcry_mpi_t a, gcry_mpi_t b, ELG_secret_key *skey )
40
41 t2 = mpi_snew (nbits);
42 r = mpi_new (nbits);
43+ r1 = mpi_new (nbits);
44+ h = mpi_new (nbits);
45+ x_blind = mpi_snew (nbits);
46
47 /* We need a random number of about the prime size. The random
48 number merely needs to be unpredictable; thus we use level 0. */
49 _gcry_mpi_randomize (r, nbits, GCRY_WEAK_RANDOM);
50
51+ /* Also, exponent blinding: x_blind = x + (p-1)*r1 */
52+ _gcry_mpi_randomize (r1, nbits, GCRY_WEAK_RANDOM);
53+ mpi_set_highbit (r1, nbits - 1);
54+ mpi_sub_ui (h, skey->p, 1);
55+ mpi_mul (x_blind, h, r1);
56+ mpi_add (x_blind, skey->x, x_blind);
57+
58 /* t1 = r^x mod p */
59- mpi_powm (t1, r, skey->x, skey->p);
60+ mpi_powm (t1, r, x_blind, skey->p);
61 /* t2 = (a * r)^-x mod p */
62 mpi_mulm (t2, a, r, skey->p);
63- mpi_powm (t2, t2, skey->x, skey->p);
64+ mpi_powm (t2, t2, x_blind, skey->p);
65 mpi_invm (t2, t2, skey->p);
66 /* t1 = (t1 * t2) mod p*/
67 mpi_mulm (t1, t1, t2, skey->p);
68
69+ mpi_free (x_blind);
70+ mpi_free (h);
71+ mpi_free (r1);
72 mpi_free (r);
73 mpi_free (t2);
74
75--
762.11.0
77
diff --git a/meta/recipes-support/libgcrypt/files/CVE-2021-40528.patch b/meta/recipes-support/libgcrypt/files/CVE-2021-40528.patch
new file mode 100644
index 0000000000..b3a18bc5aa
--- /dev/null
+++ b/meta/recipes-support/libgcrypt/files/CVE-2021-40528.patch
@@ -0,0 +1,109 @@
1From 707c3c5c511ee70ad0e39ec613471f665305fbea Mon Sep 17 00:00:00 2001
2From: NIIBE Yutaka <gniibe@fsij.org>
3Date: Fri, 21 May 2021 11:15:07 +0900
4Subject: [PATCH] cipher: Fix ElGamal encryption for other implementations.
5
6* cipher/elgamal.c (gen_k): Remove support of smaller K.
7(do_encrypt): Never use smaller K.
8(sign): Folllow the change of gen_k.
9
10--
11
12Cherry-pick master commit of:
13 632d80ef30e13de6926d503aa697f92b5dbfbc5e
14
15This change basically reverts encryption changes in two commits:
16
17 74386120dad6b3da62db37f7044267c8ef34689b
18 78531373a342aeb847950f404343a05e36022065
19
20Use of smaller K for ephemeral key in ElGamal encryption is only good,
21when we can guarantee that recipient's key is generated by our
22implementation (or compatible).
23
24For detail, please see:
25
26 Luca De Feo, Bertram Poettering, Alessandro Sorniotti,
27 "On the (in)security of ElGamal in OpenPGP";
28 in the proceedings of CCS'2021.
29
30CVE-id: CVE-2021-33560
31GnuPG-bug-id: 5328
32Suggested-by: Luca De Feo, Bertram Poettering, Alessandro Sorniotti
33Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
34
35Upstream-Status: Backport
36CVE: CVE-2021-40528
37Signed-off-by: Armin Kuster <akuster@mvista.com>
38---
39 cipher/elgamal.c | 24 ++++++------------------
40 1 file changed, 6 insertions(+), 18 deletions(-)
41
42diff --git a/cipher/elgamal.c b/cipher/elgamal.c
43index 4eb52d62..ae7a631e 100644
44--- a/cipher/elgamal.c
45+++ b/cipher/elgamal.c
46@@ -66,7 +66,7 @@ static const char *elg_names[] =
47
48
49 static int test_keys (ELG_secret_key *sk, unsigned int nbits, int nodie);
50-static gcry_mpi_t gen_k (gcry_mpi_t p, int small_k);
51+static gcry_mpi_t gen_k (gcry_mpi_t p);
52 static gcry_err_code_t generate (ELG_secret_key *sk, unsigned nbits,
53 gcry_mpi_t **factors);
54 static int check_secret_key (ELG_secret_key *sk);
55@@ -189,11 +189,10 @@ test_keys ( ELG_secret_key *sk, unsigned int nbits, int nodie )
56
57 /****************
58 * Generate a random secret exponent k from prime p, so that k is
59- * relatively prime to p-1. With SMALL_K set, k will be selected for
60- * better encryption performance - this must never be used signing!
61+ * relatively prime to p-1.
62 */
63 static gcry_mpi_t
64-gen_k( gcry_mpi_t p, int small_k )
65+gen_k( gcry_mpi_t p )
66 {
67 gcry_mpi_t k = mpi_alloc_secure( 0 );
68 gcry_mpi_t temp = mpi_alloc( mpi_get_nlimbs(p) );
69@@ -202,18 +201,7 @@ gen_k( gcry_mpi_t p, int small_k )
70 unsigned int nbits, nbytes;
71 char *rndbuf = NULL;
72
73- if (small_k)
74- {
75- /* Using a k much lesser than p is sufficient for encryption and
76- * it greatly improves the encryption performance. We use
77- * Wiener's table and add a large safety margin. */
78- nbits = wiener_map( orig_nbits ) * 3 / 2;
79- if( nbits >= orig_nbits )
80- BUG();
81- }
82- else
83- nbits = orig_nbits;
84-
85+ nbits = orig_nbits;
86
87 nbytes = (nbits+7)/8;
88 if( DBG_CIPHER )
89@@ -492,7 +480,7 @@ do_encrypt(gcry_mpi_t a, gcry_mpi_t b, gcry_mpi_t input, ELG_public_key *pkey )
90 * error code.
91 */
92
93- k = gen_k( pkey->p, 1 );
94+ k = gen_k( pkey->p );
95 mpi_powm (a, pkey->g, k, pkey->p);
96
97 /* b = (y^k * input) mod p
98@@ -594,7 +582,7 @@ sign(gcry_mpi_t a, gcry_mpi_t b, gcry_mpi_t input, ELG_secret_key *skey )
99 *
100 */
101 mpi_sub_ui(p_1, p_1, 1);
102- k = gen_k( skey->p, 0 /* no small K ! */ );
103+ k = gen_k( skey->p );
104 mpi_powm( a, skey->g, k, skey->p );
105 mpi_mul(t, skey->x, a );
106 mpi_subm(t, input, t, p_1 );
107--
1082.30.2
109
diff --git a/meta/recipes-support/libgcrypt/libgcrypt_1.8.5.bb b/meta/recipes-support/libgcrypt/libgcrypt_1.8.5.bb
index 9fd3b7c8c9..8045bab9ed 100644
--- a/meta/recipes-support/libgcrypt/libgcrypt_1.8.5.bb
+++ b/meta/recipes-support/libgcrypt/libgcrypt_1.8.5.bb
@@ -1,4 +1,7 @@
1SUMMARY = "General purpose cryptographic library based on the code from GnuPG" 1SUMMARY = "General purpose cryptographic library based on the code from GnuPG"
2DESCRIPTION = "A cryptography library developed as a separated module of GnuPG. \
3It can also be used independently of GnuPG, but depends on its error-reporting \
4library Libgpg-error."
2HOMEPAGE = "http://directory.fsf.org/project/libgcrypt/" 5HOMEPAGE = "http://directory.fsf.org/project/libgcrypt/"
3BUGTRACKER = "https://bugs.g10code.com/gnupg/index" 6BUGTRACKER = "https://bugs.g10code.com/gnupg/index"
4SECTION = "libs" 7SECTION = "libs"
@@ -25,6 +28,8 @@ SRC_URI = "${GNUPG_MIRROR}/libgcrypt/libgcrypt-${PV}.tar.bz2 \
25 file://0002-AES-move-look-up-tables-to-.data-section-and-unshare.patch \ 28 file://0002-AES-move-look-up-tables-to-.data-section-and-unshare.patch \
26 file://0003-GCM-move-look-up-table-to-.data-section-and-unshare-.patch \ 29 file://0003-GCM-move-look-up-table-to-.data-section-and-unshare-.patch \
27 file://determinism.patch \ 30 file://determinism.patch \
31 file://CVE-2021-33560.patch \
32 file://CVE-2021-40528.patch \
28" 33"
29SRC_URI[md5sum] = "348cc4601ca34307fc6cd6c945467743" 34SRC_URI[md5sum] = "348cc4601ca34307fc6cd6c945467743"
30SRC_URI[sha256sum] = "3b4a2a94cb637eff5bdebbcaf46f4d95c4f25206f459809339cdada0eb577ac3" 35SRC_URI[sha256sum] = "3b4a2a94cb637eff5bdebbcaf46f4d95c4f25206f459809339cdada0eb577ac3"
diff --git a/meta/recipes-support/libgpg-error/libgpg-error_1.37.bb b/meta/recipes-support/libgpg-error/libgpg-error_1.37.bb
index b9a2b01c20..7b7404b516 100644
--- a/meta/recipes-support/libgpg-error/libgpg-error_1.37.bb
+++ b/meta/recipes-support/libgpg-error/libgpg-error_1.37.bb
@@ -1,4 +1,5 @@
1SUMMARY = "Small library that defines common error values for all GnuPG components" 1SUMMARY = "Small library that defines common error values for all GnuPG components"
2DESCRIPTION = "Contains common error codes and error handling functions used by GnuPG, Libgcrypt, GPGME and more packages. "
2HOMEPAGE = "http://www.gnupg.org/related_software/libgpg-error/" 3HOMEPAGE = "http://www.gnupg.org/related_software/libgpg-error/"
3BUGTRACKER = "https://bugs.g10code.com/gnupg/index" 4BUGTRACKER = "https://bugs.g10code.com/gnupg/index"
4 5
diff --git a/meta/recipes-support/libical/libical_3.0.7.bb b/meta/recipes-support/libical/libical_3.0.7.bb
index a50473e9ec..170f12b7a9 100644
--- a/meta/recipes-support/libical/libical_3.0.7.bb
+++ b/meta/recipes-support/libical/libical_3.0.7.bb
@@ -1,4 +1,8 @@
1SUMMARY = "iCal and scheduling (RFC 2445, 2446, 2447) library" 1SUMMARY = "iCal and scheduling (RFC 2445, 2446, 2447) library"
2DESCRIPTION = "An Open Source implementation of the iCalendar protocols \
3and protocol data units. The iCalendar specification describes how \
4calendar clients can communicate with calendar servers so users can store \
5their calendar data and arrange meetings with other users. "
2HOMEPAGE = "https://github.com/libical/libical" 6HOMEPAGE = "https://github.com/libical/libical"
3BUGTRACKER = "https://github.com/libical/libical/issues" 7BUGTRACKER = "https://github.com/libical/libical/issues"
4LICENSE = "LGPLv2.1 | MPL-2.0" 8LICENSE = "LGPLv2.1 | MPL-2.0"
diff --git a/meta/recipes-support/libjitterentropy/libjitterentropy_2.2.0.bb b/meta/recipes-support/libjitterentropy/libjitterentropy_2.2.0.bb
index 710ef0172d..841edc6829 100644
--- a/meta/recipes-support/libjitterentropy/libjitterentropy_2.2.0.bb
+++ b/meta/recipes-support/libjitterentropy/libjitterentropy_2.2.0.bb
@@ -9,7 +9,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=a95aadbdfae7ed812bb2b7b86eb5981c \
9 file://COPYING.gplv2;md5=eb723b61539feef013de476e68b5c50a \ 9 file://COPYING.gplv2;md5=eb723b61539feef013de476e68b5c50a \
10 file://COPYING.bsd;md5=66a5cedaf62c4b2637025f049f9b826f \ 10 file://COPYING.bsd;md5=66a5cedaf62c4b2637025f049f9b826f \
11 " 11 "
12SRC_URI = "git://github.com/smuellerDD/jitterentropy-library.git \ 12SRC_URI = "git://github.com/smuellerDD/jitterentropy-library.git;branch=master;protocol=https \
13 file://0001-Makefile-cleanup-install-for-rebuilds.patch \ 13 file://0001-Makefile-cleanup-install-for-rebuilds.patch \
14 file://0001-Make-man-pages-reproducible.patch" 14 file://0001-Make-man-pages-reproducible.patch"
15SRCREV = "933a44f33ed3d6612f7cfaa7ad1207c8da4886ba" 15SRCREV = "933a44f33ed3d6612f7cfaa7ad1207c8da4886ba"
diff --git a/meta/recipes-support/libksba/libksba/CVE-2022-3515.patch b/meta/recipes-support/libksba/libksba/CVE-2022-3515.patch
new file mode 100644
index 0000000000..ff9f2f9275
--- /dev/null
+++ b/meta/recipes-support/libksba/libksba/CVE-2022-3515.patch
@@ -0,0 +1,47 @@
1From 4b7d9cd4a018898d7714ce06f3faf2626c14582b Mon Sep 17 00:00:00 2001
2From: Werner Koch <wk@gnupg.org>
3Date: Wed, 5 Oct 2022 14:19:06 +0200
4Subject: [PATCH] Detect a possible overflow directly in the TLV parser.
5
6* src/ber-help.c (_ksba_ber_read_tl): Check for overflow of a commonly
7used sum.
8--
9
10It is quite common to have checks like
11
12 if (ti.nhdr + ti.length >= DIM(tmpbuf))
13 return gpg_error (GPG_ERR_TOO_LARGE);
14
15This patch detects possible integer overflows immmediately when
16creating the TI object.
17
18Reported-by: ZDI-CAN-18927, ZDI-CAN-18928, ZDI-CAN-18929
19
20
21Upstream-Status: Backport [https://git.gnupg.org/cgi-bin/gitweb.cgi?p=libksba.git;a=patch;h=4b7d9cd4a018898d7714ce06f3faf2626c14582b]
22CVE: CVE-2022-3515
23Signed-off-by: Chee Yang Lee <chee.yang.lee@intel.com>
24---
25 src/ber-help.c | 6 ++++++
26 1 file changed, 6 insertions(+)
27
28diff --git a/src/ber-help.c b/src/ber-help.c
29index 81c31ed..56efb6a 100644
30--- a/src/ber-help.c
31+++ b/src/ber-help.c
32@@ -182,6 +182,12 @@ _ksba_ber_read_tl (ksba_reader_t reader, struct tag_info *ti)
33 ti->length = len;
34 }
35
36+ if (ti->length > ti->nhdr && (ti->nhdr + ti->length) < ti->length)
37+ {
38+ ti->err_string = "header+length would overflow";
39+ return gpg_error (GPG_ERR_EOVERFLOW);
40+ }
41+
42 /* Without this kludge some example certs can't be parsed */
43 if (ti->class == CLASS_UNIVERSAL && !ti->tag)
44 ti->length = 0;
45--
462.11.0
47
diff --git a/meta/recipes-support/libksba/libksba/CVE-2022-47629.patch b/meta/recipes-support/libksba/libksba/CVE-2022-47629.patch
new file mode 100644
index 0000000000..b09d0eb557
--- /dev/null
+++ b/meta/recipes-support/libksba/libksba/CVE-2022-47629.patch
@@ -0,0 +1,69 @@
1From b17444b3c47e32c77a3ba5335ae30ccbadcba3cf Mon Sep 17 00:00:00 2001
2From: Werner Koch <wk@gnupg.org>
3Date: Tue, 22 Nov 2022 16:36:46 +0100
4Subject: [PATCH] Fix an integer overflow in the CRL signature parser.
5
6* src/crl.c (parse_signature): N+N2 now checked for overflow.
7
8* src/ocsp.c (parse_response_extensions): Do not accept too large
9values.
10(parse_single_extensions): Ditto.
11--
12
13The second patch is an extra safegourd not related to the reported
14bug.
15
16GnuPG-bug-id: 6284
17Reported-by: Joseph Surin, elttam
18CVE: CVE-2022-47629
19https://git.gnupg.org/cgi-bin/gitweb.cgi?p=libksba.git;a=commit;h=f61a5ea4e0f6a80fd4b28ef0174bee77793cf070
20Upstream-Status: Backport
21Signed-off-by: Chee Yang Lee <chee.yang.lee@intel.com>
22---
23 src/crl.c | 2 +-
24 src/ocsp.c | 12 ++++++++++++
25 2 files changed, 13 insertions(+), 1 deletion(-)
26
27diff --git a/src/crl.c b/src/crl.c
28index 87a3fa3..9d3028e 100644
29--- a/src/crl.c
30+++ b/src/crl.c
31@@ -1434,7 +1434,7 @@ parse_signature (ksba_crl_t crl)
32 && !ti.is_constructed) )
33 return gpg_error (GPG_ERR_INV_CRL_OBJ);
34 n2 = ti.nhdr + ti.length;
35- if (n + n2 >= DIM(tmpbuf))
36+ if (n + n2 >= DIM(tmpbuf) || (n + n2) < n)
37 return gpg_error (GPG_ERR_TOO_LARGE);
38 memcpy (tmpbuf+n, ti.buf, ti.nhdr);
39 err = read_buffer (crl->reader, tmpbuf+n+ti.nhdr, ti.length);
40diff --git a/src/ocsp.c b/src/ocsp.c
41index 4b26f8d..c41234e 100644
42--- a/src/ocsp.c
43+++ b/src/ocsp.c
44@@ -912,6 +912,12 @@ parse_response_extensions (ksba_ocsp_t ocsp,
45 else
46 ocsp->good_nonce = 1;
47 }
48+ if (ti.length > (1<<24))
49+ {
50+ /* Bail out on much too large objects. */
51+ err = gpg_error (GPG_ERR_BAD_BER);
52+ goto leave;
53+ }
54 ex = xtrymalloc (sizeof *ex + strlen (oid) + ti.length);
55 if (!ex)
56 {
57@@ -979,6 +985,12 @@ parse_single_extensions (struct ocsp_reqitem_s *ri,
58 err = parse_octet_string (&data, &datalen, &ti);
59 if (err)
60 goto leave;
61+ if (ti.length > (1<<24))
62+ {
63+ /* Bail out on much too large objects. */
64+ err = gpg_error (GPG_ERR_BAD_BER);
65+ goto leave;
66+ }
67 ex = xtrymalloc (sizeof *ex + strlen (oid) + ti.length);
68 if (!ex)
69 {
diff --git a/meta/recipes-support/libksba/libksba_1.3.5.bb b/meta/recipes-support/libksba/libksba_1.3.5.bb
index 336d7f8177..5293aa91e1 100644
--- a/meta/recipes-support/libksba/libksba_1.3.5.bb
+++ b/meta/recipes-support/libksba/libksba_1.3.5.bb
@@ -1,4 +1,9 @@
1SUMMARY = "Easy API to create and parse X.509 and CMS related objects" 1SUMMARY = "Easy API to create and parse X.509 and CMS related objects"
2DESCRIPTION = "A library to make the tasks of working with X.509 certificates, \
3CMS data and related objects more easy. It provides a highlevel interface to \
4the implemented protocols and presents the data in a consistent way. The \
5library does not rely on another cryptographic library but provides \
6hooks for easy integration with Libgcrypt. "
2HOMEPAGE = "http://www.gnupg.org/related_software/libksba/" 7HOMEPAGE = "http://www.gnupg.org/related_software/libksba/"
3LICENSE = "GPLv3+ & (GPLv2+ | LGPLv3+)" 8LICENSE = "GPLv3+ & (GPLv2+ | LGPLv3+)"
4LICENSE_${PN} = "GPLv2+ | LGPLv3+" 9LICENSE_${PN} = "GPLv2+ | LGPLv3+"
@@ -17,7 +22,10 @@ inherit autotools binconfig-disabled pkgconfig texinfo
17 22
18UPSTREAM_CHECK_URI = "https://gnupg.org/download/index.html" 23UPSTREAM_CHECK_URI = "https://gnupg.org/download/index.html"
19SRC_URI = "${GNUPG_MIRROR}/${BPN}/${BPN}-${PV}.tar.bz2 \ 24SRC_URI = "${GNUPG_MIRROR}/${BPN}/${BPN}-${PV}.tar.bz2 \
20 file://ksba-add-pkgconfig-support.patch" 25 file://ksba-add-pkgconfig-support.patch \
26 file://CVE-2022-47629.patch \
27 file://CVE-2022-3515.patch \
28"
21 29
22SRC_URI[md5sum] = "8302a3e263a7c630aa7dea7d341f07a2" 30SRC_URI[md5sum] = "8302a3e263a7c630aa7dea7d341f07a2"
23SRC_URI[sha256sum] = "41444fd7a6ff73a79ad9728f985e71c9ba8cd3e5e53358e70d5f066d35c1a340" 31SRC_URI[sha256sum] = "41444fd7a6ff73a79ad9728f985e71c9ba8cd3e5e53358e70d5f066d35c1a340"
diff --git a/meta/recipes-support/libnl/libnl_3.5.0.bb b/meta/recipes-support/libnl/libnl_3.5.0.bb
index 9d0e1441a9..f4b5d40bb2 100644
--- a/meta/recipes-support/libnl/libnl_3.5.0.bb
+++ b/meta/recipes-support/libnl/libnl_3.5.0.bb
@@ -1,4 +1,9 @@
1SUMMARY = "A library for applications dealing with netlink sockets" 1SUMMARY = "A library for applications dealing with netlink sockets"
2DESCRIPTION = "The libnl suite is a collection of libraries providing \
3APIs to netlink protocol based Linux kernel interfaces. libnl is the core \
4library implementing the fundamentals required to use the netlink protocol \
5such as socket handling, message construction and parsing, and sending \
6and receiving of data."
2HOMEPAGE = "http://www.infradead.org/~tgr/libnl/" 7HOMEPAGE = "http://www.infradead.org/~tgr/libnl/"
3SECTION = "libs/network" 8SECTION = "libs/network"
4 9
diff --git a/meta/recipes-support/libpcre/libpcre/fix-pcre-name-collision.patch b/meta/recipes-support/libpcre/libpcre/fix-pcre-name-collision.patch
deleted file mode 100644
index 89b44f6aa6..0000000000
--- a/meta/recipes-support/libpcre/libpcre/fix-pcre-name-collision.patch
+++ /dev/null
@@ -1,41 +0,0 @@
1Upstream-Status: Inappropriate [debian patch]
2
3This patch address a namespace collision with libc.
4
5Although there is no "#include <regex.h>" in the source file, at
6runtime, it's unintentionally linked to the libc version, the regcomp of
7libc is called instead the pcre one using pcre's data structure...
8that looks like a disaster.
9
10Can patch is from Debian (and Ubuntu 11.04alpha has it also).
11
12[sgw: added patch comment]
13Signed-off-by: Qing He <qing.he@intel.com>
14Signed-off-by: Saul Wold <sgw@linux.intel.com>
15
16--- a/pcreposix.h 2010-05-17 00:17:23.000000000 +0800
17+++ b/pcreposix.h 2009-01-15 04:32:17.000000000 +0800
18@@ -133,14 +130,19 @@
19
20 /* The functions */
21
22-PCREPOSIX_EXP_DECL int regcomp(regex_t *, const char *, int);
23-PCREPOSIX_EXP_DECL int regexec(const regex_t *, const char *, size_t,
24+PCREPOSIX_EXP_DECL int pcreposix_regcomp(regex_t *, const char *, int);
25+PCREPOSIX_EXP_DECL int pcreposix_regexec(const regex_t *, const char *, size_t,
26 regmatch_t *, int);
27-PCREPOSIX_EXP_DECL size_t regerror(int, const regex_t *, char *, size_t);
28-PCREPOSIX_EXP_DECL void regfree(regex_t *);
29+PCREPOSIX_EXP_DECL size_t pcreposix_regerror(int, const regex_t *, char *, size_t);
30+PCREPOSIX_EXP_DECL void pcreposix_regfree(regex_t *);
31
32 #ifdef __cplusplus
33 } /* extern "C" */
34 #endif
35
36+#define regcomp pcreposix_regcomp
37+#define regexec pcreposix_regexec
38+#define regerror pcreposix_regerror
39+#define regfree pcreposix_regfree
40+
41 #endif /* End of pcreposix.h */
diff --git a/meta/recipes-support/libpcre/libpcre2/CVE-2022-1586-regression.patch b/meta/recipes-support/libpcre/libpcre2/CVE-2022-1586-regression.patch
new file mode 100644
index 0000000000..42ee417fe7
--- /dev/null
+++ b/meta/recipes-support/libpcre/libpcre2/CVE-2022-1586-regression.patch
@@ -0,0 +1,30 @@
1From 5d1e62b0155292b994aa1c96d4ed8ce4346ef4c2 Mon Sep 17 00:00:00 2001
2From: Zoltan Herczeg <hzmester@freemail.hu>
3Date: Thu, 24 Mar 2022 05:34:42 +0000
4Subject: [PATCH] Fix incorrect value reading in JIT.
5
6CVE: CVE-2022-1586
7Upstream-Status: Backport [https://github.com/PCRE2Project/pcre2/commit/d4fa336fbcc3]
8
9(cherry picked from commit d4fa336fbcc388f89095b184ba6d99422cfc676c)
10Signed-off-by: Shinu Chandran <shinucha@cisco.com>
11---
12 src/pcre2_jit_compile.c | 2 +-
13 1 file changed, 1 insertion(+), 1 deletion(-)
14
15diff --git a/src/pcre2_jit_compile.c b/src/pcre2_jit_compile.c
16index 493c96d..fa57942 100644
17--- a/src/pcre2_jit_compile.c
18+++ b/src/pcre2_jit_compile.c
19@@ -7188,7 +7188,7 @@ while (*cc != XCL_END)
20 {
21 SLJIT_ASSERT(*cc == XCL_PROP || *cc == XCL_NOTPROP);
22 cc++;
23- if (*cc == PT_CLIST && *cc == XCL_PROP)
24+ if (*cc == PT_CLIST && cc[-1] == XCL_PROP)
25 {
26 other_cases = PRIV(ucd_caseless_sets) + cc[1];
27 while (*other_cases != NOTACHAR)
28--
292.25.1
30
diff --git a/meta/recipes-support/libpcre/libpcre2/CVE-2022-1586.patch b/meta/recipes-support/libpcre/libpcre2/CVE-2022-1586.patch
new file mode 100644
index 0000000000..fbbbc9ca77
--- /dev/null
+++ b/meta/recipes-support/libpcre/libpcre2/CVE-2022-1586.patch
@@ -0,0 +1,59 @@
1From 233c4248550d0c1d9bfee42198d5ee0855b7d413 Mon Sep 17 00:00:00 2001
2From: Hitendra Prajapati <hprajapati@mvista.com>
3Date: Mon, 23 May 2022 13:52:39 +0530
4Subject: [PATCH] CVE-2022-1586
5
6Upstream-Status: Backport from https://github.com/PCRE2Project/pcre2/commit/50a51cb7e67268e6ad417eb07c9de9bfea5cc55a
7
8Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
9---
10 ChangeLog | 3 +++
11 src/pcre2_jit_compile.c | 2 +-
12 src/pcre2_jit_test.c | 4 ++++
13 3 files changed, 8 insertions(+), 1 deletion(-)
14
15diff --git a/ChangeLog b/ChangeLog
16index 0926c29..b5d72dc 100644
17--- a/ChangeLog
18+++ b/ChangeLog
19@@ -1,6 +1,9 @@
20 Change Log for PCRE2
21 --------------------
22
23+23. Fixed a unicode properrty matching issue in JIT. The character was not
24+fully read in caseless matching.
25+
26
27 Version 10.34 21-November-2019
28 ------------------------------
29diff --git a/src/pcre2_jit_compile.c b/src/pcre2_jit_compile.c
30index f564127..5d43865 100644
31--- a/src/pcre2_jit_compile.c
32+++ b/src/pcre2_jit_compile.c
33@@ -7119,7 +7119,7 @@ while (*cc != XCL_END)
34 {
35 SLJIT_ASSERT(*cc == XCL_PROP || *cc == XCL_NOTPROP);
36 cc++;
37- if (*cc == PT_CLIST)
38+ if (*cc == PT_CLIST && *cc == XCL_PROP)
39 {
40 other_cases = PRIV(ucd_caseless_sets) + cc[1];
41 while (*other_cases != NOTACHAR)
42diff --git a/src/pcre2_jit_test.c b/src/pcre2_jit_test.c
43index a9b3880..9df87fd 100644
44--- a/src/pcre2_jit_test.c
45+++ b/src/pcre2_jit_test.c
46@@ -408,6 +408,10 @@ static struct regression_test_case regression_test_cases[] = {
47 { MUP, A, 0, 0 | F_PROPERTY, "[\xc3\xa2-\xc3\xa6\xc3\x81-\xc3\x84\xe2\x80\xa8-\xe2\x80\xa9\xe6\x92\xad\\p{Zs}]{2,}", "\xe2\x80\xa7\xe2\x80\xa9\xe6\x92\xad \xe6\x92\xae" },
48 { MUP, A, 0, 0 | F_PROPERTY, "[\\P{L&}]{2}[^\xc2\x85-\xc2\x89\\p{Ll}\\p{Lu}]{2}", "\xc3\xa9\xe6\x92\xad.a\xe6\x92\xad|\xc2\x8a#" },
49 { PCRE2_UCP, 0, 0, 0 | F_PROPERTY, "[a-b\\s]{2,5}[^a]", "AB baaa" },
50+ { MUP, 0, 0, 0 | F_NOMATCH, "[^\\p{Hangul}\\p{Z}]", " " },
51+ { MUP, 0, 0, 0, "[\\p{Lu}\\P{Latin}]+", "c\xEA\xA4\xAE,A,b" },
52+ { MUP, 0, 0, 0, "[\\x{a92e}\\p{Lu}\\P{Latin}]+", "c\xEA\xA4\xAE,A,b" },
53+ { CMUP, 0, 0, 0, "[^S]\\B", "\xe2\x80\x8a" },
54
55 /* Possible empty brackets. */
56 { MU, A, 0, 0, "(?:|ab||bc|a)+d", "abcxabcabd" },
57--
582.25.1
59
diff --git a/meta/recipes-support/libpcre/libpcre2/CVE-2022-1587.patch b/meta/recipes-support/libpcre/libpcre2/CVE-2022-1587.patch
new file mode 100644
index 0000000000..70f9f9f079
--- /dev/null
+++ b/meta/recipes-support/libpcre/libpcre2/CVE-2022-1587.patch
@@ -0,0 +1,660 @@
1From aa5aac0d209e3debf80fc2db924d9401fc50454b Mon Sep 17 00:00:00 2001
2From: Hitendra Prajapati <hprajapati@mvista.com>
3Date: Mon, 23 May 2022 14:11:11 +0530
4Subject: [PATCH] CVE-2022-1587
5
6Upstream-Status: Backport [https://github.com/PCRE2Project/pcre2/commit/03654e751e7f0700693526b67dfcadda6b42c9d0]
7CVE: CVE-2022-1587
8Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
9
10---
11 ChangeLog | 3 +
12 src/pcre2_jit_compile.c | 290 ++++++++++++++++++++++++++--------------
13 src/pcre2_jit_test.c | 1 +
14 3 files changed, 194 insertions(+), 100 deletions(-)
15
16diff --git a/ChangeLog b/ChangeLog
17index b5d72dc..de82de9 100644
18--- a/ChangeLog
19+++ b/ChangeLog
20@@ -4,6 +4,9 @@ Change Log for PCRE2
21 23. Fixed a unicode properrty matching issue in JIT. The character was not
22 fully read in caseless matching.
23
24+24. Fixed an issue affecting recursions in JIT caused by duplicated data
25+transfers.
26+
27
28 Version 10.34 21-November-2019
29 ------------------------------
30diff --git a/src/pcre2_jit_compile.c b/src/pcre2_jit_compile.c
31index 5d43865..493c96d 100644
32--- a/src/pcre2_jit_compile.c
33+++ b/src/pcre2_jit_compile.c
34@@ -407,6 +407,9 @@ typedef struct compiler_common {
35 /* Locals used by fast fail optimization. */
36 sljit_s32 fast_fail_start_ptr;
37 sljit_s32 fast_fail_end_ptr;
38+ /* Variables used by recursive call generator. */
39+ sljit_s32 recurse_bitset_size;
40+ uint8_t *recurse_bitset;
41
42 /* Flipped and lower case tables. */
43 const sljit_u8 *fcc;
44@@ -2109,19 +2112,39 @@ for (i = 0; i < RECURSE_TMP_REG_COUNT; i++)
45
46 #undef RECURSE_TMP_REG_COUNT
47
48+static BOOL recurse_check_bit(compiler_common *common, sljit_sw bit_index)
49+{
50+uint8_t *byte;
51+uint8_t mask;
52+
53+SLJIT_ASSERT((bit_index & (sizeof(sljit_sw) - 1)) == 0);
54+
55+bit_index >>= SLJIT_WORD_SHIFT;
56+
57+mask = 1 << (bit_index & 0x7);
58+byte = common->recurse_bitset + (bit_index >> 3);
59+
60+if (*byte & mask)
61+ return FALSE;
62+
63+*byte |= mask;
64+return TRUE;
65+}
66+
67 static int get_recurse_data_length(compiler_common *common, PCRE2_SPTR cc, PCRE2_SPTR ccend,
68 BOOL *needs_control_head, BOOL *has_quit, BOOL *has_accept)
69 {
70 int length = 1;
71-int size;
72+int size, offset;
73 PCRE2_SPTR alternative;
74 BOOL quit_found = FALSE;
75 BOOL accept_found = FALSE;
76 BOOL setsom_found = FALSE;
77 BOOL setmark_found = FALSE;
78-BOOL capture_last_found = FALSE;
79 BOOL control_head_found = FALSE;
80
81+memset(common->recurse_bitset, 0, common->recurse_bitset_size);
82+
83 #if defined DEBUG_FORCE_CONTROL_HEAD && DEBUG_FORCE_CONTROL_HEAD
84 SLJIT_ASSERT(common->control_head_ptr != 0);
85 control_head_found = TRUE;
86@@ -2144,15 +2167,17 @@ while (cc < ccend)
87 setsom_found = TRUE;
88 if (common->mark_ptr != 0)
89 setmark_found = TRUE;
90- if (common->capture_last_ptr != 0)
91- capture_last_found = TRUE;
92+ if (common->capture_last_ptr != 0 && recurse_check_bit(common, common->capture_last_ptr))
93+ length++;
94 cc += 1 + LINK_SIZE;
95 break;
96
97 case OP_KET:
98- if (PRIVATE_DATA(cc) != 0)
99+ offset = PRIVATE_DATA(cc);
100+ if (offset != 0)
101 {
102- length++;
103+ if (recurse_check_bit(common, offset))
104+ length++;
105 SLJIT_ASSERT(PRIVATE_DATA(cc + 1) != 0);
106 cc += PRIVATE_DATA(cc + 1);
107 }
108@@ -2169,39 +2194,55 @@ while (cc < ccend)
109 case OP_SBRA:
110 case OP_SBRAPOS:
111 case OP_SCOND:
112- length++;
113 SLJIT_ASSERT(PRIVATE_DATA(cc) != 0);
114+ if (recurse_check_bit(common, PRIVATE_DATA(cc)))
115+ length++;
116 cc += 1 + LINK_SIZE;
117 break;
118
119 case OP_CBRA:
120 case OP_SCBRA:
121- length += 2;
122- if (common->capture_last_ptr != 0)
123- capture_last_found = TRUE;
124- if (common->optimized_cbracket[GET2(cc, 1 + LINK_SIZE)] == 0)
125+ offset = GET2(cc, 1 + LINK_SIZE);
126+ if (recurse_check_bit(common, OVECTOR(offset << 1)))
127+ {
128+ SLJIT_ASSERT(recurse_check_bit(common, OVECTOR((offset << 1) + 1)));
129+ length += 2;
130+ }
131+ if (common->optimized_cbracket[offset] == 0 && recurse_check_bit(common, OVECTOR_PRIV(offset)))
132+ length++;
133+ if (common->capture_last_ptr != 0 && recurse_check_bit(common, common->capture_last_ptr))
134 length++;
135 cc += 1 + LINK_SIZE + IMM2_SIZE;
136 break;
137
138 case OP_CBRAPOS:
139 case OP_SCBRAPOS:
140- length += 2 + 2;
141- if (common->capture_last_ptr != 0)
142- capture_last_found = TRUE;
143+ offset = GET2(cc, 1 + LINK_SIZE);
144+ if (recurse_check_bit(common, OVECTOR(offset << 1)))
145+ {
146+ SLJIT_ASSERT(recurse_check_bit(common, OVECTOR((offset << 1) + 1)));
147+ length += 2;
148+ }
149+ if (recurse_check_bit(common, OVECTOR_PRIV(offset)))
150+ length++;
151+ if (recurse_check_bit(common, PRIVATE_DATA(cc)))
152+ length++;
153+ if (common->capture_last_ptr != 0 && recurse_check_bit(common, common->capture_last_ptr))
154+ length++;
155 cc += 1 + LINK_SIZE + IMM2_SIZE;
156 break;
157
158 case OP_COND:
159 /* Might be a hidden SCOND. */
160 alternative = cc + GET(cc, 1);
161- if (*alternative == OP_KETRMAX || *alternative == OP_KETRMIN)
162+ if ((*alternative == OP_KETRMAX || *alternative == OP_KETRMIN) && recurse_check_bit(common, PRIVATE_DATA(cc)))
163 length++;
164 cc += 1 + LINK_SIZE;
165 break;
166
167 CASE_ITERATOR_PRIVATE_DATA_1
168- if (PRIVATE_DATA(cc) != 0)
169+ offset = PRIVATE_DATA(cc);
170+ if (offset != 0 && recurse_check_bit(common, offset))
171 length++;
172 cc += 2;
173 #ifdef SUPPORT_UNICODE
174@@ -2210,8 +2251,12 @@ while (cc < ccend)
175 break;
176
177 CASE_ITERATOR_PRIVATE_DATA_2A
178- if (PRIVATE_DATA(cc) != 0)
179+ offset = PRIVATE_DATA(cc);
180+ if (offset != 0 && recurse_check_bit(common, offset))
181+ {
182+ SLJIT_ASSERT(recurse_check_bit(common, offset + sizeof(sljit_sw)));
183 length += 2;
184+ }
185 cc += 2;
186 #ifdef SUPPORT_UNICODE
187 if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
188@@ -2219,8 +2264,12 @@ while (cc < ccend)
189 break;
190
191 CASE_ITERATOR_PRIVATE_DATA_2B
192- if (PRIVATE_DATA(cc) != 0)
193+ offset = PRIVATE_DATA(cc);
194+ if (offset != 0 && recurse_check_bit(common, offset))
195+ {
196+ SLJIT_ASSERT(recurse_check_bit(common, offset + sizeof(sljit_sw)));
197 length += 2;
198+ }
199 cc += 2 + IMM2_SIZE;
200 #ifdef SUPPORT_UNICODE
201 if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
202@@ -2228,20 +2277,29 @@ while (cc < ccend)
203 break;
204
205 CASE_ITERATOR_TYPE_PRIVATE_DATA_1
206- if (PRIVATE_DATA(cc) != 0)
207+ offset = PRIVATE_DATA(cc);
208+ if (offset != 0 && recurse_check_bit(common, offset))
209 length++;
210 cc += 1;
211 break;
212
213 CASE_ITERATOR_TYPE_PRIVATE_DATA_2A
214- if (PRIVATE_DATA(cc) != 0)
215+ offset = PRIVATE_DATA(cc);
216+ if (offset != 0 && recurse_check_bit(common, offset))
217+ {
218+ SLJIT_ASSERT(recurse_check_bit(common, offset + sizeof(sljit_sw)));
219 length += 2;
220+ }
221 cc += 1;
222 break;
223
224 CASE_ITERATOR_TYPE_PRIVATE_DATA_2B
225- if (PRIVATE_DATA(cc) != 0)
226+ offset = PRIVATE_DATA(cc);
227+ if (offset != 0 && recurse_check_bit(common, offset))
228+ {
229+ SLJIT_ASSERT(recurse_check_bit(common, offset + sizeof(sljit_sw)));
230 length += 2;
231+ }
232 cc += 1 + IMM2_SIZE;
233 break;
234
235@@ -2253,7 +2311,9 @@ while (cc < ccend)
236 #else
237 size = 1 + 32 / (int)sizeof(PCRE2_UCHAR);
238 #endif
239- if (PRIVATE_DATA(cc) != 0)
240+
241+ offset = PRIVATE_DATA(cc);
242+ if (offset != 0 && recurse_check_bit(common, offset))
243 length += get_class_iterator_size(cc + size);
244 cc += size;
245 break;
246@@ -2288,8 +2348,7 @@ while (cc < ccend)
247 case OP_THEN:
248 SLJIT_ASSERT(common->control_head_ptr != 0);
249 quit_found = TRUE;
250- if (!control_head_found)
251- control_head_found = TRUE;
252+ control_head_found = TRUE;
253 cc++;
254 break;
255
256@@ -2309,8 +2368,6 @@ SLJIT_ASSERT(cc == ccend);
257
258 if (control_head_found)
259 length++;
260-if (capture_last_found)
261- length++;
262 if (quit_found)
263 {
264 if (setsom_found)
265@@ -2343,14 +2400,12 @@ sljit_sw shared_srcw[3];
266 sljit_sw kept_shared_srcw[2];
267 int private_count, shared_count, kept_shared_count;
268 int from_sp, base_reg, offset, i;
269-BOOL setsom_found = FALSE;
270-BOOL setmark_found = FALSE;
271-BOOL capture_last_found = FALSE;
272-BOOL control_head_found = FALSE;
273+
274+memset(common->recurse_bitset, 0, common->recurse_bitset_size);
275
276 #if defined DEBUG_FORCE_CONTROL_HEAD && DEBUG_FORCE_CONTROL_HEAD
277 SLJIT_ASSERT(common->control_head_ptr != 0);
278-control_head_found = TRUE;
279+recurse_check_bit(common, common->control_head_ptr);
280 #endif
281
282 switch (type)
283@@ -2438,11 +2493,10 @@ while (cc < ccend)
284 {
285 case OP_SET_SOM:
286 SLJIT_ASSERT(common->has_set_som);
287- if (has_quit && !setsom_found)
288+ if (has_quit && recurse_check_bit(common, OVECTOR(0)))
289 {
290 kept_shared_srcw[0] = OVECTOR(0);
291 kept_shared_count = 1;
292- setsom_found = TRUE;
293 }
294 cc += 1;
295 break;
296@@ -2450,33 +2504,31 @@ while (cc < ccend)
297 case OP_RECURSE:
298 if (has_quit)
299 {
300- if (common->has_set_som && !setsom_found)
301+ if (common->has_set_som && recurse_check_bit(common, OVECTOR(0)))
302 {
303 kept_shared_srcw[0] = OVECTOR(0);
304 kept_shared_count = 1;
305- setsom_found = TRUE;
306 }
307- if (common->mark_ptr != 0 && !setmark_found)
308+ if (common->mark_ptr != 0 && recurse_check_bit(common, common->mark_ptr))
309 {
310 kept_shared_srcw[kept_shared_count] = common->mark_ptr;
311 kept_shared_count++;
312- setmark_found = TRUE;
313 }
314 }
315- if (common->capture_last_ptr != 0 && !capture_last_found)
316+ if (common->capture_last_ptr != 0 && recurse_check_bit(common, common->capture_last_ptr))
317 {
318 shared_srcw[0] = common->capture_last_ptr;
319 shared_count = 1;
320- capture_last_found = TRUE;
321 }
322 cc += 1 + LINK_SIZE;
323 break;
324
325 case OP_KET:
326- if (PRIVATE_DATA(cc) != 0)
327+ private_srcw[0] = PRIVATE_DATA(cc);
328+ if (private_srcw[0] != 0)
329 {
330- private_count = 1;
331- private_srcw[0] = PRIVATE_DATA(cc);
332+ if (recurse_check_bit(common, private_srcw[0]))
333+ private_count = 1;
334 SLJIT_ASSERT(PRIVATE_DATA(cc + 1) != 0);
335 cc += PRIVATE_DATA(cc + 1);
336 }
337@@ -2493,50 +2545,66 @@ while (cc < ccend)
338 case OP_SBRA:
339 case OP_SBRAPOS:
340 case OP_SCOND:
341- private_count = 1;
342 private_srcw[0] = PRIVATE_DATA(cc);
343+ if (recurse_check_bit(common, private_srcw[0]))
344+ private_count = 1;
345 cc += 1 + LINK_SIZE;
346 break;
347
348 case OP_CBRA:
349 case OP_SCBRA:
350- offset = (GET2(cc, 1 + LINK_SIZE)) << 1;
351- shared_srcw[0] = OVECTOR(offset);
352- shared_srcw[1] = OVECTOR(offset + 1);
353- shared_count = 2;
354+ offset = GET2(cc, 1 + LINK_SIZE);
355+ shared_srcw[0] = OVECTOR(offset << 1);
356+ if (recurse_check_bit(common, shared_srcw[0]))
357+ {
358+ shared_srcw[1] = shared_srcw[0] + sizeof(sljit_sw);
359+ SLJIT_ASSERT(recurse_check_bit(common, shared_srcw[1]));
360+ shared_count = 2;
361+ }
362
363- if (common->capture_last_ptr != 0 && !capture_last_found)
364+ if (common->capture_last_ptr != 0 && recurse_check_bit(common, common->capture_last_ptr))
365 {
366- shared_srcw[2] = common->capture_last_ptr;
367- shared_count = 3;
368- capture_last_found = TRUE;
369+ shared_srcw[shared_count] = common->capture_last_ptr;
370+ shared_count++;
371 }
372
373- if (common->optimized_cbracket[GET2(cc, 1 + LINK_SIZE)] == 0)
374+ if (common->optimized_cbracket[offset] == 0)
375 {
376- private_count = 1;
377- private_srcw[0] = OVECTOR_PRIV(GET2(cc, 1 + LINK_SIZE));
378+ private_srcw[0] = OVECTOR_PRIV(offset);
379+ if (recurse_check_bit(common, private_srcw[0]))
380+ private_count = 1;
381 }
382+
383 cc += 1 + LINK_SIZE + IMM2_SIZE;
384 break;
385
386 case OP_CBRAPOS:
387 case OP_SCBRAPOS:
388- offset = (GET2(cc, 1 + LINK_SIZE)) << 1;
389- shared_srcw[0] = OVECTOR(offset);
390- shared_srcw[1] = OVECTOR(offset + 1);
391- shared_count = 2;
392+ offset = GET2(cc, 1 + LINK_SIZE);
393+ shared_srcw[0] = OVECTOR(offset << 1);
394+ if (recurse_check_bit(common, shared_srcw[0]))
395+ {
396+ shared_srcw[1] = shared_srcw[0] + sizeof(sljit_sw);
397+ SLJIT_ASSERT(recurse_check_bit(common, shared_srcw[1]));
398+ shared_count = 2;
399+ }
400
401- if (common->capture_last_ptr != 0 && !capture_last_found)
402+ if (common->capture_last_ptr != 0 && recurse_check_bit(common, common->capture_last_ptr))
403 {
404- shared_srcw[2] = common->capture_last_ptr;
405- shared_count = 3;
406- capture_last_found = TRUE;
407+ shared_srcw[shared_count] = common->capture_last_ptr;
408+ shared_count++;
409 }
410
411- private_count = 2;
412 private_srcw[0] = PRIVATE_DATA(cc);
413- private_srcw[1] = OVECTOR_PRIV(GET2(cc, 1 + LINK_SIZE));
414+ if (recurse_check_bit(common, private_srcw[0]))
415+ private_count = 1;
416+
417+ offset = OVECTOR_PRIV(offset);
418+ if (recurse_check_bit(common, offset))
419+ {
420+ private_srcw[private_count] = offset;
421+ private_count++;
422+ }
423 cc += 1 + LINK_SIZE + IMM2_SIZE;
424 break;
425
426@@ -2545,18 +2613,17 @@ while (cc < ccend)
427 alternative = cc + GET(cc, 1);
428 if (*alternative == OP_KETRMAX || *alternative == OP_KETRMIN)
429 {
430- private_count = 1;
431 private_srcw[0] = PRIVATE_DATA(cc);
432+ if (recurse_check_bit(common, private_srcw[0]))
433+ private_count = 1;
434 }
435 cc += 1 + LINK_SIZE;
436 break;
437
438 CASE_ITERATOR_PRIVATE_DATA_1
439- if (PRIVATE_DATA(cc))
440- {
441+ private_srcw[0] = PRIVATE_DATA(cc);
442+ if (private_srcw[0] != 0 && recurse_check_bit(common, private_srcw[0]))
443 private_count = 1;
444- private_srcw[0] = PRIVATE_DATA(cc);
445- }
446 cc += 2;
447 #ifdef SUPPORT_UNICODE
448 if (common->utf && HAS_EXTRALEN(cc[-1])) cc += GET_EXTRALEN(cc[-1]);
449@@ -2564,11 +2631,12 @@ while (cc < ccend)
450 break;
451
452 CASE_ITERATOR_PRIVATE_DATA_2A
453- if (PRIVATE_DATA(cc))
454+ private_srcw[0] = PRIVATE_DATA(cc);
455+ if (private_srcw[0] != 0 && recurse_check_bit(common, private_srcw[0]))
456 {
457 private_count = 2;
458- private_srcw[0] = PRIVATE_DATA(cc);
459- private_srcw[1] = PRIVATE_DATA(cc) + sizeof(sljit_sw);
460+ private_srcw[1] = private_srcw[0] + sizeof(sljit_sw);
461+ SLJIT_ASSERT(recurse_check_bit(common, private_srcw[1]));
462 }
463 cc += 2;
464 #ifdef SUPPORT_UNICODE
465@@ -2577,11 +2645,12 @@ while (cc < ccend)
466 break;
467
468 CASE_ITERATOR_PRIVATE_DATA_2B
469- if (PRIVATE_DATA(cc))
470+ private_srcw[0] = PRIVATE_DATA(cc);
471+ if (private_srcw[0] != 0 && recurse_check_bit(common, private_srcw[0]))
472 {
473 private_count = 2;
474- private_srcw[0] = PRIVATE_DATA(cc);
475- private_srcw[1] = PRIVATE_DATA(cc) + sizeof(sljit_sw);
476+ private_srcw[1] = private_srcw[0] + sizeof(sljit_sw);
477+ SLJIT_ASSERT(recurse_check_bit(common, private_srcw[1]));
478 }
479 cc += 2 + IMM2_SIZE;
480 #ifdef SUPPORT_UNICODE
481@@ -2590,30 +2659,30 @@ while (cc < ccend)
482 break;
483
484 CASE_ITERATOR_TYPE_PRIVATE_DATA_1
485- if (PRIVATE_DATA(cc))
486- {
487+ private_srcw[0] = PRIVATE_DATA(cc);
488+ if (private_srcw[0] != 0 && recurse_check_bit(common, private_srcw[0]))
489 private_count = 1;
490- private_srcw[0] = PRIVATE_DATA(cc);
491- }
492 cc += 1;
493 break;
494
495 CASE_ITERATOR_TYPE_PRIVATE_DATA_2A
496- if (PRIVATE_DATA(cc))
497+ private_srcw[0] = PRIVATE_DATA(cc);
498+ if (private_srcw[0] != 0 && recurse_check_bit(common, private_srcw[0]))
499 {
500 private_count = 2;
501- private_srcw[0] = PRIVATE_DATA(cc);
502 private_srcw[1] = private_srcw[0] + sizeof(sljit_sw);
503+ SLJIT_ASSERT(recurse_check_bit(common, private_srcw[1]));
504 }
505 cc += 1;
506 break;
507
508 CASE_ITERATOR_TYPE_PRIVATE_DATA_2B
509- if (PRIVATE_DATA(cc))
510+ private_srcw[0] = PRIVATE_DATA(cc);
511+ if (private_srcw[0] != 0 && recurse_check_bit(common, private_srcw[0]))
512 {
513 private_count = 2;
514- private_srcw[0] = PRIVATE_DATA(cc);
515 private_srcw[1] = private_srcw[0] + sizeof(sljit_sw);
516+ SLJIT_ASSERT(recurse_check_bit(common, private_srcw[1]));
517 }
518 cc += 1 + IMM2_SIZE;
519 break;
520@@ -2630,14 +2699,17 @@ while (cc < ccend)
521 switch(get_class_iterator_size(cc + i))
522 {
523 case 1:
524- private_count = 1;
525 private_srcw[0] = PRIVATE_DATA(cc);
526 break;
527
528 case 2:
529- private_count = 2;
530 private_srcw[0] = PRIVATE_DATA(cc);
531- private_srcw[1] = private_srcw[0] + sizeof(sljit_sw);
532+ if (recurse_check_bit(common, private_srcw[0]))
533+ {
534+ private_count = 2;
535+ private_srcw[1] = private_srcw[0] + sizeof(sljit_sw);
536+ SLJIT_ASSERT(recurse_check_bit(common, private_srcw[1]));
537+ }
538 break;
539
540 default:
541@@ -2652,28 +2724,25 @@ while (cc < ccend)
542 case OP_PRUNE_ARG:
543 case OP_THEN_ARG:
544 SLJIT_ASSERT(common->mark_ptr != 0);
545- if (has_quit && !setmark_found)
546+ if (has_quit && recurse_check_bit(common, common->mark_ptr))
547 {
548 kept_shared_srcw[0] = common->mark_ptr;
549 kept_shared_count = 1;
550- setmark_found = TRUE;
551 }
552- if (common->control_head_ptr != 0 && !control_head_found)
553+ if (common->control_head_ptr != 0 && recurse_check_bit(common, common->control_head_ptr))
554 {
555 shared_srcw[0] = common->control_head_ptr;
556 shared_count = 1;
557- control_head_found = TRUE;
558 }
559 cc += 1 + 2 + cc[1];
560 break;
561
562 case OP_THEN:
563 SLJIT_ASSERT(common->control_head_ptr != 0);
564- if (!control_head_found)
565+ if (recurse_check_bit(common, common->control_head_ptr))
566 {
567 shared_srcw[0] = common->control_head_ptr;
568 shared_count = 1;
569- control_head_found = TRUE;
570 }
571 cc++;
572 break;
573@@ -2681,7 +2750,7 @@ while (cc < ccend)
574 default:
575 cc = next_opcode(common, cc);
576 SLJIT_ASSERT(cc != NULL);
577- break;
578+ continue;
579 }
580
581 if (type != recurse_copy_shared_to_global && type != recurse_copy_kept_shared_to_global)
582@@ -13262,7 +13331,7 @@ SLJIT_ASSERT(!(common->req_char_ptr != 0 && common->start_used_ptr != 0));
583 common->cbra_ptr = OVECTOR_START + (re->top_bracket + 1) * 2 * sizeof(sljit_sw);
584
585 total_length = ccend - common->start;
586-common->private_data_ptrs = (sljit_s32 *)SLJIT_MALLOC(total_length * (sizeof(sljit_s32) + (common->has_then ? 1 : 0)), allocator_data);
587+common->private_data_ptrs = (sljit_s32*)SLJIT_MALLOC(total_length * (sizeof(sljit_s32) + (common->has_then ? 1 : 0)), allocator_data);
588 if (!common->private_data_ptrs)
589 {
590 SLJIT_FREE(common->optimized_cbracket, allocator_data);
591@@ -13304,6 +13373,7 @@ if (!compiler)
592 common->compiler = compiler;
593
594 /* Main pcre_jit_exec entry. */
595+LJIT_ASSERT((private_data_size & (sizeof(sljit_sw) - 1)) == 0);
596 sljit_emit_enter(compiler, 0, SLJIT_ARG1(SW), 5, 5, 0, 0, private_data_size);
597
598 /* Register init. */
599@@ -13524,20 +13594,40 @@ common->fast_fail_end_ptr = 0;
600 common->currententry = common->entries;
601 common->local_quit_available = TRUE;
602 quit_label = common->quit_label;
603-while (common->currententry != NULL)
604+if (common->currententry != NULL)
605 {
606- /* Might add new entries. */
607- compile_recurse(common);
608- if (SLJIT_UNLIKELY(sljit_get_compiler_error(compiler)))
609+ /* A free bit for each private data. */
610+ common->recurse_bitset_size = ((private_data_size / (int)sizeof(sljit_sw)) + 7) >> 3;
611+ SLJIT_ASSERT(common->recurse_bitset_size > 0);
612+ common->recurse_bitset = (sljit_u8*)SLJIT_MALLOC(common->recurse_bitset_size, allocator_data);;
613+
614+ if (common->recurse_bitset != NULL)
615+ {
616+ do
617+ {
618+ /* Might add new entries. */
619+ compile_recurse(common);
620+ if (SLJIT_UNLIKELY(sljit_get_compiler_error(compiler)))
621+ break;
622+ flush_stubs(common);
623+ common->currententry = common->currententry->next;
624+ }
625+ while (common->currententry != NULL);
626+
627+ SLJIT_FREE(common->recurse_bitset, allocator_data);
628+ }
629+
630+ if (common->currententry != NULL)
631 {
632+ /* The common->recurse_bitset has been freed. */
633+ SLJIT_ASSERT(sljit_get_compiler_error(compiler) || common->recurse_bitset == NULL);
634+
635 sljit_free_compiler(compiler);
636 SLJIT_FREE(common->optimized_cbracket, allocator_data);
637 SLJIT_FREE(common->private_data_ptrs, allocator_data);
638 PRIV(jit_free_rodata)(common->read_only_data_head, allocator_data);
639 return PCRE2_ERROR_NOMEMORY;
640 }
641- flush_stubs(common);
642- common->currententry = common->currententry->next;
643 }
644 common->local_quit_available = FALSE;
645 common->quit_label = quit_label;
646diff --git a/src/pcre2_jit_test.c b/src/pcre2_jit_test.c
647index 9df87fd..2f84834 100644
648--- a/src/pcre2_jit_test.c
649+++ b/src/pcre2_jit_test.c
650@@ -746,6 +746,7 @@ static struct regression_test_case regression_test_cases[] = {
651 { MU, A, 0, 0, "((?(R)a|(?1)){1,3}?)M", "aaaM" },
652 { MU, A, 0, 0, "((.)(?:.|\\2(?1))){0}#(?1)#", "#aabbccdde# #aabbccddee#" },
653 { MU, A, 0, 0, "((.)(?:\\2|\\2{4}b)){0}#(?:(?1))+#", "#aaaab# #aaaaab#" },
654+ { MU, A, 0, 0 | F_NOMATCH, "(?1)$((.|\\2xx){1,2})", "abc" },
655
656 /* 16 bit specific tests. */
657 { CM, A, 0, 0 | F_FORCECONV, "\xc3\xa1", "\xc3\x81\xc3\xa1" },
658--
6592.25.1
660
diff --git a/meta/recipes-support/libpcre/libpcre2/CVE-2022-41409.patch b/meta/recipes-support/libpcre/libpcre2/CVE-2022-41409.patch
new file mode 100644
index 0000000000..882277ae73
--- /dev/null
+++ b/meta/recipes-support/libpcre/libpcre2/CVE-2022-41409.patch
@@ -0,0 +1,74 @@
1From 94e1c001761373b7d9450768aa15d04c25547a35 Mon Sep 17 00:00:00 2001
2From: Philip Hazel <Philip.Hazel@gmail.com>
3Date: Tue, 16 Aug 2022 17:00:45 +0100
4Subject: [PATCH] Diagnose negative repeat value in pcre2test subject line
5
6CVE: CVE-2022-41409
7Upstream-Status: Backport [https://github.com/PCRE2Project/pcre2/commit/94e1c001761373b7d9450768aa15d04c25547a35]
8
9Signed-off-by: Peter Marko <peter.marko@siemens.com>
10
11---
12 ChangeLog | 3 +++
13 src/pcre2test.c | 4 ++--
14 testdata/testinput2 | 3 +++
15 testdata/testoutput2 | 4 ++++
16 4 files changed, 12 insertions(+), 2 deletions(-)
17
18diff --git a/ChangeLog b/ChangeLog
19index eab50eb7..276eb57a 100644
20--- a/ChangeLog
21+++ b/ChangeLog
22@@ -7,6 +7,9 @@ fully read in caseless matching.
23 24. Fixed an issue affecting recursions in JIT caused by duplicated data
24 transfers.
25
26+20. A negative repeat value in a pcre2test subject line was not being
27+diagnosed, leading to infinite looping.
28+
29
30 Version 10.34 21-November-2019
31 ------------------------------
32diff --git a/src/pcre2test.c b/src/pcre2test.c
33index 08f86096..f6f5d66c 100644
34--- a/src/pcre2test.c
35+++ b/src/pcre2test.c
36@@ -6700,9 +6700,9 @@ while ((c = *p++) != 0)
37 }
38
39 i = (int32_t)li;
40- if (i-- == 0)
41+ if (i-- <= 0)
42 {
43- fprintf(outfile, "** Zero repeat not allowed\n");
44+ fprintf(outfile, "** Zero or negative repeat not allowed\n");
45 return PR_OK;
46 }
47
48diff --git a/testdata/testinput2 b/testdata/testinput2
49index 655e519..14e00ed 100644
50--- a/testdata/testinput2
51+++ b/testdata/testinput2
52@@ -5772,4 +5772,7 @@ a)"xI
53 /(a)?a/I
54 manm
55
56+--
57+ \[X]{-10}
58+
59 # End of testinput2
60diff --git a/testdata/testoutput2 b/testdata/testoutput2
61index c733c12..958f246 100644
62--- a/testdata/testoutput2
63+++ b/testdata/testoutput2
64@@ -17435,6 +17435,10 @@ Subject length lower bound = 1
65 manm
66 0: a
67
68+--
69+ \[X]{-10}
70+** Zero or negative repeat not allowed
71+
72 # End of testinput2
73 Error -70: PCRE2_ERROR_BADDATA (unknown error number)
74 Error -62: bad serialized data
diff --git a/meta/recipes-support/libpcre/libpcre2_10.34.bb b/meta/recipes-support/libpcre/libpcre2_10.34.bb
index fa8655e027..53277270d2 100644
--- a/meta/recipes-support/libpcre/libpcre2_10.34.bb
+++ b/meta/recipes-support/libpcre/libpcre2_10.34.bb
@@ -10,8 +10,12 @@ SECTION = "devel"
10LICENSE = "BSD-3-Clause" 10LICENSE = "BSD-3-Clause"
11LIC_FILES_CHKSUM = "file://LICENCE;md5=b1588d3bb4cb0e1f5a597d908f8c5b37" 11LIC_FILES_CHKSUM = "file://LICENCE;md5=b1588d3bb4cb0e1f5a597d908f8c5b37"
12 12
13SRC_URI = "https://ftp.pcre.org/pub/pcre/pcre2-${PV}.tar.bz2 \ 13SRC_URI = "http://downloads.yoctoproject.org/mirror/sources/pcre2-${PV}.tar.bz2 \
14 file://pcre-cross.patch \ 14 file://pcre-cross.patch \
15 file://CVE-2022-1586.patch \
16 file://CVE-2022-1586-regression.patch \
17 file://CVE-2022-1587.patch \
18 file://CVE-2022-41409.patch \
15" 19"
16 20
17SRC_URI[md5sum] = "d280b62ded13f9ccf2fac16ee5286366" 21SRC_URI[md5sum] = "d280b62ded13f9ccf2fac16ee5286366"
diff --git a/meta/recipes-support/libpcre/libpcre_8.44.bb b/meta/recipes-support/libpcre/libpcre_8.44.bb
index e5471e81da..3267c5ad72 100644
--- a/meta/recipes-support/libpcre/libpcre_8.44.bb
+++ b/meta/recipes-support/libpcre/libpcre_8.44.bb
@@ -7,8 +7,7 @@ HOMEPAGE = "http://www.pcre.org"
7SECTION = "devel" 7SECTION = "devel"
8LICENSE = "BSD-3-Clause" 8LICENSE = "BSD-3-Clause"
9LIC_FILES_CHKSUM = "file://LICENCE;md5=3bb381a66a5385b246d4877922e7511e" 9LIC_FILES_CHKSUM = "file://LICENCE;md5=3bb381a66a5385b246d4877922e7511e"
10SRC_URI = "https://ftp.pcre.org/pub/pcre/pcre-${PV}.tar.bz2 \ 10SRC_URI = "${SOURCEFORGE_MIRROR}/pcre/pcre-${PV}.tar.bz2 \
11 file://fix-pcre-name-collision.patch \
12 file://run-ptest \ 11 file://run-ptest \
13 file://Makefile \ 12 file://Makefile \
14 " 13 "
diff --git a/meta/recipes-support/libproxy/libproxy_0.4.15.bb b/meta/recipes-support/libproxy/libproxy_0.4.15.bb
index 6f704d7a91..6c7d5a68a1 100644
--- a/meta/recipes-support/libproxy/libproxy_0.4.15.bb
+++ b/meta/recipes-support/libproxy/libproxy_0.4.15.bb
@@ -1,4 +1,8 @@
1SUMMARY = "Library providing automatic proxy configuration management" 1SUMMARY = "Library providing automatic proxy configuration management"
2DESCRIPTION = "libproxy provides interfaces to get the proxy that will be \
3used to access network resources. It uses various plugins to get proxy \
4configuration via different mechanisms (e.g. environment variables or \
5desktop settings)."
2HOMEPAGE = "https://github.com/libproxy/libproxy" 6HOMEPAGE = "https://github.com/libproxy/libproxy"
3BUGTRACKER = "https://github.com/libproxy/libproxy/issues" 7BUGTRACKER = "https://github.com/libproxy/libproxy/issues"
4SECTION = "libs" 8SECTION = "libs"
diff --git a/meta/recipes-support/libpsl/libpsl_0.21.0.bb b/meta/recipes-support/libpsl/libpsl_0.21.0.bb
index 9831b4b94f..66e64f785c 100644
--- a/meta/recipes-support/libpsl/libpsl_0.21.0.bb
+++ b/meta/recipes-support/libpsl/libpsl_0.21.0.bb
@@ -1,4 +1,10 @@
1SUMMARY = "Public Suffix List library" 1SUMMARY = "Public Suffix List library"
2DESCRIPTION = "The libpsl package provides a library for accessing and \
3resolving information from the Public Suffix List (PSL). The PSL is a set of \
4domain names beyond the standard suffixes, such as .com."
5
6HOMEPAGE = "https://rockdaboot.github.io/libpsl/"
7BUGTRACKER = "https://github.com/rockdaboot/libpsl/issues"
2 8
3LICENSE = "MIT" 9LICENSE = "MIT"
4LIC_FILES_CHKSUM = "file://LICENSE;md5=5437030d9e4fbe7267ced058ddb8a7f5 \ 10LIC_FILES_CHKSUM = "file://LICENSE;md5=5437030d9e4fbe7267ced058ddb8a7f5 \
@@ -13,11 +19,10 @@ SRC_URI[sha256sum] = "41bd1c75a375b85c337b59783f5deb93dbb443fb0a52d257f403df7bd6
13 19
14UPSTREAM_CHECK_URI = "https://github.com/rockdaboot/libpsl/releases" 20UPSTREAM_CHECK_URI = "https://github.com/rockdaboot/libpsl/releases"
15 21
16DEPENDS = "libidn2"
17
18inherit autotools gettext gtk-doc manpages pkgconfig lib_package 22inherit autotools gettext gtk-doc manpages pkgconfig lib_package
19 23
20PACKAGECONFIG ??= "" 24PACKAGECONFIG ?= "idn2"
21PACKAGECONFIG[manpages] = "--enable-man,--disable-man,libxslt-native" 25PACKAGECONFIG[manpages] = "--enable-man,--disable-man,libxslt-native"
22 26PACKAGECONFIG[icu] = "--enable-runtime=libicu --enable-builtin=libicu,,icu"
27PACKAGECONFIG[idn2] = "--enable-runtime=libidn2 --enable-builtin=libidn2,,libidn2 libunistring"
23BBCLASSEXTEND = "native nativesdk" 28BBCLASSEXTEND = "native nativesdk"
diff --git a/meta/recipes-support/libsoup/libsoup-2.4_2.68.4.bb b/meta/recipes-support/libsoup/libsoup-2.4_2.68.4.bb
index f984a06aba..e42ac30bf2 100644
--- a/meta/recipes-support/libsoup/libsoup-2.4_2.68.4.bb
+++ b/meta/recipes-support/libsoup/libsoup-2.4_2.68.4.bb
@@ -1,11 +1,13 @@
1SUMMARY = "An HTTP library implementation in C" 1SUMMARY = "An HTTP library implementation in C"
2DESCRIPTION = "libsoup is an HTTP client/server library for GNOME. It uses GObjects \
3and the glib main loop, to integrate well with GNOME applications."
2HOMEPAGE = "https://wiki.gnome.org/Projects/libsoup" 4HOMEPAGE = "https://wiki.gnome.org/Projects/libsoup"
3BUGTRACKER = "https://bugzilla.gnome.org/" 5BUGTRACKER = "https://bugzilla.gnome.org/"
4SECTION = "x11/gnome/libs" 6SECTION = "x11/gnome/libs"
5LICENSE = "LGPLv2" 7LICENSE = "LGPLv2"
6LIC_FILES_CHKSUM = "file://COPYING;md5=5f30f0716dfdd0d91eb439ebec522ec2" 8LIC_FILES_CHKSUM = "file://COPYING;md5=5f30f0716dfdd0d91eb439ebec522ec2"
7 9
8DEPENDS = "glib-2.0 glib-2.0-native libxml2 sqlite3 intltool-native libpsl" 10DEPENDS = "glib-2.0 glib-2.0-native libxml2 sqlite3 libpsl"
9 11
10SHRT_VER = "${@d.getVar('PV').split('.')[0]}.${@d.getVar('PV').split('.')[1]}" 12SHRT_VER = "${@d.getVar('PV').split('.')[0]}.${@d.getVar('PV').split('.')[1]}"
11 13
diff --git a/meta/recipes-support/libunistring/libunistring_0.9.10.bb b/meta/recipes-support/libunistring/libunistring_0.9.10.bb
index 97fac4ecfa..2197b6656d 100644
--- a/meta/recipes-support/libunistring/libunistring_0.9.10.bb
+++ b/meta/recipes-support/libunistring/libunistring_0.9.10.bb
@@ -18,6 +18,7 @@ LIC_FILES_CHKSUM = "file://COPYING.LIB;md5=6a6a8e020838b23406c81b19c1d46df6 \
18 file://README;beginline=45;endline=65;md5=08287d16ba8d839faed8d2dc14d7d6a5 \ 18 file://README;beginline=45;endline=65;md5=08287d16ba8d839faed8d2dc14d7d6a5 \
19 file://doc/libunistring.texi;md5=287fa6075f78a3c85c1a52b0a92547cd \ 19 file://doc/libunistring.texi;md5=287fa6075f78a3c85c1a52b0a92547cd \
20 " 20 "
21DEPENDS = "gperf-native"
21 22
22SRC_URI = "${GNU_MIRROR}/libunistring/libunistring-${PV}.tar.gz \ 23SRC_URI = "${GNU_MIRROR}/libunistring/libunistring-${PV}.tar.gz \
23 file://iconv-m4-remove-the-test-to-convert-euc-jp.patch \ 24 file://iconv-m4-remove-the-test-to-convert-euc-jp.patch \
diff --git a/meta/recipes-support/libunwind/libunwind/0001-Fix-compilation-with-fno-common.patch b/meta/recipes-support/libunwind/libunwind/0001-Fix-compilation-with-fno-common.patch
new file mode 100644
index 0000000000..34a1f46b0f
--- /dev/null
+++ b/meta/recipes-support/libunwind/libunwind/0001-Fix-compilation-with-fno-common.patch
@@ -0,0 +1,420 @@
1From 51112447b316813ad1ae50ea66feca4eb755a424 Mon Sep 17 00:00:00 2001
2From: Yichao Yu <yyc1992@gmail.com>
3Date: Tue, 31 Mar 2020 00:43:32 -0400
4Subject: [PATCH] Fix compilation with -fno-common.
5
6[Khem Raj]
7Making all other archs consistent with IA64 which should not have this problem.
8Also move the FIXME to the correct place.
9
10Also add some minimum comments about this...
11
12[Philippe Coval]
13
14Patch ported to v1.3-stable branch,
15patch to be used used in openembedded-core dunfell branch (on v1.3.1)
16for oniro project.
17
18Upstream-Status: Backport [https://github.com/libunwind/libunwind/pull/166]
19Signed-off-by: Khem Raj <raj.khem@gmail.com>
20Thanks-to: Yichao Yu <yyc1992@gmail.com>
21Origin: https://github.com/libunwind/libunwind/commit/29e17d8d2ccbca07c423e3089a6d5ae8a1c9cb6e
22Relate-to: https://booting.oniroproject.org/distro/oniro/-/issues/191
23Forwarded: https://github.com/libunwind/libunwind/pull/312
24Last-Update: 2021-11-25
25Signed-off-by: Philippe Coval <philippe.coval@huawei.com>
26---
27 src/aarch64/Ginit.c | 15 +++++++--------
28 src/arm/Ginit.c | 15 +++++++--------
29 src/coredump/_UPT_get_dyn_info_list_addr.c | 5 +++++
30 src/hppa/Ginit.c | 15 +++++++--------
31 src/ia64/Ginit.c | 1 +
32 src/mi/Gfind_dynamic_proc_info.c | 1 +
33 src/mips/Ginit.c | 15 +++++++--------
34 src/ppc32/Ginit.c | 11 +++++++----
35 src/ppc64/Ginit.c | 11 +++++++----
36 src/ptrace/_UPT_get_dyn_info_list_addr.c | 5 +++++
37 src/sh/Ginit.c | 15 +++++++--------
38 src/tilegx/Ginit.c | 15 +++++++--------
39 src/x86/Ginit.c | 15 +++++++--------
40 src/x86_64/Ginit.c | 15 +++++++--------
41 14 files changed, 82 insertions(+), 72 deletions(-)
42
43diff --git a/src/aarch64/Ginit.c b/src/aarch64/Ginit.c
44index 9c4eae82..cb954b15 100644
45--- a/src/aarch64/Ginit.c
46+++ b/src/aarch64/Ginit.c
47@@ -61,13 +61,6 @@ tdep_uc_addr (ucontext_t *uc, int reg)
48
49 # endif /* UNW_LOCAL_ONLY */
50
51-HIDDEN unw_dyn_info_list_t _U_dyn_info_list;
52-
53-/* XXX fix me: there is currently no way to locate the dyn-info list
54- by a remote unwinder. On ia64, this is done via a special
55- unwind-table entry. Perhaps something similar can be done with
56- DWARF2 unwind info. */
57-
58 static void
59 put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg)
60 {
61@@ -78,7 +71,13 @@ static int
62 get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr,
63 void *arg)
64 {
65- *dyn_info_list_addr = (unw_word_t) &_U_dyn_info_list;
66+#ifndef UNW_LOCAL_ONLY
67+# pragma weak _U_dyn_info_list_addr
68+ if (!_U_dyn_info_list_addr)
69+ return -UNW_ENOINFO;
70+#endif
71+ // Access the `_U_dyn_info_list` from `LOCAL_ONLY` library, i.e. libunwind.so.
72+ *dyn_info_list_addr = _U_dyn_info_list_addr ();
73 return 0;
74 }
75
76diff --git a/src/arm/Ginit.c b/src/arm/Ginit.c
77index 2720d063..0bac0d72 100644
78--- a/src/arm/Ginit.c
79+++ b/src/arm/Ginit.c
80@@ -57,18 +57,17 @@ tdep_uc_addr (unw_tdep_context_t *uc, int reg)
81
82 # endif /* UNW_LOCAL_ONLY */
83
84-HIDDEN unw_dyn_info_list_t _U_dyn_info_list;
85-
86-/* XXX fix me: there is currently no way to locate the dyn-info list
87- by a remote unwinder. On ia64, this is done via a special
88- unwind-table entry. Perhaps something similar can be done with
89- DWARF2 unwind info. */
90-
91 static int
92 get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr,
93 void *arg)
94 {
95- *dyn_info_list_addr = (unw_word_t) &_U_dyn_info_list;
96+#ifndef UNW_LOCAL_ONLY
97+# pragma weak _U_dyn_info_list_addr
98+ if (!_U_dyn_info_list_addr)
99+ return -UNW_ENOINFO;
100+#endif
101+ // Access the `_U_dyn_info_list` from `LOCAL_ONLY` library, i.e. libunwind.so.
102+ *dyn_info_list_addr = _U_dyn_info_list_addr ();
103 return 0;
104 }
105
106diff --git a/src/coredump/_UPT_get_dyn_info_list_addr.c b/src/coredump/_UPT_get_dyn_info_list_addr.c
107index 0d119055..739ed056 100644
108--- a/src/coredump/_UPT_get_dyn_info_list_addr.c
109+++ b/src/coredump/_UPT_get_dyn_info_list_addr.c
110@@ -74,6 +74,11 @@ get_list_addr (unw_addr_space_t as, unw_word_t *dil_addr, void *arg,
111
112 #else
113
114+/* XXX fix me: there is currently no way to locate the dyn-info list
115+ by a remote unwinder. On ia64, this is done via a special
116+ unwind-table entry. Perhaps something similar can be done with
117+ DWARF2 unwind info. */
118+
119 static inline int
120 get_list_addr (unw_addr_space_t as, unw_word_t *dil_addr, void *arg,
121 int *countp)
122diff --git a/src/hppa/Ginit.c b/src/hppa/Ginit.c
123index 461e4b93..265455a6 100644
124--- a/src/hppa/Ginit.c
125+++ b/src/hppa/Ginit.c
126@@ -64,13 +64,6 @@ _Uhppa_uc_addr (ucontext_t *uc, int reg)
127
128 # endif /* UNW_LOCAL_ONLY */
129
130-HIDDEN unw_dyn_info_list_t _U_dyn_info_list;
131-
132-/* XXX fix me: there is currently no way to locate the dyn-info list
133- by a remote unwinder. On ia64, this is done via a special
134- unwind-table entry. Perhaps something similar can be done with
135- DWARF2 unwind info. */
136-
137 static void
138 put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg)
139 {
140@@ -81,7 +74,13 @@ static int
141 get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr,
142 void *arg)
143 {
144- *dyn_info_list_addr = (unw_word_t) &_U_dyn_info_list;
145+#ifndef UNW_LOCAL_ONLY
146+# pragma weak _U_dyn_info_list_addr
147+ if (!_U_dyn_info_list_addr)
148+ return -UNW_ENOINFO;
149+#endif
150+ // Access the `_U_dyn_info_list` from `LOCAL_ONLY` library, i.e. libunwind.so.
151+ *dyn_info_list_addr = _U_dyn_info_list_addr ();
152 return 0;
153 }
154
155diff --git a/src/ia64/Ginit.c b/src/ia64/Ginit.c
156index b09a2ad5..8601bb3c 100644
157--- a/src/ia64/Ginit.c
158+++ b/src/ia64/Ginit.c
159@@ -68,6 +68,7 @@ get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr,
160 if (!_U_dyn_info_list_addr)
161 return -UNW_ENOINFO;
162 #endif
163+ // Access the `_U_dyn_info_list` from `LOCAL_ONLY` library, i.e. libunwind.so.
164 *dyn_info_list_addr = _U_dyn_info_list_addr ();
165 return 0;
166 }
167diff --git a/src/mi/Gfind_dynamic_proc_info.c b/src/mi/Gfind_dynamic_proc_info.c
168index 98d35012..2e7c62e5 100644
169--- a/src/mi/Gfind_dynamic_proc_info.c
170+++ b/src/mi/Gfind_dynamic_proc_info.c
171@@ -49,6 +49,7 @@ local_find_proc_info (unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi,
172 return -UNW_ENOINFO;
173 #endif
174
175+ // Access the `_U_dyn_info_list` from `LOCAL_ONLY` library, i.e. libunwind.so.
176 list = (unw_dyn_info_list_t *) (uintptr_t) _U_dyn_info_list_addr ();
177 for (di = list->first; di; di = di->next)
178 if (ip >= di->start_ip && ip < di->end_ip)
179diff --git a/src/mips/Ginit.c b/src/mips/Ginit.c
180index 3df170c7..bf7a8f5a 100644
181--- a/src/mips/Ginit.c
182+++ b/src/mips/Ginit.c
183@@ -69,13 +69,6 @@ tdep_uc_addr (ucontext_t *uc, int reg)
184
185 # endif /* UNW_LOCAL_ONLY */
186
187-HIDDEN unw_dyn_info_list_t _U_dyn_info_list;
188-
189-/* XXX fix me: there is currently no way to locate the dyn-info list
190- by a remote unwinder. On ia64, this is done via a special
191- unwind-table entry. Perhaps something similar can be done with
192- DWARF2 unwind info. */
193-
194 static void
195 put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg)
196 {
197@@ -86,7 +79,13 @@ static int
198 get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr,
199 void *arg)
200 {
201- *dyn_info_list_addr = (unw_word_t) (intptr_t) &_U_dyn_info_list;
202+#ifndef UNW_LOCAL_ONLY
203+# pragma weak _U_dyn_info_list_addr
204+ if (!_U_dyn_info_list_addr)
205+ return -UNW_ENOINFO;
206+#endif
207+ // Access the `_U_dyn_info_list` from `LOCAL_ONLY` library, i.e. libunwind.so.
208+ *dyn_info_list_addr = _U_dyn_info_list_addr ();
209 return 0;
210 }
211
212diff --git a/src/ppc32/Ginit.c b/src/ppc32/Ginit.c
213index ba302448..7b454558 100644
214--- a/src/ppc32/Ginit.c
215+++ b/src/ppc32/Ginit.c
216@@ -91,9 +91,6 @@ tdep_uc_addr (ucontext_t *uc, int reg)
217
218 # endif /* UNW_LOCAL_ONLY */
219
220-HIDDEN unw_dyn_info_list_t _U_dyn_info_list;
221-
222-
223 static void
224 put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg)
225 {
226@@ -104,7 +101,13 @@ static int
227 get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr,
228 void *arg)
229 {
230- *dyn_info_list_addr = (unw_word_t) &_U_dyn_info_list;
231+#ifndef UNW_LOCAL_ONLY
232+# pragma weak _U_dyn_info_list_addr
233+ if (!_U_dyn_info_list_addr)
234+ return -UNW_ENOINFO;
235+#endif
236+ // Access the `_U_dyn_info_list` from `LOCAL_ONLY` library, i.e. libunwind.so.
237+ *dyn_info_list_addr = _U_dyn_info_list_addr ();
238 return 0;
239 }
240
241diff --git a/src/ppc64/Ginit.c b/src/ppc64/Ginit.c
242index 4c88cd6e..7bfb395a 100644
243--- a/src/ppc64/Ginit.c
244+++ b/src/ppc64/Ginit.c
245@@ -95,9 +95,6 @@ tdep_uc_addr (ucontext_t *uc, int reg)
246
247 # endif /* UNW_LOCAL_ONLY */
248
249-HIDDEN unw_dyn_info_list_t _U_dyn_info_list;
250-
251-
252 static void
253 put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg)
254 {
255@@ -108,7 +105,13 @@ static int
256 get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr,
257 void *arg)
258 {
259- *dyn_info_list_addr = (unw_word_t) &_U_dyn_info_list;
260+#ifndef UNW_LOCAL_ONLY
261+# pragma weak _U_dyn_info_list_addr
262+ if (!_U_dyn_info_list_addr)
263+ return -UNW_ENOINFO;
264+#endif
265+ // Access the `_U_dyn_info_list` from `LOCAL_ONLY` library, i.e. libunwind.so.
266+ *dyn_info_list_addr = _U_dyn_info_list_addr ();
267 return 0;
268 }
269
270diff --git a/src/ptrace/_UPT_get_dyn_info_list_addr.c b/src/ptrace/_UPT_get_dyn_info_list_addr.c
271index cc5ed044..16671d45 100644
272--- a/src/ptrace/_UPT_get_dyn_info_list_addr.c
273+++ b/src/ptrace/_UPT_get_dyn_info_list_addr.c
274@@ -71,6 +71,11 @@ get_list_addr (unw_addr_space_t as, unw_word_t *dil_addr, void *arg,
275
276 #else
277
278+/* XXX fix me: there is currently no way to locate the dyn-info list
279+ by a remote unwinder. On ia64, this is done via a special
280+ unwind-table entry. Perhaps something similar can be done with
281+ DWARF2 unwind info. */
282+
283 static inline int
284 get_list_addr (unw_addr_space_t as, unw_word_t *dil_addr, void *arg,
285 int *countp)
286diff --git a/src/sh/Ginit.c b/src/sh/Ginit.c
287index 52988a72..9fe96d2b 100644
288--- a/src/sh/Ginit.c
289+++ b/src/sh/Ginit.c
290@@ -58,13 +58,6 @@ tdep_uc_addr (ucontext_t *uc, int reg)
291
292 # endif /* UNW_LOCAL_ONLY */
293
294-HIDDEN unw_dyn_info_list_t _U_dyn_info_list;
295-
296-/* XXX fix me: there is currently no way to locate the dyn-info list
297- by a remote unwinder. On ia64, this is done via a special
298- unwind-table entry. Perhaps something similar can be done with
299- DWARF2 unwind info. */
300-
301 static void
302 put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg)
303 {
304@@ -75,7 +68,13 @@ static int
305 get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr,
306 void *arg)
307 {
308- *dyn_info_list_addr = (unw_word_t) &_U_dyn_info_list;
309+#ifndef UNW_LOCAL_ONLY
310+# pragma weak _U_dyn_info_list_addr
311+ if (!_U_dyn_info_list_addr)
312+ return -UNW_ENOINFO;
313+#endif
314+ // Access the `_U_dyn_info_list` from `LOCAL_ONLY` library, i.e. libunwind.so.
315+ *dyn_info_list_addr = _U_dyn_info_list_addr ();
316 return 0;
317 }
318
319diff --git a/src/tilegx/Ginit.c b/src/tilegx/Ginit.c
320index 7564a558..925e6413 100644
321--- a/src/tilegx/Ginit.c
322+++ b/src/tilegx/Ginit.c
323@@ -64,13 +64,6 @@ tdep_uc_addr (ucontext_t *uc, int reg)
324
325 # endif /* UNW_LOCAL_ONLY */
326
327-HIDDEN unw_dyn_info_list_t _U_dyn_info_list;
328-
329-/* XXX fix me: there is currently no way to locate the dyn-info list
330- by a remote unwinder. On ia64, this is done via a special
331- unwind-table entry. Perhaps something similar can be done with
332- DWARF2 unwind info. */
333-
334 static void
335 put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg)
336 {
337@@ -81,7 +74,13 @@ static int
338 get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr,
339 void *arg)
340 {
341- *dyn_info_list_addr = (unw_word_t) (intptr_t) &_U_dyn_info_list;
342+#ifndef UNW_LOCAL_ONLY
343+# pragma weak _U_dyn_info_list_addr
344+ if (!_U_dyn_info_list_addr)
345+ return -UNW_ENOINFO;
346+#endif
347+ // Access the `_U_dyn_info_list` from `LOCAL_ONLY` library, i.e. libunwind.so.
348+ *dyn_info_list_addr = _U_dyn_info_list_addr ();
349 return 0;
350 }
351
352diff --git a/src/x86/Ginit.c b/src/x86/Ginit.c
353index f6b8dc27..3cec74a2 100644
354--- a/src/x86/Ginit.c
355+++ b/src/x86/Ginit.c
356@@ -54,13 +54,6 @@ tdep_uc_addr (ucontext_t *uc, int reg)
357
358 # endif /* UNW_LOCAL_ONLY */
359
360-HIDDEN unw_dyn_info_list_t _U_dyn_info_list;
361-
362-/* XXX fix me: there is currently no way to locate the dyn-info list
363- by a remote unwinder. On ia64, this is done via a special
364- unwind-table entry. Perhaps something similar can be done with
365- DWARF2 unwind info. */
366-
367 static void
368 put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg)
369 {
370@@ -71,7 +64,13 @@ static int
371 get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr,
372 void *arg)
373 {
374- *dyn_info_list_addr = (unw_word_t) &_U_dyn_info_list;
375+#ifndef UNW_LOCAL_ONLY
376+# pragma weak _U_dyn_info_list_addr
377+ if (!_U_dyn_info_list_addr)
378+ return -UNW_ENOINFO;
379+#endif
380+ // Access the `_U_dyn_info_list` from `LOCAL_ONLY` library, i.e. libunwind.so.
381+ *dyn_info_list_addr = _U_dyn_info_list_addr ();
382 return 0;
383 }
384
385diff --git a/src/x86_64/Ginit.c b/src/x86_64/Ginit.c
386index b7e8e462..fe6bcc33 100644
387--- a/src/x86_64/Ginit.c
388+++ b/src/x86_64/Ginit.c
389@@ -49,13 +49,6 @@ static struct unw_addr_space local_addr_space;
390
391 unw_addr_space_t unw_local_addr_space = &local_addr_space;
392
393-HIDDEN unw_dyn_info_list_t _U_dyn_info_list;
394-
395-/* XXX fix me: there is currently no way to locate the dyn-info list
396- by a remote unwinder. On ia64, this is done via a special
397- unwind-table entry. Perhaps something similar can be done with
398- DWARF2 unwind info. */
399-
400 static void
401 put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg)
402 {
403@@ -66,7 +59,13 @@ static int
404 get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr,
405 void *arg)
406 {
407- *dyn_info_list_addr = (unw_word_t) &_U_dyn_info_list;
408+#ifndef UNW_LOCAL_ONLY
409+# pragma weak _U_dyn_info_list_addr
410+ if (!_U_dyn_info_list_addr)
411+ return -UNW_ENOINFO;
412+#endif
413+ // Access the `_U_dyn_info_list` from `LOCAL_ONLY` library, i.e. libunwind.so.
414+ *dyn_info_list_addr = _U_dyn_info_list_addr ();
415 return 0;
416 }
417
418--
4192.32.0
420
diff --git a/meta/recipes-support/libunwind/libunwind_1.3.1.bb b/meta/recipes-support/libunwind/libunwind_1.3.1.bb
index 037e04c3c0..8ae94a834c 100644
--- a/meta/recipes-support/libunwind/libunwind_1.3.1.bb
+++ b/meta/recipes-support/libunwind/libunwind_1.3.1.bb
@@ -7,6 +7,7 @@ SRC_URI = "http://download.savannah.nongnu.org/releases/libunwind/libunwind-${PV
7 file://0004-Fix-build-on-mips-musl.patch \ 7 file://0004-Fix-build-on-mips-musl.patch \
8 file://0005-ppc32-Consider-ucontext-mismatches-between-glibc-and.patch \ 8 file://0005-ppc32-Consider-ucontext-mismatches-between-glibc-and.patch \
9 file://0006-Fix-for-X32.patch \ 9 file://0006-Fix-for-X32.patch \
10 file://0001-Fix-compilation-with-fno-common.patch \
10 " 11 "
11SRC_URI_append_libc-musl = " file://musl-header-conflict.patch" 12SRC_URI_append_libc-musl = " file://musl-header-conflict.patch"
12 13
diff --git a/meta/recipes-support/liburcu/liburcu_0.11.1.bb b/meta/recipes-support/liburcu/liburcu_0.11.1.bb
index 6a517e6f29..1902415c90 100644
--- a/meta/recipes-support/liburcu/liburcu_0.11.1.bb
+++ b/meta/recipes-support/liburcu/liburcu_0.11.1.bb
@@ -1,4 +1,7 @@
1SUMMARY = "Userspace RCU (read-copy-update) library" 1SUMMARY = "Userspace RCU (read-copy-update) library"
2DESCRIPTION = "A userspace RCU (read-copy-update) library. This data \
3synchronization library provides read-side access which scales linearly \
4with the number of cores. "
2HOMEPAGE = "http://lttng.org/urcu" 5HOMEPAGE = "http://lttng.org/urcu"
3BUGTRACKER = "http://lttng.org/project/issues" 6BUGTRACKER = "http://lttng.org/project/issues"
4 7
diff --git a/meta/recipes-support/libusb/libusb1_1.0.22.bb b/meta/recipes-support/libusb/libusb1_1.0.22.bb
index 1d9d772575..ffa8f0320c 100644
--- a/meta/recipes-support/libusb/libusb1_1.0.22.bb
+++ b/meta/recipes-support/libusb/libusb1_1.0.22.bb
@@ -1,5 +1,7 @@
1SUMMARY = "Userspace library to access USB (version 1.0)" 1SUMMARY = "Userspace library to access USB (version 1.0)"
2HOMEPAGE = "http://libusb.sf.net" 2DESCRIPTION = "A cross-platform library to access USB devices from Linux, \
3macOS, Windows, OpenBSD/NetBSD, Haiku and Solaris userspace."
4HOMEPAGE = "https://libusb.info"
3BUGTRACKER = "http://www.libusb.org/report" 5BUGTRACKER = "http://www.libusb.org/report"
4SECTION = "libs" 6SECTION = "libs"
5 7
@@ -8,7 +10,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=fbc093901857fcd118f065f900982c24"
8 10
9BBCLASSEXTEND = "native nativesdk" 11BBCLASSEXTEND = "native nativesdk"
10 12
11SRC_URI = "${SOURCEFORGE_MIRROR}/libusb/libusb-${PV}.tar.bz2 \ 13SRC_URI = "https://github.com/libusb/libusb/releases/download/v${PV}/libusb-${PV}.tar.bz2 \
12 file://no-dll.patch \ 14 file://no-dll.patch \
13 file://run-ptest \ 15 file://run-ptest \
14 " 16 "
diff --git a/meta/recipes-support/libxslt/libxslt/CVE-2021-30560.patch b/meta/recipes-support/libxslt/libxslt/CVE-2021-30560.patch
new file mode 100644
index 0000000000..614047ea7a
--- /dev/null
+++ b/meta/recipes-support/libxslt/libxslt/CVE-2021-30560.patch
@@ -0,0 +1,201 @@
1From 50f9c9cd3b7dfe9b3c8c795247752d1fdcadcac8 Mon Sep 17 00:00:00 2001
2From: Nick Wellnhofer <wellnhofer@aevum.de>
3Date: Sat, 12 Jun 2021 20:02:53 +0200
4Subject: [PATCH] Fix use-after-free in xsltApplyTemplates
5
6xsltApplyTemplates without a select expression could delete nodes in
7the source document.
8
91. Text nodes with strippable whitespace
10
11Whitespace from input documents is already stripped, so there's no
12need to strip it again. Under certain circumstances, xsltApplyTemplates
13could be fooled into deleting text nodes that are still referenced,
14resulting in a use-after-free.
15
162. The DTD
17
18The DTD was only unlinked, but there's no good reason to do this just
19now. Maybe it was meant as a micro-optimization.
20
213. Unknown nodes
22
23Useless and dangerous as well, especially with XInclude nodes.
24See https://gitlab.gnome.org/GNOME/libxml2/-/issues/268
25
26Simply stop trying to uselessly delete nodes when applying a template.
27This part of the code is probably a leftover from a time where
28xsltApplyStripSpaces wasn't implemented yet. Also note that
29xsltApplyTemplates with a select expression never tried to delete
30nodes.
31
32Also stop xsltDefaultProcessOneNode from deleting nodes for the same
33reasons.
34
35This fixes CVE-2021-30560.
36
37CVE: CVE-2021-30560
38Upstream-Status: Backport [https://github.com/GNOME/libxslt/commit/50f9c9cd3b7dfe9b3c8c795247752d1fdcadcac8.patch]
39Comment: No change in any hunk
40Signed-off-by: Omkar Patil <Omkar.Patil@kpit.com>
41
42---
43 libxslt/transform.c | 119 +++-----------------------------------------
44 1 file changed, 7 insertions(+), 112 deletions(-)
45
46diff --git a/libxslt/transform.c b/libxslt/transform.c
47index 04522154..3aba354f 100644
48--- a/libxslt/transform.c
49+++ b/libxslt/transform.c
50@@ -1895,7 +1895,7 @@ static void
51 xsltDefaultProcessOneNode(xsltTransformContextPtr ctxt, xmlNodePtr node,
52 xsltStackElemPtr params) {
53 xmlNodePtr copy;
54- xmlNodePtr delete = NULL, cur;
55+ xmlNodePtr cur;
56 int nbchild = 0, oldSize;
57 int childno = 0, oldPos;
58 xsltTemplatePtr template;
59@@ -1968,54 +1968,13 @@ xsltDefaultProcessOneNode(xsltTransformContextPtr ctxt, xmlNodePtr node,
60 return;
61 }
62 /*
63- * Handling of Elements: first pass, cleanup and counting
64+ * Handling of Elements: first pass, counting
65 */
66 cur = node->children;
67 while (cur != NULL) {
68- switch (cur->type) {
69- case XML_TEXT_NODE:
70- case XML_CDATA_SECTION_NODE:
71- case XML_DOCUMENT_NODE:
72- case XML_HTML_DOCUMENT_NODE:
73- case XML_ELEMENT_NODE:
74- case XML_PI_NODE:
75- case XML_COMMENT_NODE:
76- nbchild++;
77- break;
78- case XML_DTD_NODE:
79- /* Unlink the DTD, it's still reachable using doc->intSubset */
80- if (cur->next != NULL)
81- cur->next->prev = cur->prev;
82- if (cur->prev != NULL)
83- cur->prev->next = cur->next;
84- break;
85- default:
86-#ifdef WITH_XSLT_DEBUG_PROCESS
87- XSLT_TRACE(ctxt,XSLT_TRACE_PROCESS_NODE,xsltGenericDebug(xsltGenericDebugContext,
88- "xsltDefaultProcessOneNode: skipping node type %d\n",
89- cur->type));
90-#endif
91- delete = cur;
92- }
93+ if (IS_XSLT_REAL_NODE(cur))
94+ nbchild++;
95 cur = cur->next;
96- if (delete != NULL) {
97-#ifdef WITH_XSLT_DEBUG_PROCESS
98- XSLT_TRACE(ctxt,XSLT_TRACE_PROCESS_NODE,xsltGenericDebug(xsltGenericDebugContext,
99- "xsltDefaultProcessOneNode: removing ignorable blank node\n"));
100-#endif
101- xmlUnlinkNode(delete);
102- xmlFreeNode(delete);
103- delete = NULL;
104- }
105- }
106- if (delete != NULL) {
107-#ifdef WITH_XSLT_DEBUG_PROCESS
108- XSLT_TRACE(ctxt,XSLT_TRACE_PROCESS_NODE,xsltGenericDebug(xsltGenericDebugContext,
109- "xsltDefaultProcessOneNode: removing ignorable blank node\n"));
110-#endif
111- xmlUnlinkNode(delete);
112- xmlFreeNode(delete);
113- delete = NULL;
114 }
115
116 /*
117@@ -4864,7 +4823,7 @@ xsltApplyTemplates(xsltTransformContextPtr ctxt, xmlNodePtr node,
118 xsltStylePreCompPtr comp = (xsltStylePreCompPtr) castedComp;
119 #endif
120 int i;
121- xmlNodePtr cur, delNode = NULL, oldContextNode;
122+ xmlNodePtr cur, oldContextNode;
123 xmlNodeSetPtr list = NULL, oldList;
124 xsltStackElemPtr withParams = NULL;
125 int oldXPProximityPosition, oldXPContextSize;
126@@ -4998,73 +4957,9 @@ xsltApplyTemplates(xsltTransformContextPtr ctxt, xmlNodePtr node,
127 else
128 cur = NULL;
129 while (cur != NULL) {
130- switch (cur->type) {
131- case XML_TEXT_NODE:
132- if ((IS_BLANK_NODE(cur)) &&
133- (cur->parent != NULL) &&
134- (cur->parent->type == XML_ELEMENT_NODE) &&
135- (ctxt->style->stripSpaces != NULL)) {
136- const xmlChar *val;
137-
138- if (cur->parent->ns != NULL) {
139- val = (const xmlChar *)
140- xmlHashLookup2(ctxt->style->stripSpaces,
141- cur->parent->name,
142- cur->parent->ns->href);
143- if (val == NULL) {
144- val = (const xmlChar *)
145- xmlHashLookup2(ctxt->style->stripSpaces,
146- BAD_CAST "*",
147- cur->parent->ns->href);
148- }
149- } else {
150- val = (const xmlChar *)
151- xmlHashLookup2(ctxt->style->stripSpaces,
152- cur->parent->name, NULL);
153- }
154- if ((val != NULL) &&
155- (xmlStrEqual(val, (xmlChar *) "strip"))) {
156- delNode = cur;
157- break;
158- }
159- }
160- /* Intentional fall-through */
161- case XML_ELEMENT_NODE:
162- case XML_DOCUMENT_NODE:
163- case XML_HTML_DOCUMENT_NODE:
164- case XML_CDATA_SECTION_NODE:
165- case XML_PI_NODE:
166- case XML_COMMENT_NODE:
167- xmlXPathNodeSetAddUnique(list, cur);
168- break;
169- case XML_DTD_NODE:
170- /* Unlink the DTD, it's still reachable
171- * using doc->intSubset */
172- if (cur->next != NULL)
173- cur->next->prev = cur->prev;
174- if (cur->prev != NULL)
175- cur->prev->next = cur->next;
176- break;
177- case XML_NAMESPACE_DECL:
178- break;
179- default:
180-#ifdef WITH_XSLT_DEBUG_PROCESS
181- XSLT_TRACE(ctxt,XSLT_TRACE_APPLY_TEMPLATES,xsltGenericDebug(xsltGenericDebugContext,
182- "xsltApplyTemplates: skipping cur type %d\n",
183- cur->type));
184-#endif
185- delNode = cur;
186- }
187+ if (IS_XSLT_REAL_NODE(cur))
188+ xmlXPathNodeSetAddUnique(list, cur);
189 cur = cur->next;
190- if (delNode != NULL) {
191-#ifdef WITH_XSLT_DEBUG_PROCESS
192- XSLT_TRACE(ctxt,XSLT_TRACE_APPLY_TEMPLATES,xsltGenericDebug(xsltGenericDebugContext,
193- "xsltApplyTemplates: removing ignorable blank cur\n"));
194-#endif
195- xmlUnlinkNode(delNode);
196- xmlFreeNode(delNode);
197- delNode = NULL;
198- }
199 }
200 }
201
diff --git a/meta/recipes-support/libxslt/libxslt_1.1.34.bb b/meta/recipes-support/libxslt/libxslt_1.1.34.bb
index 1961bb5b31..4755677bec 100644
--- a/meta/recipes-support/libxslt/libxslt_1.1.34.bb
+++ b/meta/recipes-support/libxslt/libxslt_1.1.34.bb
@@ -1,4 +1,9 @@
1SUMMARY = "GNOME XSLT library" 1SUMMARY = "GNOME XSLT library"
2DESCRIPTION = "libxslt is the XSLT C parser and toolkit developed for the Gnome project. \
3XSLT itself is a an XML language to define transformation for XML. Libxslt is based on \
4libxml2 the XML C library developed for the GNOME project. It also implements most of \
5the EXSLT set of processor-portable extensions functions and some of Saxon's evaluate \
6and expressions extensions."
2HOMEPAGE = "http://xmlsoft.org/XSLT/" 7HOMEPAGE = "http://xmlsoft.org/XSLT/"
3BUGTRACKER = "https://bugzilla.gnome.org/" 8BUGTRACKER = "https://bugzilla.gnome.org/"
4 9
@@ -9,6 +14,7 @@ SECTION = "libs"
9DEPENDS = "libxml2" 14DEPENDS = "libxml2"
10 15
11SRC_URI = "http://xmlsoft.org/sources/libxslt-${PV}.tar.gz \ 16SRC_URI = "http://xmlsoft.org/sources/libxslt-${PV}.tar.gz \
17 file://CVE-2021-30560.patch \
12 " 18 "
13 19
14SRC_URI[md5sum] = "db8765c8d076f1b6caafd9f2542a304a" 20SRC_URI[md5sum] = "db8765c8d076f1b6caafd9f2542a304a"
@@ -16,6 +22,10 @@ SRC_URI[sha256sum] = "98b1bd46d6792925ad2dfe9a87452ea2adebf69dcb9919ffd55bf926a7
16 22
17UPSTREAM_CHECK_REGEX = "libxslt-(?P<pver>\d+(\.\d+)+)\.tar" 23UPSTREAM_CHECK_REGEX = "libxslt-(?P<pver>\d+(\.\d+)+)\.tar"
18 24
25# We have libxml2 2.9.10 and we don't link statically with it anyway
26# so this isn't an issue.
27CVE_CHECK_WHITELIST += "CVE-2022-29824"
28
19S = "${WORKDIR}/libxslt-${PV}" 29S = "${WORKDIR}/libxslt-${PV}"
20 30
21BINCONFIG = "${bindir}/xslt-config" 31BINCONFIG = "${bindir}/xslt-config"
diff --git a/meta/recipes-support/lz4/files/CVE-2021-3520.patch b/meta/recipes-support/lz4/files/CVE-2021-3520.patch
new file mode 100644
index 0000000000..5ac8f6691f
--- /dev/null
+++ b/meta/recipes-support/lz4/files/CVE-2021-3520.patch
@@ -0,0 +1,27 @@
1From 8301a21773ef61656225e264f4f06ae14462bca7 Mon Sep 17 00:00:00 2001
2From: Jasper Lievisse Adriaanse <j@jasper.la>
3Date: Fri, 26 Feb 2021 15:21:20 +0100
4Subject: [PATCH] Fix potential memory corruption with negative memmove() size
5
6Upstream-Status: Backport
7https://github.com/lz4/lz4/commit/8301a21773ef61656225e264f4f06ae14462bca7#diff-7055e9cf14c488aea9837aaf9f528b58ee3c22988d7d0d81d172ec62d94a88a7
8CVE: CVE-2021-3520
9Signed-off-by: Armin Kuster <akuster@mvista.com>
10
11---
12 lib/lz4.c | 2 +-
13 1 file changed, 1 insertion(+), 1 deletion(-)
14
15Index: git/lib/lz4.c
16===================================================================
17--- git.orig/lib/lz4.c
18+++ git/lib/lz4.c
19@@ -1665,7 +1665,7 @@ LZ4_decompress_generic(
20 const size_t dictSize /* note : = 0 if noDict */
21 )
22 {
23- if (src == NULL) { return -1; }
24+ if ((src == NULL) || (outputSize < 0)) { return -1; }
25
26 { const BYTE* ip = (const BYTE*) src;
27 const BYTE* const iend = ip + srcSize;
diff --git a/meta/recipes-support/lz4/lz4_1.9.2.bb b/meta/recipes-support/lz4/lz4_1.9.2.bb
index 455d2a5141..bc11a57eb5 100644
--- a/meta/recipes-support/lz4/lz4_1.9.2.bb
+++ b/meta/recipes-support/lz4/lz4_1.9.2.bb
@@ -1,5 +1,6 @@
1SUMMARY = "Extremely Fast Compression algorithm" 1SUMMARY = "Extremely Fast Compression algorithm"
2DESCRIPTION = "LZ4 is a very fast lossless compression algorithm, providing compression speed at 400 MB/s per core, scalable with multi-cores CPU. It also features an extremely fast decoder, with speed in multiple GB/s per core, typically reaching RAM speed limits on multi-core systems." 2DESCRIPTION = "LZ4 is a very fast lossless compression algorithm, providing compression speed at 400 MB/s per core, scalable with multi-cores CPU. It also features an extremely fast decoder, with speed in multiple GB/s per core, typically reaching RAM speed limits on multi-core systems."
3HOMEPAGE = "https://github.com/lz4/lz4"
3 4
4LICENSE = "BSD | BSD-2-Clause | GPL-2.0" 5LICENSE = "BSD | BSD-2-Clause | GPL-2.0"
5LIC_FILES_CHKSUM = "file://lib/LICENSE;md5=ebc2ea4814a64de7708f1571904b32cc \ 6LIC_FILES_CHKSUM = "file://lib/LICENSE;md5=ebc2ea4814a64de7708f1571904b32cc \
@@ -11,8 +12,13 @@ PE = "1"
11 12
12SRCREV = "fdf2ef5809ca875c454510610764d9125ef2ebbd" 13SRCREV = "fdf2ef5809ca875c454510610764d9125ef2ebbd"
13 14
14SRC_URI = "git://github.com/lz4/lz4.git;branch=dev \ 15# remove at next version upgrade or when output changes
16PR = "r1"
17HASHEQUIV_HASH_VERSION .= ".1"
18
19SRC_URI = "git://github.com/lz4/lz4.git;branch=dev;protocol=https \
15 file://run-ptest \ 20 file://run-ptest \
21 file://CVE-2021-3520.patch \
16 " 22 "
17UPSTREAM_CHECK_GITTAGREGEX = "v(?P<pver>.*)" 23UPSTREAM_CHECK_GITTAGREGEX = "v(?P<pver>.*)"
18 24
@@ -21,7 +27,7 @@ S = "${WORKDIR}/git"
21# Fixed in r118, which is larger than the current version. 27# Fixed in r118, which is larger than the current version.
22CVE_CHECK_WHITELIST += "CVE-2014-4715" 28CVE_CHECK_WHITELIST += "CVE-2014-4715"
23 29
24EXTRA_OEMAKE = "PREFIX=${prefix} CC='${CC}' DESTDIR=${D} LIBDIR=${libdir} INCLUDEDIR=${includedir} BUILD_STATIC=no" 30EXTRA_OEMAKE = "PREFIX=${prefix} CC='${CC}' CFLAGS='${CFLAGS}' DESTDIR=${D} LIBDIR=${libdir} INCLUDEDIR=${includedir} BUILD_STATIC=no"
25 31
26do_install() { 32do_install() {
27 oe_runmake install 33 oe_runmake install
diff --git a/meta/recipes-support/lzo/lzo_2.10.bb b/meta/recipes-support/lzo/lzo_2.10.bb
index 8eefec3cc9..f0c8631aea 100644
--- a/meta/recipes-support/lzo/lzo_2.10.bb
+++ b/meta/recipes-support/lzo/lzo_2.10.bb
@@ -1,4 +1,6 @@
1SUMMARY = "Lossless data compression library" 1SUMMARY = "Lossless data compression library"
2DESCRIPTION = "A portable lossless data compression library written in \
3ANSI C that offers pretty fast compression and *extremely* fast decompression. "
2HOMEPAGE = "http://www.oberhumer.com/opensource/lzo/" 4HOMEPAGE = "http://www.oberhumer.com/opensource/lzo/"
3SECTION = "libs" 5SECTION = "libs"
4LICENSE = "GPLv2+" 6LICENSE = "GPLv2+"
@@ -16,6 +18,8 @@ SRC_URI[sha256sum] = "c0f892943208266f9b6543b3ae308fab6284c5c90e627931446fb49b42
16 18
17inherit autotools ptest 19inherit autotools ptest
18 20
21CVE_PRODUCT = "lzo oberhumer:lzo2"
22
19EXTRA_OECONF = "--enable-shared" 23EXTRA_OECONF = "--enable-shared"
20 24
21do_install_ptest() { 25do_install_ptest() {
diff --git a/meta/recipes-support/lzop/lzop_1.04.bb b/meta/recipes-support/lzop/lzop_1.04.bb
index b50c230437..59c2003b74 100644
--- a/meta/recipes-support/lzop/lzop_1.04.bb
+++ b/meta/recipes-support/lzop/lzop_1.04.bb
@@ -5,6 +5,7 @@ gzip are much higher compression and decompression speed at the cost of some \n\
5compression ratio. The lzop compression utility was designed with the goals \n\ 5compression ratio. The lzop compression utility was designed with the goals \n\
6of reliability, speed, portability and with reasonable drop-in compatibility \n\ 6of reliability, speed, portability and with reasonable drop-in compatibility \n\
7to gzip." 7to gzip."
8HOMEPAGE = "http://www.lzop.org/"
8DEPENDS += "lzo" 9DEPENDS += "lzo"
9 10
10LICENSE = "GPLv2+" 11LICENSE = "GPLv2+"
diff --git a/meta/recipes-support/mpfr/mpfr_4.0.2.bb b/meta/recipes-support/mpfr/mpfr_4.0.2.bb
index 00c2dc2fe9..0ac73f031f 100644
--- a/meta/recipes-support/mpfr/mpfr_4.0.2.bb
+++ b/meta/recipes-support/mpfr/mpfr_4.0.2.bb
@@ -1,4 +1,5 @@
1SUMMARY = "C library for multiple-precision floating-point computations with exact rounding" 1SUMMARY = "C library for multiple-precision floating-point computations with exact rounding"
2DESCRIPTION = "The GNU Multiple Precision Floating-Point Reliable Library (GNU MPFR) is a GNU portable C library for arbitrary-precision binary floating-point computation with correct rounding, based on GNU Multi-Precision Library. MPFR's computation is both efficient and has a well-defined semantics: the functions are completely specified on all the possible operands and the results do not depend on the platform."
2HOMEPAGE = "https://www.mpfr.org/" 3HOMEPAGE = "https://www.mpfr.org/"
3LICENSE = "LGPLv3+" 4LICENSE = "LGPLv3+"
4SECTION = "devel" 5SECTION = "devel"
diff --git a/meta/recipes-support/nettle/nettle-3.5.1/CVE-2021-20305-1.patch b/meta/recipes-support/nettle/nettle-3.5.1/CVE-2021-20305-1.patch
new file mode 100644
index 0000000000..cfc0f382fa
--- /dev/null
+++ b/meta/recipes-support/nettle/nettle-3.5.1/CVE-2021-20305-1.patch
@@ -0,0 +1,215 @@
1Backport of:
2
3From a63893791280d441c713293491da97c79c0950fe Mon Sep 17 00:00:00 2001
4From: =?UTF-8?q?Niels=20M=C3=B6ller?= <nisse@lysator.liu.se>
5Date: Thu, 11 Mar 2021 19:37:41 +0100
6Subject: [PATCH] New functions ecc_mod_mul_canonical and
7 ecc_mod_sqr_canonical.
8
9* ecc-mod-arith.c (ecc_mod_mul_canonical, ecc_mod_sqr_canonical):
10New functions.
11* ecc-internal.h: Declare and document new functions.
12* curve448-eh-to-x.c (curve448_eh_to_x): Use ecc_mod_sqr_canonical.
13* curve25519-eh-to-x.c (curve25519_eh_to_x): Use ecc_mod_mul_canonical.
14* ecc-eh-to-a.c (ecc_eh_to_a): Likewise.
15* ecc-j-to-a.c (ecc_j_to_a): Likewise.
16* ecc-mul-m.c (ecc_mul_m): Likewise.
17
18(cherry picked from commit 2bf497ba4d6acc6f352bca015837fad33008565c)
19
20Upstream-Status: Backport
21https://sources.debian.org/data/main/n/nettle/3.4.1-1%2Bdeb10u1/debian/patches/CVE-2021-20305-1.patch
22CVE: CVE-2021-20305 dep1
23Signed-off-by: Armin Kuster <akuster@mvista.com>
24
25---
26 ChangeLog | 11 +++++++++++
27 curve25519-eh-to-x.c | 6 +-----
28 curve448-eh-to-x.c | 5 +----
29 ecc-eh-to-a.c | 12 ++----------
30 ecc-internal.h | 15 +++++++++++++++
31 ecc-j-to-a.c | 15 +++------------
32 ecc-mod-arith.c | 24 ++++++++++++++++++++++++
33 ecc-mul-m.c | 6 ++----
34 8 files changed, 59 insertions(+), 35 deletions(-)
35
36#diff --git a/ChangeLog b/ChangeLog
37#index fd138d82..5cc5c188 100644
38#--- a/ChangeLog
39#+++ b/ChangeLog
40#@@ -1,3 +1,14 @@
41#+2021-03-11 Niels Möller <nisse@lysator.liu.se>
42#+
43#+ * ecc-mod-arith.c (ecc_mod_mul_canonical, ecc_mod_sqr_canonical):
44#+ New functions.
45#+ * ecc-internal.h: Declare and document new functions.
46#+ * curve448-eh-to-x.c (curve448_eh_to_x): Use ecc_mod_sqr_canonical.
47#+ * curve25519-eh-to-x.c (curve25519_eh_to_x): Use ecc_mod_mul_canonical.
48#+ * ecc-eh-to-a.c (ecc_eh_to_a): Likewise.
49#+ * ecc-j-to-a.c (ecc_j_to_a): Likewise.
50#+ * ecc-mul-m.c (ecc_mul_m): Likewise.
51#+
52# 2021-02-17 Niels Möller <nisse@lysator.liu.se>
53#
54# * Released Nettle-3.7.1.
55Index: nettle-3.5.1/curve25519-eh-to-x.c
56===================================================================
57--- nettle-3.5.1.orig/curve25519-eh-to-x.c
58+++ nettle-3.5.1/curve25519-eh-to-x.c
59@@ -53,7 +53,6 @@ curve25519_eh_to_x (mp_limb_t *xp, const
60 #define t2 (scratch + 2*ecc->p.size)
61
62 const struct ecc_curve *ecc = &_nettle_curve25519;
63- mp_limb_t cy;
64
65 /* If u = U/W and v = V/W are the coordiantes of the point on the
66 Edwards curve we get the curve25519 x coordinate as
67@@ -69,10 +68,7 @@ curve25519_eh_to_x (mp_limb_t *xp, const
68 ecc->p.invert (&ecc->p, t1, t0, t2 + ecc->p.size);
69
70 ecc_modp_add (ecc, t0, wp, vp);
71- ecc_modp_mul (ecc, t2, t0, t1);
72-
73- cy = mpn_sub_n (xp, t2, ecc->p.m, ecc->p.size);
74- cnd_copy (cy, xp, t2, ecc->p.size);
75+ ecc_mod_mul_canonical (&ecc->p, xp, t0, t1, t2);
76 #undef vp
77 #undef wp
78 #undef t0
79Index: nettle-3.5.1/ecc-eh-to-a.c
80===================================================================
81--- nettle-3.5.1.orig/ecc-eh-to-a.c
82+++ nettle-3.5.1/ecc-eh-to-a.c
83@@ -59,9 +59,7 @@ ecc_eh_to_a (const struct ecc_curve *ecc
84 /* Needs 2*size + scratch for the invert call. */
85 ecc->p.invert (&ecc->p, izp, zp, tp + ecc->p.size);
86
87- ecc_modp_mul (ecc, tp, xp, izp);
88- cy = mpn_sub_n (r, tp, ecc->p.m, ecc->p.size);
89- cnd_copy (cy, r, tp, ecc->p.size);
90+ ecc_mod_mul_canonical (&ecc->p, r, xp, izp, tp);
91
92 if (op)
93 {
94@@ -81,7 +79,5 @@ ecc_eh_to_a (const struct ecc_curve *ecc
95 }
96 return;
97 }
98- ecc_modp_mul (ecc, tp, yp, izp);
99- cy = mpn_sub_n (r + ecc->p.size, tp, ecc->p.m, ecc->p.size);
100- cnd_copy (cy, r + ecc->p.size, tp, ecc->p.size);
101+ ecc_mod_mul_canonical (&ecc->p, r + ecc->p.size, yp, izp, tp);
102 }
103Index: nettle-3.5.1/ecc-internal.h
104===================================================================
105--- nettle-3.5.1.orig/ecc-internal.h
106+++ nettle-3.5.1/ecc-internal.h
107@@ -49,6 +49,8 @@
108 #define ecc_mod_submul_1 _nettle_ecc_mod_submul_1
109 #define ecc_mod_mul _nettle_ecc_mod_mul
110 #define ecc_mod_sqr _nettle_ecc_mod_sqr
111+#define ecc_mod_mul_canonical _nettle_ecc_mod_mul_canonical
112+#define ecc_mod_sqr_canonical _nettle_ecc_mod_sqr_canonical
113 #define ecc_mod_random _nettle_ecc_mod_random
114 #define ecc_mod _nettle_ecc_mod
115 #define ecc_mod_inv _nettle_ecc_mod_inv
116@@ -263,6 +265,19 @@ ecc_mod_sqr (const struct ecc_modulo *m,
117 #define ecc_modq_mul(ecc, r, a, b) \
118 ecc_mod_mul (&(ecc)->q, (r), (a), (b))
119
120+/* These mul and sqr functions produce a canonical result, 0 <= R < M.
121+ Requirements on input and output areas are similar to the above
122+ functions, except that it is *not* allowed to pass rp = rp +
123+ m->size.
124+ */
125+void
126+ecc_mod_mul_canonical (const struct ecc_modulo *m, mp_limb_t *rp,
127+ const mp_limb_t *ap, const mp_limb_t *bp, mp_limb_t *tp);
128+
129+void
130+ecc_mod_sqr_canonical (const struct ecc_modulo *m, mp_limb_t *rp,
131+ const mp_limb_t *ap, mp_limb_t *tp);
132+
133 /* mod q operations. */
134 void
135 ecc_mod_random (const struct ecc_modulo *m, mp_limb_t *xp,
136Index: nettle-3.5.1/ecc-j-to-a.c
137===================================================================
138--- nettle-3.5.1.orig/ecc-j-to-a.c
139+++ nettle-3.5.1/ecc-j-to-a.c
140@@ -51,8 +51,6 @@ ecc_j_to_a (const struct ecc_curve *ecc,
141 #define izBp (scratch + 3*ecc->p.size)
142 #define tp scratch
143
144- mp_limb_t cy;
145-
146 if (ecc->use_redc)
147 {
148 /* Set v = (r_z / B^2)^-1,
149@@ -86,17 +84,14 @@ ecc_j_to_a (const struct ecc_curve *ecc,
150 ecc_modp_sqr (ecc, iz2p, izp);
151 }
152
153- ecc_modp_mul (ecc, iz3p, iz2p, p);
154- /* ecc_modp (and ecc_modp_mul) may return a value up to 2p - 1, so
155- do a conditional subtraction. */
156- cy = mpn_sub_n (r, iz3p, ecc->p.m, ecc->p.size);
157- cnd_copy (cy, r, iz3p, ecc->p.size);
158+ ecc_mod_mul_canonical (&ecc->p, r, iz2p, p, iz3p);
159
160 if (op)
161 {
162 /* Skip y coordinate */
163 if (op > 1)
164 {
165+ mp_limb_t cy;
166 /* Also reduce the x coordinate mod ecc->q. It should
167 already be < 2*ecc->q, so one subtraction should
168 suffice. */
169@@ -106,10 +101,7 @@ ecc_j_to_a (const struct ecc_curve *ecc,
170 return;
171 }
172 ecc_modp_mul (ecc, iz3p, iz2p, izp);
173- ecc_modp_mul (ecc, tp, iz3p, p + ecc->p.size);
174- /* And a similar subtraction. */
175- cy = mpn_sub_n (r + ecc->p.size, tp, ecc->p.m, ecc->p.size);
176- cnd_copy (cy, r + ecc->p.size, tp, ecc->p.size);
177+ ecc_mod_mul_canonical (&ecc->p, r + ecc->p.size, iz3p, p + ecc->p.size, iz3p);
178
179 #undef izp
180 #undef up
181Index: nettle-3.5.1/ecc-mod-arith.c
182===================================================================
183--- nettle-3.5.1.orig/ecc-mod-arith.c
184+++ nettle-3.5.1/ecc-mod-arith.c
185@@ -119,6 +119,30 @@ ecc_mod_mul (const struct ecc_modulo *m,
186 }
187
188 void
189+ecc_mod_mul_canonical (const struct ecc_modulo *m, mp_limb_t *rp,
190+ const mp_limb_t *ap, const mp_limb_t *bp, mp_limb_t *tp)
191+{
192+ mp_limb_t cy;
193+ mpn_mul_n (tp + m->size, ap, bp, m->size);
194+ m->reduce (m, tp + m->size);
195+
196+ cy = mpn_sub_n (rp, tp + m->size, m->m, m->size);
197+ cnd_copy (cy, rp, tp + m->size, m->size);
198+}
199+
200+void
201+ecc_mod_sqr_canonical (const struct ecc_modulo *m, mp_limb_t *rp,
202+ const mp_limb_t *ap, mp_limb_t *tp)
203+{
204+ mp_limb_t cy;
205+ mpn_sqr (tp + m->size, ap, m->size);
206+ m->reduce (m, tp + m->size);
207+
208+ cy = mpn_sub_n (rp, tp + m->size, m->m, m->size);
209+ cnd_copy (cy, rp, tp + m->size, m->size);
210+}
211+
212+void
213 ecc_mod_sqr (const struct ecc_modulo *m, mp_limb_t *rp,
214 const mp_limb_t *ap)
215 {
diff --git a/meta/recipes-support/nettle/nettle-3.5.1/CVE-2021-20305-2.patch b/meta/recipes-support/nettle/nettle-3.5.1/CVE-2021-20305-2.patch
new file mode 100644
index 0000000000..bb56b14c8c
--- /dev/null
+++ b/meta/recipes-support/nettle/nettle-3.5.1/CVE-2021-20305-2.patch
@@ -0,0 +1,53 @@
1Backport of:
2
3From 971bed6ab4b27014eb23085e8176917e1a096fd5 Mon Sep 17 00:00:00 2001
4From: =?UTF-8?q?Niels=20M=C3=B6ller?= <nisse@lysator.liu.se>
5Date: Sat, 13 Mar 2021 17:26:37 +0100
6Subject: [PATCH] Use ecc_mod_mul_canonical for point comparison.
7
8* eddsa-verify.c (equal_h): Use ecc_mod_mul_canonical.
9
10(cherry picked from commit 5b7608fde3a6d2ab82bffb35db1e4e330927c906)
11
12Upstream-Status: Backport
13https://sources.debian.org/data/main/n/nettle/3.4.1-1%2Bdeb10u1/debian/patches/CVE-2021-20305-2.patch
14CVE: CVE-2021-20305 dep2
15Signed-off-by: Armin Kuster <akuster@mvista.com>
16
17---
18 ChangeLog | 4 ++++
19 eddsa-verify.c | 9 ++-------
20 2 files changed, 6 insertions(+), 7 deletions(-)
21
22#diff --git a/ChangeLog b/ChangeLog
23#index 5cc5c188..2a9217a6 100644
24#--- a/ChangeLog
25#+++ b/ChangeLog
26#@@ -1,3 +1,7 @@
27#+2021-03-13 Niels Möller <nisse@lysator.liu.se>
28#+
29#+ * eddsa-verify.c (equal_h): Use ecc_mod_mul_canonical.
30#+
31# 2021-03-11 Niels Möller <nisse@lysator.liu.se>
32#
33# * ecc-mod-arith.c (ecc_mod_mul_canonical, ecc_mod_sqr_canonical):
34Index: nettle-3.5.1/eddsa-verify.c
35===================================================================
36--- nettle-3.5.1.orig/eddsa-verify.c
37+++ nettle-3.5.1/eddsa-verify.c
38@@ -53,13 +53,8 @@ equal_h (const struct ecc_modulo *p,
39 #define t0 scratch
40 #define t1 (scratch + p->size)
41
42- ecc_mod_mul (p, t0, x1, z2);
43- if (mpn_cmp (t0, p->m, p->size) >= 0)
44- mpn_sub_n (t0, t0, p->m, p->size);
45-
46- ecc_mod_mul (p, t1, x2, z1);
47- if (mpn_cmp (t1, p->m, p->size) >= 0)
48- mpn_sub_n (t1, t1, p->m, p->size);
49+ ecc_mod_mul_canonical (p, t0, x1, z2, t0);
50+ ecc_mod_mul_canonical (p, t1, x2, z1, t1);
51
52 return mpn_cmp (t0, t1, p->size) == 0;
53
diff --git a/meta/recipes-support/nettle/nettle-3.5.1/CVE-2021-20305-3.patch b/meta/recipes-support/nettle/nettle-3.5.1/CVE-2021-20305-3.patch
new file mode 100644
index 0000000000..15a892ecdf
--- /dev/null
+++ b/meta/recipes-support/nettle/nettle-3.5.1/CVE-2021-20305-3.patch
@@ -0,0 +1,122 @@
1Backport of:
2
3From 74ee0e82b6891e090f20723750faeb19064e31b2 Mon Sep 17 00:00:00 2001
4From: =?UTF-8?q?Niels=20M=C3=B6ller?= <nisse@lysator.liu.se>
5Date: Sat, 13 Mar 2021 15:19:19 +0100
6Subject: [PATCH] Fix bug in ecc_ecdsa_verify.
7
8* ecc-ecdsa-verify.c (ecc_ecdsa_verify): Use ecc_mod_mul_canonical
9to compute the scalars used for ecc multiplication.
10* testsuite/ecdsa-verify-test.c (test_main): Add test case that
11triggers an assert on 64-bit platforms, without above fix.
12* testsuite/ecdsa-sign-test.c (test_main): Test case generating
13the same signature.
14
15(cherry picked from commit 2397757b3f95fcae1e2d3011bf99ca5b5438378f)
16
17Upstream-Status: Backport
18https://sources.debian.org/data/main/n/nettle/3.4.1-1%2Bdeb10u1/debian/patches/CVE-2021-20305-3.patch
19CVE: CVE-2021-20305 dep3
20[Minor fixup on _nettle_secp_224r1]
21Signed-off-by: Armin Kuster <akuster@mvista.com>
22
23---
24 ChangeLog | 10 +++++++++-
25 ecc-ecdsa-verify.c | 4 ++--
26 testsuite/ecdsa-sign-test.c | 13 +++++++++++++
27 testsuite/ecdsa-verify-test.c | 20 ++++++++++++++++++++
28 4 files changed, 44 insertions(+), 3 deletions(-)
29
30#diff --git a/ChangeLog b/ChangeLog
31#index 2a9217a6..63848f53 100644
32#--- a/ChangeLog
33#+++ b/ChangeLog
34#@@ -1,7 +1,15 @@
35# 2021-03-13 Niels Möller <nisse@lysator.liu.se>
36#
37#- * eddsa-verify.c (equal_h): Use ecc_mod_mul_canonical.
38#+ * ecc-ecdsa-verify.c (ecc_ecdsa_verify): Use ecc_mod_mul_canonical
39#+ to compute the scalars used for ecc multiplication.
40#+ * testsuite/ecdsa-verify-test.c (test_main): Add test case that
41#+ triggers an assert on 64-bit platforms, without above fix.
42#+ * testsuite/ecdsa-sign-test.c (test_main): Test case generating
43#+ the same signature.
44#+
45#+2021-03-13 Niels Möller <nisse@lysator.liu.se>
46#
47#+ * eddsa-verify.c (equal_h): Use ecc_mod_mul_canonical.
48# 2021-03-11 Niels Möller <nisse@lysator.liu.se>
49#
50# * ecc-mod-arith.c (ecc_mod_mul_canonical, ecc_mod_sqr_canonical):
51Index: nettle-3.5.1/ecc-ecdsa-verify.c
52===================================================================
53--- nettle-3.5.1.orig/ecc-ecdsa-verify.c
54+++ nettle-3.5.1/ecc-ecdsa-verify.c
55@@ -112,10 +112,10 @@ ecc_ecdsa_verify (const struct ecc_curve
56
57 /* u1 = h / s, P1 = u1 * G */
58 ecc_hash (&ecc->q, hp, length, digest);
59- ecc_modq_mul (ecc, u1, hp, sinv);
60+ ecc_mod_mul_canonical (&ecc->q, u1, hp, sinv, u1);
61
62 /* u2 = r / s, P2 = u2 * Y */
63- ecc_modq_mul (ecc, u2, rp, sinv);
64+ ecc_mod_mul_canonical (&ecc->q, u2, rp, sinv, u2);
65
66 /* Total storage: 5*ecc->p.size + ecc->mul_itch */
67 ecc->mul (ecc, P2, u2, pp, u2 + ecc->p.size);
68Index: nettle-3.5.1/testsuite/ecdsa-sign-test.c
69===================================================================
70--- nettle-3.5.1.orig/testsuite/ecdsa-sign-test.c
71+++ nettle-3.5.1/testsuite/ecdsa-sign-test.c
72@@ -58,6 +58,19 @@ test_ecdsa (const struct ecc_curve *ecc,
73 void
74 test_main (void)
75 {
76+ /* Producing the signature for corresponding test in
77+ ecdsa-verify-test.c, with special u1 and u2. */
78+ test_ecdsa (&_nettle_secp_224r1,
79+ "99b5b787484def12894ca507058b3bf5"
80+ "43d72d82fa7721d2e805e5e6",
81+ "2",
82+ SHEX("cdb887ac805a3b42e22d224c85482053"
83+ "16c755d4a736bb2032c92553"),
84+ "706a46dc76dcb76798e60e6d89474788"
85+ "d16dc18032d268fd1a704fa6", /* r */
86+ "3a41e1423b1853e8aa89747b1f987364"
87+ "44705d6d6d8371ea1f578f2e"); /* s */
88+
89 /* Test cases for the smaller groups, verified with a
90 proof-of-concept implementation done for Yubico AB. */
91 test_ecdsa (&_nettle_secp_192r1,
92Index: nettle-3.5.1/testsuite/ecdsa-verify-test.c
93===================================================================
94--- nettle-3.5.1.orig/testsuite/ecdsa-verify-test.c
95+++ nettle-3.5.1/testsuite/ecdsa-verify-test.c
96@@ -81,6 +81,26 @@ test_ecdsa (const struct ecc_curve *ecc,
97 void
98 test_main (void)
99 {
100+ /* Corresponds to nonce k = 2 and private key z =
101+ 0x99b5b787484def12894ca507058b3bf543d72d82fa7721d2e805e5e6. z and
102+ hash are chosen so that intermediate scalars in the verify
103+ equations are u1 = 0x6b245680e700, u2 =
104+ 259da6542d4ba7d21ad916c3bd57f811. These values require canonical
105+ reduction of the scalars. Bug caused by missing canonical
106+ reduction reported by Guido Vranken. */
107+ test_ecdsa (&_nettle_secp_224r1,
108+ "9e7e6cc6b1bdfa8ee039b66ad85e5490"
109+ "7be706a900a3cba1c8fdd014", /* x */
110+ "74855db3f7c1b4097ae095745fc915e3"
111+ "8a79d2a1de28f282eafb22ba", /* y */
112+
113+ SHEX("cdb887ac805a3b42e22d224c85482053"
114+ "16c755d4a736bb2032c92553"),
115+ "706a46dc76dcb76798e60e6d89474788"
116+ "d16dc18032d268fd1a704fa6", /* r */
117+ "3a41e1423b1853e8aa89747b1f987364"
118+ "44705d6d6d8371ea1f578f2e"); /* s */
119+
120 /* From RFC 4754 */
121 test_ecdsa (&_nettle_secp_256r1,
122 "2442A5CC 0ECD015F A3CA31DC 8E2BBC70"
diff --git a/meta/recipes-support/nettle/nettle-3.5.1/CVE-2021-20305-4.patch b/meta/recipes-support/nettle/nettle-3.5.1/CVE-2021-20305-4.patch
new file mode 100644
index 0000000000..54b4fa584c
--- /dev/null
+++ b/meta/recipes-support/nettle/nettle-3.5.1/CVE-2021-20305-4.patch
@@ -0,0 +1,48 @@
1Backport of:
2
3From 51f643eee00e2caa65c8a2f5857f49acdf3ef1ce Mon Sep 17 00:00:00 2001
4From: =?UTF-8?q?Niels=20M=C3=B6ller?= <nisse@lysator.liu.se>
5Date: Sat, 13 Mar 2021 16:27:50 +0100
6Subject: [PATCH] Ensure ecdsa_sign output is canonically reduced.
7
8* ecc-ecdsa-sign.c (ecc_ecdsa_sign): Ensure s output is reduced to
9canonical range.
10
11(cherry picked from commit c24b36160dc5303f7541dd9da1429c4046f27398)
12
13Upstream-Status: Backport
14https://sources.debian.org/data/main/n/nettle/3.4.1-1%2Bdeb10u1/debian/patches/CVE-2021-20305-4.patch
15CVE: CVE-2021-20305 dep4
16Signed-off-by: Armin Kuster <akuster@mvista.com>
17
18---
19 ChangeLog | 3 +++
20 ecc-ecdsa-sign.c | 3 +--
21 2 files changed, 4 insertions(+), 2 deletions(-)
22
23#diff --git a/ChangeLog b/ChangeLog
24#index 63848f53..fb2d7f66 100644
25#--- a/ChangeLog
26#+++ b/ChangeLog
27#@@ -1,5 +1,8 @@
28# 2021-03-13 Niels Möller <nisse@lysator.liu.se>
29#
30#+ * ecc-ecdsa-sign.c (ecc_ecdsa_sign): Ensure s output is reduced to
31#+ canonical range.
32#+
33# * ecc-ecdsa-verify.c (ecc_ecdsa_verify): Use ecc_mod_mul_canonical
34# to compute the scalars used for ecc multiplication.
35# * testsuite/ecdsa-verify-test.c (test_main): Add test case that
36--- a/ecc-ecdsa-sign.c
37+++ b/ecc-ecdsa-sign.c
38@@ -90,9 +90,8 @@ ecc_ecdsa_sign (const struct ecc_curve *
39
40 ecc_modq_mul (ecc, tp, zp, rp);
41 ecc_modq_add (ecc, hp, hp, tp);
42- ecc_modq_mul (ecc, tp, hp, kinv);
43+ ecc_mod_mul_canonical (&ecc->q, sp, hp, kinv, tp);
44
45- mpn_copyi (sp, tp, ecc->p.size);
46 #undef P
47 #undef hp
48 #undef kinv
diff --git a/meta/recipes-support/nettle/nettle-3.5.1/CVE-2021-20305-5.patch b/meta/recipes-support/nettle/nettle-3.5.1/CVE-2021-20305-5.patch
new file mode 100644
index 0000000000..468ff66266
--- /dev/null
+++ b/meta/recipes-support/nettle/nettle-3.5.1/CVE-2021-20305-5.patch
@@ -0,0 +1,53 @@
1Backport of:
2
3From ae3801a0e5cce276c270973214385c86048d5f7b Mon Sep 17 00:00:00 2001
4From: =?UTF-8?q?Niels=20M=C3=B6ller?= <nisse@lysator.liu.se>
5Date: Sat, 13 Mar 2021 16:42:21 +0100
6Subject: [PATCH] Similar fix for eddsa.
7
8* eddsa-hash.c (_eddsa_hash): Ensure result is canonically
9reduced. Two of the three call sites need that.
10
11(cherry picked from commit d9b564e4b3b3a5691afb9328c7342b3f7ca64288)
12
13
14Upstream-Status: Backport
15https://sources.debian.org/data/main/n/nettle/3.4.1-1%2Bdeb10u1/debian/patches/CVE-2021-20305-6.patch
16CVE: CVE-2021-20305
17Signed-off-by: Armin Kuster <akuster@mvista.com>
18
19---
20 ChangeLog | 3 +++
21 eddsa-hash.c | 10 +++++++---
22 2 files changed, 10 insertions(+), 3 deletions(-)
23
24#diff --git a/ChangeLog b/ChangeLog
25#index 5f8a22c2..ce330831 100644
26#--- a/ChangeLog
27#+++ b/ChangeLog
28#@@ -1,5 +1,8 @@
29# 2021-03-13 Niels Möller <nisse@lysator.liu.se>
30#
31#+ * eddsa-hash.c (_eddsa_hash): Ensure result is canonically
32#+ reduced. Two of the three call sites need that.
33#+
34# * ecc-gostdsa-verify.c (ecc_gostdsa_verify): Use ecc_mod_mul_canonical
35# to compute the scalars used for ecc multiplication.
36#
37Index: nettle-3.5.1/eddsa-hash.c
38===================================================================
39--- nettle-3.5.1.orig/eddsa-hash.c
40+++ nettle-3.5.1/eddsa-hash.c
41@@ -46,7 +46,12 @@ void
42 _eddsa_hash (const struct ecc_modulo *m,
43 mp_limb_t *rp, const uint8_t *digest)
44 {
45+ mp_limb_t cy;
46 size_t nbytes = 1 + m->bit_size / 8;
47 mpn_set_base256_le (rp, 2*m->size, digest, 2*nbytes);
48 m->mod (m, rp);
49+ mpn_copyi (rp + m->size, rp, m->size);
50+ /* Ensure canonical reduction. */
51+ cy = mpn_sub_n (rp, rp + m->size, m->m, m->size);
52+ cnd_copy (cy, rp, rp + m->size, m->size);
53 }
diff --git a/meta/recipes-support/nettle/nettle-3.5.1/CVE-2021-3580_1.patch b/meta/recipes-support/nettle/nettle-3.5.1/CVE-2021-3580_1.patch
new file mode 100644
index 0000000000..ac3a638e72
--- /dev/null
+++ b/meta/recipes-support/nettle/nettle-3.5.1/CVE-2021-3580_1.patch
@@ -0,0 +1,277 @@
1From cd6059aebdd3059fbcf674dddb850b821c13b6c2 Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Niels=20M=C3=B6ller?= <nisse@lysator.liu.se>
3Date: Tue, 8 Jun 2021 21:31:39 +0200
4Subject: [PATCH 1/2] Change _rsa_sec_compute_root_tr to take a fix input size.
5
6Improves consistency with _rsa_sec_compute_root, and fixes zero-input bug.
7
8(cherry picked from commit 485b5e2820a057e873b1ba812fdb39cae4adf98c)
9
10Upstream-Status: Backport
11CVE: CVE-2021-3580 dep#1
12Signed-off-by: Armin Kuster <akuster@mvista.com>
13
14---
15 ChangeLog | 17 +++++++++-
16 rsa-decrypt-tr.c | 7 ++---
17 rsa-internal.h | 4 +--
18 rsa-sec-decrypt.c | 9 ++++--
19 rsa-sign-tr.c | 61 +++++++++++++++++-------------------
20 testsuite/rsa-encrypt-test.c | 14 ++++++++-
21 6 files changed, 69 insertions(+), 43 deletions(-)
22
23Index: nettle-3.5.1/rsa-decrypt-tr.c
24===================================================================
25--- nettle-3.5.1.orig/rsa-decrypt-tr.c
26+++ nettle-3.5.1/rsa-decrypt-tr.c
27@@ -52,14 +52,13 @@ rsa_decrypt_tr(const struct rsa_public_k
28 mp_size_t key_limb_size;
29 int res;
30
31- key_limb_size = NETTLE_OCTET_SIZE_TO_LIMB_SIZE(key->size);
32+ key_limb_size = mpz_size(pub->n);
33
34 TMP_GMP_ALLOC (m, key_limb_size);
35 TMP_GMP_ALLOC (em, key->size);
36+ mpz_limbs_copy(m, gibberish, key_limb_size);
37
38- res = _rsa_sec_compute_root_tr (pub, key, random_ctx, random, m,
39- mpz_limbs_read(gibberish),
40- mpz_size(gibberish));
41+ res = _rsa_sec_compute_root_tr (pub, key, random_ctx, random, m, m);
42
43 mpn_get_base256 (em, key->size, m, key_limb_size);
44
45Index: nettle-3.5.1/rsa-internal.h
46===================================================================
47--- nettle-3.5.1.orig/rsa-internal.h
48+++ nettle-3.5.1/rsa-internal.h
49@@ -78,11 +78,11 @@ _rsa_sec_compute_root(const struct rsa_p
50 mp_limb_t *scratch);
51
52 /* Safe side-channel silent variant, using RSA blinding, and checking the
53- * result after CRT. */
54+ * result after CRT. In-place calls, with x == m, is allowed. */
55 int
56 _rsa_sec_compute_root_tr(const struct rsa_public_key *pub,
57 const struct rsa_private_key *key,
58 void *random_ctx, nettle_random_func *random,
59- mp_limb_t *x, const mp_limb_t *m, size_t mn);
60+ mp_limb_t *x, const mp_limb_t *m);
61
62 #endif /* NETTLE_RSA_INTERNAL_H_INCLUDED */
63Index: nettle-3.5.1/rsa-sec-decrypt.c
64===================================================================
65--- nettle-3.5.1.orig/rsa-sec-decrypt.c
66+++ nettle-3.5.1/rsa-sec-decrypt.c
67@@ -58,9 +58,12 @@ rsa_sec_decrypt(const struct rsa_public_
68 TMP_GMP_ALLOC (m, mpz_size(pub->n));
69 TMP_GMP_ALLOC (em, key->size);
70
71- res = _rsa_sec_compute_root_tr (pub, key, random_ctx, random, m,
72- mpz_limbs_read(gibberish),
73- mpz_size(gibberish));
74+ /* We need a copy because m can be shorter than key_size,
75+ * but _rsa_sec_compute_root_tr expect all inputs to be
76+ * normalized to a key_size long buffer length */
77+ mpz_limbs_copy(m, gibberish, mpz_size(pub->n));
78+
79+ res = _rsa_sec_compute_root_tr (pub, key, random_ctx, random, m, m);
80
81 mpn_get_base256 (em, key->size, m, mpz_size(pub->n));
82
83Index: nettle-3.5.1/rsa-sign-tr.c
84===================================================================
85--- nettle-3.5.1.orig/rsa-sign-tr.c
86+++ nettle-3.5.1/rsa-sign-tr.c
87@@ -131,35 +131,34 @@ int
88 _rsa_sec_compute_root_tr(const struct rsa_public_key *pub,
89 const struct rsa_private_key *key,
90 void *random_ctx, nettle_random_func *random,
91- mp_limb_t *x, const mp_limb_t *m, size_t mn)
92+ mp_limb_t *x, const mp_limb_t *m)
93 {
94+ mp_size_t nn;
95 mpz_t mz;
96 mpz_t xz;
97 int res;
98
99- mpz_init(mz);
100 mpz_init(xz);
101
102- mpn_copyi(mpz_limbs_write(mz, mn), m, mn);
103- mpz_limbs_finish(mz, mn);
104+ nn = mpz_size (pub->n);
105
106- res = rsa_compute_root_tr(pub, key, random_ctx, random, xz, mz);
107+ res = rsa_compute_root_tr(pub, key, random_ctx, random, xz,
108+ mpz_roinit_n(mz, m, nn));
109
110 if (res)
111- mpz_limbs_copy(x, xz, mpz_size(pub->n));
112+ mpz_limbs_copy(x, xz, nn);
113
114- mpz_clear(mz);
115 mpz_clear(xz);
116 return res;
117 }
118 #else
119 /* Blinds m, by computing c = m r^e (mod n), for a random r. Also
120- returns the inverse (ri), for use by rsa_unblind. */
121+ returns the inverse (ri), for use by rsa_unblind. Must have c != m,
122+ no in-place operation.*/
123 static void
124 rsa_sec_blind (const struct rsa_public_key *pub,
125 void *random_ctx, nettle_random_func *random,
126- mp_limb_t *c, mp_limb_t *ri, const mp_limb_t *m,
127- mp_size_t mn)
128+ mp_limb_t *c, mp_limb_t *ri, const mp_limb_t *m)
129 {
130 const mp_limb_t *ep = mpz_limbs_read (pub->e);
131 const mp_limb_t *np = mpz_limbs_read (pub->n);
132@@ -177,15 +176,15 @@ rsa_sec_blind (const struct rsa_public_k
133
134 /* c = m*(r^e) mod n */
135 itch = mpn_sec_powm_itch(nn, ebn, nn);
136- i2 = mpn_sec_mul_itch(nn, mn);
137+ i2 = mpn_sec_mul_itch(nn, nn);
138 itch = MAX(itch, i2);
139- i2 = mpn_sec_div_r_itch(nn + mn, nn);
140+ i2 = mpn_sec_div_r_itch(2*nn, nn);
141 itch = MAX(itch, i2);
142 i2 = mpn_sec_invert_itch(nn);
143 itch = MAX(itch, i2);
144
145- TMP_GMP_ALLOC (tp, nn + mn + itch);
146- scratch = tp + nn + mn;
147+ TMP_GMP_ALLOC (tp, 2*nn + itch);
148+ scratch = tp + 2*nn;
149
150 /* ri = r^(-1) */
151 do
152@@ -198,9 +197,8 @@ rsa_sec_blind (const struct rsa_public_k
153 while (!mpn_sec_invert (ri, tp, np, nn, 2 * nn * GMP_NUMB_BITS, scratch));
154
155 mpn_sec_powm (c, rp, nn, ep, ebn, np, nn, scratch);
156- /* normally mn == nn, but m can be smaller in some cases */
157- mpn_sec_mul (tp, c, nn, m, mn, scratch);
158- mpn_sec_div_r (tp, nn + mn, np, nn, scratch);
159+ mpn_sec_mul (tp, c, nn, m, nn, scratch);
160+ mpn_sec_div_r (tp, 2*nn, np, nn, scratch);
161 mpn_copyi(c, tp, nn);
162
163 TMP_GMP_FREE (r);
164@@ -208,7 +206,7 @@ rsa_sec_blind (const struct rsa_public_k
165 TMP_GMP_FREE (tp);
166 }
167
168-/* m = c ri mod n */
169+/* m = c ri mod n. Allows x == c. */
170 static void
171 rsa_sec_unblind (const struct rsa_public_key *pub,
172 mp_limb_t *x, mp_limb_t *ri, const mp_limb_t *c)
173@@ -299,7 +297,7 @@ int
174 _rsa_sec_compute_root_tr(const struct rsa_public_key *pub,
175 const struct rsa_private_key *key,
176 void *random_ctx, nettle_random_func *random,
177- mp_limb_t *x, const mp_limb_t *m, size_t mn)
178+ mp_limb_t *x, const mp_limb_t *m)
179 {
180 TMP_GMP_DECL (c, mp_limb_t);
181 TMP_GMP_DECL (ri, mp_limb_t);
182@@ -307,7 +305,7 @@ _rsa_sec_compute_root_tr(const struct rs
183 size_t key_limb_size;
184 int ret;
185
186- key_limb_size = NETTLE_OCTET_SIZE_TO_LIMB_SIZE(key->size);
187+ key_limb_size = mpz_size(pub->n);
188
189 /* mpz_powm_sec handles only odd moduli. If p, q or n is even, the
190 key is invalid and rejected by rsa_private_key_prepare. However,
191@@ -321,19 +319,18 @@ _rsa_sec_compute_root_tr(const struct rs
192 }
193
194 assert(mpz_size(pub->n) == key_limb_size);
195- assert(mn <= key_limb_size);
196
197 TMP_GMP_ALLOC (c, key_limb_size);
198 TMP_GMP_ALLOC (ri, key_limb_size);
199 TMP_GMP_ALLOC (scratch, _rsa_sec_compute_root_itch(key));
200
201- rsa_sec_blind (pub, random_ctx, random, x, ri, m, mn);
202+ rsa_sec_blind (pub, random_ctx, random, c, ri, m);
203
204- _rsa_sec_compute_root(key, c, x, scratch);
205+ _rsa_sec_compute_root(key, x, c, scratch);
206
207- ret = rsa_sec_check_root(pub, c, x);
208+ ret = rsa_sec_check_root(pub, x, c);
209
210- rsa_sec_unblind(pub, x, ri, c);
211+ rsa_sec_unblind(pub, x, ri, x);
212
213 cnd_mpn_zero(1 - ret, x, key_limb_size);
214
215@@ -357,17 +354,17 @@ rsa_compute_root_tr(const struct rsa_pub
216 mpz_t x, const mpz_t m)
217 {
218 TMP_GMP_DECL (l, mp_limb_t);
219+ mp_size_t nn = mpz_size(pub->n);
220 int res;
221
222- mp_size_t l_size = NETTLE_OCTET_SIZE_TO_LIMB_SIZE(key->size);
223- TMP_GMP_ALLOC (l, l_size);
224+ TMP_GMP_ALLOC (l, nn);
225+ mpz_limbs_copy(l, m, nn);
226
227- res = _rsa_sec_compute_root_tr (pub, key, random_ctx, random, l,
228- mpz_limbs_read(m), mpz_size(m));
229+ res = _rsa_sec_compute_root_tr (pub, key, random_ctx, random, l, l);
230 if (res) {
231- mp_limb_t *xp = mpz_limbs_write (x, l_size);
232- mpn_copyi (xp, l, l_size);
233- mpz_limbs_finish (x, l_size);
234+ mp_limb_t *xp = mpz_limbs_write (x, nn);
235+ mpn_copyi (xp, l, nn);
236+ mpz_limbs_finish (x, nn);
237 }
238
239 TMP_GMP_FREE (l);
240Index: nettle-3.5.1/testsuite/rsa-encrypt-test.c
241===================================================================
242--- nettle-3.5.1.orig/testsuite/rsa-encrypt-test.c
243+++ nettle-3.5.1/testsuite/rsa-encrypt-test.c
244@@ -19,6 +19,7 @@ test_main(void)
245 uint8_t after;
246
247 mpz_t gibberish;
248+ mpz_t zero;
249
250 rsa_private_key_init(&key);
251 rsa_public_key_init(&pub);
252@@ -101,6 +102,17 @@ test_main(void)
253 ASSERT(decrypted[decrypted_length] == after);
254 ASSERT(decrypted[0] == 'A');
255
256+ /* Test zero input. */
257+ mpz_init_set_ui (zero, 0);
258+ decrypted_length = msg_length;
259+ ASSERT(!rsa_decrypt(&key, &decrypted_length, decrypted, zero));
260+ ASSERT(!rsa_decrypt_tr(&pub, &key,
261+ &lfib, (nettle_random_func *) knuth_lfib_random,
262+ &decrypted_length, decrypted, zero));
263+ ASSERT(!rsa_sec_decrypt(&pub, &key,
264+ &lfib, (nettle_random_func *) knuth_lfib_random,
265+ decrypted_length, decrypted, zero));
266+ ASSERT(decrypted_length == msg_length);
267
268 /* Test invalid key. */
269 mpz_add_ui (key.q, key.q, 2);
270@@ -112,6 +124,6 @@ test_main(void)
271 rsa_private_key_clear(&key);
272 rsa_public_key_clear(&pub);
273 mpz_clear(gibberish);
274+ mpz_clear(zero);
275 free(decrypted);
276 }
277-
diff --git a/meta/recipes-support/nettle/nettle-3.5.1/CVE-2021-3580_2.patch b/meta/recipes-support/nettle/nettle-3.5.1/CVE-2021-3580_2.patch
new file mode 100644
index 0000000000..18e952ddf7
--- /dev/null
+++ b/meta/recipes-support/nettle/nettle-3.5.1/CVE-2021-3580_2.patch
@@ -0,0 +1,163 @@
1From c80961c646b0962ab152619ac0a7c6a21850a380 Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Niels=20M=C3=B6ller?= <nisse@lysator.liu.se>
3Date: Tue, 8 Jun 2021 21:32:38 +0200
4Subject: [PATCH 2/2] Add input check to rsa_decrypt family of functions.
5
6(cherry picked from commit 0ad0b5df315665250dfdaa4a1e087f4799edaefe)
7
8Upstream-Status: Backport
9CVE: CVE-2021-3580
10Signed-off-by: Armin Kuster <akuster@mvista.com>
11
12---
13 ChangeLog | 10 +++++++++-
14 rsa-decrypt-tr.c | 4 ++++
15 rsa-decrypt.c | 10 ++++++++++
16 rsa-sec-decrypt.c | 4 ++++
17 rsa.h | 5 +++--
18 testsuite/rsa-encrypt-test.c | 38 ++++++++++++++++++++++++++++++------
19 6 files changed, 62 insertions(+), 9 deletions(-)
20
21Index: nettle-3.5.1/rsa-decrypt-tr.c
22===================================================================
23--- nettle-3.5.1.orig/rsa-decrypt-tr.c
24+++ nettle-3.5.1/rsa-decrypt-tr.c
25@@ -52,6 +52,10 @@ rsa_decrypt_tr(const struct rsa_public_k
26 mp_size_t key_limb_size;
27 int res;
28
29+ /* First check that input is in range. */
30+ if (mpz_sgn (gibberish) < 0 || mpz_cmp (gibberish, pub->n) >= 0)
31+ return 0;
32+
33 key_limb_size = mpz_size(pub->n);
34
35 TMP_GMP_ALLOC (m, key_limb_size);
36Index: nettle-3.5.1/rsa-decrypt.c
37===================================================================
38--- nettle-3.5.1.orig/rsa-decrypt.c
39+++ nettle-3.5.1/rsa-decrypt.c
40@@ -48,6 +48,16 @@ rsa_decrypt(const struct rsa_private_key
41 int res;
42
43 mpz_init(m);
44+
45+ /* First check that input is in range. Since we don't have the
46+ public key available here, we need to reconstruct n. */
47+ mpz_mul (m, key->p, key->q);
48+ if (mpz_sgn (gibberish) < 0 || mpz_cmp (gibberish, m) >= 0)
49+ {
50+ mpz_clear (m);
51+ return 0;
52+ }
53+
54 rsa_compute_root(key, m, gibberish);
55
56 res = pkcs1_decrypt (key->size, m, length, message);
57Index: nettle-3.5.1/rsa-sec-decrypt.c
58===================================================================
59--- nettle-3.5.1.orig/rsa-sec-decrypt.c
60+++ nettle-3.5.1/rsa-sec-decrypt.c
61@@ -55,6 +55,10 @@ rsa_sec_decrypt(const struct rsa_public_
62 TMP_GMP_DECL (em, uint8_t);
63 int res;
64
65+ /* First check that input is in range. */
66+ if (mpz_sgn (gibberish) < 0 || mpz_cmp (gibberish, pub->n) >= 0)
67+ return 0;
68+
69 TMP_GMP_ALLOC (m, mpz_size(pub->n));
70 TMP_GMP_ALLOC (em, key->size);
71
72Index: nettle-3.5.1/rsa.h
73===================================================================
74--- nettle-3.5.1.orig/rsa.h
75+++ nettle-3.5.1/rsa.h
76@@ -428,13 +428,14 @@ rsa_sec_decrypt(const struct rsa_public_
77 size_t length, uint8_t *message,
78 const mpz_t gibberish);
79
80-/* Compute x, the e:th root of m. Calling it with x == m is allowed. */
81+/* Compute x, the e:th root of m. Calling it with x == m is allowed.
82+ It is required that 0 <= m < n. */
83 void
84 rsa_compute_root(const struct rsa_private_key *key,
85 mpz_t x, const mpz_t m);
86
87 /* Safer variant, using RSA blinding, and checking the result after
88- CRT. */
89+ CRT. It is required that 0 <= m < n. */
90 int
91 rsa_compute_root_tr(const struct rsa_public_key *pub,
92 const struct rsa_private_key *key,
93Index: nettle-3.5.1/testsuite/rsa-encrypt-test.c
94===================================================================
95--- nettle-3.5.1.orig/testsuite/rsa-encrypt-test.c
96+++ nettle-3.5.1/testsuite/rsa-encrypt-test.c
97@@ -19,11 +19,12 @@ test_main(void)
98 uint8_t after;
99
100 mpz_t gibberish;
101- mpz_t zero;
102+ mpz_t bad_input;
103
104 rsa_private_key_init(&key);
105 rsa_public_key_init(&pub);
106 mpz_init(gibberish);
107+ mpz_init(bad_input);
108
109 knuth_lfib_init(&lfib, 17);
110
111@@ -103,15 +104,40 @@ test_main(void)
112 ASSERT(decrypted[0] == 'A');
113
114 /* Test zero input. */
115- mpz_init_set_ui (zero, 0);
116+ mpz_set_ui (bad_input, 0);
117 decrypted_length = msg_length;
118- ASSERT(!rsa_decrypt(&key, &decrypted_length, decrypted, zero));
119+ ASSERT(!rsa_decrypt(&key, &decrypted_length, decrypted, bad_input));
120 ASSERT(!rsa_decrypt_tr(&pub, &key,
121 &lfib, (nettle_random_func *) knuth_lfib_random,
122- &decrypted_length, decrypted, zero));
123+ &decrypted_length, decrypted, bad_input));
124 ASSERT(!rsa_sec_decrypt(&pub, &key,
125 &lfib, (nettle_random_func *) knuth_lfib_random,
126- decrypted_length, decrypted, zero));
127+ decrypted_length, decrypted, bad_input));
128+ ASSERT(decrypted_length == msg_length);
129+
130+ /* Test input that is slightly larger than n */
131+ mpz_add(bad_input, gibberish, pub.n);
132+ decrypted_length = msg_length;
133+ ASSERT(!rsa_decrypt(&key, &decrypted_length, decrypted, bad_input));
134+ ASSERT(!rsa_decrypt_tr(&pub, &key,
135+ &lfib, (nettle_random_func *) knuth_lfib_random,
136+ &decrypted_length, decrypted, bad_input));
137+ ASSERT(!rsa_sec_decrypt(&pub, &key,
138+ &lfib, (nettle_random_func *) knuth_lfib_random,
139+ decrypted_length, decrypted, bad_input));
140+ ASSERT(decrypted_length == msg_length);
141+
142+ /* Test input that is considerably larger than n */
143+ mpz_mul_2exp (bad_input, pub.n, 100);
144+ mpz_add (bad_input, bad_input, gibberish);
145+ decrypted_length = msg_length;
146+ ASSERT(!rsa_decrypt(&key, &decrypted_length, decrypted, bad_input));
147+ ASSERT(!rsa_decrypt_tr(&pub, &key,
148+ &lfib, (nettle_random_func *) knuth_lfib_random,
149+ &decrypted_length, decrypted, bad_input));
150+ ASSERT(!rsa_sec_decrypt(&pub, &key,
151+ &lfib, (nettle_random_func *) knuth_lfib_random,
152+ decrypted_length, decrypted, bad_input));
153 ASSERT(decrypted_length == msg_length);
154
155 /* Test invalid key. */
156@@ -124,6 +150,6 @@ test_main(void)
157 rsa_private_key_clear(&key);
158 rsa_public_key_clear(&pub);
159 mpz_clear(gibberish);
160- mpz_clear(zero);
161+ mpz_clear(bad_input);
162 free(decrypted);
163 }
diff --git a/meta/recipes-support/nettle/nettle_3.5.1.bb b/meta/recipes-support/nettle/nettle_3.5.1.bb
index a9550ed033..192fd295e9 100644
--- a/meta/recipes-support/nettle/nettle_3.5.1.bb
+++ b/meta/recipes-support/nettle/nettle_3.5.1.bb
@@ -1,4 +1,5 @@
1SUMMARY = "A low level cryptographic library" 1SUMMARY = "A low level cryptographic library"
2DESCRIPTION = "Nettle is a cryptographic library that is designed to fit easily in more or less any context: In crypto toolkits for object-oriented languages (C++, Python, Pike, ...), in applications like LSH or GNUPG, or even in kernel space."
2HOMEPAGE = "http://www.lysator.liu.se/~nisse/nettle/" 3HOMEPAGE = "http://www.lysator.liu.se/~nisse/nettle/"
3DESCRIPTION = "It tries to solve a problem of providing a common set of \ 4DESCRIPTION = "It tries to solve a problem of providing a common set of \
4cryptographic algorithms for higher-level applications by implementing a \ 5cryptographic algorithms for higher-level applications by implementing a \
@@ -17,6 +18,13 @@ SRC_URI = "${GNU_MIRROR}/${BPN}/${BP}.tar.gz \
17 file://Add-target-to-only-build-tests-not-run-them.patch \ 18 file://Add-target-to-only-build-tests-not-run-them.patch \
18 file://run-ptest \ 19 file://run-ptest \
19 file://check-header-files-of-openssl-only-if-enable_.patch \ 20 file://check-header-files-of-openssl-only-if-enable_.patch \
21 file://CVE-2021-3580_1.patch \
22 file://CVE-2021-3580_2.patch \
23 file://CVE-2021-20305-1.patch \
24 file://CVE-2021-20305-2.patch \
25 file://CVE-2021-20305-3.patch \
26 file://CVE-2021-20305-4.patch \
27 file://CVE-2021-20305-5.patch \
20 " 28 "
21 29
22SRC_URI_append_class-target = "\ 30SRC_URI_append_class-target = "\
diff --git a/meta/recipes-support/npth/npth_1.6.bb b/meta/recipes-support/npth/npth_1.6.bb
index 88484acec3..94a3f00eac 100644
--- a/meta/recipes-support/npth/npth_1.6.bb
+++ b/meta/recipes-support/npth/npth_1.6.bb
@@ -1,4 +1,5 @@
1SUMMARY = "New GNU Portable Threads library" 1SUMMARY = "New GNU Portable Threads library"
2DESCRIPTION = "nPth is a library to provide the GNU Pth API and thus a non-preemptive threads implementation. "
2HOMEPAGE = "https://www.gnu.org/software/pth/" 3HOMEPAGE = "https://www.gnu.org/software/pth/"
3SECTION = "libs" 4SECTION = "libs"
4LICENSE = "LGPLv2+" 5LICENSE = "LGPLv2+"
diff --git a/meta/recipes-support/p11-kit/p11-kit_0.23.22.bb b/meta/recipes-support/p11-kit/p11-kit_0.23.22.bb
index c539ecdbc6..5f1b73ee16 100644
--- a/meta/recipes-support/p11-kit/p11-kit_0.23.22.bb
+++ b/meta/recipes-support/p11-kit/p11-kit_0.23.22.bb
@@ -1,4 +1,6 @@
1SUMMARY = "Provides a way to load and enumerate PKCS#11 modules" 1SUMMARY = "Provides a way to load and enumerate PKCS#11 modules"
2DESCRIPTION = " Provides a standard configuration setup for installing PKCS#11 modules in such a way that they're discoverable. Also solves problems with coordinating the use of PKCS#11 by different components or libraries living in the same process."
3HOMEPAGE = "https://p11-glue.github.io/p11-glue/p11-kit.html"
2LICENSE = "BSD-3-Clause" 4LICENSE = "BSD-3-Clause"
3LIC_FILES_CHKSUM = "file://COPYING;md5=02933887f609807fbb57aa4237d14a50" 5LIC_FILES_CHKSUM = "file://COPYING;md5=02933887f609807fbb57aa4237d14a50"
4 6
@@ -8,7 +10,7 @@ DEPENDS = "libtasn1 libtasn1-native libffi"
8 10
9DEPENDS_append = "${@' glib-2.0' if d.getVar('GTKDOC_ENABLED') == 'True' else ''}" 11DEPENDS_append = "${@' glib-2.0' if d.getVar('GTKDOC_ENABLED') == 'True' else ''}"
10 12
11SRC_URI = "git://github.com/p11-glue/p11-kit;branch=0.23" 13SRC_URI = "git://github.com/p11-glue/p11-kit;branch=0.23;protocol=https"
12SRCREV = "bd97afbfe28d5fbbde95ce36ff7a8834fc0291ee" 14SRCREV = "bd97afbfe28d5fbbde95ce36ff7a8834fc0291ee"
13S = "${WORKDIR}/git" 15S = "${WORKDIR}/git"
14 16
diff --git a/meta/recipes-support/popt/popt_1.16.bb b/meta/recipes-support/popt/popt_1.16.bb
index 27e49c2ca2..0c0392d036 100644
--- a/meta/recipes-support/popt/popt_1.16.bb
+++ b/meta/recipes-support/popt/popt_1.16.bb
@@ -1,4 +1,5 @@
1SUMMARY = "Library for parsing command line options" 1SUMMARY = "Library for parsing command line options"
2DESCRIPTION = "Popt is a C library for parsing command line parameters. Popt was heavily influenced by the getopt() and getopt_long() functions, but it improves on them by allowing more powerful argument expansion. Popt can parse arbitrary argv[] style arrays and automatically set variables based on command line arguments."
2HOMEPAGE = "http://rpm5.org/" 3HOMEPAGE = "http://rpm5.org/"
3SECTION = "libs" 4SECTION = "libs"
4 5
diff --git a/meta/recipes-support/ptest-runner/ptest-runner_2.4.0.bb b/meta/recipes-support/ptest-runner/ptest-runner_2.4.0.bb
index 8b9938f572..3401b7b39e 100644
--- a/meta/recipes-support/ptest-runner/ptest-runner_2.4.0.bb
+++ b/meta/recipes-support/ptest-runner/ptest-runner_2.4.0.bb
@@ -10,7 +10,7 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=751419260aa954499f7abaabaa882bbe"
10SRCREV = "834670317bd3f6e427e1ac461c07ada6b8936dfd" 10SRCREV = "834670317bd3f6e427e1ac461c07ada6b8936dfd"
11PV .= "+git${SRCPV}" 11PV .= "+git${SRCPV}"
12 12
13SRC_URI = "git://git.yoctoproject.org/ptest-runner2 \ 13SRC_URI = "git://git.yoctoproject.org/ptest-runner2;branch=master \
14" 14"
15UPSTREAM_VERSION_UNKNOWN = "1" 15UPSTREAM_VERSION_UNKNOWN = "1"
16 16
@@ -27,3 +27,5 @@ do_compile () {
27do_install () { 27do_install () {
28 install -D -m 0755 ${S}/ptest-runner ${D}${bindir}/ptest-runner 28 install -D -m 0755 ${S}/ptest-runner ${D}${bindir}/ptest-runner
29} 29}
30
31RDEPENDS_${PN}_append_libc-glibc = " libgcc"
diff --git a/meta/recipes-support/re2c/re2c/CVE-2018-21232-1.patch b/meta/recipes-support/re2c/re2c/CVE-2018-21232-1.patch
new file mode 100644
index 0000000000..b7dcaefad3
--- /dev/null
+++ b/meta/recipes-support/re2c/re2c/CVE-2018-21232-1.patch
@@ -0,0 +1,347 @@
1From fd634998f813340768c333cdad638498602856e5 Mon Sep 17 00:00:00 2001
2From: Ulya Trofimovich <skvadrik@gmail.com>
3Date: Tue, 21 Apr 2020 21:28:32 +0100
4Subject: [PATCH] Rewrite recursion into iteration (Tarjan's SCC algorithm and
5 YYFILL states).
6
7This is to avoid stack overflow on large RE (especially on instrumented
8builds that have larger stack frames, like AddressSanitizer).
9
10Stack overflow reported by Agostino Sarubbo.
11Related to #219 "overflow-1.re test fails on system with small stack".
12
13Upstram-Status: Backport:
14https://github.com/skvadrik/re2c/commit/fd634998f813340768c333cdad638498602856e5
15
16CVE: CVE-2018-21232
17
18Signed-off-by: Davide Gardenal <davide.gardenal@huawei.com>
19---
20diff --git a/src/dfa/fillpoints.cc b/src/dfa/fillpoints.cc
21--- a/src/dfa/fillpoints.cc (revision e58939b34bb4c37cd990f82dc286f21cb405743e)
22+++ b/src/dfa/fillpoints.cc (date 1646929180243)
23@@ -5,151 +5,186 @@
24
25 #include "src/dfa/dfa.h"
26
27-namespace re2c
28-{
29+
30+/*
31+ * note [finding strongly connected components of DFA]
32+ *
33+ * A slight modification of Tarjan's algorithm.
34+ *
35+ * The algorithm traverses the DFA in depth-first order. It maintains a stack
36+ * of states that have already been visited but haven't been assigned to an SCC
37+ * yet. For each state the algorithm calculates 'lowlink': index of the highest
38+ * ancestor state reachable in one step from a descendant of this state.
39+ * Lowlink is used to determine when a set of states should be popped off stack
40+ * into a new SCC.
41+ *
42+ * We use lowlink to hold different kinds of information:
43+ * - values in range [0 .. stack size] mean that the state is on stack (a
44+ * link to a state with the smallest index reachable from this one)
45+ * - SCC_UND means that this state has not been visited yet
46+ * - SCC_INF means that this state has already been popped off stack
47+ *
48+ * We use stack size (rather than topological sort index) as a unique index of
49+ * the state on stack. This is safe because the indices of states on stack are
50+ * unique and less than the indices of states that have been popped off stack
51+ * (SCC_INF).
52+ */
53+
54+namespace re2c {
55+ namespace {
56
57-static const size_t SCC_INF = std::numeric_limits<size_t>::max();
58-static const size_t SCC_UND = SCC_INF - 1;
59+ static const size_t SCC_INF = std::numeric_limits<size_t>::max();
60+ static const size_t SCC_UND = SCC_INF - 1;
61
62-static bool loopback(size_t node, size_t narcs, const size_t *arcs)
63-{
64- for (size_t i = 0; i < narcs; ++i)
65- {
66- if (arcs[i] == node)
67- {
68- return true;
69- }
70- }
71- return false;
72-}
73+ static bool loopback(size_t state, size_t narcs, const size_t *arcs)
74+ {
75+ for (size_t i = 0; i < narcs; ++i) {
76+ if (arcs[i] == state) return true;
77+ }
78+ return false;
79+ }
80
81-/*
82- * node [finding strongly connected components of DFA]
83- *
84- * A slight modification of Tarjan's algorithm.
85- *
86- * The algorithm walks graph in deep-first order. It maintains a stack
87- * of nodes that have already been visited but haven't been assigned to
88- * SCC yet. For each node the algorithm calculates 'lowlink': index of
89- * the highest ancestor node reachable in one step from a descendant of
90- * the node. Lowlink is used to determine when a set of nodes should be
91- * popped off the stack into a new SCC.
92- *
93- * We use lowlink to hold different kinds of information:
94- * - values in range [0 .. stack size] mean that this node is on stack
95- * (link to a node with the smallest index reachable from this one)
96- * - SCC_UND means that this node has not been visited yet
97- * - SCC_INF means that this node has already been popped off stack
98- *
99- * We use stack size (rather than topological sort index) as unique index
100- * of a node on stack. This is safe because indices of nodes on stack are
101- * still unique and less than indices of nodes that have been popped off
102- * stack (SCC_INF).
103- *
104- */
105-static void scc(
106- const dfa_t &dfa,
107- std::stack<size_t> &stack,
108- std::vector<size_t> &lowlink,
109- std::vector<bool> &trivial,
110- size_t i)
111-{
112- const size_t link = stack.size();
113- lowlink[i] = link;
114- stack.push(i);
115+ struct StackItem {
116+ size_t state; // current state
117+ size_t symbol; // next arc to be visited in this state
118+ size_t link; // Tarjan's "lowlink"
119+ };
120+
121+// Tarjan's algorithm
122+ static void scc(const dfa_t &dfa, std::vector<bool> &trivial,
123+ std::vector<StackItem> &stack_dfs)
124+ {
125+ std::vector<size_t> lowlink(dfa.states.size(), SCC_UND);
126+ std::stack<size_t> stack;
127+
128+ StackItem x0 = {0, 0, 0};
129+ stack_dfs.push_back(x0);
130+
131+ while (!stack_dfs.empty()) {
132+ const size_t i = stack_dfs.back().state;
133+ size_t c = stack_dfs.back().symbol;
134+ size_t link = stack_dfs.back().link;
135+ stack_dfs.pop_back();
136+
137+ const size_t *arcs = dfa.states[i]->arcs;
138+
139+ if (c == 0) {
140+ // DFS recursive enter
141+ //DASSERT(lowlink[i] == SCC_UND);
142+ link = lowlink[i] = stack.size();
143+ stack.push(i);
144+ }
145+ else {
146+ // DFS recursive return (from one of successor states)
147+ const size_t j = arcs[c - 1];
148+ //DASSERT(lowlink[j] != SCC_UND);
149+ lowlink[i] = std::min(lowlink[i], lowlink[j]);
150+ }
151
152- const size_t *arcs = dfa.states[i]->arcs;
153- for (size_t c = 0; c < dfa.nchars; ++c)
154- {
155- const size_t j = arcs[c];
156- if (j != dfa_t::NIL)
157- {
158- if (lowlink[j] == SCC_UND)
159- {
160- scc(dfa, stack, lowlink, trivial, j);
161- }
162- if (lowlink[j] < lowlink[i])
163- {
164- lowlink[i] = lowlink[j];
165- }
166- }
167- }
168+ // find the next successor state that hasn't been visited yet
169+ for (; c < dfa.nchars; ++c) {
170+ const size_t j = arcs[c];
171+ if (j != dfa_t::NIL) {
172+ if (lowlink[j] == SCC_UND) {
173+ break;
174+ }
175+ lowlink[i] = std::min(lowlink[i], lowlink[j]);
176+ }
177+ }
178
179- if (lowlink[i] == link)
180- {
181- // SCC is non-trivial (has loops) iff it either:
182- // - consists of multiple nodes (they all must be interconnected)
183- // - consists of single node which loops back to itself
184- trivial[i] = i == stack.top()
185- && !loopback(i, dfa.nchars, arcs);
186+ if (c < dfa.nchars) {
187+ // recurse into the next successor state
188+ StackItem x1 = {i, c + 1, link};
189+ stack_dfs.push_back(x1);
190+ StackItem x2 = {arcs[c], 0, SCC_UND};
191+ stack_dfs.push_back(x2);
192+ }
193+ else if (lowlink[i] == link) {
194+ // all successors have been visited
195+ // SCC is non-trivial (has loops) if either:
196+ // - it contains multiple interconnected states
197+ // - it contains a single self-looping state
198+ trivial[i] = i == stack.top() && !loopback(i, dfa.nchars, arcs);
199
200- size_t j;
201- do
202- {
203- j = stack.top();
204- stack.pop();
205- lowlink[j] = SCC_INF;
206- }
207- while (j != i);
208- }
209-}
210+ for (;;) {
211+ const size_t j = stack.top();
212+ stack.pop();
213+ lowlink[j] = SCC_INF;
214+ if (i == j) break;
215+ }
216+ }
217+ }
218+ }
219
220-static void calc_fill(
221- const dfa_t &dfa,
222- const std::vector<bool> &trivial,
223- std::vector<size_t> &fill,
224- size_t i)
225-{
226- if (fill[i] == SCC_UND)
227- {
228- fill[i] = 0;
229- const size_t *arcs = dfa.states[i]->arcs;
230- for (size_t c = 0; c < dfa.nchars; ++c)
231- {
232- const size_t j = arcs[c];
233- if (j != dfa_t::NIL)
234- {
235- calc_fill(dfa, trivial, fill, j);
236- size_t max = 1;
237- if (trivial[j])
238- {
239- max += fill[j];
240- }
241- if (max > fill[i])
242- {
243- fill[i] = max;
244- }
245- }
246- }
247- }
248-}
249-
250-void fillpoints(const dfa_t &dfa, std::vector<size_t> &fill)
251-{
252- const size_t size = dfa.states.size();
253-
254- // find DFA states that belong to non-trivial SCC
255- std::stack<size_t> stack;
256- std::vector<size_t> lowlink(size, SCC_UND);
257- std::vector<bool> trivial(size, false);
258- scc(dfa, stack, lowlink, trivial, 0);
259-
260- // for each DFA state, calculate YYFILL argument:
261- // maximal path length to the next YYFILL state
262- fill.resize(size, SCC_UND);
263- calc_fill(dfa, trivial, fill, 0);
264+ static void calc_fill(const dfa_t &dfa, const std::vector<bool> &trivial,
265+ std::vector<StackItem> &stack_dfs, std::vector<size_t> &fill)
266+ {
267+ const size_t nstates = dfa.states.size();
268+ fill.resize(nstates, SCC_UND);
269+
270+ StackItem x0 = {0, 0, SCC_INF};
271+ stack_dfs.push_back(x0);
272+
273+ while (!stack_dfs.empty()) {
274+ const size_t i = stack_dfs.back().state;
275+ size_t c = stack_dfs.back().symbol;
276+ stack_dfs.pop_back();
277+
278+ const size_t *arcs = dfa.states[i]->arcs;
279+
280+ if (c == 0) {
281+ // DFS recursive enter
282+ if (fill[i] != SCC_UND) continue;
283+ fill[i] = 0;
284+ }
285+ else {
286+ // DFS recursive return (from one of successor states)
287+ const size_t j = arcs[c - 1];
288+ //DASSERT(fill[i] != SCC_UND && fill[j] != SCC_UND);
289+ fill[i] = std::max(fill[i], 1 + (trivial[j] ? fill[j] : 0));
290+ }
291+
292+ // find the next successor state that hasn't been visited yet
293+ for (; c < dfa.nchars; ++c) {
294+ const size_t j = arcs[c];
295+ if (j != dfa_t::NIL) break;
296+ }
297+
298+ if (c < dfa.nchars) {
299+ // recurse into the next successor state
300+ StackItem x1 = {i, c + 1, SCC_INF};
301+ stack_dfs.push_back(x1);
302+ StackItem x2 = {arcs[c], 0, SCC_INF};
303+ stack_dfs.push_back(x2);
304+ }
305+ }
306
307- // The following states must trigger YYFILL:
308- // - inital state
309- // - all states in non-trivial SCCs
310- // for other states, reset YYFILL argument to zero
311- for (size_t i = 1; i < size; ++i)
312- {
313- if (trivial[i])
314- {
315- fill[i] = 0;
316- }
317- }
318-}
319+ // The following states must trigger YYFILL:
320+ // - inital state
321+ // - all states in non-trivial SCCs
322+ // for other states, reset YYFILL argument to zero
323+ for (size_t i = 1; i < nstates; ++i) {
324+ if (trivial[i]) {
325+ fill[i] = 0;
326+ }
327+ }
328+ }
329
330+ } // anonymous namespace
331+
332+ void fillpoints(const dfa_t &dfa, std::vector<size_t> &fill)
333+ {
334+ const size_t nstates = dfa.states.size();
335+ std::vector<bool> trivial(nstates, false);
336+ std::vector<StackItem> stack_dfs;
337+ stack_dfs.reserve(nstates);
338+
339+ // find DFA states that belong to non-trivial SCC
340+ scc(dfa, trivial, stack_dfs);
341+
342+ // for each DFA state, calculate YYFILL argument:
343+ // maximal path length to the next YYFILL state
344+ calc_fill(dfa, trivial, stack_dfs, fill);
345+ }
346+
347 } // namespace re2c
diff --git a/meta/recipes-support/re2c/re2c/CVE-2018-21232-2.patch b/meta/recipes-support/re2c/re2c/CVE-2018-21232-2.patch
new file mode 100644
index 0000000000..820a6decbc
--- /dev/null
+++ b/meta/recipes-support/re2c/re2c/CVE-2018-21232-2.patch
@@ -0,0 +1,243 @@
1From 7b5643476bd99c994c4f51b8143f942982d85521 Mon Sep 17 00:00:00 2001
2From: Ulya Trofimovich <skvadrik@gmail.com>
3Date: Wed, 22 Apr 2020 22:37:24 +0100
4Subject: [PATCH] Rewrite recursion into iteration (fixed tags computation).
5
6This is to avoid stack overflow on large RE (especially on instrumented
7builds that have larger stack frames, like AddressSanitizer).
8
9Partial fix for #219 "overflow-1.re test fails on system with small stack".
10
11Upstream-Stauts: Backport:
12https://github.com/skvadrik/re2c/commit/7b5643476bd99c994c4f51b8143f942982d85521
13
14CVE: CVE-2018-21232
15
16Signed-off-by: Davide Gardenal <davide.gardenal@huawei.com>
17---
18diff --git a/src/re/tag.cc b/src/re/tag.cc
19--- a/src/re/tag.cc (revision e58939b34bb4c37cd990f82dc286f21cb405743e)
20+++ b/src/re/tag.cc (date 1646986908580)
21@@ -6,7 +6,7 @@
22 {
23
24 const size_t Tag::RIGHTMOST = std::numeric_limits<size_t>::max();
25-const size_t Tag::VARDIST = std::numeric_limits<size_t>::max();
26+const uint32_t Tag::VARDIST = std::numeric_limits<uint32_t>::max();
27 const size_t Tag::FICTIVE = Tag::RIGHTMOST - 1;
28
29 } // namespace re2c
30
31
32diff --git a/src/re/tag.h b/src/re/tag.h
33--- a/src/re/tag.h (revision e58939b34bb4c37cd990f82dc286f21cb405743e)
34+++ b/src/re/tag.h (date 1646986922376)
35@@ -19,7 +19,7 @@
36 struct Tag
37 {
38 static const size_t RIGHTMOST;
39- static const size_t VARDIST;
40+ static const uint32_t VARDIST;
41 static const size_t FICTIVE;
42
43 const std::string *name;
44
45
46diff --git a/src/re/fixed_tags.cc b/src/re/fixed_tags.cc
47--- a/src/re/fixed_tags.cc (revision e58939b34bb4c37cd990f82dc286f21cb405743e)
48+++ b/src/re/fixed_tags.cc (date 1646991137317)
49@@ -7,78 +7,131 @@
50 #include "src/re/tag.h"
51
52 namespace re2c {
53+namespace {
54
55 /* note [fixed and variable tags]
56 *
57- * If distance between two tags is constant (equal for all strings that
58- * match the given regexp), then lexer only needs to track one of them:
59- * the second tag equals the first tag plus static offset.
60+ * If distance between two tags is constant (equal for all strings that match
61+ * the given regexp), then lexer only needs to track one of them: the second
62+ * tag equals the first tag plus static offset.
63 *
64- * However, this optimization is applied only to tags in top-level
65- * concatenation, because other tags may be uninitialized and we don't
66- * want to mess with conditional calculation of fixed tags.
67- *
68+ * This optimization is applied only to tags in top-level concatenation,
69+ * because in other cases the base tag may be NULL, and the calculation of
70+ * the fixed tag value is not as simple as substracting a fixed offset.
71 * Furthermore, fixed tags are fobidden with generic API because it cannot
72- * express fixed offsets.
73- *
74- * Tags with history also cannot be fixed.
75+ * express fixed offsets. M-tags (with history) also cannot be fixed.
76 *
77 * Another special case is fictive tags (those that exist only to impose
78- * hierarchical laws of POSIX disambiguation). We treat them as fixed
79- * in order to suppress code generation.
80+ * hierarchical laws of POSIX disambiguation). We treat them as fixed in order
81+ * to suppress code generation.
82 */
83
84-static void find_fixed_tags(RE *re, std::vector<Tag> &tags,
85- size_t &dist, size_t &base, bool toplevel)
86+struct StackItem {
87+ RE *re; // current sub-RE
88+ uint32_t dist; // distance backup for alternative, unused for other RE
89+ uint8_t succ; // index of the next successor to be visited
90+ bool toplevel; // if this sub-RE is in top-level concatenation
91+};
92+
93+static void find_fixed_tags(RESpec &spec, std::vector<StackItem> &stack, RE *re0)
94 {
95- switch (re->type) {
96- case RE::NIL: break;
97- case RE::SYM:
98- if (dist != Tag::VARDIST) ++dist;
99- break;
100- case RE::ALT: {
101- size_t d1 = dist, d2 = dist;
102- find_fixed_tags(re->alt.re1, tags, d1, base, false);
103- find_fixed_tags(re->alt.re2, tags, d2, base, false);
104- dist = (d1 == d2) ? d1 : Tag::VARDIST;
105- break;
106- }
107- case RE::CAT:
108- find_fixed_tags(re->cat.re2, tags, dist, base, toplevel);
109- find_fixed_tags(re->cat.re1, tags, dist, base, toplevel);
110- break;
111- case RE::ITER:
112- find_fixed_tags(re->iter.re, tags, dist, base, false);
113- dist = Tag::VARDIST;
114- break;
115- case RE::TAG: {
116- // see note [fixed and variable tags]
117- Tag &tag = tags[re->tag.idx];
118- if (fictive(tag)) {
119- tag.base = tag.dist = 0;
120- } else if (toplevel && dist != Tag::VARDIST && !history(tag)) {
121- tag.base = base;
122- tag.dist = dist;
123- } else if (toplevel) {
124- base = re->tag.idx;
125- dist = 0;
126- }
127- if (trailing(tag)) dist = 0;
128- break;
129- }
130- }
131+ static const uint32_t VARDIST = Tag::VARDIST;
132+ bool toplevel = spec.opts->input_api != INPUT_CUSTOM;
133+
134+ // base tag, intially the fake "rightmost tag" (the end of RE)
135+ size_t base = Tag::RIGHTMOST;
136+
137+ // the distance to the nearest top-level tag to the right (base tag)
138+ uint32_t dist = 0;
139+
140+ const StackItem i0 = {re0, VARDIST, 0, toplevel};
141+ stack.push_back(i0);
142+
143+ while (!stack.empty()) {
144+ const StackItem i = stack.back();
145+ stack.pop_back();
146+ RE *re = i.re;
147+
148+ if (re->type == RE::SYM) {
149+ if (dist != VARDIST) ++dist;
150+ }
151+ else if (re->type == RE::ALT) {
152+ if (i.succ == 0) {
153+ // save the current distance on stack (from the alternative end
154+ // to base) and recurse into the left sub-RE
155+ StackItem k = {re, dist, 1, i.toplevel};
156+ stack.push_back(k);
157+ StackItem j = {re->alt.re1, VARDIST, 0, false};
158+ stack.push_back(j);
159+ }
160+ else if (i.succ == 1) {
161+ // save the current distance on stack (from the left sub-RE to
162+ // base), reset distance to the distance popped from stack (from
163+ // the alternative end to base), recurse into the right sub-RE
164+ StackItem k = {re, dist, 2, i.toplevel};
165+ stack.push_back(k);
166+ StackItem j = {re->alt.re2, VARDIST, 0, false};
167+ stack.push_back(j);
168+ dist = i.dist;
169+ }
170+ else {
171+ // both sub-RE visited, compare the distance on stack (from the
172+ // left sub-RE to base) to the current distance (from the right
173+ // sub-RE to base), if not equal set variable distance
174+ dist = (i.dist == dist) ? i.dist : VARDIST;
175+ }
176+ }
177+ else if (re->type == RE::ITER) {
178+ if (i.succ == 0) {
179+ // recurse into the sub-RE
180+ StackItem k = {re, VARDIST, 1, i.toplevel};
181+ stack.push_back(k);
182+ StackItem j = {re->iter.re, VARDIST, 0, false};
183+ stack.push_back(j);
184+ }
185+ else {
186+ // sub-RE visited, assume unknown number of iterations
187+ // TODO: find precise distance for fixed repetition counter
188+ dist = VARDIST;
189+ }
190+ }
191+ else if (re->type == RE::CAT) {
192+ // the right sub-RE is pushed on stack after the left sub-RE and
193+ // visited earlier (because distance is computed from right to left)
194+ StackItem j1 = {re->cat.re1, VARDIST, 0, i.toplevel};
195+ stack.push_back(j1);
196+ StackItem j2 = {re->cat.re2, VARDIST, 0, i.toplevel};
197+ stack.push_back(j2);
198+ }
199+ else if (re->type == RE::TAG) {
200+ // see note [fixed and variable tags]
201+ Tag &tag = spec.tags[re->tag.idx];
202+ if (fictive(tag)) {
203+ tag.base = tag.dist = 0;
204+ }
205+ else if (i.toplevel && dist != VARDIST && !history(tag)) {
206+ tag.base = base;
207+ tag.dist = dist;
208+ }
209+ else if (i.toplevel) {
210+ base = re->tag.idx;
211+ dist = 0;
212+ }
213+ if (trailing(tag)) {
214+ dist = 0;
215+ }
216+ }
217+ }
218 }
219+
220+} // anonymous namespace
221
222-void find_fixed_tags(RESpec &spec)
223-{
224- const bool generic = spec.opts->input_api == INPUT_CUSTOM;
225- std::vector<RE*>::iterator
226- i = spec.res.begin(),
227- e = spec.res.end();
228- for (; i != e; ++i) {
229- size_t base = Tag::RIGHTMOST, dist = 0;
230- find_fixed_tags(*i, spec.tags, dist, base, !generic);
231- }
232-}
233+ void find_fixed_tags(RESpec &spec)
234+ {
235+ std::vector<StackItem> stack;
236+ for (std::vector<RE*>::iterator i = spec.res.begin(); i != spec.res.end(); ++i) {
237+ find_fixed_tags(spec, stack, *i);
238+ }
239+ }
240
241-} // namespace re2c
242+} // namespace re2c
243\ No newline at end of file
diff --git a/meta/recipes-support/re2c/re2c/CVE-2018-21232-3.patch b/meta/recipes-support/re2c/re2c/CVE-2018-21232-3.patch
new file mode 100644
index 0000000000..f942e21cba
--- /dev/null
+++ b/meta/recipes-support/re2c/re2c/CVE-2018-21232-3.patch
@@ -0,0 +1,156 @@
1From 4d9c809355b574f2a58eac119f5e076c48e4d1e2 Mon Sep 17 00:00:00 2001
2From: Ulya Trofimovich <skvadrik@gmail.com>
3Date: Thu, 23 Apr 2020 22:16:51 +0100
4Subject: [PATCH] Rewrite recursion into iteration (nullable RE).
5
6This is to avoid stack overflow on large RE (especially on instrumented
7builds that have larger stack frames, like AddressSanitizer).
8
9Partial fix for #219 "overflow-1.re test fails on system with small stack".
10
11Upstream-Status: Backport:
12https://github.com/skvadrik/re2c/commit/4d9c809355b574f2a58eac119f5e076c48e4d1e2
13
14CVE: CVE-2018-21232
15
16Signed-off-by: Davide Gardenal <davide.gardenal@huawei.com>
17---
18diff --git a/src/re/nullable.cc b/src/re/nullable.cc
19--- a/src/re/nullable.cc (revision e58939b34bb4c37cd990f82dc286f21cb405743e)
20+++ b/src/re/nullable.cc (date 1647253886226)
21@@ -9,43 +9,100 @@
22 #include "src/re/tag.h"
23
24 namespace re2c {
25+ namespace {
26+
27+ struct StackItem {
28+ const RE *re; // current sub-RE
29+ uint8_t succ; // index of the next sucessor to be visited
30+ };
31
32-static bool nullable(const RESpec &spec, const RE *re, bool &trail)
33-{
34- if (trail) return true;
35+ static bool nullable(const RESpec &spec, std::vector<StackItem> &stack, const RE *re0)
36+ {
37+ // the "nullable" status of the last sub-RE visited by DFS
38+ bool null = false;
39
40- switch (re->type) {
41- case RE::NIL: return true;
42- case RE::SYM: return false;
43- case RE::ITER:
44- return nullable(spec, re->iter.re, trail);
45- case RE::TAG:
46- trail |= trailing(spec.tags[re->tag.idx]);
47- return true;
48- case RE::ALT:
49- return nullable(spec, re->alt.re1, trail)
50- || nullable(spec, re->alt.re2, trail);
51- case RE::CAT:
52- return nullable(spec, re->cat.re1, trail)
53- && nullable(spec, re->cat.re2, trail);
54- }
55- return false; /* unreachable */
56-}
57+ const StackItem i0 = {re0, 0};
58+ stack.push_back(i0);
59+
60+ while (!stack.empty()) {
61+ const StackItem i = stack.back();
62+ stack.pop_back();
63+
64+ const RE *re = i.re;
65+ if (re->type == RE::NIL) {
66+ null = true;
67+ }
68+ else if (re->type == RE::SYM) {
69+ null = false;
70+ }
71+ else if (re->type == RE::TAG) {
72+ null = true;
73
74-/*
75- * warn about rules that match empty string
76- * (including rules with nonempty trailing context)
77- * false positives on partially self-shadowed rules like [^]?
78- */
79-void warn_nullable(const RESpec &spec, const std::string &cond)
80-{
81- const size_t nre = spec.res.size();
82- for (size_t i = 0; i < nre; ++i) {
83- bool trail = false;
84- if (nullable(spec, spec.res[i], trail)) {
85- spec.warn.match_empty_string(spec.rules[i].code->fline, cond);
86- }
87- }
88-}
89+ // Trailing context is always in top-level concatenation, and sub-RE
90+ // are visited from left to right. Since we are here, sub-RE to the
91+ // left of the trailing context is nullable (otherwise we would not
92+ // recurse into the right sub-RE), therefore the whole RE is nullable.
93+ if (trailing(spec.tags[re->tag.idx])) {
94+ //DASSERT(stack.size() == 1 && stack.back().re->type == RE::CAT);
95+ stack.pop_back();
96+ break;
97+ }
98+ }
99+ else if (re->type == RE::ALT) {
100+ if (i.succ == 0) {
101+ // recurse into the left sub-RE
102+ StackItem k = {re, 1};
103+ stack.push_back(k);
104+ StackItem j = {re->alt.re1, 0};
105+ stack.push_back(j);
106+ }
107+ else if (!null) {
108+ // if the left sub-RE is nullable, so is alternative, so stop
109+ // recursion; otherwise recurse into the right sub-RE
110+ StackItem j = {re->alt.re2, 0};
111+ stack.push_back(j);
112+ }
113+ }
114+ else if (re->type == RE::CAT) {
115+ if (i.succ == 0) {
116+ // recurse into the left sub-RE
117+ StackItem k = {re, 1};
118+ stack.push_back(k);
119+ StackItem j = {re->cat.re1, 0};
120+ stack.push_back(j);
121+ }
122+ else if (null) {
123+ // if the left sub-RE is not nullable, neither is concatenation,
124+ // so stop recursion; otherwise recurse into the right sub-RE
125+ StackItem j = {re->cat.re2, 0};
126+ stack.push_back(j);
127+ }
128+ }
129+ else if (re->type == RE::ITER) {
130+ // iteration is nullable if the sub-RE is nullable
131+ // (zero repetitions is represented with alternative)
132+ StackItem j = {re->iter.re, 0};
133+ stack.push_back(j);
134+ }
135+ }
136+
137+ //DASSERT(stack.empty());
138+ return null;
139+ }
140+
141+ } // anonymous namespace
142+
143+// Warn about rules that match empty string (including rules with nonempty
144+// trailing context). False positives on partially self-shadowed rules like [^]?
145+ void warn_nullable(const RESpec &spec, const std::string &cond)
146+ {
147+ std::vector<StackItem> stack;
148+ const size_t nre = spec.res.size();
149+ for (size_t i = 0; i < nre; ++i) {
150+ if (nullable(spec, stack, spec.res[i])) {
151+ spec.warn.match_empty_string(spec.rules[i].code->fline, cond);
152+ }
153+ }
154+ }
155
156 } // namespace re2c
diff --git a/meta/recipes-support/re2c/re2c/CVE-2018-21232-4.patch b/meta/recipes-support/re2c/re2c/CVE-2018-21232-4.patch
new file mode 100644
index 0000000000..ee8d84b1bc
--- /dev/null
+++ b/meta/recipes-support/re2c/re2c/CVE-2018-21232-4.patch
@@ -0,0 +1,166 @@
1From 89be91f3df00657261870adbc590209fdb2bc405 Mon Sep 17 00:00:00 2001
2From: Ulya Trofimovich <skvadrik@gmail.com>
3Date: Thu, 23 Apr 2020 23:02:21 +0100
4Subject: [PATCH] Rewrite recursion into iteration (estimation of NFA size for
5 RE).
6
7This is to avoid stack overflow on large RE (especially on instrumented
8builds that have larger stack frames, like AddressSanitizer).
9
10Partial fix for #219 "overflow-1.re test fails on system with small stack".
11
12Upstram-Status: Backport:
13https://github.com/skvadrik/re2c/commit/89be91f3df00657261870adbc590209fdb2bc405
14
15CVE: CVE-2018-21232
16
17Signed-off-by: Davide Gardenal <davide.gardenal@huawei.com>
18---
19diff --git a/src/nfa/estimate_size.cc b/src/nfa/estimate_size.cc
20--- a/src/nfa/estimate_size.cc (revision e58939b34bb4c37cd990f82dc286f21cb405743e)
21+++ b/src/nfa/estimate_size.cc (date 1647005399735)
22@@ -6,41 +6,113 @@
23 #include "src/re/re.h"
24
25 namespace re2c {
26+namespace {
27+
28+struct StackItem {
29+ const RE *re; // current sub-RE
30+ uint32_t size; // size of the sub-RE (only for alternative and concatenation)
31+ uint8_t succ; // index of the next sucessor to be visited
32+};
33
34-static size_t estimate(const RE *re)
35+static uint32_t estimate_re_size(const RE *re0, std::vector<StackItem> &stack)
36 {
37- switch (re->type) {
38- case RE::NIL: return 0;
39- case RE::SYM: return 1;
40- case RE::TAG: return 1;
41- case RE::ALT:
42- return estimate(re->alt.re1)
43- + estimate(re->alt.re2)
44- + 1;
45- case RE::CAT:
46- return estimate(re->cat.re1)
47- + estimate(re->cat.re2);
48- case RE::ITER: {
49- const size_t
50- iter = estimate(re->iter.re),
51- min = re->iter.min,
52- max = re->iter.max;
53- return max == AST::MANY
54- ? iter * min + 1
55- : iter * max + (max - min);
56- }
57- }
58- return 0; /* unreachable */
59-}
60+ // the estimated size of the last sub-RE visited by DFS
61+ uint32_t size = 0;
62+
63+ const StackItem i0 = {re0, 0, 0};
64+ stack.push_back(i0);
65+
66+ while (!stack.empty()) {
67+ const StackItem i = stack.back();
68+ stack.pop_back();
69+
70+ const RE *re = i.re;
71+ if (re->type == RE::NIL) {
72+ size = 0;
73+ }
74+ else if (re->type == RE::SYM || re->type == RE::TAG) {
75+ size = 1;
76+ }
77+ else if (re->type == RE::ALT) {
78+ if (i.succ == 0) {
79+ // recurse into the left sub-RE
80+ StackItem k = {re, 0, 1};
81+ stack.push_back(k);
82+ StackItem j = {re->alt.re1, 0, 0};
83+ stack.push_back(j);
84+ }
85+ else if (i.succ == 1) {
86+ // recurse into the right sub-RE
87+ StackItem k = {re, size, 2};
88+ stack.push_back(k);
89+ StackItem j = {re->alt.re2, 0, 0};
90+ stack.push_back(j);
91+ }
92+ else {
93+ // both sub-RE visited, recursive return
94+ size = i.size // left sub-RE (saved on stack)
95+ + size // right sub-RE (just visited by DFS)
96+ + 1; // additional state for alternative
97+ }
98+ }
99+ else if (re->type == RE::CAT) {
100+ if (i.succ == 0) {
101+ // recurse into the left sub-RE
102+ StackItem k = {re, 0, 1};
103+ stack.push_back(k);
104+ StackItem j = {re->cat.re1, 0, 0};
105+ stack.push_back(j);
106+ }
107+ else if (i.succ == 1) {
108+ // recurse into the right sub-RE
109+ StackItem k = {re, size, 2};
110+ stack.push_back(k);
111+ StackItem j = {re->cat.re2, 0, 0};
112+ stack.push_back(j);
113+ }
114+ else {
115+ // both sub-RE visited, recursive return
116+ size = i.size // left sub-RE (saved on stack)
117+ + size; // right sub-RE (just visited by DFS)
118+ }
119+ }
120+ else if (re->type == RE::ITER) {
121+ if (i.succ == 0) {
122+ // recurse into the sub-RE
123+ StackItem k = {re, 0, 1};
124+ stack.push_back(k);
125+ StackItem j = {re->iter.re, 0, 0};
126+ stack.push_back(j);
127+ }
128+ else {
129+ // sub-RE visited, recursive return
130+ const uint32_t min = re->iter.min, max = re->iter.max;
131+ size = max == AST::MANY
132+ ? size * min + 1
133+ : size * max + (max - min);
134+ }
135+ }
136+ }
137+
138+ //DASSERT(stack.empty());
139+ return size;
140+}
141+
142+} // anonymous namespace
143
144 size_t estimate_size(const std::vector<RE*> &res)
145 {
146- const size_t nre = res.size();
147- size_t size = nre - 1;
148- for (size_t i = 0; i < nre; ++i) {
149- size += estimate(res[i]) + 1;
150- }
151- return size;
152+ std::vector<StackItem> stack;
153+
154+ const size_t nre = res.size();
155+ //DASSERT(nre > 0);
156+ size_t size = nre - 1;
157+
158+ for (size_t i = 0; i < nre; ++i) {
159+ size += estimate_re_size(res[i], stack) + 1;
160+ }
161+
162+ return size;
163 }
164
165 } // namespace re2c
166
diff --git a/meta/recipes-support/re2c/re2c_1.0.1.bb b/meta/recipes-support/re2c/re2c_1.0.1.bb
index 35200ecde8..ca5c33f151 100644
--- a/meta/recipes-support/re2c/re2c_1.0.1.bb
+++ b/meta/recipes-support/re2c/re2c_1.0.1.bb
@@ -1,11 +1,17 @@
1SUMMARY = "Tool for writing very fast and very flexible scanners" 1SUMMARY = "Tool for writing very fast and very flexible scanners"
2HOMEPAGE = "http://re2c.sourceforge.net/" 2DESCRIPTION = "A free and open-source lexer generator for C, C++ and Go. It compiles regular expressions to determinisitic finite automata and encodes the automata in the form of a program in the target language. Unlike any other such tool, re2c focuses on generating high efficient code for regular expression matching. As a result this allows a much broader range of use than any traditional lexer."
3HOMEPAGE = "http://re2c.org/"
4BUGTRACKER = "https://github.com/skvadrik/re2c/issues"
3AUTHOR = "Marcus Börger <helly@users.sourceforge.net>" 5AUTHOR = "Marcus Börger <helly@users.sourceforge.net>"
4SECTION = "devel" 6SECTION = "devel"
5LICENSE = "PD" 7LICENSE = "PD"
6LIC_FILES_CHKSUM = "file://README;beginline=146;md5=881056c9add17f8019ccd8c382ba963a" 8LIC_FILES_CHKSUM = "file://README;beginline=146;md5=881056c9add17f8019ccd8c382ba963a"
7 9
8SRC_URI = "https://github.com/skvadrik/re2c/releases/download/${PV}/${BPN}-${PV}.tar.gz" 10SRC_URI = "https://github.com/skvadrik/re2c/releases/download/${PV}/${BPN}-${PV}.tar.gz \
11file://CVE-2018-21232-1.patch \
12file://CVE-2018-21232-2.patch \
13file://CVE-2018-21232-3.patch \
14file://CVE-2018-21232-4.patch"
9SRC_URI[md5sum] = "e2c6cf52fc6a21595f21bc82db5324f8" 15SRC_URI[md5sum] = "e2c6cf52fc6a21595f21bc82db5324f8"
10SRC_URI[sha256sum] = "605058d18a00e01bfc32aebf83af35ed5b13180b4e9f279c90843afab2c66c7c" 16SRC_URI[sha256sum] = "605058d18a00e01bfc32aebf83af35ed5b13180b4e9f279c90843afab2c66c7c"
11UPSTREAM_CHECK_URI = "https://github.com/skvadrik/re2c/releases" 17UPSTREAM_CHECK_URI = "https://github.com/skvadrik/re2c/releases"
diff --git a/meta/recipes-support/rng-tools/rng-tools/rngd.service b/meta/recipes-support/rng-tools/rng-tools/rngd.service
index aaaaa29074..f296a99e1f 100644
--- a/meta/recipes-support/rng-tools/rng-tools/rngd.service
+++ b/meta/recipes-support/rng-tools/rng-tools/rngd.service
@@ -3,6 +3,7 @@ Description=Hardware RNG Entropy Gatherer Daemon
3DefaultDependencies=no 3DefaultDependencies=no
4After=systemd-udev-settle.service 4After=systemd-udev-settle.service
5Before=sysinit.target shutdown.target 5Before=sysinit.target shutdown.target
6Wants=systemd-udev-settle.service
6Conflicts=shutdown.target 7Conflicts=shutdown.target
7 8
8[Service] 9[Service]
diff --git a/meta/recipes-support/rng-tools/rng-tools_6.9.bb b/meta/recipes-support/rng-tools/rng-tools_6.9.bb
index b8c6f022f3..58b58fbb3c 100644
--- a/meta/recipes-support/rng-tools/rng-tools_6.9.bb
+++ b/meta/recipes-support/rng-tools/rng-tools_6.9.bb
@@ -9,7 +9,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"
9DEPENDS = "sysfsutils" 9DEPENDS = "sysfsutils"
10 10
11SRC_URI = "\ 11SRC_URI = "\
12 git://github.com/nhorman/rng-tools.git \ 12 git://github.com/nhorman/rng-tools.git;branch=master;protocol=https \
13 file://0001-rngd_jitter-fix-O_NONBLOCK-setting-for-entropy-pipe.patch \ 13 file://0001-rngd_jitter-fix-O_NONBLOCK-setting-for-entropy-pipe.patch \
14 file://0002-rngd_jitter-initialize-AES-key-before-setting-the-en.patch \ 14 file://0002-rngd_jitter-initialize-AES-key-before-setting-the-en.patch \
15 file://0003-rngd_jitter-always-read-from-entropy-pipe-before-set.patch \ 15 file://0003-rngd_jitter-always-read-from-entropy-pipe-before-set.patch \
diff --git a/meta/recipes-support/serf/serf_1.3.9.bb b/meta/recipes-support/serf/serf_1.3.9.bb
index 2fbf96f997..3276d40df6 100644
--- a/meta/recipes-support/serf/serf_1.3.9.bb
+++ b/meta/recipes-support/serf/serf_1.3.9.bb
@@ -1,4 +1,9 @@
1SUMMARY = "High-Performance Asynchronous HTTP Client Library" 1SUMMARY = "High-Performance Asynchronous HTTP Client Library"
2DESCRIPTION = "The Apache Serf library is a C-based HTTP client library built upon the Apache \
3Portable Runtime (APR) library. It multiplexes connections, running the \
4read/write communication asynchronously. Memory copies and transformations are \
5kept to a minimum to provide high performance operation."
6HOMEPAGE = "http://serf.apache.org/"
2SRC_URI = "${APACHE_MIRROR}/${BPN}/${BPN}-${PV}.tar.bz2 \ 7SRC_URI = "${APACHE_MIRROR}/${BPN}/${BPN}-${PV}.tar.bz2 \
3 file://norpath.patch \ 8 file://norpath.patch \
4 file://env.patch \ 9 file://env.patch \
diff --git a/meta/recipes-support/shared-mime-info/shared-mime-info_git.bb b/meta/recipes-support/shared-mime-info/shared-mime-info_git.bb
index 7a060b09ad..05c7d32965 100644
--- a/meta/recipes-support/shared-mime-info/shared-mime-info_git.bb
+++ b/meta/recipes-support/shared-mime-info/shared-mime-info_git.bb
@@ -1,4 +1,5 @@
1SUMMARY = "Shared MIME type database and specification" 1SUMMARY = "Shared MIME type database and specification"
2DESCRIPTION = "The shared-mime-info package contains the core database of common types and the update-mime-database command used to extend it. It requires glib2 to be installed for building the update command. Additionally, it uses intltool for translations, though this is only a dependency for the maintainers."
2HOMEPAGE = "http://freedesktop.org/wiki/Software/shared-mime-info" 3HOMEPAGE = "http://freedesktop.org/wiki/Software/shared-mime-info"
3SECTION = "base" 4SECTION = "base"
4 5
@@ -7,7 +8,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"
7 8
8DEPENDS = "libxml2 itstool-native glib-2.0 shared-mime-info-native" 9DEPENDS = "libxml2 itstool-native glib-2.0 shared-mime-info-native"
9 10
10SRC_URI = "git://gitlab.freedesktop.org/xdg/shared-mime-info.git;protocol=https" 11SRC_URI = "git://gitlab.freedesktop.org/xdg/shared-mime-info.git;protocol=https;branch=master"
11SRCREV = "829b26d85e7d89a0caee03046c3bce373f04c80a" 12SRCREV = "829b26d85e7d89a0caee03046c3bce373f04c80a"
12PV = "1.15" 13PV = "1.15"
13S = "${WORKDIR}/git" 14S = "${WORKDIR}/git"
diff --git a/meta/recipes-support/sqlite/files/CVE-2020-35525.patch b/meta/recipes-support/sqlite/files/CVE-2020-35525.patch
new file mode 100644
index 0000000000..27d81d42d9
--- /dev/null
+++ b/meta/recipes-support/sqlite/files/CVE-2020-35525.patch
@@ -0,0 +1,21 @@
1From: drh <drh@noemail.net>
2Date: Thu, 20 Feb 2020 14:08:51 +0000
3Subject: [PATCH] Early-out on the INTERSECT query processing following an
4 error.
5
6Upstream-Status: Backport [http://security.debian.org/debian-security/pool/updates/main/s/sqlite3/sqlite3_3.27.2-3+deb10u2.debian.tar.xz]
7CVE: CVE-2020-35525
8Signed-off-by: Virendra Thakur <virendrak@kpit.com>
9---
10Index: sqlite-autoconf-3310100/sqlite3.c
11===================================================================
12--- sqlite-autoconf-3310100.orig/sqlite3.c
13+++ sqlite-autoconf-3310100/sqlite3.c
14@@ -130767,6 +130767,7 @@ static int multiSelect(
15 /* Generate code to take the intersection of the two temporary
16 ** tables.
17 */
18+ if( rc ) break;
19 assert( p->pEList );
20 iBreak = sqlite3VdbeMakeLabel(pParse);
21 iCont = sqlite3VdbeMakeLabel(pParse);
diff --git a/meta/recipes-support/sqlite/files/CVE-2020-35527.patch b/meta/recipes-support/sqlite/files/CVE-2020-35527.patch
new file mode 100644
index 0000000000..d1dae389b0
--- /dev/null
+++ b/meta/recipes-support/sqlite/files/CVE-2020-35527.patch
@@ -0,0 +1,22 @@
1From: dan <dan@noemail.net>
2Date: Mon, 26 Oct 2020 13:24:36 +0000
3Subject: [PATCH] Fix a problem with ALTER TABLE for views that have a nested
4 FROM clause. Ticket [f50af3e8a565776b].
5
6Upstream-Status: Backport [http://security.debian.org/debian-security/pool/updates/main/s/sqlite3/sqlite3_3.27.2-3+deb10u2.debian.tar.xz]
7CVE: CVE-2020-35527
8Signed-off-by: Virendra Thakur <virendra.thakur@kpit.com>
9---
10Index: sqlite-autoconf-3310100/sqlite3.c
11===================================================================
12--- sqlite-autoconf-3310100.orig/sqlite3.c
13+++ sqlite-autoconf-3310100/sqlite3.c
14@@ -133110,7 +133110,7 @@ static int selectExpander(Walker *pWalke
15 pNew = sqlite3ExprListAppend(pParse, pNew, pExpr);
16 sqlite3TokenInit(&sColname, zColname);
17 sqlite3ExprListSetName(pParse, pNew, &sColname, 0);
18- if( pNew && (p->selFlags & SF_NestedFrom)!=0 ){
19+ if( pNew && (p->selFlags & SF_NestedFrom)!=0 && !IN_RENAME_OBJECT ){
20 struct ExprList_item *pX = &pNew->a[pNew->nExpr-1];
21 sqlite3DbFree(db, pX->zEName);
22 if( pSub ){
diff --git a/meta/recipes-support/sqlite/files/CVE-2021-20223.patch b/meta/recipes-support/sqlite/files/CVE-2021-20223.patch
new file mode 100644
index 0000000000..e9d2e04d30
--- /dev/null
+++ b/meta/recipes-support/sqlite/files/CVE-2021-20223.patch
@@ -0,0 +1,23 @@
1From d1d43efa4fb0f2098c0e2c5bf2e807c58d5ec05b Mon Sep 17 00:00:00 2001
2From: dan <dan@noemail.net>
3Date: Mon, 26 Oct 2020 13:24:36 +0000
4Subject: [PATCH] Prevent fts5 tokenizer unicode61 from considering '\0' to be
5 a token characters, even if other characters of class "Cc" are.
6
7FossilOrigin-Name: b7b7bde9b7a03665e3691c6d51118965f216d2dfb1617f138b9f9e60e418ed2f
8
9CVE: CVE-2021-20223
10Upstream-Status: Backport [https://github.com/sqlite/sqlite/commit/d1d43efa4fb0f2098c0e2c5bf2e807c58d5ec05b.patch]
11Comment: Removed manifest, manifest.uuid and fts5tok1.test as these files are not present in the amalgamated source code
12Signed-Off-by: Sana.Kazi@kpit.com
13---
14--- a/sqlite3.c 2022-09-09 13:54:30.010768197 +0530
15+++ b/sqlite3.c 2022-09-09 13:56:25.458769142 +0530
16@@ -227114,6 +227114,7 @@
17 }
18 iTbl++;
19 }
20+ aAscii[0] = 0; /* 0x00 is never a token character */
21 }
22
23 /*
diff --git a/meta/recipes-support/sqlite/files/CVE-2022-35737.patch b/meta/recipes-support/sqlite/files/CVE-2022-35737.patch
new file mode 100644
index 0000000000..341e002913
--- /dev/null
+++ b/meta/recipes-support/sqlite/files/CVE-2022-35737.patch
@@ -0,0 +1,29 @@
1From 2bbf4c999dbb4b520561a57e0bafc19a15562093 Mon Sep 17 00:00:00 2001
2From: Hitendra Prajapati <hprajapati@mvista.com>
3Date: Fri, 2 Sep 2022 11:22:29 +0530
4Subject: [PATCH] CVE-2022-35737
5
6Upstream-Status: Backport [https://www.sqlite.org/src/info/aab790a16e1bdff7]
7CVE: CVE-2022-35737
8Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
9---
10 sqlite3.c | 3 ++-
11 1 file changed, 2 insertions(+), 1 deletion(-)
12
13diff --git a/sqlite3.c b/sqlite3.c
14index f664217..33dfb78 100644
15--- a/sqlite3.c
16+++ b/sqlite3.c
17@@ -28758,7 +28758,8 @@ SQLITE_API void sqlite3_str_vappendf(
18 case etSQLESCAPE: /* %q: Escape ' characters */
19 case etSQLESCAPE2: /* %Q: Escape ' and enclose in '...' */
20 case etSQLESCAPE3: { /* %w: Escape " characters */
21- int i, j, k, n, isnull;
22+ i64 i, j, k, n;
23+ int isnull;
24 int needQuote;
25 char ch;
26 char q = ((xtype==etSQLESCAPE3)?'"':'\''); /* Quote character */
27--
282.25.1
29
diff --git a/meta/recipes-support/sqlite/files/CVE-2023-7104.patch b/meta/recipes-support/sqlite/files/CVE-2023-7104.patch
new file mode 100644
index 0000000000..01ff29ff5e
--- /dev/null
+++ b/meta/recipes-support/sqlite/files/CVE-2023-7104.patch
@@ -0,0 +1,46 @@
1From eab426c5fba69d2c77023939f72b4ad446834e3c Mon Sep 17 00:00:00 2001
2From: dan <Dan Kennedy>
3Date: Thu, 7 Sep 2023 13:53:09 +0000
4Subject: [PATCH] Fix a buffer overread in the sessions extension that could occur when processing a corrupt changeset.
5
6Upstream-Status: Backport [https://sqlite.org/src/info/0e4e7a05c4204b47]
7CVE: CVE-2023-7104
8Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
9---
10 sqlite3.c | 18 +++++++++++-------
11 1 file changed, 11 insertions(+), 7 deletions(-)
12
13diff --git a/sqlite3.c b/sqlite3.c
14index 972ef18..c645ac8 100644
15--- a/sqlite3.c
16+++ b/sqlite3.c
17@@ -203301,15 +203301,19 @@ static int sessionReadRecord(
18 }
19 }
20 if( eType==SQLITE_INTEGER || eType==SQLITE_FLOAT ){
21- sqlite3_int64 v = sessionGetI64(aVal);
22- if( eType==SQLITE_INTEGER ){
23- sqlite3VdbeMemSetInt64(apOut[i], v);
24+ if( (pIn->nData-pIn->iNext)<8 ){
25+ rc = SQLITE_CORRUPT_BKPT;
26 }else{
27- double d;
28- memcpy(&d, &v, 8);
29- sqlite3VdbeMemSetDouble(apOut[i], d);
30+ sqlite3_int64 v = sessionGetI64(aVal);
31+ if( eType==SQLITE_INTEGER ){
32+ sqlite3VdbeMemSetInt64(apOut[i], v);
33+ }else{
34+ double d;
35+ memcpy(&d, &v, 8);
36+ sqlite3VdbeMemSetDouble(apOut[i], d);
37+ }
38+ pIn->iNext += 8;
39 }
40- pIn->iNext += 8;
41 }
42 }
43 }
44--
452.25.1
46
diff --git a/meta/recipes-support/sqlite/sqlite3.inc b/meta/recipes-support/sqlite/sqlite3.inc
index 07614bdb3e..1adc0eba66 100644
--- a/meta/recipes-support/sqlite/sqlite3.inc
+++ b/meta/recipes-support/sqlite/sqlite3.inc
@@ -1,4 +1,5 @@
1SUMMARY = "Embeddable SQL database engine" 1SUMMARY = "Embeddable SQL database engine"
2DESCRIPTION = "A library that implements a small, fast, self-contained, high-reliability, full-featured, SQL database engine. SQLite is the most used database engine in the world. SQLite is built into all mobile phones and most computers and comes bundled inside countless other applications that people use every day"
2HOMEPAGE = "http://www.sqlite.org" 3HOMEPAGE = "http://www.sqlite.org"
3SECTION = "libs" 4SECTION = "libs"
4 5
diff --git a/meta/recipes-support/sqlite/sqlite3_3.31.1.bb b/meta/recipes-support/sqlite/sqlite3_3.31.1.bb
index 877e80f5a3..0e7bcfa5a7 100644
--- a/meta/recipes-support/sqlite/sqlite3_3.31.1.bb
+++ b/meta/recipes-support/sqlite/sqlite3_3.31.1.bb
@@ -13,6 +13,11 @@ SRC_URI = "http://www.sqlite.org/2020/sqlite-autoconf-${SQLITE_PV}.tar.gz \
13 file://CVE-2020-13630.patch \ 13 file://CVE-2020-13630.patch \
14 file://CVE-2020-13631.patch \ 14 file://CVE-2020-13631.patch \
15 file://CVE-2020-13632.patch \ 15 file://CVE-2020-13632.patch \
16 file://CVE-2022-35737.patch \
17 file://CVE-2020-35525.patch \
18 file://CVE-2020-35527.patch \
19 file://CVE-2021-20223.patch \
20 file://CVE-2023-7104.patch \
16 " 21 "
17SRC_URI[md5sum] = "2d0a553534c521504e3ac3ad3b90f125" 22SRC_URI[md5sum] = "2d0a553534c521504e3ac3ad3b90f125"
18SRC_URI[sha256sum] = "62284efebc05a76f909c580ffa5c008a7d22a1287285d68b7825a2b6b51949ae" 23SRC_URI[sha256sum] = "62284efebc05a76f909c580ffa5c008a7d22a1287285d68b7825a2b6b51949ae"
diff --git a/meta/recipes-support/taglib/taglib_1.11.1.bb b/meta/recipes-support/taglib/taglib_1.11.1.bb
index f4e288295d..165bccadc1 100644
--- a/meta/recipes-support/taglib/taglib_1.11.1.bb
+++ b/meta/recipes-support/taglib/taglib_1.11.1.bb
@@ -1,4 +1,5 @@
1SUMMARY = "Library for reading and editing the meta-data of popular audio formats" 1SUMMARY = "Library for reading and editing the meta-data of popular audio formats"
2DESCRIPTION = "Platform-independent library (tested on Windows/Linux) for reading and writing metadata in media files, including video, audio, and photo formats. This is a convenient one-stop-shop to present or tag all your media collection, regardless of which format/container these might use. You can read/write the standard or more common tags/properties of a media, or you can also create and retrieve your own custom tags."
2SECTION = "libs/multimedia" 3SECTION = "libs/multimedia"
3HOMEPAGE = "http://taglib.github.io/" 4HOMEPAGE = "http://taglib.github.io/"
4LICENSE = "LGPLv2.1 | MPL-1.1" 5LICENSE = "LGPLv2.1 | MPL-1.1"
diff --git a/meta/recipes-support/vim/files/0001-src-Makefile-improve-reproducibility.patch b/meta/recipes-support/vim/files/0001-src-Makefile-improve-reproducibility.patch
index 63a7b78f12..2fc11dbdc2 100644
--- a/meta/recipes-support/vim/files/0001-src-Makefile-improve-reproducibility.patch
+++ b/meta/recipes-support/vim/files/0001-src-Makefile-improve-reproducibility.patch
@@ -16,11 +16,11 @@ Signed-off-by: Mingli Yu <mingli.yu@windriver.com>
16 src/Makefile | 14 ++++---------- 16 src/Makefile | 14 ++++----------
17 1 file changed, 4 insertions(+), 10 deletions(-) 17 1 file changed, 4 insertions(+), 10 deletions(-)
18 18
19diff --git a/src/Makefile b/src/Makefile 19Index: git/src/Makefile
20index f2fafa4dc..7148d4bd9 100644 20===================================================================
21--- a/src/Makefile 21--- git.orig/src/Makefile
22+++ b/src/Makefile 22+++ git/src/Makefile
23@@ -2845,16 +2845,10 @@ auto/pathdef.c: Makefile auto/config.mk 23@@ -3101,16 +3101,10 @@ auto/pathdef.c: Makefile auto/config.mk
24 -@echo '#include "vim.h"' >> $@ 24 -@echo '#include "vim.h"' >> $@
25 -@echo 'char_u *default_vim_dir = (char_u *)"$(VIMRCLOC)";' | $(QUOTESED) >> $@ 25 -@echo 'char_u *default_vim_dir = (char_u *)"$(VIMRCLOC)";' | $(QUOTESED) >> $@
26 -@echo 'char_u *default_vimruntime_dir = (char_u *)"$(VIMRUNTIMEDIR)";' | $(QUOTESED) >> $@ 26 -@echo 'char_u *default_vimruntime_dir = (char_u *)"$(VIMRUNTIMEDIR)";' | $(QUOTESED) >> $@
@@ -41,6 +41,3 @@ index f2fafa4dc..7148d4bd9 100644
41 -@sh $(srcdir)/pathdef.sh 41 -@sh $(srcdir)/pathdef.sh
42 42
43 GUI_GTK_RES_INPUTS = \ 43 GUI_GTK_RES_INPUTS = \
44--
452.17.1
46
diff --git a/meta/recipes-support/vim/files/disable_acl_header_check.patch b/meta/recipes-support/vim/files/disable_acl_header_check.patch
index 33089162b4..533138245d 100644
--- a/meta/recipes-support/vim/files/disable_acl_header_check.patch
+++ b/meta/recipes-support/vim/files/disable_acl_header_check.patch
@@ -13,11 +13,11 @@ Signed-off-by: Changqing Li <changqing.li@windriver.com>
13 src/configure.ac | 3 ++- 13 src/configure.ac | 3 ++-
14 1 file changed, 2 insertions(+), 1 deletion(-) 14 1 file changed, 2 insertions(+), 1 deletion(-)
15 15
16diff --git a/src/configure.ac b/src/configure.ac 16Index: git/src/configure.ac
17index 2d409b3ca06a..dbcaf6140263 100644 17===================================================================
18--- a/src/configure.ac 18--- git.orig/src/configure.ac
19+++ b/src/configure.ac 19+++ git/src/configure.ac
20@@ -3257,7 +3257,7 @@ AC_CHECK_HEADERS(stdint.h stdlib.h string.h \ 20@@ -3292,7 +3292,7 @@ AC_CHECK_HEADERS(stdint.h stdlib.h strin
21 sys/systeminfo.h locale.h sys/stream.h termios.h \ 21 sys/systeminfo.h locale.h sys/stream.h termios.h \
22 libc.h sys/statfs.h poll.h sys/poll.h pwd.h \ 22 libc.h sys/statfs.h poll.h sys/poll.h pwd.h \
23 utime.h sys/param.h sys/ptms.h libintl.h libgen.h \ 23 utime.h sys/param.h sys/ptms.h libintl.h libgen.h \
@@ -26,7 +26,7 @@ index 2d409b3ca06a..dbcaf6140263 100644
26 sys/access.h sys/sysinfo.h wchar.h wctype.h) 26 sys/access.h sys/sysinfo.h wchar.h wctype.h)
27 27
28 dnl sys/ptem.h depends on sys/stream.h on Solaris 28 dnl sys/ptem.h depends on sys/stream.h on Solaris
29@@ -3886,6 +3886,7 @@ AC_ARG_ENABLE(acl, 29@@ -3974,6 +3974,7 @@ AC_ARG_ENABLE(acl,
30 , [enable_acl="yes"]) 30 , [enable_acl="yes"])
31 if test "$enable_acl" = "yes"; then 31 if test "$enable_acl" = "yes"; then
32 AC_MSG_RESULT(no) 32 AC_MSG_RESULT(no)
@@ -34,6 +34,3 @@ index 2d409b3ca06a..dbcaf6140263 100644
34 AC_CHECK_LIB(posix1e, acl_get_file, [LIBS="$LIBS -lposix1e"], 34 AC_CHECK_LIB(posix1e, acl_get_file, [LIBS="$LIBS -lposix1e"],
35 AC_CHECK_LIB(acl, acl_get_file, [LIBS="$LIBS -lacl" 35 AC_CHECK_LIB(acl, acl_get_file, [LIBS="$LIBS -lacl"
36 AC_CHECK_LIB(attr, fgetxattr, LIBS="$LIBS -lattr",,)],,),) 36 AC_CHECK_LIB(attr, fgetxattr, LIBS="$LIBS -lattr",,)],,),)
37--
382.7.4
39
diff --git a/meta/recipes-support/vim/files/no-path-adjust.patch b/meta/recipes-support/vim/files/no-path-adjust.patch
index 05c2d803f6..9d6da80913 100644
--- a/meta/recipes-support/vim/files/no-path-adjust.patch
+++ b/meta/recipes-support/vim/files/no-path-adjust.patch
@@ -7,9 +7,11 @@ Upstream-Status: Pending
7 7
8Signed-off-by: Joe Slater <joe.slater@windriver.com> 8Signed-off-by: Joe Slater <joe.slater@windriver.com>
9 9
10--- a/src/Makefile 10Index: git/src/Makefile
11+++ b/src/Makefile 11===================================================================
12@@ -2507,11 +2507,14 @@ installtools: $(TOOLS) $(DESTDIR)$(exec_ 12--- git.orig/src/Makefile
13+++ git/src/Makefile
14@@ -2565,11 +2565,14 @@ installtools: $(TOOLS) $(DESTDIR)$(exec_
13 rm -rf $$cvs; \ 15 rm -rf $$cvs; \
14 fi 16 fi
15 -chmod $(FILEMOD) $(DEST_TOOLS)/* 17 -chmod $(FILEMOD) $(DEST_TOOLS)/*
diff --git a/meta/recipes-support/vim/files/racefix.patch b/meta/recipes-support/vim/files/racefix.patch
deleted file mode 100644
index 48dca44cad..0000000000
--- a/meta/recipes-support/vim/files/racefix.patch
+++ /dev/null
@@ -1,33 +0,0 @@
1The creation of the LINGUAS file is duplicated for each desktop file
2which can lead the commands to race against each other. Rework
3the makefile to avoid this as the expense of leaving the file on disk.
4
5Upstream-Status: Pending
6RP 2021/2/15
7
8Index: git/src/po/Makefile
9===================================================================
10--- git.orig/src/po/Makefile
11+++ git/src/po/Makefile
12@@ -165,17 +165,16 @@ $(PACKAGE).pot: ../*.c ../if_perl.xs ../
13 po/gvim.desktop.in po/vim.desktop.in
14 mv -f ../$(PACKAGE).po $(PACKAGE).pot
15
16-vim.desktop: vim.desktop.in $(POFILES)
17+LINGUAS:
18 echo $(LANGUAGES) | tr " " "\n" |sed -e '/\./d' | sort > LINGUAS
19+
20+vim.desktop: vim.desktop.in $(POFILES) LINGUAS
21 $(MSGFMT) --desktop -d . --template vim.desktop.in -o tmp_vim.desktop
22- rm -f LINGUAS
23 if command -v desktop-file-validate; then desktop-file-validate tmp_vim.desktop; fi
24 mv tmp_vim.desktop vim.desktop
25
26-gvim.desktop: gvim.desktop.in $(POFILES)
27- echo $(LANGUAGES) | tr " " "\n" |sed -e '/\./d' | sort > LINGUAS
28+gvim.desktop: gvim.desktop.in $(POFILES) LINGUAS
29 $(MSGFMT) --desktop -d . --template gvim.desktop.in -o tmp_gvim.desktop
30- rm -f LINGUAS
31 if command -v desktop-file-validate; then desktop-file-validate tmp_gvim.desktop; fi
32 mv tmp_gvim.desktop gvim.desktop
33
diff --git a/meta/recipes-support/vim/files/vim-add-knob-whether-elf.h-are-checked.patch b/meta/recipes-support/vim/files/vim-add-knob-whether-elf.h-are-checked.patch
index 37914d4cd9..5284ba45b6 100644
--- a/meta/recipes-support/vim/files/vim-add-knob-whether-elf.h-are-checked.patch
+++ b/meta/recipes-support/vim/files/vim-add-knob-whether-elf.h-are-checked.patch
@@ -14,11 +14,11 @@ Signed-off-by: Changqing Li <changqing.li@windriver.com>
14 src/configure.ac | 7 +++++++ 14 src/configure.ac | 7 +++++++
15 1 file changed, 7 insertions(+) 15 1 file changed, 7 insertions(+)
16 16
17diff --git a/src/configure.ac b/src/configure.ac 17Index: git/src/configure.ac
18index 0ee86ad..64736f0 100644 18===================================================================
19--- a/src/configure.ac 19--- git.orig/src/configure.ac
20+++ b/src/configure.ac 20+++ git/src/configure.ac
21@@ -3192,11 +3192,18 @@ AC_TRY_COMPILE([#include <stdio.h>], [int x __attribute__((unused));], 21@@ -3264,11 +3264,18 @@ AC_TRY_COMPILE([#include <stdio.h>], [in
22 AC_MSG_RESULT(no)) 22 AC_MSG_RESULT(no))
23 23
24 dnl Checks for header files. 24 dnl Checks for header files.
@@ -37,6 +37,3 @@ index 0ee86ad..64736f0 100644
37 37
38 AC_HEADER_DIRENT 38 AC_HEADER_DIRENT
39 39
40--
412.7.4
42
diff --git a/meta/recipes-support/vim/vim-tiny_8.2.bb b/meta/recipes-support/vim/vim-tiny_9.0.bb
index e4c26d23f6..e4c26d23f6 100644
--- a/meta/recipes-support/vim/vim-tiny_8.2.bb
+++ b/meta/recipes-support/vim/vim-tiny_9.0.bb
diff --git a/meta/recipes-support/vim/vim.inc b/meta/recipes-support/vim/vim.inc
index d57f784da5..6d62bd67af 100644
--- a/meta/recipes-support/vim/vim.inc
+++ b/meta/recipes-support/vim/vim.inc
@@ -1,29 +1,37 @@
1SUMMARY = "Vi IMproved - enhanced vi editor" 1SUMMARY = "Vi IMproved - enhanced vi editor"
2DESCRIPTION = "Vim is a greatly improved version of the good old UNIX editor Vi. Many new features have been added: multi-level undo, syntax highlighting, command line history, on-line help, spell checking, filename completion, block operations, script language, etc. There is also a Graphical User Interface (GUI) available."
2SECTION = "console/utils" 3SECTION = "console/utils"
3 4
5HOMEPAGE = "https://www.vim.org/"
6BUGTRACKER = "https://github.com/vim/vim/issues"
7
4DEPENDS = "ncurses gettext-native" 8DEPENDS = "ncurses gettext-native"
5# vimdiff doesn't like busybox diff 9# vimdiff doesn't like busybox diff
6RSUGGESTS_${PN} = "diffutils" 10RSUGGESTS_${PN} = "diffutils"
11
7LICENSE = "vim" 12LICENSE = "vim"
8LIC_FILES_CHKSUM = "file://runtime/doc/uganda.txt;endline=287;md5=a19edd7ec70d573a005d9e509375a99a" 13LIC_FILES_CHKSUM = "file://LICENSE;md5=d1a651ab770b45d41c0f8cb5a8ca930e"
9 14
10SRC_URI = "git://github.com/vim/vim.git \ 15SRC_URI = "git://github.com/vim/vim.git;branch=master;protocol=https \
11 file://disable_acl_header_check.patch \ 16 file://disable_acl_header_check.patch \
12 file://vim-add-knob-whether-elf.h-are-checked.patch \ 17 file://vim-add-knob-whether-elf.h-are-checked.patch \
13 file://0001-src-Makefile-improve-reproducibility.patch \ 18 file://0001-src-Makefile-improve-reproducibility.patch \
14 file://no-path-adjust.patch \ 19 file://no-path-adjust.patch \
15 file://racefix.patch \ 20 "
16" 21
17SRCREV = "98056533b96b6b5d8849641de93185dd7bcadc44" 22PV .= ".2190"
23SRCREV = "6a950da86d7a6eb09d5ebeab17657986420d07ac"
18 24
19# Do not consider .z in x.y.z, as that is updated with every commit 25# Do not consider .z in x.y.z, as that is updated with every commit
20UPSTREAM_CHECK_GITTAGREGEX = "(?P<pver>\d+\.\d+)\.0" 26UPSTREAM_CHECK_GITTAGREGEX = "(?P<pver>\d+\.\d+)\.0"
27# Ignore that the upstream version .z in x.y.z is always newer
28UPSTREAM_VERSION_UNKNOWN = "1"
21 29
22S = "${WORKDIR}/git" 30S = "${WORKDIR}/git"
23 31
24VIMDIR = "vim${@d.getVar('PV').split('.')[0]}${@d.getVar('PV').split('.')[1]}" 32VIMDIR = "vim${@d.getVar('PV').split('.')[0]}${@d.getVar('PV').split('.')[1]}"
25 33
26inherit autotools-brokensep update-alternatives mime-xdg 34inherit autotools-brokensep update-alternatives mime-xdg pkgconfig
27 35
28CLEANBROKEN = "1" 36CLEANBROKEN = "1"
29 37
@@ -32,29 +40,24 @@ do_configure () {
32 cd src 40 cd src
33 rm -f auto/* 41 rm -f auto/*
34 touch auto/config.mk 42 touch auto/config.mk
43 # git timestamps aren't reliable, so touch the shipped .po files so they aren't regenerated
44 touch -c po/cs.cp1250.po po/ja.euc-jp.po po/ja.sjis.po po/ko.po po/pl.UTF-8.po po/pl.cp1250.po po/ru.cp1251.po po/sk.cp1250.po po/uk.cp1251.po po/zh_CN.po po/zh_CN.cp936.po po/zh_TW.po
45 # ru.cp1251.po uses CP1251 rather than cp1251, fix that
46 sed -i -e s/CP1251/cp1251/ po/ru.cp1251.po
35 aclocal 47 aclocal
36 autoconf 48 autoconf
37 cd .. 49 cd ..
38 oe_runconf 50 oe_runconf
39 touch src/auto/configure 51 touch src/auto/configure
40 touch src/auto/config.mk src/auto/config.h 52 touch src/auto/config.mk src/auto/config.h
53 # need a native tool, not a target one
54 ${BUILD_CC} src/po/sjiscorr.c -o src/po/sjiscorr
41} 55}
42 56
43do_compile() { 57PACKAGECONFIG ??= "\
44 # We do not support fully / correctly the following locales. Attempting
45 # to use these with msgfmt in order to update the ".desktop" files exposes
46 # this problem and leads to the compile failing.
47 for LOCALE in cs fr ko pl sk zh_CN zh_TW;do
48 echo -n > src/po/${LOCALE}.po
49 done
50 autotools_do_compile
51}
52
53#Available PACKAGECONFIG options are gtkgui, acl, x11, tiny
54PACKAGECONFIG ??= ""
55PACKAGECONFIG += " \
56 ${@bb.utils.filter('DISTRO_FEATURES', 'acl selinux', d)} \ 58 ${@bb.utils.filter('DISTRO_FEATURES', 'acl selinux', d)} \
57 ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'x11 gtkgui', '', d)} \ 59 ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'x11 gtkgui', '', d)} \
60 nls \
58" 61"
59 62
60PACKAGECONFIG[gtkgui] = "--enable-gui=gtk3,--enable-gui=no,gtk+3" 63PACKAGECONFIG[gtkgui] = "--enable-gui=gtk3,--enable-gui=no,gtk+3"
@@ -63,6 +66,7 @@ PACKAGECONFIG[x11] = "--with-x,--without-x,xt,"
63PACKAGECONFIG[tiny] = "--with-features=tiny,--with-features=big,," 66PACKAGECONFIG[tiny] = "--with-features=tiny,--with-features=big,,"
64PACKAGECONFIG[selinux] = "--enable-selinux,--disable-selinux,libselinux," 67PACKAGECONFIG[selinux] = "--enable-selinux,--disable-selinux,libselinux,"
65PACKAGECONFIG[elfutils] = "--enable-elf-check,,elfutils," 68PACKAGECONFIG[elfutils] = "--enable-elf-check,,elfutils,"
69PACKAGECONFIG[nls] = "--enable-nls,--disable-nls,,"
66 70
67EXTRA_OECONF = " \ 71EXTRA_OECONF = " \
68 --disable-gpm \ 72 --disable-gpm \
@@ -71,6 +75,7 @@ EXTRA_OECONF = " \
71 --disable-netbeans \ 75 --disable-netbeans \
72 --disable-desktop-database-update \ 76 --disable-desktop-database-update \
73 --with-tlib=ncurses \ 77 --with-tlib=ncurses \
78 --with-modified-by='${MAINTAINER}' \
74 ac_cv_small_wchar_t=no \ 79 ac_cv_small_wchar_t=no \
75 ac_cv_path_GLIB_COMPILE_RESOURCES=no \ 80 ac_cv_path_GLIB_COMPILE_RESOURCES=no \
76 vim_cv_getcwd_broken=no \ 81 vim_cv_getcwd_broken=no \
@@ -83,6 +88,11 @@ EXTRA_OECONF = " \
83 STRIP=/bin/true \ 88 STRIP=/bin/true \
84" 89"
85 90
91# Some host distros don't have it, disable consistently
92# also disable on dunfell target builds
93EXTRA_OECONF_append_class-native = " vim_cv_timer_create=no"
94EXTRA_OECONF_append_class-target = " vim_cv_timer_create=no"
95
86do_install() { 96do_install() {
87 autotools_do_install 97 autotools_do_install
88 98
diff --git a/meta/recipes-support/vim/vim_8.2.bb b/meta/recipes-support/vim/vim_9.0.bb
index 709b6ddb55..709b6ddb55 100644
--- a/meta/recipes-support/vim/vim_8.2.bb
+++ b/meta/recipes-support/vim/vim_9.0.bb
diff --git a/meta/recipes-support/vte/vte_0.58.3.bb b/meta/recipes-support/vte/vte_0.58.3.bb
index 41dc2e77c9..50724700e8 100644
--- a/meta/recipes-support/vte/vte_0.58.3.bb
+++ b/meta/recipes-support/vte/vte_0.58.3.bb
@@ -1,4 +1,6 @@
1SUMMARY = "Virtual terminal emulator GTK+ widget library" 1SUMMARY = "Virtual terminal emulator GTK+ widget library"
2DESCRIPTION = "VTE provides a virtual terminal widget for GTK applications."
3HOMEPAGE = "https://wiki.gnome.org/Apps/Terminal/VTE"
2BUGTRACKER = "https://bugzilla.gnome.org/buglist.cgi?product=vte" 4BUGTRACKER = "https://bugzilla.gnome.org/buglist.cgi?product=vte"
3LICENSE = "GPLv3 & LGPLv3+ & LGPLv2.1+" 5LICENSE = "GPLv3 & LGPLv3+ & LGPLv2.1+"
4LICENSE_libvte = "LGPLv3+" 6LICENSE_libvte = "LGPLv3+"