summaryrefslogtreecommitdiffstats
path: root/meta/recipes-connectivity/openssl
diff options
context:
space:
mode:
authorTim Orling <ticotimo@gmail.com>2023-05-30 12:20:39 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-06-01 08:05:11 +0100
commit9d01c892b408bc74f4c7505a62187c84d2b514ed (patch)
treeed64f42717cb73521e0baa1fd87ddff17b4e3efb /meta/recipes-connectivity/openssl
parentcbbd5352054c98d102bb6b52ef61a2d2be20e936 (diff)
downloadpoky-9d01c892b408bc74f4c7505a62187c84d2b514ed.tar.gz
openssl: upgrade 3.1.0 -> 3.1.1
* Drop CVE-2023-0464.patch (merged upstream). * Refresh 0001-Configure-do-not-tweak-mips-cflags.patch https://github.com/openssl/openssl/blob/openssl-3.1.1/NEWS.md Major changes between OpenSSL 3.1.0 and OpenSSL 3.1.1 [30 May 2023] * Mitigate for very slow OBJ_obj2txt() performance with gigantic OBJECT IDENTIFIER sub-identities. (CVE-2023-2650) * Fixed buffer overread in AES-XTS decryption on ARM 64 bit platforms (CVE-2023-1255) * Fixed documentation of X509_VERIFY_PARAM_add0_policy() (CVE-2023-0466) * Fixed handling of invalid certificate policies in leaf certificates (CVE-2023-0465) * Limited the number of nodes created in a policy tree (CVE-2023-0464) Security Advisory: https://www.openssl.org/news/secadv/20230530.txt CVE: CVE-2023-2650 CVE: CVE-2023-1255 CVE: CVE-2023-0466 CVE: CVE-2023-0465 CVE: CVE-2023-0464 (From OE-Core rev: 26ce9a5fd31c27812ce8784a398b600cc0e9aa80) Signed-off-by: Tim Orling <tim.orling@konsulko.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-connectivity/openssl')
-rw-r--r--meta/recipes-connectivity/openssl/openssl/0001-Configure-do-not-tweak-mips-cflags.patch19
-rw-r--r--meta/recipes-connectivity/openssl/openssl/CVE-2023-0464.patch226
-rw-r--r--meta/recipes-connectivity/openssl/openssl_3.1.1.bb (renamed from meta/recipes-connectivity/openssl/openssl_3.1.0.bb)3
3 files changed, 12 insertions, 236 deletions
diff --git a/meta/recipes-connectivity/openssl/openssl/0001-Configure-do-not-tweak-mips-cflags.patch b/meta/recipes-connectivity/openssl/openssl/0001-Configure-do-not-tweak-mips-cflags.patch
index 0b7abc3a11..502a7aaf32 100644
--- a/meta/recipes-connectivity/openssl/openssl/0001-Configure-do-not-tweak-mips-cflags.patch
+++ b/meta/recipes-connectivity/openssl/openssl/0001-Configure-do-not-tweak-mips-cflags.patch
@@ -1,6 +1,6 @@
1From 326909baf81a638d51fa8be1d8227518784f5cc4 Mon Sep 17 00:00:00 2001 1From 0377f0d5b5c1079e3b9a80881f4dcc891cbe9f9a Mon Sep 17 00:00:00 2001
2From: Alexander Kanavin <alex@linutronix.de> 2From: Alexander Kanavin <alex@linutronix.de>
3Date: Tue, 14 Sep 2021 12:18:25 +0200 3Date: Tue, 30 May 2023 09:11:27 -0700
4Subject: [PATCH] Configure: do not tweak mips cflags 4Subject: [PATCH] Configure: do not tweak mips cflags
5 5
6This conflicts with mips machine definitons from yocto, 6This conflicts with mips machine definitons from yocto,
@@ -9,20 +9,23 @@ e.g.
9 9
10Upstream-Status: Inappropriate [oe-core specific] 10Upstream-Status: Inappropriate [oe-core specific]
11Signed-off-by: Alexander Kanavin <alex@linutronix.de> 11Signed-off-by: Alexander Kanavin <alex@linutronix.de>
12
13Refreshed for openssl-3.1.1
14Signed-off-by: Tim Orling <tim.orling@konsulko.com>
12--- 15---
13 Configure | 10 ---------- 16 Configure | 10 ----------
14 1 file changed, 10 deletions(-) 17 1 file changed, 10 deletions(-)
15 18
16Index: openssl-3.0.4/Configure 19diff --git a/Configure b/Configure
17=================================================================== 20index 4569952..adf019b 100755
18--- openssl-3.0.4.orig/Configure 21--- a/Configure
19+++ openssl-3.0.4/Configure 22+++ b/Configure
20@@ -1423,16 +1423,6 @@ if ($target =~ /^mingw/ && `$config{CC} 23@@ -1422,16 +1422,6 @@ if ($target =~ /^mingw/ && `$config{CC} --target-help 2>&1` =~ m/-mno-cygwin/m)
21 push @{$config{shared_ldflag}}, "-mno-cygwin"; 24 push @{$config{shared_ldflag}}, "-mno-cygwin";
22 } 25 }
23 26
24-if ($target =~ /linux.*-mips/ && !$disabled{asm} 27-if ($target =~ /linux.*-mips/ && !$disabled{asm}
25- && !grep { $_ !~ /-m(ips|arch=)/ } (@{$config{CFLAGS}})) { 28- && !grep { $_ =~ /-m(ips|arch=)/ } (@{$config{CFLAGS}})) {
26- # minimally required architecture flags for assembly modules 29- # minimally required architecture flags for assembly modules
27- my $value; 30- my $value;
28- $value = '-mips2' if ($target =~ /mips32/); 31- $value = '-mips2' if ($target =~ /mips32/);
diff --git a/meta/recipes-connectivity/openssl/openssl/CVE-2023-0464.patch b/meta/recipes-connectivity/openssl/openssl/CVE-2023-0464.patch
deleted file mode 100644
index 33b0bb6c79..0000000000
--- a/meta/recipes-connectivity/openssl/openssl/CVE-2023-0464.patch
+++ /dev/null
@@ -1,226 +0,0 @@
1From 2017771e2db3e2b96f89bbe8766c3209f6a99545 Mon Sep 17 00:00:00 2001
2From: Pauli <pauli@openssl.org>
3Date: Wed, 8 Mar 2023 15:28:20 +1100
4Subject: [PATCH] x509: excessive resource use verifying policy constraints
5
6A security vulnerability has been identified in all supported versions
7of OpenSSL related to the verification of X.509 certificate chains
8that include policy constraints. Attackers may be able to exploit this
9vulnerability by creating a malicious certificate chain that triggers
10exponential use of computational resources, leading to a denial-of-service
11(DoS) attack on affected systems.
12
13Fixes CVE-2023-0464
14
15Reviewed-by: Tomas Mraz <tomas@openssl.org>
16Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
17(Merged from https://github.com/openssl/openssl/pull/20570)
18
19Upstream-Status: Backport from [https://git.openssl.org/gitweb/?p=openssl.git;a=commitdiff;h=2017771e2db3e2b96f89bbe8766c3209f6a99545]
20CVE: CVE-2023-0464
21Signed-off-by: Siddharth Doshi <sdoshi@mvista.com>
22
23---
24 crypto/x509/pcy_local.h | 8 +++++++-
25 crypto/x509/pcy_node.c | 12 +++++++++---
26 crypto/x509/pcy_tree.c | 36 ++++++++++++++++++++++++++----------
27 3 files changed, 42 insertions(+), 14 deletions(-)
28
29diff --git a/crypto/x509/pcy_local.h b/crypto/x509/pcy_local.h
30index 18b53cc..cba107c 100644
31--- a/crypto/x509/pcy_local.h
32+++ b/crypto/x509/pcy_local.h
33@@ -111,6 +111,11 @@ struct X509_POLICY_LEVEL_st {
34 };
35
36 struct X509_POLICY_TREE_st {
37+ /* The number of nodes in the tree */
38+ size_t node_count;
39+ /* The maximum number of nodes in the tree */
40+ size_t node_maximum;
41+
42 /* This is the tree 'level' data */
43 X509_POLICY_LEVEL *levels;
44 int nlevel;
45@@ -157,7 +162,8 @@ X509_POLICY_NODE *ossl_policy_tree_find_sk(STACK_OF(X509_POLICY_NODE) *sk,
46 X509_POLICY_NODE *ossl_policy_level_add_node(X509_POLICY_LEVEL *level,
47 X509_POLICY_DATA *data,
48 X509_POLICY_NODE *parent,
49- X509_POLICY_TREE *tree);
50+ X509_POLICY_TREE *tree,
51+ int extra_data);
52 void ossl_policy_node_free(X509_POLICY_NODE *node);
53 int ossl_policy_node_match(const X509_POLICY_LEVEL *lvl,
54 const X509_POLICY_NODE *node, const ASN1_OBJECT *oid);
55diff --git a/crypto/x509/pcy_node.c b/crypto/x509/pcy_node.c
56index 9d9a7ea..450f95a 100644
57--- a/crypto/x509/pcy_node.c
58+++ b/crypto/x509/pcy_node.c
59@@ -59,10 +59,15 @@ X509_POLICY_NODE *ossl_policy_level_find_node(const X509_POLICY_LEVEL *level,
60 X509_POLICY_NODE *ossl_policy_level_add_node(X509_POLICY_LEVEL *level,
61 X509_POLICY_DATA *data,
62 X509_POLICY_NODE *parent,
63- X509_POLICY_TREE *tree)
64+ X509_POLICY_TREE *tree,
65+ int extra_data)
66 {
67 X509_POLICY_NODE *node;
68
69+ /* Verify that the tree isn't too large. This mitigates CVE-2023-0464 */
70+ if (tree->node_maximum > 0 && tree->node_count >= tree->node_maximum)
71+ return NULL;
72+
73 node = OPENSSL_zalloc(sizeof(*node));
74 if (node == NULL) {
75 ERR_raise(ERR_LIB_X509V3, ERR_R_MALLOC_FAILURE);
76@@ -70,7 +75,7 @@ X509_POLICY_NODE *ossl_policy_level_add_node(X509_POLICY_LEVEL *level,
77 }
78 node->data = data;
79 node->parent = parent;
80- if (level) {
81+ if (level != NULL) {
82 if (OBJ_obj2nid(data->valid_policy) == NID_any_policy) {
83 if (level->anyPolicy)
84 goto node_error;
85@@ -90,7 +95,7 @@ X509_POLICY_NODE *ossl_policy_level_add_node(X509_POLICY_LEVEL *level,
86 }
87 }
88
89- if (tree) {
90+ if (extra_data) {
91 if (tree->extra_data == NULL)
92 tree->extra_data = sk_X509_POLICY_DATA_new_null();
93 if (tree->extra_data == NULL){
94@@ -103,6 +108,7 @@ X509_POLICY_NODE *ossl_policy_level_add_node(X509_POLICY_LEVEL *level,
95 }
96 }
97
98+ tree->node_count++;
99 if (parent)
100 parent->nchild++;
101
102diff --git a/crypto/x509/pcy_tree.c b/crypto/x509/pcy_tree.c
103index fa45da5..f953a05 100644
104--- a/crypto/x509/pcy_tree.c
105+++ b/crypto/x509/pcy_tree.c
106@@ -14,6 +14,17 @@
107
108 #include "pcy_local.h"
109
110+/*
111+ * If the maximum number of nodes in the policy tree isn't defined, set it to
112+ * a generous default of 1000 nodes.
113+ *
114+ * Defining this to be zero means unlimited policy tree growth which opens the
115+ * door on CVE-2023-0464.
116+ */
117+#ifndef OPENSSL_POLICY_TREE_NODES_MAX
118+# define OPENSSL_POLICY_TREE_NODES_MAX 1000
119+#endif
120+
121 static void expected_print(BIO *channel,
122 X509_POLICY_LEVEL *lev, X509_POLICY_NODE *node,
123 int indent)
124@@ -163,6 +174,9 @@ static int tree_init(X509_POLICY_TREE **ptree, STACK_OF(X509) *certs,
125 return X509_PCY_TREE_INTERNAL;
126 }
127
128+ /* Limit the growth of the tree to mitigate CVE-2023-0464 */
129+ tree->node_maximum = OPENSSL_POLICY_TREE_NODES_MAX;
130+
131 /*
132 * http://tools.ietf.org/html/rfc5280#section-6.1.2, figure 3.
133 *
134@@ -180,7 +194,7 @@ static int tree_init(X509_POLICY_TREE **ptree, STACK_OF(X509) *certs,
135 if ((data = ossl_policy_data_new(NULL,
136 OBJ_nid2obj(NID_any_policy), 0)) == NULL)
137 goto bad_tree;
138- if (ossl_policy_level_add_node(level, data, NULL, tree) == NULL) {
139+ if (ossl_policy_level_add_node(level, data, NULL, tree, 1) == NULL) {
140 ossl_policy_data_free(data);
141 goto bad_tree;
142 }
143@@ -239,7 +253,8 @@ static int tree_init(X509_POLICY_TREE **ptree, STACK_OF(X509) *certs,
144 * Return value: 1 on success, 0 otherwise
145 */
146 static int tree_link_matching_nodes(X509_POLICY_LEVEL *curr,
147- X509_POLICY_DATA *data)
148+ X509_POLICY_DATA *data,
149+ X509_POLICY_TREE *tree)
150 {
151 X509_POLICY_LEVEL *last = curr - 1;
152 int i, matched = 0;
153@@ -249,13 +264,13 @@ static int tree_link_matching_nodes(X509_POLICY_LEVEL *curr,
154 X509_POLICY_NODE *node = sk_X509_POLICY_NODE_value(last->nodes, i);
155
156 if (ossl_policy_node_match(last, node, data->valid_policy)) {
157- if (ossl_policy_level_add_node(curr, data, node, NULL) == NULL)
158+ if (ossl_policy_level_add_node(curr, data, node, tree, 0) == NULL)
159 return 0;
160 matched = 1;
161 }
162 }
163 if (!matched && last->anyPolicy) {
164- if (ossl_policy_level_add_node(curr, data, last->anyPolicy, NULL) == NULL)
165+ if (ossl_policy_level_add_node(curr, data, last->anyPolicy, tree, 0) == NULL)
166 return 0;
167 }
168 return 1;
169@@ -268,7 +283,8 @@ static int tree_link_matching_nodes(X509_POLICY_LEVEL *curr,
170 * Return value: 1 on success, 0 otherwise.
171 */
172 static int tree_link_nodes(X509_POLICY_LEVEL *curr,
173- const X509_POLICY_CACHE *cache)
174+ const X509_POLICY_CACHE *cache,
175+ X509_POLICY_TREE *tree)
176 {
177 int i;
178
179@@ -276,7 +292,7 @@ static int tree_link_nodes(X509_POLICY_LEVEL *curr,
180 X509_POLICY_DATA *data = sk_X509_POLICY_DATA_value(cache->data, i);
181
182 /* Look for matching nodes in previous level */
183- if (!tree_link_matching_nodes(curr, data))
184+ if (!tree_link_matching_nodes(curr, data, tree))
185 return 0;
186 }
187 return 1;
188@@ -307,7 +323,7 @@ static int tree_add_unmatched(X509_POLICY_LEVEL *curr,
189 /* Curr may not have anyPolicy */
190 data->qualifier_set = cache->anyPolicy->qualifier_set;
191 data->flags |= POLICY_DATA_FLAG_SHARED_QUALIFIERS;
192- if (ossl_policy_level_add_node(curr, data, node, tree) == NULL) {
193+ if (ossl_policy_level_add_node(curr, data, node, tree, 1) == NULL) {
194 ossl_policy_data_free(data);
195 return 0;
196 }
197@@ -370,7 +386,7 @@ static int tree_link_any(X509_POLICY_LEVEL *curr,
198 /* Finally add link to anyPolicy */
199 if (last->anyPolicy &&
200 ossl_policy_level_add_node(curr, cache->anyPolicy,
201- last->anyPolicy, NULL) == NULL)
202+ last->anyPolicy, tree, 0) == NULL)
203 return 0;
204 return 1;
205 }
206@@ -553,7 +569,7 @@ static int tree_calculate_user_set(X509_POLICY_TREE *tree,
207 extra->flags = POLICY_DATA_FLAG_SHARED_QUALIFIERS
208 | POLICY_DATA_FLAG_EXTRA_NODE;
209 node = ossl_policy_level_add_node(NULL, extra, anyPolicy->parent,
210- tree);
211+ tree, 1);
212 }
213 if (!tree->user_policies) {
214 tree->user_policies = sk_X509_POLICY_NODE_new_null();
215@@ -580,7 +596,7 @@ static int tree_evaluate(X509_POLICY_TREE *tree)
216
217 for (i = 1; i < tree->nlevel; i++, curr++) {
218 cache = ossl_policy_cache_set(curr->cert);
219- if (!tree_link_nodes(curr, cache))
220+ if (!tree_link_nodes(curr, cache, tree))
221 return X509_PCY_TREE_INTERNAL;
222
223 if (!(curr->flags & X509_V_FLAG_INHIBIT_ANY)
224--
2252.25.1
226
diff --git a/meta/recipes-connectivity/openssl/openssl_3.1.0.bb b/meta/recipes-connectivity/openssl/openssl_3.1.1.bb
index b319c66044..dca6f18e74 100644
--- a/meta/recipes-connectivity/openssl/openssl_3.1.0.bb
+++ b/meta/recipes-connectivity/openssl/openssl_3.1.1.bb
@@ -12,14 +12,13 @@ SRC_URI = "http://www.openssl.org/source/openssl-${PV}.tar.gz \
12 file://0001-buildinfo-strip-sysroot-and-debug-prefix-map-from-co.patch \ 12 file://0001-buildinfo-strip-sysroot-and-debug-prefix-map-from-co.patch \
13 file://0001-Configure-do-not-tweak-mips-cflags.patch \ 13 file://0001-Configure-do-not-tweak-mips-cflags.patch \
14 file://fix_random_labels.patch \ 14 file://fix_random_labels.patch \
15 file://CVE-2023-0464.patch \
16 " 15 "
17 16
18SRC_URI:append:class-nativesdk = " \ 17SRC_URI:append:class-nativesdk = " \
19 file://environment.d-openssl.sh \ 18 file://environment.d-openssl.sh \
20 " 19 "
21 20
22SRC_URI[sha256sum] = "aaa925ad9828745c4cad9d9efeb273deca820f2cdcf2c3ac7d7c1212b7c497b4" 21SRC_URI[sha256sum] = "b3aa61334233b852b63ddb048df181177c2c659eb9d4376008118f9c08d07674"
23 22
24inherit lib_package multilib_header multilib_script ptest perlnative 23inherit lib_package multilib_header multilib_script ptest perlnative
25MULTILIB_SCRIPTS = "${PN}-bin:${bindir}/c_rehash" 24MULTILIB_SCRIPTS = "${PN}-bin:${bindir}/c_rehash"