summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--conf/machine/imx8mm-lpddr4-evk.conf7
-rw-r--r--conf/machine/imx8mq-evk.conf10
-rw-r--r--recipes-bsp/u-boot/files/0001-Add-support-for-OpenSSL-Provider-API.patch340
-rw-r--r--recipes-bsp/u-boot/u-boot-fslc-common_2026.10.inc (renamed from recipes-bsp/u-boot/u-boot-fslc-common_2025.01.inc)10
-rw-r--r--recipes-bsp/u-boot/u-boot-fslc-mxsboot_2026.10.bb (renamed from recipes-bsp/u-boot/u-boot-fslc-mxsboot_2025.01.bb)0
-rw-r--r--recipes-bsp/u-boot/u-boot-fslc_2026.10.bb (renamed from recipes-bsp/u-boot/u-boot-fslc_2025.01.bb)0
6 files changed, 363 insertions, 4 deletions
diff --git a/conf/machine/imx8mm-lpddr4-evk.conf b/conf/machine/imx8mm-lpddr4-evk.conf
index ae81a92d4..024515095 100644
--- a/conf/machine/imx8mm-lpddr4-evk.conf
+++ b/conf/machine/imx8mm-lpddr4-evk.conf
@@ -37,5 +37,12 @@ DDR_FIRMWARE_NAME = " \
37 lpddr4_pmu_train_2d_imem.bin \ 37 lpddr4_pmu_train_2d_imem.bin \
38 lpddr4_pmu_train_2d_dmem.bin \ 38 lpddr4_pmu_train_2d_dmem.bin \
39" 39"
40# Mainline U-Boot packs the versioned 202006 DDR firmware since v2026.10
41DDR_FIRMWARE_NAME:use-mainline-bsp = " \
42 lpddr4_pmu_train_1d_imem_202006.bin \
43 lpddr4_pmu_train_1d_dmem_202006.bin \
44 lpddr4_pmu_train_2d_imem_202006.bin \
45 lpddr4_pmu_train_2d_dmem_202006.bin \
46"
40 47
41IMXBOOT_TARGETS_BASENAME = "flash_evk" 48IMXBOOT_TARGETS_BASENAME = "flash_evk"
diff --git a/conf/machine/imx8mq-evk.conf b/conf/machine/imx8mq-evk.conf
index 9974928db..40ff665e9 100644
--- a/conf/machine/imx8mq-evk.conf
+++ b/conf/machine/imx8mq-evk.conf
@@ -62,6 +62,13 @@ DDR_FIRMWARE_NAME = " \
62 lpddr4_pmu_train_2d_imem.bin \ 62 lpddr4_pmu_train_2d_imem.bin \
63 lpddr4_pmu_train_2d_dmem.bin \ 63 lpddr4_pmu_train_2d_dmem.bin \
64" 64"
65# Mainline U-Boot packs the versioned 202006 DDR firmware since v2026.10
66DDR_FIRMWARE_NAME:use-mainline-bsp = " \
67 lpddr4_pmu_train_1d_imem_202006.bin \
68 lpddr4_pmu_train_1d_dmem_202006.bin \
69 lpddr4_pmu_train_2d_imem_202006.bin \
70 lpddr4_pmu_train_2d_dmem_202006.bin \
71"
65 72
66# Set u-boot DTB 73# Set u-boot DTB
67UBOOT_DTB_NAME = "imx8mq-evk.dtb" 74UBOOT_DTB_NAME = "imx8mq-evk.dtb"
@@ -95,6 +102,9 @@ IMAGE_BOOT_FILES:append:use-mainline-bsp = " extlinux.conf;extlinux/extlinux.con
95LOADADDR = "" 102LOADADDR = ""
96UBOOT_MAKE_TARGET = "" 103UBOOT_MAKE_TARGET = ""
97IMX_BOOT_SEEK = "33" 104IMX_BOOT_SEEK = "33"
105# Mainline U-Boot puts the signed HDMI firmware, with its 1KB head
106# padding, at the start of flash.bin since v2026.10, so it goes at 32KB
107IMX_BOOT_SEEK:use-mainline-bsp = "32"
98 108
99OPTEE_BIN_EXT = "8mq" 109OPTEE_BIN_EXT = "8mq"
100 110
diff --git a/recipes-bsp/u-boot/files/0001-Add-support-for-OpenSSL-Provider-API.patch b/recipes-bsp/u-boot/files/0001-Add-support-for-OpenSSL-Provider-API.patch
new file mode 100644
index 000000000..346d0584d
--- /dev/null
+++ b/recipes-bsp/u-boot/files/0001-Add-support-for-OpenSSL-Provider-API.patch
@@ -0,0 +1,340 @@
1From a81cb0932dce109af44d7245d47489fe54ae390f Mon Sep 17 00:00:00 2001
2From: Eddie Kovsky <ewk@edkovsky.org>
3Date: Mon, 23 Feb 2026 09:43:22 -0700
4Subject: [PATCH] Add support for OpenSSL Provider API
5
6The Engine API has been deprecated since the release of OpenSSL 3.0. End
7users have been advised to migrate to the new Provider interface.
8Several distributions have already removed support for engines, which is
9preventing U-Boot from being compiled in those environments.
10
11Add support for the Provider API while continuing to support the existing
12Engine API on distros shipping older releases of OpenSSL.
13
14This is based on similar work contributed by Jan Stancek updating Linux
15to use the Provider interface.
16
17 commit 558bdc45dfb2669e1741384a0c80be9c82fa052c
18 Author: Jan Stancek <jstancek@redhat.com>
19 Date: Fri Sep 20 19:52:48 2024 +0300
20
21 sign-file,extract-cert: use pkcs11 provider for OPENSSL MAJOR >= 3
22
23The changes have been tested with the FIT signature verification vboot
24tests on Fedora 42 and Debian 13. All 30 tests pass with both the legacy
25Engine library installed and with the Provider API.
26
27Signed-off-by: Eddie Kovsky <ewk@edkovsky.org>
28
29Upstream-Status: Submitted [https://lore.kernel.org/u-boot/20260429180247.83091-1-ekovsky@redhat.com/]
30
31Note: Modified to make pkcs11 provider loading optional. The upstream
32patch unconditionally requires the pkcs11 provider, which is not
33available in the OE build environment. File-based key signing only needs
34the default provider; pkcs11 is only required for pkcs11: URI keys.
35Changes from upstream:
36 - Load default provider first (was pkcs11 first)
37 - Make pkcs11 provider load failure non-fatal (ERR_clear_error instead
38 of ERR(1, ...) which calls errx/abort)
39
40Signed-off-by: Jaipaul Cheernam <jaipaul.cheernam@est.tech>
41---
42 doc/build/gcc.rst | 4 +-
43 lib/aes/aes-encrypt.c | 4 +-
44 lib/rsa/rsa-sign.c | 102 +++++++++++++++++++++++++++++++++++++++---
45 tools/docker/Dockerfile | 1 +
46 4 files changed, 103 insertions(+), 8 deletions(-)
47
48diff --git a/doc/build/gcc.rst b/doc/build/gcc.rst
49index 1fef718ceecb..29a6a632e7e3 100644
50--- a/doc/build/gcc.rst
51+++ b/doc/build/gcc.rst
52@@ -25,8 +25,8 @@ Depending on the build targets further packages maybe needed
53
54 sudo apt-get install bc bison build-essential coccinelle \
55 device-tree-compiler dfu-util efitools flex gdisk graphviz imagemagick \
56- libgnutls28-dev libguestfs-tools libncurses-dev \
57- libpython3-dev libsdl2-dev libssl-dev lz4 lzma lzma-alone openssl \
58+ libgnutls28-dev libguestfs-tools libncurses-dev libpython3-dev \
59+ libsdl2-dev libssl-dev lz4 lzma lzma-alone openssl pkcs11-provider \
60 pkg-config python3 python3-asteval python3-coverage python3-filelock \
61 python3-pkg-resources python3-pycryptodome python3-pyelftools \
62 python3-pytest python3-pytest-xdist python3-sphinxcontrib.apidoc \
63diff --git a/lib/aes/aes-encrypt.c b/lib/aes/aes-encrypt.c
64index 90e1407b4f09..4fc4ce232478 100644
65--- a/lib/aes/aes-encrypt.c
66+++ b/lib/aes/aes-encrypt.c
67@@ -16,7 +16,9 @@
68 #include <openssl/err.h>
69 #include <openssl/ssl.h>
70 #include <openssl/evp.h>
71-#include <openssl/engine.h>
72+#if !defined(OPENSSL_NO_ENGINE) && !defined(OPENSSL_NO_DEPRECATED_3_0)
73+# include <openssl/engine.h>
74+#endif
75 #include <uboot_aes.h>
76
77 #if OPENSSL_VERSION_NUMBER >= 0x10000000L
78diff --git a/lib/rsa/rsa-sign.c b/lib/rsa/rsa-sign.c
79index 0e38c9e802fd..f456f3c58e65 100644
80--- a/lib/rsa/rsa-sign.c
81+++ b/lib/rsa/rsa-sign.c
82@@ -19,7 +19,47 @@
83 #include <openssl/err.h>
84 #include <openssl/ssl.h>
85 #include <openssl/evp.h>
86-#include <openssl/engine.h>
87+#if OPENSSL_VERSION_MAJOR >= 3
88+# define USE_PKCS11_PROVIDER
89+# include <err.h>
90+# include <openssl/provider.h>
91+# include <openssl/store.h>
92+#else
93+# if !defined(OPENSSL_NO_ENGINE) && !defined(OPENSSL_NO_DEPRECATED_3_0)
94+# define USE_PKCS11_ENGINE
95+# include <openssl/engine.h>
96+# endif
97+#endif
98+
99+#ifdef USE_PKCS11_PROVIDER
100+#define ERR(cond, fmt, ...) \
101+ do { \
102+ bool __cond = (cond); \
103+ drain_openssl_errors(__LINE__, 0); \
104+ if (__cond) { \
105+ errx(1, fmt, ## __VA_ARGS__); \
106+ } \
107+ } while (0)
108+
109+static void drain_openssl_errors(int l, int silent)
110+{
111+ const char *file;
112+ char buf[120];
113+ int e, line;
114+
115+ if (ERR_peek_error() == 0)
116+ return;
117+ if (!silent)
118+ fprintf(stderr, "At main.c:%d:\n", l);
119+
120+ while ((e = ERR_peek_error_line(&file, &line))) {
121+ ERR_error_string(e, buf);
122+ if (!silent)
123+ fprintf(stderr, "- SSL %s: %s:%d\n", buf, file, line);
124+ ERR_get_error();
125+ }
126+}
127+#endif
128
129 static int rsa_err(const char *msg)
130 {
131@@ -94,10 +134,11 @@ static int rsa_pem_get_pub_key(const char *keydir, const char *name, EVP_PKEY **
132 *
133 * @keydir: Key prefix
134 * @name Name of key
135- * @engine Engine to use
136+ * @engine Engine to use or NULL when using pkcs11 provider
137 * @evpp Returns EVP_PKEY object, or NULL on failure
138 * Return: 0 if ok, -ve on error (in which case *evpp will be set to NULL)
139 */
140+#ifdef USE_PKCS11_ENGINE
141 static int rsa_engine_get_pub_key(const char *keydir, const char *name,
142 ENGINE *engine, EVP_PKEY **evpp)
143 {
144@@ -157,21 +198,24 @@ static int rsa_engine_get_pub_key(const char *keydir, const char *name,
145
146 return 0;
147 }
148+#endif
149
150 /**
151 * rsa_get_pub_key() - read a public key
152 *
153 * @keydir: Directory containing the key (PEM file) or key prefix (engine)
154 * @name Name of key file (will have a .crt extension)
155- * @engine Engine to use
156+ * @engine Engine to use or NULL when using pkcs11 provider
157 * @evpp Returns EVP_PKEY object, or NULL on failure
158 * Return: 0 if ok, -ve on error (in which case *evpp will be set to NULL)
159 */
160 static int rsa_get_pub_key(const char *keydir, const char *name,
161 ENGINE *engine, EVP_PKEY **evpp)
162 {
163+#ifdef USE_PKCS11_ENGINE
164 if (engine)
165 return rsa_engine_get_pub_key(keydir, name, engine, evpp);
166+#endif
167 return rsa_pem_get_pub_key(keydir, name, evpp);
168 }
169
170@@ -207,13 +251,45 @@ static int rsa_pem_get_priv_key(const char *keydir, const char *name,
171 return -ENOENT;
172 }
173
174+#ifdef USE_PKCS11_PROVIDER
175+ EVP_PKEY *private_key = NULL;
176+ OSSL_STORE_CTX *store;
177+
178+ if (!OSSL_PROVIDER_try_load(NULL, "default", true))
179+ ERR(1, "OSSL_PROVIDER_try_load(default)");
180+ /* pkcs11 provider is optional; only needed for pkcs11: URIs */
181+ if (!OSSL_PROVIDER_try_load(NULL, "pkcs11", true))
182+ ERR_clear_error();
183+
184+ store = OSSL_STORE_open(path, NULL, NULL, NULL, NULL);
185+ ERR(!store, "OSSL_STORE_open");
186+
187+ while (!OSSL_STORE_eof(store)) {
188+ OSSL_STORE_INFO *info = OSSL_STORE_load(store);
189+
190+ if (!info) {
191+ drain_openssl_errors(__LINE__, 0);
192+ continue;
193+ }
194+ if (OSSL_STORE_INFO_get_type(info) == OSSL_STORE_INFO_PKEY) {
195+ private_key = OSSL_STORE_INFO_get1_PKEY(info);
196+ ERR(!private_key, "OSSL_STORE_INFO_get1_PKEY");
197+ }
198+ OSSL_STORE_INFO_free(info);
199+ if (private_key)
200+ break;
201+ }
202+ OSSL_STORE_close(store);
203+
204+ *evpp = private_key;
205+#else
206 if (!PEM_read_PrivateKey(f, evpp, NULL, path)) {
207 rsa_err("Failure reading private key");
208 fclose(f);
209 return -EPROTO;
210 }
211 fclose(f);
212-
213+#endif
214 return 0;
215 }
216
217@@ -226,6 +301,7 @@ static int rsa_pem_get_priv_key(const char *keydir, const char *name,
218 * @evpp Returns EVP_PKEY object, or NULL on failure
219 * Return: 0 if ok, -ve on error (in which case *evpp will be set to NULL)
220 */
221+#ifdef USE_PKCS11_ENGINE
222 static int rsa_engine_get_priv_key(const char *keydir, const char *name,
223 const char *keyfile,
224 ENGINE *engine, EVP_PKEY **evpp)
225@@ -293,22 +369,25 @@ static int rsa_engine_get_priv_key(const char *keydir, const char *name,
226
227 return 0;
228 }
229+#endif
230
231 /**
232 * rsa_get_priv_key() - read a private key
233 *
234 * @keydir: Directory containing the key (PEM file) or key prefix (engine)
235 * @name Name of key
236- * @engine Engine to use for signing
237+ * @engine Engine to use or NULL when using pkcs11 provider
238 * @evpp Returns EVP_PKEY object, or NULL on failure
239 * Return: 0 if ok, -ve on error (in which case *evpp will be set to NULL)
240 */
241 static int rsa_get_priv_key(const char *keydir, const char *name,
242 const char *keyfile, ENGINE *engine, EVP_PKEY **evpp)
243 {
244+#ifdef USE_PKCS11_ENGINE
245 if (engine)
246 return rsa_engine_get_priv_key(keydir, name, keyfile, engine,
247 evpp);
248+#endif
249 return rsa_pem_get_priv_key(keydir, name, keyfile, evpp);
250 }
251
252@@ -325,6 +404,7 @@ static int rsa_init(void)
253 return 0;
254 }
255
256+#ifdef USE_PKCS11_ENGINE
257 static int rsa_engine_init(const char *engine_id, ENGINE **pe)
258 {
259 const char *key_pass;
260@@ -380,6 +460,7 @@ static void rsa_engine_remove(ENGINE *e)
261 ENGINE_free(e);
262 }
263 }
264+#endif
265
266 static int rsa_sign_with_key(EVP_PKEY *pkey, struct padding_algo *padding_algo,
267 struct checksum_algo *checksum_algo,
268@@ -480,11 +561,13 @@ int rsa_sign(struct image_sign_info *info,
269 if (ret)
270 return ret;
271
272+#ifdef USE_PKCS11_ENGINE
273 if (info->engine_id) {
274 ret = rsa_engine_init(info->engine_id, &e);
275 if (ret)
276 return ret;
277 }
278+#endif
279
280 ret = rsa_get_priv_key(info->keydir, info->keyname, info->keyfile,
281 e, &pkey);
282@@ -496,16 +579,21 @@ int rsa_sign(struct image_sign_info *info,
283 goto err_sign;
284
285 EVP_PKEY_free(pkey);
286+
287+#ifdef USE_PKCS11_ENGINE
288 if (info->engine_id)
289 rsa_engine_remove(e);
290+#endif
291
292 return ret;
293
294 err_sign:
295 EVP_PKEY_free(pkey);
296 err_priv:
297+#ifdef USE_PKCS11_ENGINE
298 if (info->engine_id)
299 rsa_engine_remove(e);
300+#endif
301 return ret;
302 }
303
304@@ -645,11 +733,13 @@ int rsa_add_verify_data(struct image_sign_info *info, void *keydest)
305 ENGINE *e = NULL;
306
307 debug("%s: Getting verification data\n", __func__);
308+#ifdef USE_PKCS11_ENGINE
309 if (info->engine_id) {
310 ret = rsa_engine_init(info->engine_id, &e);
311 if (ret)
312 return ret;
313 }
314+#endif
315 ret = rsa_get_pub_key(info->keydir, info->keyname, e, &pkey);
316 if (ret)
317 goto err_get_pub_key;
318@@ -726,8 +816,10 @@ int rsa_add_verify_data(struct image_sign_info *info, void *keydest)
319 err_get_params:
320 EVP_PKEY_free(pkey);
321 err_get_pub_key:
322+#ifdef USE_PKCS11_ENGINE
323 if (info->engine_id)
324 rsa_engine_remove(e);
325+#endif
326
327 if (ret)
328 return ret;
329diff --git a/tools/docker/Dockerfile b/tools/docker/Dockerfile
330index 73bf6cdd2c52..50e98e83dc20 100644
331--- a/tools/docker/Dockerfile
332+++ b/tools/docker/Dockerfile
333@@ -122,6 +122,7 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
334 openssl \
335 picocom \
336 parted \
337+ pkcs11-provider \
338 pkg-config \
339 python-is-python3 \
340 python3 \
diff --git a/recipes-bsp/u-boot/u-boot-fslc-common_2025.01.inc b/recipes-bsp/u-boot/u-boot-fslc-common_2026.10.inc
index a7be37572..e401c110d 100644
--- a/recipes-bsp/u-boot/u-boot-fslc-common_2025.01.inc
+++ b/recipes-bsp/u-boot/u-boot-fslc-common_2026.10.inc
@@ -9,12 +9,14 @@ LIC_FILES_CHKSUM = "file://Licenses/README;md5=2ca5f2c35c8cc335f0a19756634782f1"
9 9
10DEPENDS += "bison-native flex-native" 10DEPENDS += "bison-native flex-native"
11 11
12PV = "2025.01+fslc+git${SRCPV}" 12PV = "2026.10+fslc+git${SRCPV}"
13 13
14SRC_URI = "git://github.com/Freescale/u-boot-fslc.git;branch=${SRCBRANCH};protocol=https" 14SRC_URI = "git://github.com/Freescale/u-boot-fslc.git;branch=${SRCBRANCH};protocol=https \
15 file://0001-Add-support-for-OpenSSL-Provider-API.patch \
16"
15 17
16SRCREV = "aa4bc52d08c342df83e3c576e2c108d7c8816e0e" 18SRCREV = "322904a1db22d45b9a7f4627e1093fe4f6befaba"
17SRCBRANCH = "2025.01+fslc" 19SRCBRANCH = "2026.10+fslc"
18 20
19CVE_PRODUCT = "denx:u-boot" 21CVE_PRODUCT = "denx:u-boot"
20 22
diff --git a/recipes-bsp/u-boot/u-boot-fslc-mxsboot_2025.01.bb b/recipes-bsp/u-boot/u-boot-fslc-mxsboot_2026.10.bb
index a5c4011aa..a5c4011aa 100644
--- a/recipes-bsp/u-boot/u-boot-fslc-mxsboot_2025.01.bb
+++ b/recipes-bsp/u-boot/u-boot-fslc-mxsboot_2026.10.bb
diff --git a/recipes-bsp/u-boot/u-boot-fslc_2025.01.bb b/recipes-bsp/u-boot/u-boot-fslc_2026.10.bb
index 92076aa72..92076aa72 100644
--- a/recipes-bsp/u-boot/u-boot-fslc_2025.01.bb
+++ b/recipes-bsp/u-boot/u-boot-fslc_2026.10.bb