mbedtls: add recipe for v4.1.0
PATCH v2 1/1 mbedtls: add recipe for v4.1.0
This is the current LTS version for mbedtls, add it next to the existing recipe for v3.6. This new version will be supported longer than v3.6, but there are some incompatibilities between the two (see migration guide[1] and changelog[2]).
This recipe is based on the v3.6 recipe. psa PACKAGECONFIG was dropped, as it is now the regular behavior, without an option to turn it off. update-alternatives class is also removed - it was required due to a sample program called "hello", which has been removed from this release.
Added two small patches:
- one to handle the CC env var correctly from Python. This is submitted for upstream.
- one to use qemu to run cross-compiled binaries instead of running them as they are. This is not upstreamed, as it is OE specific.
Ptests passed successfully:
root@qemux86-64:~# ptest-runner START: ptest-runner 2026-04-23T07:29 BEGIN: /usr/lib/mbedtls/ptest PASS: test_suite_config.mbedtls_boolean PASS: test_suite_config.tls_combinations PASS: test_suite_constant_time_hmac PASS: test_suite_debug PASS: test_suite_error PASS: test_suite_mps PASS: test_suite_net PASS: test_suite_pkcs7 PASS: test_suite_ssl PASS: test_suite_ssl.records PASS: test_suite_ssl.tls-defrag PASS: test_suite_ssl_decrypt.misc PASS: test_suite_test_helpers PASS: test_suite_timing PASS: test_suite_version PASS: test_suite_x509_oid PASS: test_suite_x509parse PASS: test_suite_x509write DURATION: 7 END: /usr/lib/mbedtls/ptest 2026-04-23T07:29 STOP: ptest-runner TOTAL: 1 FAIL: 0
[1]: https://github.com/Mbed-TLS/mbedtls/blob/development/docs/4.0-migration-guide.md
[2]: https://github.com/Mbed-TLS/mbedtls/releases/tag/mbedtls-4.1.0
---
v2: Inherit python3native, because some native python modules need to be used. When using the
system python, PYTHONPATH gets mixed with build host and sysroot modules, which is incorrect. When using python3native class, the module search path is confined to the sysroot, so it can be better controlled. Also, add python3-jsonschema-native as a build dependency (in v1 the recipe took this dependency from my build host)
...c_build_helper-Split-cc-command-line.patch | 33 +++++++ ...wrapper-to-run-cross-compiled-binary.patch | 29 ++++++ .../mbedtls/mbedtls_4.1.0.bb | 88 +++++++++++++++++++ 3 files changed, 150 insertions(+) create mode 100644 meta-networking/recipes-connectivity/mbedtls/mbedtls/0001-c_build_helper-Split-cc-command-line.patch create mode 100644 meta-networking/recipes-connectivity/mbedtls/mbedtls/0001-use-qemuwrapper-to-run-cross-compiled-binary.patch create mode 100644 meta-networking/recipes-connectivity/mbedtls/mbedtls_4.1.0.bb
meta-networking/recipes-connectivity/mbedtls/mbedtls/0001-c_build_helper-Split-cc-command-line.patch new file +33 -0
@@ -0,0 +1,33 @@ +From 178e089683bf42097ac6d27522820d07483bc6bd Mon Sep 17 00:00:00 2001 +From: Gyorgy Sarvari <[email protected]> +Date: Thu, 23 Apr 2026 08:54:02 +0200 +Subject: [PATCH] c_build_helper: Split cc command line + +Optionally the CC/HOSTCC environment variable can hold the command to +invoke the C compiler, however this command can also contain extra +arguments, not only the binary name. In this particular case Python +was treating the whole value as a single binary name, and was trying +to execute as such (e.g. "cc -arg1 -arg2" instead of "cc" and the arguments +separately), which results in failure. + +Split the compiler command into its components to invoke it correctly. + +Upstream-Status: Submitted [https://github.com/Mbed-TLS/mbedtls-framework/pull/301] +Signed-off-by: Gyorgy Sarvari <[email protected]> +--- + scripts/mbedtls_framework/c_build_helper.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/scripts/mbedtls_framework/c_build_helper.py b/scripts/mbedtls_framework/c_build_helper.py +index 59bb326e2..85dbb628f 100644 +--- a/tf-psa-crypto/framework/scripts/mbedtls_framework/c_build_helper.py ++++ b/tf-psa-crypto/framework/scripts/mbedtls_framework/c_build_helper.py +@@ -98,7 +98,7 @@ def compile_c_file(c_filename, exe_filename, include_dirs): + cc = os.getenv('HOSTCC', None) + if cc is None: + cc = os.getenv('CC', 'cc') +- cmd = [cc] ++ cmd = cc.split() + + proc = subprocess.Popen(cmd, + stdout=subprocess.DEVNULL,
meta-networking/recipes-connectivity/mbedtls/mbedtls/0001-use-qemuwrapper-to-run-cross-compiled-binary.patch new file +29 -0
@@ -0,0 +1,29 @@ +From 46f0ea3eb35e8d0d33e88298a9e7c3dbdd49ec17 Mon Sep 17 00:00:00 2001 +From: Gyorgy Sarvari <[email protected]> +Date: Thu, 23 Apr 2026 09:14:40 +0200 +Subject: [PATCH] use qemuwrapper to run cross-compiled binary + +The build process executes a compiled binary to get some details, +however this results in a failure in case of cross-compiling. + +Run it with qemuwrapper, that is created in the recipe. + +Upstream-Status: Inappropriate [cross-compile specific] +Signed-off-by: Gyorgy Sarvari <[email protected]> +--- + scripts/mbedtls_framework/c_build_helper.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/scripts/mbedtls_framework/c_build_helper.py b/scripts/mbedtls_framework/c_build_helper.py +index 59bb326e2..5c4c211ee 100644 +--- a/tf-psa-crypto/framework/scripts/mbedtls_framework/c_build_helper.py ++++ b/tf-psa-crypto/framework/scripts/mbedtls_framework/c_build_helper.py +@@ -169,7 +169,7 @@ def get_c_expression_values( + .format(caller, c_name)) + else: + os.remove(c_name) +- output = subprocess.check_output([exe_name]) ++ output = subprocess.check_output(['../../../qemuwrapper', exe_name]) + return output.decode('ascii').strip().split('\n') + finally: + remove_file_if_exists(exe_name)
meta-networking/recipes-connectivity/mbedtls/mbedtls_4.1.0.bb new file +88 -0
88 lines not on this page · raw message
here is next error
| *** stack smashing detected ***: terminated | qemu: uncaught target signal 6 (Aborted) - core dumped | Aborted | Traceback (most recent call last): | File "/srv/pokybuild/yocto-worker/meta-oe/build/build/tmp/work/x86-64-v3-poky-linux/mbedtls/4.1.0/sources/mbedtls-4.1.0/tf-psa-crypto/framework/scripts/generate_psa_tests.py", line 870, in <module> | test_data_generation.main(sys.argv[1:], __doc__, PSATestGenerator) | ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Detailed error log
https://autobuilder.yoctoproject.org/valkyrie/api/v2/logs/6511632/raw_inline
Quoted 285 lines · Gyorgy Sarvari via lists.openembedded.org
This is the current LTS version for mbedtls, add it next to the existing recipe
for v3.6. This new version will be supported longer than v3.6, but there are
some incompatibilities between the two (see migration guide[1] and changelog[2]).This recipe is based on the v3.6 recipe. psa PACKAGECONFIG was dropped, as it is
now the regular behavior, without an option to turn it off. update-alternatives
class is also removed - it was required due to a sample program called "hello",
which has been removed from this release.Added two small patches:
- one to handle the CC env var correctly from Python. This is submitted for upstream.
- one to use qemu to run cross-compiled binaries instead of running them as they are.
This is not upstreamed, as it is OE specific.Ptests passed successfully:
root@qemux86-64:~# ptest-runner START: ptest-runner 2026-04-23T07:29 BEGIN: /usr/lib/mbedtls/ptest PASS: test_suite_config.mbedtls_boolean PASS: test_suite_config.tls_combinations PASS: test_suite_constant_time_hmac PASS: test_suite_debug PASS: test_suite_error PASS: test_suite_mps PASS: test_suite_net PASS: test_suite_pkcs7 PASS: test_suite_ssl PASS: test_suite_ssl.records PASS: test_suite_ssl.tls-defrag PASS: test_suite_ssl_decrypt.misc PASS: test_suite_test_helpers PASS: test_suite_timing PASS: test_suite_version PASS: test_suite_x509_oid PASS: test_suite_x509parse PASS: test_suite_x509write DURATION: 7 END: /usr/lib/mbedtls/ptest 2026-04-23T07:29 STOP: ptest-runner TOTAL: 1 FAIL: 0[1]:
https://github.com/Mbed-TLS/mbedtls/blob/development/docs/4.0-migration-guide.md
[2]: https://github.com/Mbed-TLS/mbedtls/releases/tag/mbedtls-4.1.0Signed-off-by Gyorgy Sarvari <[email protected]>---
v2: Inherit python3native, because some native python modules need to be used. When using the
system python, PYTHONPATH gets mixed with build host and sysroot
modules, which is incorrect.
When using python3native class, the module search path is confined to
the sysroot, so it
can be better controlled. Also, add python3-jsonschema-native as a
build dependency (in v1
the recipe took this dependency from my build host)...c_build_helper-Split-cc-command-line.patch | 33 +++++++ ...wrapper-to-run-cross-compiled-binary.patch | 29 ++++++ .../mbedtls/mbedtls_4.1.0.bb | 88 +++++++++++++++++++ 3 files changed, 150 insertions(+) create mode 100644 meta-networking/recipes-connectivity/mbedtls/mbedtls/0001-c_build_helper-Split-cc-command-line.patch create mode 100644 meta-networking/recipes-connectivity/mbedtls/mbedtls/0001-use-qemuwrapper-to-run-cross-compiled-binary.patch create mode 100644 meta-networking/recipes-connectivity/mbedtls/mbedtls_4.1.0.bb
diff --git
a/meta-networking/recipes-connectivity/mbedtls/mbedtls/0001-c_build_helper-Split-cc-command-line.patchb/meta-networking/recipes-connectivity/mbedtls/mbedtls/0001-c_build_helper-Split-cc-command-line.patchnew file mode 100644
index 0000000000..adddb7ad8e
---/dev/null
+++b/meta-networking/recipes-connectivity/mbedtls/mbedtls/0001-c_build_helper-Split-cc-command-line.patchmeta-networking/recipes-connectivity/mbedtls/mbedtls/0001-c_build_helper-Split-cc-command-line.patch new file +10
-0@@ -0,0 +1,33 @@ +From 178e089683bf42097ac6d27522820d07483bc6bd Mon Sep 17 00:00:00 2001 +From: Gyorgy Sarvari <[email protected]> +Date: Thu, 23 Apr 2026 08:54:02 +0200 +Subject: [PATCH] c_build_helper: Split cc command line + +Optionally the CC/HOSTCC environment variable can hold the command to +invoke the C compiler, however this command can also contain extra +arguments, not only the binary name. In this particular case Python +was treating the whole value as a single binary name, and was trying +to execute as such (e.g. "cc -arg1 -arg2" instead of "cc" and thearguments
meta-networking/recipes-connectivity/mbedtls/mbedtls/0001-c_build_helper-Split-cc-command-line.patch new file +5
-0+separately), which results in failure. + +Split the compiler command into its components to invoke it correctly. + +Upstream-Status: Submitted [https://github.com/Mbed-TLS/mbedtls-framework/pull/301]
meta-networking/recipes-connectivity/mbedtls/mbedtls/0001-c_build_helper-Split-cc-command-line.patch new file +6
-0+Signed-off-by: Gyorgy Sarvari <[email protected]> +--- + scripts/mbedtls_framework/c_build_helper.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/scripts/mbedtls_framework/c_build_helper.py
b/scripts/mbedtls_framework/c_build_helper.py
+index59bb326e2..85dbb628f100644
+---a/tf-psa-crypto/framework/scripts/mbedtls_framework/c_build_helper.py++++b/tf-psa-crypto/framework/scripts/mbedtls_framework/c_build_helper.py+@@ -98,7 +98,7 @@ defcompile_c_file(c_filename, exe_filename, include_dirs):meta-networking/recipes-connectivity/mbedtls/mbedtls/0001-c_build_helper-Split-cc-command-line.patch new file +8
-0+ cc = os.getenv('HOSTCC', None) + if cc is None: + cc = os.getenv('CC', 'cc') +- cmd = [cc] ++ cmd = cc.split() + + proc = subprocess.Popen(cmd, + stdout=subprocess.DEVNULL,diff --git
a/meta-networking/recipes-connectivity/mbedtls/mbedtls/0001-use-qemuwrapper-to-run-cross-compiled-binary.patchb/meta-networking/recipes-connectivity/mbedtls/mbedtls/0001-use-qemuwrapper-to-run-cross-compiled-binary.patchnew file mode 100644
index 0000000000..a9e8bb2ed9
---/dev/null
+++b/meta-networking/recipes-connectivity/mbedtls/mbedtls/0001-use-qemuwrapper-to-run-cross-compiled-binary.patchmeta-networking/recipes-connectivity/mbedtls/mbedtls/0001-use-qemuwrapper-to-run-cross-compiled-binary.patch new file +17
-0@@ -0,0 +1,29 @@ +From 46f0ea3eb35e8d0d33e88298a9e7c3dbdd49ec17 Mon Sep 17 00:00:00 2001 +From: Gyorgy Sarvari <[email protected]> +Date: Thu, 23 Apr 2026 09:14:40 +0200 +Subject: [PATCH] use qemuwrapper to run cross-compiled binary + +The build process executes a compiled binary to get some details, +however this results in a failure in case of cross-compiling. + +Run it with qemuwrapper, that is created in the recipe. + +Upstream-Status: Inappropriate [cross-compile specific] +Signed-off-by: Gyorgy Sarvari <[email protected]> +--- + scripts/mbedtls_framework/c_build_helper.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/scripts/mbedtls_framework/c_build_helper.py
b/scripts/mbedtls_framework/c_build_helper.pymeta-networking/recipes-connectivity/mbedtls/mbedtls/0001-use-qemuwrapper-to-run-cross-compiled-binary.patch new file +9
-0+index 59bb326e2..5c4c211ee 100644 +--- a/tf-psa-crypto/framework/scripts/mbedtls_framework/c_build_helper.py ++++ b/tf-psa-crypto/framework/scripts/mbedtls_framework/c_build_helper.py +@@ -169,7 +169,7 @@ def get_c_expression_values( + .format(caller, c_name)) + else: + os.remove(c_name) +- output = subprocess.check_output([exe_name]) ++ output = subprocess.check_output(['../../../qemuwrapper',
exe_name])meta-networking/recipes-connectivity/mbedtls/mbedtls/0001-use-qemuwrapper-to-run-cross-compiled-binary.patch new file +3
-0+ return output.decode('ascii').strip().split('\n') + finally: + remove_file_if_exists(exe_name)meta-networking/recipes-connectivity/mbedtls/mbedtls_4.1.0.bb new file +26
-0@@ -0,0 +1,88 @@ +SUMMARY = "Lightweight crypto and SSL/TLS library" +DESCRIPTION = "mbedtls is a lean open source crypto library \ +for providing SSL and TLS support in your programs. It offers \ +an intuitive API and documented header files, so you can actually \ +understand what the code does. It features: \ + \ + - Symmetric algorithms, like AES, Blowfish, Triple-DES, DES, ARC4, \ + Camellia and XTEA \ + - Hash algorithms, like SHA-1, SHA-2, RIPEMD-160 and MD5 \ + - Entropy pool and random generators, like CTR-DRBG and HMAC-DRBG \ + - Public key algorithms, like RSA, Elliptic Curves, Diffie-Hellman, \ + ECDSA and ECDH \ + - SSL v3 and TLS 1.0, 1.1 and 1.2 \ + - Abstraction layers for ciphers, hashes, public key operations, \ + platform abstraction and threading \ +" + +HOMEPAGE = "https://www.trustedfirmware.org/projects/mbed-tls/" +BUGTRACKER = "https://github.com/Mbed-TLS/mbedtls/issues" + +LICENSE = "Apache-2.0 | GPL-2.0-or-later" +LIC_FILES_CHKSUM = "file://LICENSE;md5=379d5819937a6c2f1ef1630d341e026d" + +SECTION = "libs" + +SRC_URI = "gitsm://github.com/Mbed-TLS/mbedtls.git;protocol=https;branch=mbedtls-4.1;tag=v${PV}
<http://github.com/Mbed-TLS/mbedtls.git;protocol=https;branch=mbedtls-4.1;tag=v$%7BPV%7D>
\meta-networking/recipes-connectivity/mbedtls/mbedtls_4.1.0.bb new file +5
-0+ file://run-ptest \ + file://0001-c_build_helper-Split-cc-command-line.patch \ + " + +SRC_URI:append:class-target = "file://0001-use-qemuwrapper-to-run-cross-compiled-binary.patch"
meta-networking/recipes-connectivity/mbedtls/mbedtls_4.1.0.bb new file +10
-0+ +SRCREV = "0fe989b6b514192783c469039edd325fd0989806" + +DEPENDS += "python3-jinja2-native python3-jsonschema-native qemu-native" + +UPSTREAM_CHECK_GITTAGREGEX = "v(?P<pver>\d+(\.\d+)+)" + +inherit cmake ptest python3native qemu + +PACKAGECONFIG ??= "shared-libs programs${@bb.utils.contains('PTEST_ENABLED', '1', 'tests', '', d)}" +PACKAGECONFIG[shared-libs] = "-DUSE_SHARED_MBEDTLS_LIBRARY=ON,-DUSE_SHARED_MBEDTLS_LIBRARY=OFF"
meta-networking/recipes-connectivity/mbedtls/mbedtls_4.1.0.bb new file +2
-0+PACKAGECONFIG[programs] = "-DENABLE_PROGRAMS=ON,-DENABLE_PROGRAMS=OFF" +PACKAGECONFIG[werror] ="-DMBEDTLS_FATAL_WARNINGS=ON,-DMBEDTLS_FATAL_WARNINGS=OFF"
meta-networking/recipes-connectivity/mbedtls/mbedtls_4.1.0.bb new file +14
-0+PACKAGECONFIG[tests] = "-DENABLE_TESTING=ON,-DENABLE_TESTING=OFF" + +PROVIDES += "polarssl" +RPROVIDES:${PN} = "polarssl" + +PACKAGES =+ "${PN}-programs" +FILES:${PN}-programs = "${bindir}/" + +BBCLASSEXTEND = "native nativesdk" + +CVE_PRODUCT = "mbed_tls" + +do_configure:prepend() { + # during building
tf-psa-crypto/framework/scripts/mbedtls_framework/c_build_helper.pymeta-networking/recipes-connectivity/mbedtls/mbedtls_4.1.0.bb new file +3
-0+ # runs some of the cross-compiled binaries. + + qemu_binary="${@qemu_wrapper_cmdline(d,
d.getVar('STAGING_DIR_HOST'), [d.expand('${STAGING_DIR_HOST}${libdir}'),d.expand('${STAGING_LIBDIR}')])}"meta-networking/recipes-connectivity/mbedtls/mbedtls_4.1.0.bb new file +17
-0+ cat > ${WORKDIR}/qemuwrapper << EOF +#!/bin/sh +$qemu_binary "\$@" +EOF + + chmod +x ${WORKDIR}/qemuwrapper +} + +# Strip host paths from autogenerated test files +do_compile:append() { + sed -i 's+${S}/++g' ${B}/tests/*.c 2>/dev/null || : + sed -i 's+${B}/++g' ${B}/tests/*.c 2>/dev/null || : +} + +# Export source files/headers needed by Arm Trusted Firmware +sysroot_stage_all:append() { + sysroot_stage_dir "${S}/library""${SYSROOT_DESTDIR}/usr/share/mbedtls-source/library"
+sysroot_stage_dir"${S}/include"
"${SYSROOT_DESTDIR}/usr/share/mbedtls-source/include"meta-networking/recipes-connectivity/mbedtls/mbedtls_4.1.0.bb new file +9
-1+} + +do_install_ptest () { + install -d ${D}${PTEST_PATH}/tests + install -d ${D}${PTEST_PATH}/framework + cp -f ${B}/tests/test_suite_* ${D}${PTEST_PATH}/tests/ + find ${D}${PTEST_PATH}/tests/ -type f -name "*.c" -delete + cp -fR ${S}/framework/data_files ${D}${PTEST_PATH}/framework/ +} -=-=-=-=-=-=-=-=-=-=-=-Links: You receive all messages sent to this group. View/Reply Online (#126602):
https://lists.openembedded.org/g/openembedded-devel/message/126602
Mute This Topic: https://lists.openembedded.org/mt/118983952/1997914
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
and knock on effects perhaps see.
https://errors.yoctoproject.org/Errors/Build/237188/
Quoted 306 lines · Khem Raj
here is next error
| *** stack smashing detected ***: terminated | qemu: uncaught target signal 6 (Aborted) - core dumped | Aborted | Traceback (most recent call last): | File "/srv/pokybuild/yocto-worker/meta-oe/build/build/tmp/work/x86-64-v3-poky-linux/mbedtls/4.1.0/sources/mbedtls-4.1.0/tf-psa-crypto/framework/scripts/generate_psa_tests.py", line 870, in <module> | test_data_generation.main(sys.argv[1:], __doc__, PSATestGenerator) | ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^Detailed error log
https://autobuilder.yoctoproject.org/valkyrie/api/v2/logs/6511632/raw_inline
Quoted 286 lines · Gyorgy Sarvari via lists.openembedded.org
This is the current LTS version for mbedtls, add it next to the existing recipe
for v3.6. This new version will be supported longer than v3.6, but there are
some incompatibilities between the two (see migration guide[1] and changelog[2]).This recipe is based on the v3.6 recipe. psa PACKAGECONFIG was dropped, as it is
now the regular behavior, without an option to turn it off. update-alternatives
class is also removed - it was required due to a sample program called "hello",
which has been removed from this release.Added two small patches:
- one to handle the CC env var correctly from Python. This is submitted for upstream.
- one to use qemu to run cross-compiled binaries instead of running them as they are.
This is not upstreamed, as it is OE specific.Ptests passed successfully:
root@qemux86-64:~# ptest-runner START: ptest-runner 2026-04-23T07:29 BEGIN: /usr/lib/mbedtls/ptest PASS: test_suite_config.mbedtls_boolean PASS: test_suite_config.tls_combinations PASS: test_suite_constant_time_hmac PASS: test_suite_debug PASS: test_suite_error PASS: test_suite_mps PASS: test_suite_net PASS: test_suite_pkcs7 PASS: test_suite_ssl PASS: test_suite_ssl.records PASS: test_suite_ssl.tls-defrag PASS: test_suite_ssl_decrypt.misc PASS: test_suite_test_helpers PASS: test_suite_timing PASS: test_suite_version PASS: test_suite_x509_oid PASS: test_suite_x509parse PASS: test_suite_x509write DURATION: 7 END: /usr/lib/mbedtls/ptest 2026-04-23T07:29 STOP: ptest-runner TOTAL: 1 FAIL: 0[1]:
https://github.com/Mbed-TLS/mbedtls/blob/development/docs/4.0-migration-guide.md
[2]: https://github.com/Mbed-TLS/mbedtls/releases/tag/mbedtls-4.1.0Signed-off-by Gyorgy Sarvari <[email protected]>---
v2: Inherit python3native, because some native python modules need to be used. When using the
system python, PYTHONPATH gets mixed with build host and sysroot
modules, which is incorrect.
When using python3native class, the module search path is confined to
the sysroot, so it
can be better controlled. Also, add python3-jsonschema-native as a
build dependency (in v1
the recipe took this dependency from my build host)...c_build_helper-Split-cc-command-line.patch | 33 +++++++ ...wrapper-to-run-cross-compiled-binary.patch | 29 ++++++ .../mbedtls/mbedtls_4.1.0.bb | 88 +++++++++++++++++++ 3 files changed, 150 insertions(+) create mode 100644 meta-networking/recipes-connectivity/mbedtls/mbedtls/0001-c_build_helper-Split-cc-command-line.patch create mode 100644 meta-networking/recipes-connectivity/mbedtls/mbedtls/0001-use-qemuwrapper-to-run-cross-compiled-binary.patch create mode 100644 meta-networking/recipes-connectivity/mbedtls/mbedtls_4.1.0.bb
diff --git
a/meta-networking/recipes-connectivity/mbedtls/mbedtls/0001-c_build_helper-Split-cc-command-line.patchb/meta-networking/recipes-connectivity/mbedtls/mbedtls/0001-c_build_helper-Split-cc-command-line.patchnew file mode 100644
index 0000000000..adddb7ad8e
---/dev/null
+++b/meta-networking/recipes-connectivity/mbedtls/mbedtls/0001-c_build_helper-Split-cc-command-line.patchmeta-networking/recipes-connectivity/mbedtls/mbedtls/0001-c_build_helper-Split-cc-command-line.patch new file +10
-0@@ -0,0 +1,33 @@ +From 178e089683bf42097ac6d27522820d07483bc6bd Mon Sep 17 00:00:00 2001 +From: Gyorgy Sarvari <[email protected]> +Date: Thu, 23 Apr 2026 08:54:02 +0200 +Subject: [PATCH] c_build_helper: Split cc command line + +Optionally the CC/HOSTCC environment variable can hold the command to +invoke the C compiler, however this command can also contain extra +arguments, not only the binary name. In this particular case Python +was treating the whole value as a single binary name, and was trying +to execute as such (e.g. "cc -arg1 -arg2" instead of "cc" and thearguments
meta-networking/recipes-connectivity/mbedtls/mbedtls/0001-c_build_helper-Split-cc-command-line.patch new file +5
-0+separately), which results in failure. + +Split the compiler command into its components to invoke it correctly. + +Upstream-Status: Submitted [https://github.com/Mbed-TLS/mbedtls-framework/pull/301]
meta-networking/recipes-connectivity/mbedtls/mbedtls/0001-c_build_helper-Split-cc-command-line.patch new file +6
-0+Signed-off-by: Gyorgy Sarvari <[email protected]> +--- + scripts/mbedtls_framework/c_build_helper.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/scripts/mbedtls_framework/c_build_helper.py
b/scripts/mbedtls_framework/c_build_helper.py
+index59bb326e2..85dbb628f100644
+---a/tf-psa-crypto/framework/scripts/mbedtls_framework/c_build_helper.py++++b/tf-psa-crypto/framework/scripts/mbedtls_framework/c_build_helper.py+@@ -98,7 +98,7 @@ defcompile_c_file(c_filename, exe_filename, include_dirs):meta-networking/recipes-connectivity/mbedtls/mbedtls/0001-c_build_helper-Split-cc-command-line.patch new file +8
-0+ cc = os.getenv('HOSTCC', None) + if cc is None: + cc = os.getenv('CC', 'cc') +- cmd = [cc] ++ cmd = cc.split() + + proc = subprocess.Popen(cmd, + stdout=subprocess.DEVNULL,diff --git
a/meta-networking/recipes-connectivity/mbedtls/mbedtls/0001-use-qemuwrapper-to-run-cross-compiled-binary.patchb/meta-networking/recipes-connectivity/mbedtls/mbedtls/0001-use-qemuwrapper-to-run-cross-compiled-binary.patchnew file mode 100644
index 0000000000..a9e8bb2ed9
---/dev/null
+++b/meta-networking/recipes-connectivity/mbedtls/mbedtls/0001-use-qemuwrapper-to-run-cross-compiled-binary.patchmeta-networking/recipes-connectivity/mbedtls/mbedtls/0001-use-qemuwrapper-to-run-cross-compiled-binary.patch new file +17
-0@@ -0,0 +1,29 @@ +From 46f0ea3eb35e8d0d33e88298a9e7c3dbdd49ec17 Mon Sep 17 00:00:00 2001 +From: Gyorgy Sarvari <[email protected]> +Date: Thu, 23 Apr 2026 09:14:40 +0200 +Subject: [PATCH] use qemuwrapper to run cross-compiled binary + +The build process executes a compiled binary to get some details, +however this results in a failure in case of cross-compiling. + +Run it with qemuwrapper, that is created in the recipe. + +Upstream-Status: Inappropriate [cross-compile specific] +Signed-off-by: Gyorgy Sarvari <[email protected]> +--- + scripts/mbedtls_framework/c_build_helper.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/scripts/mbedtls_framework/c_build_helper.py
b/scripts/mbedtls_framework/c_build_helper.pymeta-networking/recipes-connectivity/mbedtls/mbedtls/0001-use-qemuwrapper-to-run-cross-compiled-binary.patch new file +9
-0+index 59bb326e2..5c4c211ee 100644 +--- a/tf-psa-crypto/framework/scripts/mbedtls_framework/c_build_helper.py ++++ b/tf-psa-crypto/framework/scripts/mbedtls_framework/c_build_helper.py +@@ -169,7 +169,7 @@ def get_c_expression_values( + .format(caller, c_name)) + else: + os.remove(c_name) +- output = subprocess.check_output([exe_name]) ++ output = subprocess.check_output(['../../../qemuwrapper',
exe_name])meta-networking/recipes-connectivity/mbedtls/mbedtls/0001-use-qemuwrapper-to-run-cross-compiled-binary.patch new file +3
-0+ return output.decode('ascii').strip().split('\n') + finally: + remove_file_if_exists(exe_name)(quoted diff) +0
-0mbedtls_4.1.0.bb b/meta-networking/recipes-connectivity/mbedtls/ mbedtls_4.1.0.bb
new file mode 100644
index 0000000000..614016b0f1meta-networking/recipes-connectivity/mbedtls/mbedtls_4.1.0.bb new file +26
-0@@ -0,0 +1,88 @@ +SUMMARY = "Lightweight crypto and SSL/TLS library" +DESCRIPTION = "mbedtls is a lean open source crypto library \ +for providing SSL and TLS support in your programs. It offers \ +an intuitive API and documented header files, so you can actually \ +understand what the code does. It features: \ + \ + - Symmetric algorithms, like AES, Blowfish, Triple-DES, DES, ARC4, \ + Camellia and XTEA \ + - Hash algorithms, like SHA-1, SHA-2, RIPEMD-160 and MD5 \ + - Entropy pool and random generators, like CTR-DRBG and HMAC-DRBG \ + - Public key algorithms, like RSA, Elliptic Curves, Diffie-Hellman, \ + ECDSA and ECDH \ + - SSL v3 and TLS 1.0, 1.1 and 1.2 \ + - Abstraction layers for ciphers, hashes, public key operations, \ + platform abstraction and threading \ +" + +HOMEPAGE = "https://www.trustedfirmware.org/projects/mbed-tls/" +BUGTRACKER = "https://github.com/Mbed-TLS/mbedtls/issues" + +LICENSE = "Apache-2.0 | GPL-2.0-or-later" +LIC_FILES_CHKSUM = "file://LICENSE;md5=379d5819937a6c2f1ef1630d341e026d" + +SECTION = "libs" + +SRC_URI = "gitsm://github.com/Mbed-TLS/mbedtls.git;protocol=https;branch=mbedtls-4.1;tag=v${PV}
<http://github.com/Mbed-TLS/mbedtls.git;protocol=https;branch=mbedtls-4.1;tag=v$%7BPV%7D>
\meta-networking/recipes-connectivity/mbedtls/mbedtls_4.1.0.bb new file +5
-0+ file://run-ptest \ + file://0001-c_build_helper-Split-cc-command-line.patch \ + " + +SRC_URI:append:class-target = "file://0001-use-qemuwrapper-to-run-cross-compiled-binary.patch"
meta-networking/recipes-connectivity/mbedtls/mbedtls_4.1.0.bb new file +10
-0+ +SRCREV = "0fe989b6b514192783c469039edd325fd0989806" + +DEPENDS += "python3-jinja2-native python3-jsonschema-native qemu-native" + +UPSTREAM_CHECK_GITTAGREGEX = "v(?P<pver>\d+(\.\d+)+)" + +inherit cmake ptest python3native qemu + +PACKAGECONFIG ??= "shared-libs programs${@bb.utils.contains('PTEST_ENABLED', '1', 'tests', '', d)}" +PACKAGECONFIG[shared-libs] = "-DUSE_SHARED_MBEDTLS_LIBRARY=ON,-DUSE_SHARED_MBEDTLS_LIBRARY=OFF"
meta-networking/recipes-connectivity/mbedtls/mbedtls_4.1.0.bb new file +2
-0+PACKAGECONFIG[programs] = "-DENABLE_PROGRAMS=ON,-DENABLE_PROGRAMS=OFF" +PACKAGECONFIG[werror] ="-DMBEDTLS_FATAL_WARNINGS=ON,-DMBEDTLS_FATAL_WARNINGS=OFF"
meta-networking/recipes-connectivity/mbedtls/mbedtls_4.1.0.bb new file +14
-0+PACKAGECONFIG[tests] = "-DENABLE_TESTING=ON,-DENABLE_TESTING=OFF" + +PROVIDES += "polarssl" +RPROVIDES:${PN} = "polarssl" + +PACKAGES =+ "${PN}-programs" +FILES:${PN}-programs = "${bindir}/" + +BBCLASSEXTEND = "native nativesdk" + +CVE_PRODUCT = "mbed_tls" + +do_configure:prepend() { + # during building
tf-psa-crypto/framework/scripts/mbedtls_framework/c_build_helper.pymeta-networking/recipes-connectivity/mbedtls/mbedtls_4.1.0.bb new file +3
-0+ # runs some of the cross-compiled binaries. + + qemu_binary="${@qemu_wrapper_cmdline(d,
d.getVar('STAGING_DIR_HOST'), [d.expand('${STAGING_DIR_HOST}${libdir}'),d.expand('${STAGING_LIBDIR}')])}"meta-networking/recipes-connectivity/mbedtls/mbedtls_4.1.0.bb new file +17
-0+ cat > ${WORKDIR}/qemuwrapper << EOF +#!/bin/sh +$qemu_binary "\$@" +EOF + + chmod +x ${WORKDIR}/qemuwrapper +} + +# Strip host paths from autogenerated test files +do_compile:append() { + sed -i 's+${S}/++g' ${B}/tests/*.c 2>/dev/null || : + sed -i 's+${B}/++g' ${B}/tests/*.c 2>/dev/null || : +} + +# Export source files/headers needed by Arm Trusted Firmware +sysroot_stage_all:append() { + sysroot_stage_dir "${S}/library""${SYSROOT_DESTDIR}/usr/share/mbedtls-source/library"
+sysroot_stage_dir"${S}/include"
"${SYSROOT_DESTDIR}/usr/share/mbedtls-source/include"meta-networking/recipes-connectivity/mbedtls/mbedtls_4.1.0.bb new file +9
-1+} + +do_install_ptest () { + install -d ${D}${PTEST_PATH}/tests + install -d ${D}${PTEST_PATH}/framework + cp -f ${B}/tests/test_suite_* ${D}${PTEST_PATH}/tests/ + find ${D}${PTEST_PATH}/tests/ -type f -name "*.c" -delete + cp -fR ${S}/framework/data_files ${D}${PTEST_PATH}/framework/ +} -=-=-=-=-=-=-=-=-=-=-=-Links: You receive all messages sent to this group. View/Reply Online (#126602):
https://lists.openembedded.org/g/openembedded-devel/message/126602
Mute This Topic: https://lists.openembedded.org/mt/118983952/1997914
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Just dropping mbedtls/ecp.h looks like it might be sufficient for mdns (untested because of the mbedtls build failure around qemuwrapper):
mDNSPosix/mbedtls.c +0 -1
@@ -31,7 +31,6 @@#include <mbedtls/error.h> #include <mbedtls/pk.h> -#include <mbedtls/ecp.h> #include <mbedtls/ecdsa.h> #include <mbedtls/entropy.h> #include <mbedtls/ctr_drbg.h>
Quoted 259 lines · Khem Raj via lists.openembedded.org
and knock on effects perhaps see.
https://errors.yoctoproject.org/Errors/Build/237188/
Quoted 244 lines · Khem Raj
here is next error
| *** stack smashing detected ***: terminated | qemu: uncaught target signal 6 (Aborted) - core dumped | Aborted | Traceback (most recent call last): | File "/srv/pokybuild/yocto-worker/meta-oe/build/build/tmp/work/x86-64-v3-poky-linux/mbedtls/4.1.0/sources/mbedtls-4.1.0/tf-psa-crypto/framework/scripts/generate_psa_tests.py", line 870, in <module> | test_data_generation.main(sys.argv[1:], __doc__, PSATestGenerator) | ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^Detailed error log
https://autobuilder.yoctoproject.org/valkyrie/api/v2/logs/6511632/raw_inline
Quoted 228 lines · Gyorgy Sarvari via lists.openembedded.org
This is the current LTS version for mbedtls, add it next to the existing recipe for v3.6. This new version will be supported longer than v3.6, but there are some incompatibilities between the two (see migration guide[1] and changelog[2]).
This recipe is based on the v3.6 recipe. psa PACKAGECONFIG was dropped, as it is now the regular behavior, without an option to turn it off. update-alternatives class is also removed - it was required due to a sample program called "hello", which has been removed from this release.
Added two small patches:
- one to handle the CC env var correctly from Python. This is submitted for upstream.
- one to use qemu to run cross-compiled binaries instead of running them as they are. This is not upstreamed, as it is OE specific.Ptests passed successfully:
root@qemux86-64:~# ptest-runner START: ptest-runner 2026-04-23T07:29 BEGIN: /usr/lib/mbedtls/ptest PASS: test_suite_config.mbedtls_boolean PASS: test_suite_config.tls_combinations PASS: test_suite_constant_time_hmac PASS: test_suite_debug PASS: test_suite_error PASS: test_suite_mps PASS: test_suite_net PASS: test_suite_pkcs7 PASS: test_suite_ssl PASS: test_suite_ssl.records PASS: test_suite_ssl.tls-defrag PASS: test_suite_ssl_decrypt.misc PASS: test_suite_test_helpers PASS: test_suite_timing PASS: test_suite_version PASS: test_suite_x509_oid PASS: test_suite_x509parse PASS: test_suite_x509write DURATION: 7 END: /usr/lib/mbedtls/ptest 2026-04-23T07:29 STOP: ptest-runner TOTAL: 1 FAIL: 0[1]: https://github.com/Mbed-TLS/mbedtls/blob/development/docs/4.0-migration-guide.md
[2]: https://github.com/Mbed-TLS/mbedtls/releases/tag/mbedtls-4.1.0Signed-off-by Gyorgy Sarvari <[email protected]>---
v2: Inherit python3native, because some native python modules need to be used. When using the
system python, PYTHONPATH gets mixed with build host and sysroot modules, which is incorrect. When using python3native class, the module search path is confined to the sysroot, so it can be better controlled. Also, add python3-jsonschema-native as a build dependency (in v1 the recipe took this dependency from my build host)...c_build_helper-Split-cc-command-line.patch | 33 +++++++ ...wrapper-to-run-cross-compiled-binary.patch | 29 ++++++ .../mbedtls/mbedtls_4.1.0.bb | 88 +++++++++++++++++++ 3 files changed, 150 insertions(+) create mode 100644 meta-networking/recipes-connectivity/mbedtls/mbedtls/0001-c_build_helper-Split-cc-command-line.patch create mode 100644 meta-networking/recipes-connectivity/mbedtls/mbedtls/0001-use-qemuwrapper-to-run-cross-compiled-binary.patch create mode 100644 meta-networking/recipes-connectivity/mbedtls/mbedtls_4.1.0.bbmeta-networking/recipes-connectivity/mbedtls/mbedtls/0001-c_build_helper-Split-cc-command-line.patch new file +33
-0@@ -0,0 +1,33 @@ +From 178e089683bf42097ac6d27522820d07483bc6bd Mon Sep 17 00:00:00 2001 +From: Gyorgy Sarvari <[email protected]> +Date: Thu, 23 Apr 2026 08:54:02 +0200 +Subject: [PATCH] c_build_helper: Split cc command line + +Optionally the CC/HOSTCC environment variable can hold the command to +invoke the C compiler, however this command can also contain extra +arguments, not only the binary name. In this particular case Python +was treating the whole value as a single binary name, and was trying +to execute as such (e.g. "cc -arg1 -arg2" instead of "cc" and the arguments +separately), which results in failure. + +Split the compiler command into its components to invoke it correctly. + +Upstream-Status: Submitted [https://github.com/Mbed-TLS/mbedtls-framework/pull/301] +Signed-off-by: Gyorgy Sarvari <[email protected]> +--- + scripts/mbedtls_framework/c_build_helper.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/scripts/mbedtls_framework/c_build_helper.py b/scripts/mbedtls_framework/c_build_helper.py +index 59bb326e2..85dbb628f 100644 +--- a/tf-psa-crypto/framework/scripts/mbedtls_framework/c_build_helper.py ++++ b/tf-psa-crypto/framework/scripts/mbedtls_framework/c_build_helper.py +@@ -98,7 +98,7 @@ def compile_c_file(c_filename, exe_filename, include_dirs): + cc = os.getenv('HOSTCC', None) + if cc is None: + cc = os.getenv('CC', 'cc') +- cmd = [cc] ++ cmd = cc.split() + + proc = subprocess.Popen(cmd, + stdout=subprocess.DEVNULL,meta-networking/recipes-connectivity/mbedtls/mbedtls/0001-use-qemuwrapper-to-run-cross-compiled-binary.patch new file +29
-0@@ -0,0 +1,29 @@ +From 46f0ea3eb35e8d0d33e88298a9e7c3dbdd49ec17 Mon Sep 17 00:00:00 2001 +From: Gyorgy Sarvari <[email protected]> +Date: Thu, 23 Apr 2026 09:14:40 +0200 +Subject: [PATCH] use qemuwrapper to run cross-compiled binary + +The build process executes a compiled binary to get some details, +however this results in a failure in case of cross-compiling. + +Run it with qemuwrapper, that is created in the recipe. + +Upstream-Status: Inappropriate [cross-compile specific] +Signed-off-by: Gyorgy Sarvari <[email protected]> +--- + scripts/mbedtls_framework/c_build_helper.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/scripts/mbedtls_framework/c_build_helper.py b/scripts/mbedtls_framework/c_build_helper.py +index 59bb326e2..5c4c211ee 100644 +--- a/tf-psa-crypto/framework/scripts/mbedtls_framework/c_build_helper.py ++++ b/tf-psa-crypto/framework/scripts/mbedtls_framework/c_build_helper.py +@@ -169,7 +169,7 @@ def get_c_expression_values( + .format(caller, c_name)) + else: + os.remove(c_name) +- output = subprocess.check_output([exe_name]) ++ output = subprocess.check_output(['../../../qemuwrapper', exe_name]) + return output.decode('ascii').strip().split('\n') + finally: + remove_file_if_exists(exe_name)meta-networking/recipes-connectivity/mbedtls/mbedtls_4.1.0.bb new file +83
-0@@ -0,0 +1,88 @@ +SUMMARY = "Lightweight crypto and SSL/TLS library" +DESCRIPTION = "mbedtls is a lean open source crypto library \ +for providing SSL and TLS support in your programs. It offers \ +an intuitive API and documented header files, so you can actually \ +understand what the code does. It features: \ + \ + - Symmetric algorithms, like AES, Blowfish, Triple-DES, DES, ARC4, \ + Camellia and XTEA \ + - Hash algorithms, like SHA-1, SHA-2, RIPEMD-160 and MD5 \ + - Entropy pool and random generators, like CTR-DRBG and HMAC-DRBG \ + - Public key algorithms, like RSA, Elliptic Curves, Diffie-Hellman, \ + ECDSA and ECDH \ + - SSL v3 and TLS 1.0, 1.1 and 1.2 \ + - Abstraction layers for ciphers, hashes, public key operations, \ + platform abstraction and threading \ +" + +HOMEPAGE = "https://www.trustedfirmware.org/projects/mbed-tls/" +BUGTRACKER = "https://github.com/Mbed-TLS/mbedtls/issues" + +LICENSE = "Apache-2.0 | GPL-2.0-or-later" +LIC_FILES_CHKSUM = "file://LICENSE;md5=379d5819937a6c2f1ef1630d341e026d" + +SECTION = "libs" + +SRC_URI = "gitsm://github.com/Mbed-TLS/mbedtls.git;protocol=https;branch=mbedtls-4.1;tag=v${PV} \ + file://run-ptest \ + file://0001-c_build_helper-Split-cc-command-line.patch \ + " + +SRC_URI:append:class-target = " file://0001-use-qemuwrapper-to-run-cross-compiled-binary.patch" + +SRCREV = "0fe989b6b514192783c469039edd325fd0989806" + +DEPENDS += "python3-jinja2-native python3-jsonschema-native qemu-native" + +UPSTREAM_CHECK_GITTAGREGEX = "v(?P<pver>\d+(\.\d+)+)" + +inherit cmake ptest python3native qemu + +PACKAGECONFIG ??= "shared-libs programs ${@bb.utils.contains('PTEST_ENABLED', '1', 'tests', '', d)}" +PACKAGECONFIG[shared-libs] = "-DUSE_SHARED_MBEDTLS_LIBRARY=ON,-DUSE_SHARED_MBEDTLS_LIBRARY=OFF" +PACKAGECONFIG[programs] = "-DENABLE_PROGRAMS=ON,-DENABLE_PROGRAMS=OFF" +PACKAGECONFIG[werror] = "-DMBEDTLS_FATAL_WARNINGS=ON,-DMBEDTLS_FATAL_WARNINGS=OFF" +PACKAGECONFIG[tests] = "-DENABLE_TESTING=ON,-DENABLE_TESTING=OFF" + +PROVIDES += "polarssl" +RPROVIDES:${PN} = "polarssl" + +PACKAGES =+ "${PN}-programs" +FILES:${PN}-programs = "${bindir}/" + +BBCLASSEXTEND = "native nativesdk" + +CVE_PRODUCT = "mbed_tls" + +do_configure:prepend() { + # during building tf-psa-crypto/framework/scripts/mbedtls_framework/c_build_helper.py + # runs some of the cross-compiled binaries. + + qemu_binary="${@qemu_wrapper_cmdline(d, d.getVar('STAGING_DIR_HOST'), [d.expand('${STAGING_DIR_HOST}${libdir}'),d.expand('${STAGING_LIBDIR}')])}" + cat > ${WORKDIR}/qemuwrapper << EOF +#!/bin/sh +$qemu_binary "\$@" +EOF + + chmod +x ${WORKDIR}/qemuwrapper +} + +# Strip host paths from autogenerated test files +do_compile:append() { + sed -i 's+${S}/++g' ${B}/tests/*.c 2>/dev/null || : + sed -i 's+${B}/++g' ${B}/tests/*.c 2>/dev/null || : +} + +# Export source files/headers needed by Arm Trusted Firmware +sysroot_stage_all:append() { + sysroot_stage_dir "${S}/library" "${SYSROOT_DESTDIR}/usr/share/mbedtls-source/library" + sysroot_stage_dir "${S}/include" "${SYSROOT_DESTDIR}/usr/share/mbedtls-source/include" +} + +do_install_ptest () { + install -d ${D}${PTEST_PATH}/testsQuoted 8 lines
meta-networking/recipes-connectivity/mbedtls/mbedtls_4.1.0.bb line 88
Quoted 8 lines
meta-networking/recipes-connectivity/mbedtls/mbedtls_4.1.0.bb new file +5
-0+ install -d ${D}${PTEST_PATH}/framework + cp -f ${B}/tests/test_suite_* ${D}${PTEST_PATH}/tests/ + find ${D}${PTEST_PATH}/tests/ -type f -name "*.c" -delete + cp -fR ${S}/framework/data_files ${D}${PTEST_PATH}/framework/ +}
Quoted 8 lines
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#126610): https://lists.openembedded.org/g/openembedded-devel/message/126610
Mute This Topic: https://lists.openembedded.org/mt/118983952/3618097
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
--
Alex Kiernan
Quoted 11 lines · Khem Raj
and knock on effects perhaps see.
https://errors.yoctoproject.org/Errors/Build/237188/ <https://
errors.yoctoproject.org/Errors/Build/237188/>On Fri, Apr 24, 2026 at 6:33 PM Khem Raj <[email protected] <mailto:[email protected]>> wrote:
here is next error
| *** stack smashing detected ***: terminated
Ugh, this seems to happen when sysvinit is set as the init system (usually I just use nodistro, that currently defaults to systemd, which is why I haven't seen this. But poky distro is sysvinit).
Will try to stare at it soonish.
Quoted 354 lines
| qemu: uncaught target signal 6 (Aborted) - core dumped
| Aborted
| Traceback (most recent call last):
| File "/srv/pokybuild/yocto-worker/meta-oe/build/build/tmp/work/
x86-64-v3-poky-linux/mbedtls/4.1.0/sources/mbedtls-4.1.0/tf-psa-
crypto/framework/scripts/generate_psa_tests.py", line 870, in <module>
| test_data_generation.main(sys.argv[1:], __doc__, PSATestGenerator)
| ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Detailed error log
https://autobuilder.yoctoproject.org/valkyrie/api/v2/logs/6511632/
raw_inline <https://autobuilder.yoctoproject.org/valkyrie/api/v2/
logs/6511632/raw_inline>
On Thu, Apr 23, 2026 at 11:46 PM Gyorgy Sarvari via
lists.openembedded.org <http://lists.openembedded.org>
<[email protected]
<mailto:[email protected]>> wrote:
This is the current LTS version for mbedtls, add it next to the
existing recipe
for v3.6. This new version will be supported longer than v3.6,
but there are
some incompatibilities between the two (see migration guide[1]
and changelog[2]).
This recipe is based on the v3.6 recipe. psa PACKAGECONFIG was
dropped, as it is
now the regular behavior, without an option to turn it off.
update-alternatives
class is also removed - it was required due to a sample program
called "hello",
which has been removed from this release.
Added two small patches:
- one to handle the CC env var correctly from Python. This is
submitted for upstream.
- one to use qemu to run cross-compiled binaries instead of
running them as they are.
This is not upstreamed, as it is OE specific.
Ptests passed successfully:
root@qemux86-64:~# ptest-runner
START: ptest-runner
2026-04-23T07:29
BEGIN: /usr/lib/mbedtls/ptest
PASS: test_suite_config.mbedtls_boolean
PASS: test_suite_config.tls_combinations
PASS: test_suite_constant_time_hmac
PASS: test_suite_debug
PASS: test_suite_error
PASS: test_suite_mps
PASS: test_suite_net
PASS: test_suite_pkcs7
PASS: test_suite_ssl
PASS: test_suite_ssl.records
PASS: test_suite_ssl.tls-defrag
PASS: test_suite_ssl_decrypt.misc
PASS: test_suite_test_helpers
PASS: test_suite_timing
PASS: test_suite_version
PASS: test_suite_x509_oid
PASS: test_suite_x509parse
PASS: test_suite_x509write
DURATION: 7
END: /usr/lib/mbedtls/ptest
2026-04-23T07:29
STOP: ptest-runner
TOTAL: 1 FAIL: 0
[1]: https://github.com/Mbed-TLS/mbedtls/blob/development/
docs/4.0-migration-guide.md <https://github.com/Mbed-TLS/
mbedtls/blob/development/docs/4.0-migration-guide.md>
[2]: https://github.com/Mbed-TLS/mbedtls/releases/tag/
mbedtls-4.1.0 <https://github.com/Mbed-TLS/mbedtls/releases/tag/
mbedtls-4.1.0>
Signed-off-by: Gyorgy Sarvari <[email protected]
<mailto:[email protected]>>
---
v2: Inherit python3native, because some native python modules
need to be used. When using the
system python, PYTHONPATH gets mixed with build host and
sysroot modules, which is incorrect.
When using python3native class, the module search path is
confined to the sysroot, so it
can be better controlled. Also, add python3-jsonschema-
native as a build dependency (in v1
the recipe took this dependency from my build host)
...c_build_helper-Split-cc-command-line.patch | 33 +++++++
...wrapper-to-run-cross-compiled-binary.patch | 29 ++++++
.../mbedtls/mbedtls_4.1.0.bb <http://mbedtls_4.1.0.bb>
| 88 +++++++++++++++++++
3 files changed, 150 insertions(+)
create mode 100644 meta-networking/recipes-connectivity/
mbedtls/mbedtls/0001-c_build_helper-Split-cc-command-line.patch
create mode 100644 meta-networking/recipes-connectivity/
mbedtls/mbedtls/0001-use-qemuwrapper-to-run-cross-compiled-
binary.patch
create mode 100644 meta-networking/recipes-connectivity/
mbedtls/mbedtls_4.1.0.bb <http://mbedtls_4.1.0.bb>
diff --git a/meta-networking/recipes-connectivity/mbedtls/
mbedtls/0001-c_build_helper-Split-cc-command-line.patch b/meta-
networking/recipes-connectivity/mbedtls/mbedtls/0001-
c_build_helper-Split-cc-command-line.patch
new file mode 100644
index 0000000000..adddb7ad8e
--- /dev/null
+++ b/meta-networking/recipes-connectivity/mbedtls/mbedtls/0001-
c_build_helper-Split-cc-command-line.patch
@@ -0,0 +1,33 @@
+From 178e089683bf42097ac6d27522820d07483bc6bd Mon Sep 17
00:00:00 2001
+From: Gyorgy Sarvari <[email protected]
<mailto:[email protected]>>
+Date: Thu, 23 Apr 2026 08:54:02 +0200
+Subject: [PATCH] c_build_helper: Split cc command line
+
+Optionally the CC/HOSTCC environment variable can hold the
command to
+invoke the C compiler, however this command can also contain extra
+arguments, not only the binary name. In this particular case Python
+was treating the whole value as a single binary name, and was
trying
+to execute as such (e.g. "cc -arg1 -arg2" instead of "cc" and
the arguments
+separately), which results in failure.
+
+Split the compiler command into its components to invoke it
correctly.
+
+Upstream-Status: Submitted [https://github.com/Mbed-TLS/
mbedtls-framework/pull/301 <https://github.com/Mbed-TLS/mbedtls-
framework/pull/301>]
+Signed-off-by: Gyorgy Sarvari <[email protected]
<mailto:[email protected]>>
+---
+ scripts/mbedtls_framework/c_build_helper.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/scripts/mbedtls_framework/c_build_helper.py b/
scripts/mbedtls_framework/c_build_helper.py
+index 59bb326e2..85dbb628f 100644
+--- a/tf-psa-crypto/framework/scripts/mbedtls_framework/
c_build_helper.py
++++ b/tf-psa-crypto/framework/scripts/mbedtls_framework/
c_build_helper.py
+@@ -98,7 +98,7 @@ def compile_c_file(c_filename, exe_filename,
include_dirs):
+ cc = os.getenv('HOSTCC', None)
+ if cc is None:
+ cc = os.getenv('CC', 'cc')
+- cmd = [cc]
++ cmd = cc.split()
+
+ proc = subprocess.Popen(cmd,
+ stdout=subprocess.DEVNULL,
diff --git a/meta-networking/recipes-connectivity/mbedtls/
mbedtls/0001-use-qemuwrapper-to-run-cross-compiled-binary.patch
b/meta-networking/recipes-connectivity/mbedtls/mbedtls/0001-use-
qemuwrapper-to-run-cross-compiled-binary.patch
new file mode 100644
index 0000000000..a9e8bb2ed9
--- /dev/null
+++ b/meta-networking/recipes-connectivity/mbedtls/mbedtls/0001-
use-qemuwrapper-to-run-cross-compiled-binary.patch
@@ -0,0 +1,29 @@
+From 46f0ea3eb35e8d0d33e88298a9e7c3dbdd49ec17 Mon Sep 17
00:00:00 2001
+From: Gyorgy Sarvari <[email protected]
<mailto:[email protected]>>
+Date: Thu, 23 Apr 2026 09:14:40 +0200
+Subject: [PATCH] use qemuwrapper to run cross-compiled binary
+
+The build process executes a compiled binary to get some details,
+however this results in a failure in case of cross-compiling.
+
+Run it with qemuwrapper, that is created in the recipe.
+
+Upstream-Status: Inappropriate [cross-compile specific]
+Signed-off-by: Gyorgy Sarvari <[email protected]
<mailto:[email protected]>>
+---
+ scripts/mbedtls_framework/c_build_helper.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/scripts/mbedtls_framework/c_build_helper.py b/
scripts/mbedtls_framework/c_build_helper.py
+index 59bb326e2..5c4c211ee 100644
+--- a/tf-psa-crypto/framework/scripts/mbedtls_framework/
c_build_helper.py
++++ b/tf-psa-crypto/framework/scripts/mbedtls_framework/
c_build_helper.py
+@@ -169,7 +169,7 @@ def get_c_expression_values(
+ .format(caller, c_name))
+ else:
+ os.remove(c_name)
+- output = subprocess.check_output([exe_name])
++ output = subprocess.check_output(['../../../
qemuwrapper', exe_name])
+ return output.decode('ascii').strip().split('\n')
+ finally:
+ remove_file_if_exists(exe_name)
diff --git a/meta-networking/recipes-connectivity/mbedtls/
mbedtls_4.1.0.bb <http://mbedtls_4.1.0.bb> b/meta-networking/
recipes-connectivity/mbedtls/mbedtls_4.1.0.bb <http://
mbedtls_4.1.0.bb>
new file mode 100644
index 0000000000..614016b0f1
--- /dev/null
+++ b/meta-networking/recipes-connectivity/mbedtls/
mbedtls_4.1.0.bb <http://mbedtls_4.1.0.bb>
@@ -0,0 +1,88 @@
+SUMMARY = "Lightweight crypto and SSL/TLS library"
+DESCRIPTION = "mbedtls is a lean open source crypto library
\
+for providing SSL and TLS support in your programs. It offers
\
+an intuitive API and documented header files, so you can
actually \
+understand what the code does. It features:
\
+
\
+ - Symmetric algorithms, like AES, Blowfish, Triple-DES, DES,
ARC4, \
+ Camellia and XTEA
\
+ - Hash algorithms, like SHA-1, SHA-2, RIPEMD-160 and MD5
\
+ - Entropy pool and random generators, like CTR-DRBG and HMAC-
DRBG \
+ - Public key algorithms, like RSA, Elliptic Curves, Diffie-
Hellman, \
+ ECDSA and ECDH
\
+ - SSL v3 and TLS 1.0, 1.1 and 1.2
\
+ - Abstraction layers for ciphers, hashes, public key
operations, \
+ platform abstraction and threading
\
+"
+
+HOMEPAGE = "https://www.trustedfirmware.org/projects/mbed-tls/
<https://www.trustedfirmware.org/projects/mbed-tls/>"
+BUGTRACKER = "https://github.com/Mbed-TLS/mbedtls/issues
<https://github.com/Mbed-TLS/mbedtls/issues>"
+
+LICENSE = "Apache-2.0 | GPL-2.0-or-later"
+LIC_FILES_CHKSUM = "file://
LICENSE;md5=379d5819937a6c2f1ef1630d341e026d"
+
+SECTION = "libs"
+
+SRC_URI = "gitsm://github.com/Mbed-TLS/
mbedtls.git;protocol=https;branch=mbedtls-4.1;tag=v${PV}
<http://github.com/Mbed-TLS/
mbedtls.git;protocol=https;branch=mbedtls-4.1;tag=v$%7BPV%7D> \
+ file://run-ptest \
+ file://0001-c_build_helper-Split-cc-command-line.patch \
+ "
+
+SRC_URI:append:class-target = " file://0001-use-qemuwrapper-to-
run-cross-compiled-binary.patch"
+
+SRCREV = "0fe989b6b514192783c469039edd325fd0989806"
+
+DEPENDS += "python3-jinja2-native python3-jsonschema-native
qemu-native"
+
+UPSTREAM_CHECK_GITTAGREGEX = "v(?P<pver>\d+(\.\d+)+)"
+
+inherit cmake ptest python3native qemu
+
+PACKAGECONFIG ??= "shared-libs programs
${@bb.utils.contains('PTEST_ENABLED', '1', 'tests', '', d)}"
+PACKAGECONFIG[shared-libs] = "-DUSE_SHARED_MBEDTLS_LIBRARY=ON,-
DUSE_SHARED_MBEDTLS_LIBRARY=OFF"
+PACKAGECONFIG[programs] = "-DENABLE_PROGRAMS=ON,-
DENABLE_PROGRAMS=OFF"
+PACKAGECONFIG[werror] = "-DMBEDTLS_FATAL_WARNINGS=ON,-
DMBEDTLS_FATAL_WARNINGS=OFF"
+PACKAGECONFIG[tests] = "-DENABLE_TESTING=ON,-DENABLE_TESTING=OFF"
+
+PROVIDES += "polarssl"
+RPROVIDES:${PN} = "polarssl"
+
+PACKAGES =+ "${PN}-programs"
+FILES:${PN}-programs = "${bindir}/"
+
+BBCLASSEXTEND = "native nativesdk"
+
+CVE_PRODUCT = "mbed_tls"
+
+do_configure:prepend() {
+ # during building tf-psa-crypto/framework/scripts/
mbedtls_framework/c_build_helper.py
+ # runs some of the cross-compiled binaries.
+
+ qemu_binary="${@qemu_wrapper_cmdline(d,
d.getVar('STAGING_DIR_HOST'),
[d.expand('${STAGING_DIR_HOST}${libdir}'),d.expand('${STAGING_LIBDIR}')])}"
+ cat > ${WORKDIR}/qemuwrapper << EOF
+#!/bin/sh
+$qemu_binary "\$@"
+EOF
+
+ chmod +x ${WORKDIR}/qemuwrapper
+}
+
+# Strip host paths from autogenerated test files
+do_compile:append() {
+ sed -i 's+${S}/++g' ${B}/tests/*.c 2>/dev/null || :
+ sed -i 's+${B}/++g' ${B}/tests/*.c 2>/dev/null || :
+}
+
+# Export source files/headers needed by Arm Trusted Firmware
+sysroot_stage_all:append() {
+ sysroot_stage_dir "${S}/library" "${SYSROOT_DESTDIR}/
usr/share/mbedtls-source/library"
+ sysroot_stage_dir "${S}/include" "${SYSROOT_DESTDIR}/
usr/share/mbedtls-source/include"
+}
+
+do_install_ptest () {
+ install -d ${D}${PTEST_PATH}/tests
+ install -d ${D}${PTEST_PATH}/framework
+ cp -f ${B}/tests/test_suite_* ${D}${PTEST_PATH}/tests/
+ find ${D}${PTEST_PATH}/tests/ -type f -name "*.c" -delete
+ cp -fR ${S}/framework/data_files ${D}${PTEST_PATH}/
framework/
+}
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#126602): https://lists.openembedded.org/g/
openembedded-devel/message/126602 <https://
lists.openembedded.org/g/openembedded-devel/message/126602>
Mute This Topic: https://lists.openembedded.org/
mt/118983952/1997914 <https://lists.openembedded.org/
mt/118983952/1997914>
Group Owner: [email protected]
<mailto:openembedded-devel%[email protected]>
Unsubscribe: https://lists.openembedded.org/g/openembedded-
devel/unsub <https://lists.openembedded.org/g/openembedded-
devel/unsub> [[email protected] <mailto:[email protected]>]
-=-=-=-=-=-=-=-=-=-=-=-A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 10 lines · Alex Kiernan via lists.openembedded.org
Just dropping
mbedtls/ecp.hlooks like it might be sufficient for mdns (untested because of the mbedtls build failure around qemuwrapper):mDNSPosix/mbedtls.c +0
-0
mDNSPosix/mbedtls.c line 36
Quoted 7 lines
mDNSPosix/mbedtls.c +0
-1@@ -31,7 +31,6 @@#include <mbedtls/error.h> #include <mbedtls/pk.h> -#include <mbedtls/ecp.h> #include <mbedtls/ecdsa.h> #include <mbedtls/entropy.h> #include <mbedtls/ctr_drbg.h>
Scratch that... the changes needed are much more than simple header removal.
Quoted 277 lines
Quoted 250 lines · Khem Raj via lists.openembedded.org
and knock on effects perhaps see.
https://errors.yoctoproject.org/Errors/Build/237188/
Quoted 244 lines · Khem Raj
here is next error
| *** stack smashing detected ***: terminated | qemu: uncaught target signal 6 (Aborted) - core dumped | Aborted | Traceback (most recent call last): | File "/srv/pokybuild/yocto-worker/meta-oe/build/build/tmp/work/x86-64-v3-poky-linux/mbedtls/4.1.0/sources/mbedtls-4.1.0/tf-psa-crypto/framework/scripts/generate_psa_tests.py", line 870, in <module> | test_data_generation.main(sys.argv[1:], __doc__, PSATestGenerator) | ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^Detailed error log
https://autobuilder.yoctoproject.org/valkyrie/api/v2/logs/6511632/raw_inline
Quoted 228 lines · Gyorgy Sarvari via lists.openembedded.org
This is the current LTS version for mbedtls, add it next to the existing recipe for v3.6. This new version will be supported longer than v3.6, but there are some incompatibilities between the two (see migration guide[1] and changelog[2]).
This recipe is based on the v3.6 recipe. psa PACKAGECONFIG was dropped, as it is now the regular behavior, without an option to turn it off. update-alternatives class is also removed - it was required due to a sample program called "hello", which has been removed from this release.
Added two small patches:
- one to handle the CC env var correctly from Python. This is submitted for upstream.
- one to use qemu to run cross-compiled binaries instead of running them as they are. This is not upstreamed, as it is OE specific.Ptests passed successfully:
root@qemux86-64:~# ptest-runner START: ptest-runner 2026-04-23T07:29 BEGIN: /usr/lib/mbedtls/ptest PASS: test_suite_config.mbedtls_boolean PASS: test_suite_config.tls_combinations PASS: test_suite_constant_time_hmac PASS: test_suite_debug PASS: test_suite_error PASS: test_suite_mps PASS: test_suite_net PASS: test_suite_pkcs7 PASS: test_suite_ssl PASS: test_suite_ssl.records PASS: test_suite_ssl.tls-defrag PASS: test_suite_ssl_decrypt.misc PASS: test_suite_test_helpers PASS: test_suite_timing PASS: test_suite_version PASS: test_suite_x509_oid PASS: test_suite_x509parse PASS: test_suite_x509write DURATION: 7 END: /usr/lib/mbedtls/ptest 2026-04-23T07:29 STOP: ptest-runner TOTAL: 1 FAIL: 0[1]: https://github.com/Mbed-TLS/mbedtls/blob/development/docs/4.0-migration-guide.md
[2]: https://github.com/Mbed-TLS/mbedtls/releases/tag/mbedtls-4.1.0Signed-off-by Gyorgy Sarvari <[email protected]>---
v2: Inherit python3native, because some native python modules need to be used. When using the
system python, PYTHONPATH gets mixed with build host and sysroot modules, which is incorrect. When using python3native class, the module search path is confined to the sysroot, so it can be better controlled. Also, add python3-jsonschema-native as a build dependency (in v1 the recipe took this dependency from my build host)...c_build_helper-Split-cc-command-line.patch | 33 +++++++ ...wrapper-to-run-cross-compiled-binary.patch | 29 ++++++ .../mbedtls/mbedtls_4.1.0.bb | 88 +++++++++++++++++++ 3 files changed, 150 insertions(+) create mode 100644 meta-networking/recipes-connectivity/mbedtls/mbedtls/0001-c_build_helper-Split-cc-command-line.patch create mode 100644 meta-networking/recipes-connectivity/mbedtls/mbedtls/0001-use-qemuwrapper-to-run-cross-compiled-binary.patch create mode 100644 meta-networking/recipes-connectivity/mbedtls/mbedtls_4.1.0.bbmeta-networking/recipes-connectivity/mbedtls/mbedtls/0001-c_build_helper-Split-cc-command-line.patch new file +33
-0@@ -0,0 +1,33 @@ +From 178e089683bf42097ac6d27522820d07483bc6bd Mon Sep 17 00:00:00 2001 +From: Gyorgy Sarvari <[email protected]> +Date: Thu, 23 Apr 2026 08:54:02 +0200 +Subject: [PATCH] c_build_helper: Split cc command line + +Optionally the CC/HOSTCC environment variable can hold the command to +invoke the C compiler, however this command can also contain extra +arguments, not only the binary name. In this particular case Python +was treating the whole value as a single binary name, and was trying +to execute as such (e.g. "cc -arg1 -arg2" instead of "cc" and the arguments +separately), which results in failure. + +Split the compiler command into its components to invoke it correctly. + +Upstream-Status: Submitted [https://github.com/Mbed-TLS/mbedtls-framework/pull/301] +Signed-off-by: Gyorgy Sarvari <[email protected]> +--- + scripts/mbedtls_framework/c_build_helper.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/scripts/mbedtls_framework/c_build_helper.py b/scripts/mbedtls_framework/c_build_helper.py +index 59bb326e2..85dbb628f 100644 +--- a/tf-psa-crypto/framework/scripts/mbedtls_framework/c_build_helper.py ++++ b/tf-psa-crypto/framework/scripts/mbedtls_framework/c_build_helper.py +@@ -98,7 +98,7 @@ def compile_c_file(c_filename, exe_filename, include_dirs): + cc = os.getenv('HOSTCC', None) + if cc is None: + cc = os.getenv('CC', 'cc') +- cmd = [cc] ++ cmd = cc.split() + + proc = subprocess.Popen(cmd, + stdout=subprocess.DEVNULL,meta-networking/recipes-connectivity/mbedtls/mbedtls/0001-use-qemuwrapper-to-run-cross-compiled-binary.patch new file +29
-0@@ -0,0 +1,29 @@ +From 46f0ea3eb35e8d0d33e88298a9e7c3dbdd49ec17 Mon Sep 17 00:00:00 2001 +From: Gyorgy Sarvari <[email protected]> +Date: Thu, 23 Apr 2026 09:14:40 +0200 +Subject: [PATCH] use qemuwrapper to run cross-compiled binary + +The build process executes a compiled binary to get some details, +however this results in a failure in case of cross-compiling. + +Run it with qemuwrapper, that is created in the recipe. + +Upstream-Status: Inappropriate [cross-compile specific] +Signed-off-by: Gyorgy Sarvari <[email protected]> +--- + scripts/mbedtls_framework/c_build_helper.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/scripts/mbedtls_framework/c_build_helper.py b/scripts/mbedtls_framework/c_build_helper.py +index 59bb326e2..5c4c211ee 100644 +--- a/tf-psa-crypto/framework/scripts/mbedtls_framework/c_build_helper.py ++++ b/tf-psa-crypto/framework/scripts/mbedtls_framework/c_build_helper.py +@@ -169,7 +169,7 @@ def get_c_expression_values( + .format(caller, c_name)) + else: + os.remove(c_name) +- output = subprocess.check_output([exe_name]) ++ output = subprocess.check_output(['../../../qemuwrapper', exe_name]) + return output.decode('ascii').strip().split('\n') + finally: + remove_file_if_exists(exe_name)meta-networking/recipes-connectivity/mbedtls/mbedtls_4.1.0.bb new file +83
-0@@ -0,0 +1,88 @@ +SUMMARY = "Lightweight crypto and SSL/TLS library" +DESCRIPTION = "mbedtls is a lean open source crypto library \ +for providing SSL and TLS support in your programs. It offers \ +an intuitive API and documented header files, so you can actually \ +understand what the code does. It features: \ + \ + - Symmetric algorithms, like AES, Blowfish, Triple-DES, DES, ARC4, \ + Camellia and XTEA \ + - Hash algorithms, like SHA-1, SHA-2, RIPEMD-160 and MD5 \ + - Entropy pool and random generators, like CTR-DRBG and HMAC-DRBG \ + - Public key algorithms, like RSA, Elliptic Curves, Diffie-Hellman, \ + ECDSA and ECDH \ + - SSL v3 and TLS 1.0, 1.1 and 1.2 \ + - Abstraction layers for ciphers, hashes, public key operations, \ + platform abstraction and threading \ +" + +HOMEPAGE = "https://www.trustedfirmware.org/projects/mbed-tls/" +BUGTRACKER = "https://github.com/Mbed-TLS/mbedtls/issues" + +LICENSE = "Apache-2.0 | GPL-2.0-or-later" +LIC_FILES_CHKSUM = "file://LICENSE;md5=379d5819937a6c2f1ef1630d341e026d" + +SECTION = "libs" + +SRC_URI = "gitsm://github.com/Mbed-TLS/mbedtls.git;protocol=https;branch=mbedtls-4.1;tag=v${PV} \ + file://run-ptest \ + file://0001-c_build_helper-Split-cc-command-line.patch \ + " + +SRC_URI:append:class-target = " file://0001-use-qemuwrapper-to-run-cross-compiled-binary.patch" + +SRCREV = "0fe989b6b514192783c469039edd325fd0989806" + +DEPENDS += "python3-jinja2-native python3-jsonschema-native qemu-native" + +UPSTREAM_CHECK_GITTAGREGEX = "v(?P<pver>\d+(\.\d+)+)" + +inherit cmake ptest python3native qemu + +PACKAGECONFIG ??= "shared-libs programs ${@bb.utils.contains('PTEST_ENABLED', '1', 'tests', '', d)}" +PACKAGECONFIG[shared-libs] = "-DUSE_SHARED_MBEDTLS_LIBRARY=ON,-DUSE_SHARED_MBEDTLS_LIBRARY=OFF" +PACKAGECONFIG[programs] = "-DENABLE_PROGRAMS=ON,-DENABLE_PROGRAMS=OFF" +PACKAGECONFIG[werror] = "-DMBEDTLS_FATAL_WARNINGS=ON,-DMBEDTLS_FATAL_WARNINGS=OFF" +PACKAGECONFIG[tests] = "-DENABLE_TESTING=ON,-DENABLE_TESTING=OFF" + +PROVIDES += "polarssl" +RPROVIDES:${PN} = "polarssl" + +PACKAGES =+ "${PN}-programs" +FILES:${PN}-programs = "${bindir}/" + +BBCLASSEXTEND = "native nativesdk" + +CVE_PRODUCT = "mbed_tls" + +do_configure:prepend() { + # during building tf-psa-crypto/framework/scripts/mbedtls_framework/c_build_helper.py + # runs some of the cross-compiled binaries. + + qemu_binary="${@qemu_wrapper_cmdline(d, d.getVar('STAGING_DIR_HOST'), [d.expand('${STAGING_DIR_HOST}${libdir}'),d.expand('${STAGING_LIBDIR}')])}" + cat > ${WORKDIR}/qemuwrapper << EOF +#!/bin/sh +$qemu_binary "\$@" +EOF + + chmod +x ${WORKDIR}/qemuwrapper +} + +# Strip host paths from autogenerated test files +do_compile:append() { + sed -i 's+${S}/++g' ${B}/tests/*.c 2>/dev/null || : + sed -i 's+${B}/++g' ${B}/tests/*.c 2>/dev/null || : +} + +# Export source files/headers needed by Arm Trusted Firmware +sysroot_stage_all:append() { + sysroot_stage_dir "${S}/library" "${SYSROOT_DESTDIR}/usr/share/mbedtls-source/library" + sysroot_stage_dir "${S}/include" "${SYSROOT_DESTDIR}/usr/share/mbedtls-source/include" +} + +do_install_ptest () { + install -d ${D}${PTEST_PATH}/testsQuoted 11 lines
Quoted 8 lines
meta-networking/recipes-connectivity/mbedtls/mbedtls_4.1.0.bb line 88
Quoted 8 lines
meta-networking/recipes-connectivity/mbedtls/mbedtls_4.1.0.bb new file +5
-0+ install -d ${D}${PTEST_PATH}/framework + cp -f ${B}/tests/test_suite_* ${D}${PTEST_PATH}/tests/ + find ${D}${PTEST_PATH}/tests/ -type f -name "*.c" -delete + cp -fR ${S}/framework/data_files ${D}${PTEST_PATH}/framework/ +}--
Alex Kiernan-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#126614): https://lists.openembedded.org/g/openembedded-devel/message/126614
Mute This Topic: https://lists.openembedded.org/mt/118983952/3618097
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Signature · 1 line
Alex Kiernan
Quoted 13 lines · Alex Kiernan
Quoted 10 lines · Alex Kiernan via lists.openembedded.org
Just dropping
mbedtls/ecp.hlooks like it might be sufficient for mdns (untested because of the mbedtls build failure around qemuwrapper):mDNSPosix/mbedtls.c +0
-0@@ -31,7 +31,6 @@
Quoted 10 lines
mDNSPosix/mbedtls.c line 36
Quoted 7 lines
mDNSPosix/mbedtls.c +0
-1#include <mbedtls/error.h> #include <mbedtls/pk.h> -#include <mbedtls/ecp.h> #include <mbedtls/ecdsa.h> #include <mbedtls/entropy.h> #include <mbedtls/ctr_drbg.h> Scratch that... the changes needed are much more than simple header removal.
Good to know, thanks - but I think this also means that it won't get into Wrynose unfortunately. Doing big changes on multiple recipes is just too unstable for a stable branch, I guess.
Quoted 279 lines
Quoted 277 lines
Quoted 250 lines · Khem Raj via lists.openembedded.org
and knock on effects perhaps see.
https://errors.yoctoproject.org/Errors/Build/237188/
Quoted 244 lines · Khem Raj
here is next error
| *** stack smashing detected ***: terminated | qemu: uncaught target signal 6 (Aborted) - core dumped | Aborted | Traceback (most recent call last): | File "/srv/pokybuild/yocto-worker/meta-oe/build/build/tmp/work/x86-64-v3-poky-linux/mbedtls/4.1.0/sources/mbedtls-4.1.0/tf-psa-crypto/framework/scripts/generate_psa_tests.py", line 870, in <module> | test_data_generation.main(sys.argv[1:], __doc__, PSATestGenerator) | ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^Detailed error log
https://autobuilder.yoctoproject.org/valkyrie/api/v2/logs/6511632/raw_inline
Quoted 228 lines · Gyorgy Sarvari via lists.openembedded.org
This is the current LTS version for mbedtls, add it next to the existing recipe for v3.6. This new version will be supported longer than v3.6, but there are some incompatibilities between the two (see migration guide[1] and changelog[2]).
This recipe is based on the v3.6 recipe. psa PACKAGECONFIG was dropped, as it is now the regular behavior, without an option to turn it off. update-alternatives class is also removed - it was required due to a sample program called "hello", which has been removed from this release.
Added two small patches:
- one to handle the CC env var correctly from Python. This is submitted for upstream.
- one to use qemu to run cross-compiled binaries instead of running them as they are. This is not upstreamed, as it is OE specific.Ptests passed successfully:
root@qemux86-64:~# ptest-runner START: ptest-runner 2026-04-23T07:29 BEGIN: /usr/lib/mbedtls/ptest PASS: test_suite_config.mbedtls_boolean PASS: test_suite_config.tls_combinations PASS: test_suite_constant_time_hmac PASS: test_suite_debug PASS: test_suite_error PASS: test_suite_mps PASS: test_suite_net PASS: test_suite_pkcs7 PASS: test_suite_ssl PASS: test_suite_ssl.records PASS: test_suite_ssl.tls-defrag PASS: test_suite_ssl_decrypt.misc PASS: test_suite_test_helpers PASS: test_suite_timing PASS: test_suite_version PASS: test_suite_x509_oid PASS: test_suite_x509parse PASS: test_suite_x509write DURATION: 7 END: /usr/lib/mbedtls/ptest 2026-04-23T07:29 STOP: ptest-runner TOTAL: 1 FAIL: 0[1]: https://github.com/Mbed-TLS/mbedtls/blob/development/docs/4.0-migration-guide.md
[2]: https://github.com/Mbed-TLS/mbedtls/releases/tag/mbedtls-4.1.0Signed-off-by Gyorgy Sarvari <[email protected]>---
v2: Inherit python3native, because some native python modules need to be used. When using the
system python, PYTHONPATH gets mixed with build host and sysroot modules, which is incorrect. When using python3native class, the module search path is confined to the sysroot, so it can be better controlled. Also, add python3-jsonschema-native as a build dependency (in v1 the recipe took this dependency from my build host)...c_build_helper-Split-cc-command-line.patch | 33 +++++++ ...wrapper-to-run-cross-compiled-binary.patch | 29 ++++++ .../mbedtls/mbedtls_4.1.0.bb | 88 +++++++++++++++++++ 3 files changed, 150 insertions(+) create mode 100644 meta-networking/recipes-connectivity/mbedtls/mbedtls/0001-c_build_helper-Split-cc-command-line.patch create mode 100644 meta-networking/recipes-connectivity/mbedtls/mbedtls/0001-use-qemuwrapper-to-run-cross-compiled-binary.patch create mode 100644 meta-networking/recipes-connectivity/mbedtls/mbedtls_4.1.0.bbmeta-networking/recipes-connectivity/mbedtls/mbedtls/0001-c_build_helper-Split-cc-command-line.patch new file +33
-0@@ -0,0 +1,33 @@ +From 178e089683bf42097ac6d27522820d07483bc6bd Mon Sep 17 00:00:00 2001 +From: Gyorgy Sarvari <[email protected]> +Date: Thu, 23 Apr 2026 08:54:02 +0200 +Subject: [PATCH] c_build_helper: Split cc command line + +Optionally the CC/HOSTCC environment variable can hold the command to +invoke the C compiler, however this command can also contain extra +arguments, not only the binary name. In this particular case Python +was treating the whole value as a single binary name, and was trying +to execute as such (e.g. "cc -arg1 -arg2" instead of "cc" and the arguments +separately), which results in failure. + +Split the compiler command into its components to invoke it correctly. + +Upstream-Status: Submitted [https://github.com/Mbed-TLS/mbedtls-framework/pull/301] +Signed-off-by: Gyorgy Sarvari <[email protected]> +--- + scripts/mbedtls_framework/c_build_helper.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/scripts/mbedtls_framework/c_build_helper.py b/scripts/mbedtls_framework/c_build_helper.py +index 59bb326e2..85dbb628f 100644 +--- a/tf-psa-crypto/framework/scripts/mbedtls_framework/c_build_helper.py ++++ b/tf-psa-crypto/framework/scripts/mbedtls_framework/c_build_helper.py +@@ -98,7 +98,7 @@ def compile_c_file(c_filename, exe_filename, include_dirs): + cc = os.getenv('HOSTCC', None) + if cc is None: + cc = os.getenv('CC', 'cc') +- cmd = [cc] ++ cmd = cc.split() + + proc = subprocess.Popen(cmd, + stdout=subprocess.DEVNULL,meta-networking/recipes-connectivity/mbedtls/mbedtls/0001-use-qemuwrapper-to-run-cross-compiled-binary.patch new file +29
-0@@ -0,0 +1,29 @@ +From 46f0ea3eb35e8d0d33e88298a9e7c3dbdd49ec17 Mon Sep 17 00:00:00 2001 +From: Gyorgy Sarvari <[email protected]> +Date: Thu, 23 Apr 2026 09:14:40 +0200 +Subject: [PATCH] use qemuwrapper to run cross-compiled binary + +The build process executes a compiled binary to get some details, +however this results in a failure in case of cross-compiling. + +Run it with qemuwrapper, that is created in the recipe. + +Upstream-Status: Inappropriate [cross-compile specific] +Signed-off-by: Gyorgy Sarvari <[email protected]> +--- + scripts/mbedtls_framework/c_build_helper.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/scripts/mbedtls_framework/c_build_helper.py b/scripts/mbedtls_framework/c_build_helper.py +index 59bb326e2..5c4c211ee 100644 +--- a/tf-psa-crypto/framework/scripts/mbedtls_framework/c_build_helper.py ++++ b/tf-psa-crypto/framework/scripts/mbedtls_framework/c_build_helper.py +@@ -169,7 +169,7 @@ def get_c_expression_values( + .format(caller, c_name)) + else: + os.remove(c_name) +- output = subprocess.check_output([exe_name]) ++ output = subprocess.check_output(['../../../qemuwrapper', exe_name]) + return output.decode('ascii').strip().split('\n') + finally: + remove_file_if_exists(exe_name)meta-networking/recipes-connectivity/mbedtls/mbedtls_4.1.0.bb new file +83
-0@@ -0,0 +1,88 @@ +SUMMARY = "Lightweight crypto and SSL/TLS library" +DESCRIPTION = "mbedtls is a lean open source crypto library \ +for providing SSL and TLS support in your programs. It offers \ +an intuitive API and documented header files, so you can actually \ +understand what the code does. It features: \ + \ + - Symmetric algorithms, like AES, Blowfish, Triple-DES, DES, ARC4, \ + Camellia and XTEA \ + - Hash algorithms, like SHA-1, SHA-2, RIPEMD-160 and MD5 \ + - Entropy pool and random generators, like CTR-DRBG and HMAC-DRBG \ + - Public key algorithms, like RSA, Elliptic Curves, Diffie-Hellman, \ + ECDSA and ECDH \ + - SSL v3 and TLS 1.0, 1.1 and 1.2 \ + - Abstraction layers for ciphers, hashes, public key operations, \ + platform abstraction and threading \ +" + +HOMEPAGE = "https://www.trustedfirmware.org/projects/mbed-tls/" +BUGTRACKER = "https://github.com/Mbed-TLS/mbedtls/issues" + +LICENSE = "Apache-2.0 | GPL-2.0-or-later" +LIC_FILES_CHKSUM = "file://LICENSE;md5=379d5819937a6c2f1ef1630d341e026d" + +SECTION = "libs" + +SRC_URI = "gitsm://github.com/Mbed-TLS/mbedtls.git;protocol=https;branch=mbedtls-4.1;tag=v${PV} \ + file://run-ptest \ + file://0001-c_build_helper-Split-cc-command-line.patch \ + " + +SRC_URI:append:class-target = " file://0001-use-qemuwrapper-to-run-cross-compiled-binary.patch" + +SRCREV = "0fe989b6b514192783c469039edd325fd0989806" + +DEPENDS += "python3-jinja2-native python3-jsonschema-native qemu-native" + +UPSTREAM_CHECK_GITTAGREGEX = "v(?P<pver>\d+(\.\d+)+)" + +inherit cmake ptest python3native qemu + +PACKAGECONFIG ??= "shared-libs programs ${@bb.utils.contains('PTEST_ENABLED', '1', 'tests', '', d)}" +PACKAGECONFIG[shared-libs] = "-DUSE_SHARED_MBEDTLS_LIBRARY=ON,-DUSE_SHARED_MBEDTLS_LIBRARY=OFF" +PACKAGECONFIG[programs] = "-DENABLE_PROGRAMS=ON,-DENABLE_PROGRAMS=OFF" +PACKAGECONFIG[werror] = "-DMBEDTLS_FATAL_WARNINGS=ON,-DMBEDTLS_FATAL_WARNINGS=OFF" +PACKAGECONFIG[tests] = "-DENABLE_TESTING=ON,-DENABLE_TESTING=OFF" + +PROVIDES += "polarssl" +RPROVIDES:${PN} = "polarssl" + +PACKAGES =+ "${PN}-programs" +FILES:${PN}-programs = "${bindir}/" + +BBCLASSEXTEND = "native nativesdk" + +CVE_PRODUCT = "mbed_tls" + +do_configure:prepend() { + # during building tf-psa-crypto/framework/scripts/mbedtls_framework/c_build_helper.py + # runs some of the cross-compiled binaries. + + qemu_binary="${@qemu_wrapper_cmdline(d, d.getVar('STAGING_DIR_HOST'), [d.expand('${STAGING_DIR_HOST}${libdir}'),d.expand('${STAGING_LIBDIR}')])}" + cat > ${WORKDIR}/qemuwrapper << EOF +#!/bin/sh +$qemu_binary "\$@" +EOF + + chmod +x ${WORKDIR}/qemuwrapper +} + +# Strip host paths from autogenerated test files +do_compile:append() { + sed -i 's+${S}/++g' ${B}/tests/*.c 2>/dev/null || : + sed -i 's+${B}/++g' ${B}/tests/*.c 2>/dev/null || : +} + +# Export source files/headers needed by Arm Trusted Firmware +sysroot_stage_all:append() { + sysroot_stage_dir "${S}/library" "${SYSROOT_DESTDIR}/usr/share/mbedtls-source/library" + sysroot_stage_dir "${S}/include" "${SYSROOT_DESTDIR}/usr/share/mbedtls-source/include" +} + +do_install_ptest () { + install -d ${D}${PTEST_PATH}/testsQuoted 11 lines
Quoted 8 lines
meta-networking/recipes-connectivity/mbedtls/mbedtls_4.1.0.bb line 88
Quoted 8 lines
meta-networking/recipes-connectivity/mbedtls/mbedtls_4.1.0.bb new file +5
-0+ install -d ${D}${PTEST_PATH}/framework + cp -f ${B}/tests/test_suite_* ${D}${PTEST_PATH}/tests/ + find ${D}${PTEST_PATH}/tests/ -type f -name "*.c" -delete + cp -fR ${S}/framework/data_files ${D}${PTEST_PATH}/framework/ +}--
Alex Kiernan-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#126614): https://lists.openembedded.org/g/openembedded-devel/message/126614
Mute This Topic: https://lists.openembedded.org/mt/118983952/3618097
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Quoted 27 lines · Gyorgy Sarvari
Quoted 13 lines · Alex Kiernan
Quoted 10 lines · Alex Kiernan via lists.openembedded.org
Just dropping
mbedtls/ecp.hlooks like it might be sufficient for mdns (untested because of the mbedtls build failure around qemuwrapper):mDNSPosix/mbedtls.c +0
-0@@ -31,7 +31,6 @@Quoted 10 lines
mDNSPosix/mbedtls.c line 36
Quoted 7 lines
mDNSPosix/mbedtls.c +0
-1#include <mbedtls/error.h> #include <mbedtls/pk.h> -#include <mbedtls/ecp.h> #include <mbedtls/ecdsa.h> #include <mbedtls/entropy.h> #include <mbedtls/ctr_drbg.h> Scratch that... the changes needed are much more than simple header removal.
Quoted 4 lines
Good to know, thanks - but I think this also means that it won't get into Wrynose unfortunately. Doing big changes on multiple recipes is just too unstable for a stable branch, I guess.
Given how much of the legacy API they've removed/the transition to PSA, I wonder if we're at the point of needing mbedtls3 as a separate recipe - for mDNSResponder we're at Apple's mercy to upgrade it to something that works with mbedtls4, or we'll just carry patches forever. The only saving grace might be they seem to be engaged with matter-openwrt:
https://github.com/project-chip/matter-openwrt/tree/main/third_party/mdnsresponder/patches
Signature · 1 line
Alex Kiernan
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 34 lines · Alex Kiernan via lists.openembedded.org
Quoted 27 lines · Gyorgy Sarvari
Quoted 13 lines · Alex Kiernan
Quoted 10 lines · Alex Kiernan via lists.openembedded.org
Just dropping
mbedtls/ecp.hlooks like it might be sufficient for mdns (untested because of the mbedtls build failure around qemuwrapper):mDNSPosix/mbedtls.c +0
-0@@ -31,7 +31,6 @@Quoted 10 lines
mDNSPosix/mbedtls.c line 36
Quoted 7 lines
mDNSPosix/mbedtls.c +0
-1#include <mbedtls/error.h> #include <mbedtls/pk.h> -#include <mbedtls/ecp.h> #include <mbedtls/ecdsa.h> #include <mbedtls/entropy.h> #include <mbedtls/ctr_drbg.h> Scratch that... the changes needed are much more than simple header removal.
Quoted 4 lines
Good to know, thanks - but I think this also means that it won't get into Wrynose unfortunately. Doing big changes on multiple recipes is just too unstable for a stable branch, I guess.
Quoted 5 lines
Given how much of the legacy API they've removed/the transition to PSA, I wonder if we're at the point of needing mbedtls3 as a separate recipe - for mDNSResponder we're at Apple's mercy to upgrade it to something that works with mbedtls4, or we'll just carry patches forever.
Actually it looks like the changes might be trivial... will wait for the mbedtls4 recipe to land so I can check.
Signature · 1 line
Alex Kiernan
Quoted 37 lines · Alex Kiernan
Quoted 34 lines · Alex Kiernan via lists.openembedded.org
Quoted 31 lines · Gyorgy Sarvari
Quoted 13 lines · Alex Kiernan
Quoted 10 lines · Alex Kiernan via lists.openembedded.org
Just dropping
mbedtls/ecp.hlooks like it might be sufficient for mdns (untested because of the mbedtls build failure around qemuwrapper):mDNSPosix/mbedtls.c +0
-0@@ -31,7 +31,6 @@Quoted 10 lines
mDNSPosix/mbedtls.c line 36
Quoted 7 lines
mDNSPosix/mbedtls.c +0
-1#include <mbedtls/error.h> #include <mbedtls/pk.h> -#include <mbedtls/ecp.h> #include <mbedtls/ecdsa.h> #include <mbedtls/entropy.h> #include <mbedtls/ctr_drbg.h> Scratch that... the changes needed are much more than simple header removal.
Good to know, thanks - but I think this also means that it won't get into Wrynose unfortunately. Doing big changes on multiple recipes is just too unstable for a stable branch, I guess.
Quoted 9 lines
Quoted 5 lines
Given how much of the legacy API they've removed/the transition to PSA, I wonder if we're at the point of needing mbedtls3 as a separate recipe - for mDNSResponder we're at Apple's mercy to upgrade it to something that works with mbedtls4, or we'll just carry patches forever.
Actually it looks like the changes might be trivial... will wait for the mbedtls4 recipe to land so I can check.
Just in case you are (or anyone else is) waiting on me, please don't. When it became apparent that the extent of this change is way too big for Wrynose, it became a low priority issue for me. I might get back to it in the future, but if anyone has more motivation to do the upgrade than I, please feel free to finish it.