Skip to contentSkip to conversation

arm-bsp/u-boot: enable OpenSSL engine stub API

PATCH New Ross Burton 1 participant 3 messages Sep 9

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 arm-bsp/u-boot: enable OpenSSL engine stub API

u-boot/lib/rsa/rsa-sign.c uses the OpenSSL engine API, but this has been removed from OpenSSL 4. Patches are being worked on upstream and the recipe in oe-core has those patches, but for ease we can simply enable the stub API to fix the build until this old recipe is removed.

---
 meta-arm-bsp/recipes-bsp/u-boot/u-boot_2025.10.bb | 5 +++++
 1 file changed, 5 insertions(+)
meta-arm-bsp/recipes-bsp/u-boot/u-boot_2025.10.bb +5 -0
index 39af337d362..e9a7e52a68e 100644
@@ -5,3 +5,8 @@ DEPENDS += "bc-native dtc-native gnutls-native python3-pyelftools-native"
 
 SRCREV = "e50b1e8715011def8aff1588081a2649a2c6cd47"
 SRC_URI = "git://source.denx.de/u-boot/u-boot.git;protocol=https;branch=master"
+
+# u-boot/lib/rsa/rsa-sign.c uses the OpenSSL engine API, but this has been removed
+# from OpenSSL 4.  Upstream u-boot has been fixed but we can enable the stub engine
+# API in OpenSSL until this recipe is removed.
+BUILD_CFLAGS += "-DOPENSSL_ENGINE_STUBS"
Signature · 1 line
2.43.0
#1 lore raw

PATCH 2/3 arm/trusted-firmware-a: enable OpenSSL stub engine API

The cert_create tool uses the OpenSSL engine API, which has been removed from OpenSSL 4. Enable the engine stubs to fix the build until this is resolved upstream.

Also shoe-horn BUILD_CFLAGS into cert_create/Makefile, so the define is passed to the build.

---
 .../recipes-bsp/trusted-firmware-a/trusted-firmware-a.inc    | 5 +++++
 1 file changed, 5 insertions(+)
meta-arm/recipes-bsp/trusted-firmware-a/trusted-firmware-a.inc +5 -0
index 1e06559ce28..9a2b741f335 100644
@@ -93,6 +93,10 @@ def remove_options_tail (in_string):
     from itertools import takewhile
     return ' '.join(takewhile(lambda x: not x.startswith('-'), in_string.split(' ')))
 
+# tools/cert_create/src/key.c uses the OpenSSL engine API, but this has been removed
+# from OpenSSL 4.  Enable the compatibility stub APIs until upstream is fixed.
+BUILD_CFLAGS += "-DOPENSSL_ENGINE_STUBS"
+
 EXTRA_OEMAKE += "${@'' if d.getVar('TFA_LTO') else "'LD=" + remove_options_tail(d.getVar('LD')) + "'"}"
 
 EXTRA_OEMAKE += "CC='${@remove_options_tail(d.getVar('CC'))}'"
@@ -158,6 +162,7 @@ do_compile() {
     sed -i '/^LDOPTS/ s,$, \$\{BUILD_LDFLAGS},' ${S}/tools/fiptool/Makefile
     sed -i '/^INCLUDE_PATHS/ s,$, \$\{BUILD_CFLAGS},' ${S}/tools/fiptool/Makefile
     sed -i '/^LIB/ s,$, \$\{BUILD_LDFLAGS},' ${S}/tools/cert_create/Makefile
+    sed -i '/^INC_DIR / s,$, \$\{BUILD_CFLAGS},' ${S}/tools/cert_create/Makefile
 
     # Currently there are races if you build all the targets at once in parallel
     for T in ${TFA_BUILD_TARGET}; do
Signature · 1 line
2.43.0
#2 lore raw

PATCH 3/3 arm/fiptool: fix native linkage

In reply to Ross Burton

The Makefiles in TF-A have changed since this recipe was last altered, and our BUILD_LDFLAGS are no longer being respected. This means the built objects don't have the correct RPATH, so they fail to run if the host doesn't have libcrypto.so.4 (from OpenSSL 4) installed.

Pass all of our BUILD_* flags via HOSTCC*, and delete the now redundant sed operations.

---
 .../trusted-firmware-a/fiptool-native_2.15.0.bb       | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
meta-arm/recipes-bsp/trusted-firmware-a/fiptool-native_2.15.0.bb +5 -6
index 11e54fbf06e..8292eefcec3 100644
@@ -17,14 +17,13 @@ DEPENDS += "openssl-native"
 
 inherit native
 
-EXTRA_OEMAKE = "V=1 HOSTCC='${BUILD_CC}' OPENSSL_DIR=${STAGING_DIR_NATIVE}/${prefix_native}"
+EXTRA_OEMAKE = "V=1 \
+    HOSTCC='${BUILD_CC}' \
+    HOSTCCFLAGS='${BUILD_CPPFLAGS} ${BUILD_CFLAGS}' \
+    HOSTLDFLAGS='${BUILD_LDFLAGS}' \
+    OPENSSL_DIR=${STAGING_DIR_NATIVE}/${prefix_native}"
 
 do_compile () {
-    # This is still needed to have the native fiptool executing properly by
-    # setting the RPATH
-    sed -i '/^LDOPTS/ s,$, \$\{BUILD_LDFLAGS},' ${S}/tools/fiptool/Makefile
-    sed -i '/^INCLUDE_PATHS/ s,$, \$\{BUILD_CFLAGS},' ${S}/tools/fiptool/Makefile
-
     oe_runmake fiptool
 }
 
Signature · 1 line
2.43.0