Skip to contentSkip to conversation

arm/trusted-firmware-m: set OpenSSL provider path

PATCH Applied Ross Burton 2 participants 4 messages Jan 27, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 arm/trusted-firmware-m: set OpenSSL provider path

imgtool from mcuboot uses python3-cryptography-native, and the latest python3-cryptography explicitly loads the legacy provider, which is a separate shared object in OpenSSL 3. The search path for providers is hard-coded into the library so the wrong path is searched and the module is not found.

Set OPENSSL_MODULES so the right path, so that the legacy module is found. In the future we may be able to be removed this if the explict use of legacy algorithms is removed
(https://github.com/pyca/cryptography/issues/6809).

This also means we can remove the downgrades of python3-crytography that were being carried in meta-arm.

---
 .../trusted-firmware-m/trusted-firmware-m_1.5.0.bb            | 4 ++++
 1 file changed, 4 insertions(+)
meta-arm/recipes-bsp/trusted-firmware-m/trusted-firmware-m_1.5.0.bb +4 -0
index 302fd2cd..c0eee5cc 100644
@@ -97,6 +97,10 @@ LDFLAGS[unexport] = "1"
 AS[unexport] = "1"
 LD[unexport] = "1"
 
+# python3-cryptography needs the legacy provider, so set OPENSSL_MODULES to the
+# right path until this is relocated automatically.
+export OPENSSL_MODULES="${STAGING_LIBDIR_NATIVE}/ossl-modules"
+
 # TF-M ships patches that it needs applied to mbedcrypto, so apply them
 # as part of do_patch.
 apply_local_patches() {
Signature · 1 line
2.25.1
#1 lore raw

PATCH 2/3 Revert "meta-arm-bsp: use old python3-crytography on platforms using TF-M"

This reverts commit 2a27bd4f47d09bb709a953f4a91ef2a2cf921255.

---
 meta-arm-bsp/conf/layer.conf                       | 6 +-----
 meta-arm-bsp/conf/machine/include/corstone1000.inc | 5 -----
 meta-arm-bsp/conf/machine/musca-b1.conf            | 5 -----
 meta-arm-bsp/conf/machine/musca-s1.conf            | 5 -----
 4 files changed, 1 insertion(+), 20 deletions(-)
meta-arm-bsp/conf/layer.conf +1 -5
index 82230470..45767866 100644
@@ -21,8 +21,4 @@ LAYERDEPENDS_meta-arm-bsp:append:musca-s1 = " meta-python"
 LICENSE_PATH += "${LAYERDIR}/custom-licenses"
 
 # Delete this when our downgrade of python3-cryptography is removed
-META_ARM_PYCRYPTO = "meta-arm-bsp/recipes-devtools/python/python3-cryptography_3.3.2.bb"
-META_ARM_PYCRYPTO:corstone1000 = ""
-META_ARM_PYCRYPTO:musca-b1 = ""
-META_ARM_PYCRYPTO:musca-s1 = ""
-BBMASK += "${META_ARM_PYCRYPTO}"
+BBMASK += "meta-arm-bsp/recipes-devtools/python/python3-cryptography_3.3.2.bb"
meta-arm-bsp/conf/machine/include/corstone1000.inc +0 -5
index 019293b0..f9d301e4 100644
@@ -63,8 +63,3 @@ SERIAL_CONSOLES ?= "115200;ttyAMA0"
 WKS_FILE_DEPENDS:append = " ${EXTRA_IMAGEDEPENDS}"
 
 WKS_FILE ?= "corstone1000-image.corstone1000.wks"
-
-# The latest python3-cryptography-native doesn't work
-# (cryptography.exceptions.InternalError: Unknown OpenSSL error) so use the
-# version before Rust was involved for now.
-PREFERRED_VERSION_python3-cryptography-native = "3.3.2"
meta-arm-bsp/conf/machine/musca-b1.conf +0 -5
index ec5ff4ee..073c466e 100644
@@ -26,8 +26,3 @@ ZEPHYR_INHERIT_CLASSES += "zephyr-qemuboot"
 ARCH:musca-b1 = "arm"
 
 TFM_PLATFORM = "arm/musca_b1/sse_200"
-
-# The latest python3-cryptography-native doesn't work
-# (cryptography.exceptions.InternalError: Unknown OpenSSL error) so use the
-# version before Rust was involved for now.
-PREFERRED_VERSION_python3-cryptography-native = "3.3.2"
meta-arm-bsp/conf/machine/musca-s1.conf +0 -5
index e5f63f76..d18c06c2 100644
@@ -25,8 +25,3 @@ ZEPHYR_INHERIT_CLASSES += "zephyr-qemuboot"
 ARCH:musca-s1 = "arm"
 
 TFM_PLATFORM = "arm/musca_s1"
-
-# The latest python3-cryptography-native doesn't work
-# (cryptography.exceptions.InternalError: Unknown OpenSSL error) so use the
-# version before Rust was involved for now.
-PREFERRED_VERSION_python3-cryptography-native = "3.3.2"
Signature · 1 line
2.25.1
#2 lore raw

PATCH 3/3 Revert "meta-arm: add old version of python3-cryptography"

In reply to Ross Burton

This reverts commit a15c16068ab011e2ba91a6c4ca6e1251de0d8058.

---
 meta-arm-bsp/conf/layer.conf                  |  3 -
 .../python/python3-cryptography/h-test.patch  | 10 ---
 .../python3-cryptography/openssl3.patch       | 62 -----------------
 .../python/python3-cryptography/run-ptest     |  2 -
 .../python/python3-cryptography_3.3.2.bb      | 68 -------------------
 5 files changed, 145 deletions(-)
 delete mode 100644 meta-arm-bsp/recipes-devtools/python/python3-cryptography/h-test.patch
 delete mode 100644 meta-arm-bsp/recipes-devtools/python/python3-cryptography/openssl3.patch
 delete mode 100644 meta-arm-bsp/recipes-devtools/python/python3-cryptography/run-ptest
 delete mode 100644 meta-arm-bsp/recipes-devtools/python/python3-cryptography_3.3.2.bb
meta-arm-bsp/conf/layer.conf +0 -3
index 45767866..7af156e8 100644
@@ -19,6 +19,3 @@ LAYERDEPENDS_meta-arm-bsp:append:musca-s1 = " meta-python"
 
 # Additional license directories.
 LICENSE_PATH += "${LAYERDIR}/custom-licenses"
-
-# Delete this when our downgrade of python3-cryptography is removed
-BBMASK += "meta-arm-bsp/recipes-devtools/python/python3-cryptography_3.3.2.bb"
meta-arm-bsp/recipes-devtools/python/python3-cryptography/h-test.patch deleted +0 -10
deleted file mode 100644
index 9f07c738..00000000
@@ -1,10 +0,0 @@
---- a/tests/hypothesis/__init__.py
-+++ b/tests/hypothesis/__init__.py
-@@ -3,3 +3,7 @@
- # for complete details.
- 
- from __future__ import absolute_import, division, print_function
-+
-+import pytest
-+hypothesis = pytest.importorskip("hypothesis")
-+
meta-arm-bsp/recipes-devtools/python/python3-cryptography/openssl3.patch deleted +0 -62

62 lines not on this page · raw message

meta-arm-bsp/recipes-devtools/python/python3-cryptography/run-ptest deleted +0 -2
deleted file mode 100644
index 0ba239c2..00000000
@@ -1,2 +0,0 @@
-#!/bin/sh
-py.test
meta-arm-bsp/recipes-devtools/python/python3-cryptography_3.3.2.bb deleted +0 -68

68 lines not on this page · raw message

Signature · 1 line
2.25.1
Applied
#3 lore raw
In reply to Ross Burton
Quoted 6 lines · Ross Burton

imgtool from mcuboot uses python3-cryptography-native, and the latest python3-cryptography explicitly loads the legacy provider, which is a separate shared object in OpenSSL 3. The search path for providers is hard-coded into the library so the wrong path is searched and the module is not found.

Quoted 6 lines

Set OPENSSL_MODULES so the right path, so that the legacy module is found. In the future we may be able to be removed this if the explict use of legacy algorithms is removed
(https://github.com/pyca/cryptography/issues/6809).

[...]

Applied, thanks!

[1/3] arm/trusted-firmware-m: set OpenSSL provider path

      commit: 1ee79374727224129f47c56115b18dea4edbd553
[2/3] Revert "meta-arm-bsp: use old python3-crytography on platforms using TF-M"
      commit: 778236335a983cd3e8e55857a19b83daf20ef8b7
[3/3] Revert "meta-arm: add old version of python3-cryptography"
      commit: 8a42328437db26071339162fd3c5b23d104eed60

Best regards,

Signature · 1 line
Jon Mason <[email protected]>