Skip to contentSkip to conversation

arm/trusted-firmware-a: ensure native cert_create has -rpath

PATCH New Ross Burton 1 participant 4 messages Nov 9, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/4 arm/trusted-firmware-a: ensure native cert_create has -rpath

Patch in BUILD_LDFLAGS into the cert_create Makefile so that the -rpath arguments are passed to the native build, meaning it can find libssl correctly. This somewhat worked previously as the host libssl and sysroot libssl matched, but now that OE has OpenSSL 3 that often isn't the case.

---
 meta-arm/recipes-bsp/trusted-firmware-a/trusted-firmware-a.inc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
meta-arm/recipes-bsp/trusted-firmware-a/trusted-firmware-a.inc +2 -1
index 39b51566..243e641c 100644
@@ -152,10 +152,11 @@ BUILD_DIR .= "${@'/${TFA_BOARD}' if d.getVar('TFA_BOARD') else ''}"
 BUILD_DIR .= "/${@'debug' if d.getVar("TFA_DEBUG") == '1' else 'release'}"
 
 do_compile() {
-    # This is still needed to have the native fiptool executing properly by
+    # This is still needed to have the native tools executing properly by
     # setting the RPATH
     sed -i '/^LDLIBS/ 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
 
     # 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.25.1
#1 lore raw

PATCH 2/4 atp/atp-native: don't pass -Werror

New compiler is now warning about ignored return values[1], so patch out the use of -Werror, which is bad practise outside of development builds.

[1] https://github.com/ARM-software/ATP-Engine/issues/9

---
 .../recipes-devtools/atp/atp-native_3.1.bb     |  3 ++-
 .../recipes-devtools/atp/files/no-werror.patch | 18 ++++++++++++++++++
 2 files changed, 20 insertions(+), 1 deletion(-)
 create mode 100644 meta-atp/recipes-devtools/atp/files/no-werror.patch
meta-atp/recipes-devtools/atp/atp-native_3.1.bb +2 -1
index bb519882..31b58bf9 100644
@@ -4,7 +4,8 @@ inherit pkgconfig native
 SUMMARY = "AMBA ATP Engine: synthetic traffic interface modelling framework"
 
 S = "${WORKDIR}/git"
-SRC_URI = "${ATP_SRC}"
+SRC_URI = "${ATP_SRC} \
+           file://no-werror.patch"
 
 EXTRA_OEMAKE += "EXTRA_CXX_FLAGS='${CXXFLAGS}' EXTRA_LD_FLAGS='${LDFLAGS}'"
 
meta-atp/recipes-devtools/atp/files/no-werror.patch new file +18 -0
new file mode 100644
index 00000000..4be143af
@@ -0,0 +1,18 @@
+Don't pass -Werror, as new compilers introduce new warnings.
+
+Upstream-Status: Pending
+Signed-off-by: Ross Burton <[email protected]>
+
+diff --git a/Makefile b/Makefile
+index c01b120..1d3c30a 100644
+--- a/Makefile
++++ b/Makefile
+@@ -18,7 +18,7 @@ PROTOBUF_C_FLAGS:= $(shell pkg-config --cflags protobuf)
+ CPPUNIT_C_FLAGS := $(shell pkg-config --cflags cppunit)
+ PROTOBUF_L_FLAGS:= $(shell pkg-config --libs protobuf)
+ CPPUNIT_L_FLAGS	:= $(shell pkg-config --libs cppunit)
+-CXX_FLAGS       := $(PROTOBUF_C_FLAGS) -std=c++11 -Wall -Werror -Wextra -Wno-unused-parameter -Wno-unused-variable $(CPPUNIT_C_FLAGS) -fPIC $(EXTRA_CXX_FLAGS)
++CXX_FLAGS       := $(PROTOBUF_C_FLAGS) -std=c++11 -Wall -Wextra -Wno-unused-parameter -Wno-unused-variable $(CPPUNIT_C_FLAGS) -fPIC $(EXTRA_CXX_FLAGS)
+ LD_FLAGS        := $(PROTOBUF_L_FLAGS) $(CPPUNIT_L_FLAGS) $(EXTRA_LD_FLAGS)
+ PROTO_SRC_DIR   := ./proto/
+ PROTO_SRC       := $(wildcard $(PROTO_SRC_DIR)tp*.proto)
Signature · 1 line
2.25.1
#2 lore raw

PATCH 3/4 CI: apply a patch to fix python3-cryptography with OpenSSL 3

In reply to Ross Burton

python3-cryptography doesn't even start with OpenSSL 3, because symbols that it tries to use have been removed. Backport enough of the OpenSSL 3 port that it will start up.

This patch has been submitted to meta-openembedded and will be removed when it is merged.

---
 ci/crypto-ssl3.patch     | 105 +++++++++++++++++++++++++++++++++++++++
 ci/meta-openembedded.yml |   4 ++
 2 files changed, 109 insertions(+)
 create mode 100644 ci/crypto-ssl3.patch
ci/crypto-ssl3.patch new file +105 -0
new file mode 100644
index 00000000..bacb1f24
@@ -0,0 +1,105 @@
+Upstream-Status: Submitted [posted to oe-devel]
+Signed-off-by: Ross Burton <[email protected]>
+
+From 71bec4794626f8a2a46377ef284cc3261bdc0c4e Mon Sep 17 00:00:00 2001
+From: Ross Burton <[email protected]>
+Date: Mon, 8 Nov 2021 16:58:11 +0000
+Subject: [PATCH] python3-cryptography: backport patches to make this work
+ against OpenSSL 3
+
+Backport just enough changes that python3-cryptography doesn't crash on
+startup when linked against OpenSSL 3.
+
+This is very much not complete, and the upgrade to the latest version of
+python3-crytography has to happen soon.
+
+Signed-off-by: Ross Burton <[email protected]>
+---
+ .../python3-cryptography/openssl3.patch       | 62 +++++++++++++++++++
+ .../python/python3-cryptography_3.3.2.bb      |  1 +
+ 2 files changed, 63 insertions(+)
+ create mode 100644 meta-python/recipes-devtools/python/python3-cryptography/openssl3.patch
+
+diff --git a/meta-python/recipes-devtools/python/python3-cryptography/openssl3.patch b/meta-python/recipes-devtools/python/python3-cryptography/openssl3.patch
+new file mode 100644
+index 0000000000..25baa42cc9
+--- /dev/null
++++ b/meta-python/recipes-devtools/python/python3-cryptography/openssl3.patch
+@@ -0,0 +1,62 @@
++Encourage our old python3-cryptography to at least start to work with OpenSSL 3.
++
++- Backport one patch to err.py to remove a symbol which has been removed in
++  OpenSSL 3, and isn't used in python3-cryptography.
++  (50ec692749b7e2e62685b443f5e629627b03987e)
++
++- Backport the detection of OpenSSL 3 and don't link to FIPS_mode/FIPS_mode_set
++  (parts of f08a7de651f9e6475c8c0a67d2a61ed8b669ddf6)
++
++This is *not* a complete backport of the 3.0 support, but is enough that packages
++such as imgtool can import python3-cryptography and operate until the upgrade is
++ready.
++
++Upstream-Status: Inappropriate
++Signed-off-by: Ross Burton <[email protected]>
++
++diff --git a/src/_cffi_src/openssl/cryptography.py b/src/_cffi_src/openssl/cryptography.py
++index f24bee5a..920a86de 100644
++--- a/src/_cffi_src/openssl/cryptography.py
+++++ b/src/_cffi_src/openssl/cryptography.py
++@@ -35,6 +35,8 @@ INCLUDES = """
++ 
++ #define CRYPTOGRAPHY_OPENSSL_110F_OR_GREATER \
++     (OPENSSL_VERSION_NUMBER >= 0x1010006f && !CRYPTOGRAPHY_IS_LIBRESSL)
+++#define CRYPTOGRAPHY_OPENSSL_300_OR_GREATER \
+++    (OPENSSL_VERSION_NUMBER >= 0x30000000 && !CRYPTOGRAPHY_IS_LIBRESSL)
++ 
++ #define CRYPTOGRAPHY_OPENSSL_LESS_THAN_110J \
++     (OPENSSL_VERSION_NUMBER < 0x101000af || CRYPTOGRAPHY_IS_LIBRESSL)
++@@ -54,6 +56,7 @@ INCLUDES = """
++ 
++ TYPES = """
++ static const int CRYPTOGRAPHY_OPENSSL_110F_OR_GREATER;
+++static const int CRYPTOGRAPHY_OPENSSL_300_OR_GREATER;
++ 
++ static const int CRYPTOGRAPHY_OPENSSL_LESS_THAN_111;
++ static const int CRYPTOGRAPHY_OPENSSL_LESS_THAN_111B;
++diff --git a/src/_cffi_src/openssl/err.py b/src/_cffi_src/openssl/err.py
++index 0dd74146..42bab4d9 100644
++--- a/src/_cffi_src/openssl/err.py
+++++ b/src/_cffi_src/openssl/err.py
++@@ -40,7 +40,6 @@ void ERR_clear_error(void);
++ void ERR_put_error(int, int, int, const char *, int);
++ 
++ int ERR_GET_LIB(unsigned long);
++-int ERR_GET_FUNC(unsigned long);
++ int ERR_GET_REASON(unsigned long);
++ 
++ """
++diff --git a/src/_cffi_src/openssl/fips.py b/src/_cffi_src/openssl/fips.py
++index c92bca49..38bfa231 100644
++--- a/src/_cffi_src/openssl/fips.py
+++++ b/src/_cffi_src/openssl/fips.py
++@@ -18,7 +18,7 @@ int FIPS_mode(void);
++ """
++ 
++ CUSTOMIZATIONS = """
++-#if CRYPTOGRAPHY_IS_LIBRESSL
+++#if CRYPTOGRAPHY_IS_LIBRESSL || CRYPTOGRAPHY_OPENSSL_300_OR_GREATER
++ static const long Cryptography_HAS_FIPS = 0;
++ int (*FIPS_mode_set)(int) = NULL;
++ int (*FIPS_mode)(void) = NULL;
+diff --git a/meta-python/recipes-devtools/python/python3-cryptography_3.3.2.bb b/meta-python/recipes-devtools/python/python3-cryptography_3.3.2.bb
+index baec105a3e..8808b81625 100644
+--- a/meta-python/recipes-devtools/python/python3-cryptography_3.3.2.bb
++++ b/meta-python/recipes-devtools/python/python3-cryptography_3.3.2.bb
+@@ -11,6 +11,7 @@ SRC_URI[sha256sum] = "5a60d3780149e13b7a6ff7ad6526b38846354d11a15e21068e57073e29
+ SRC_URI += " \
+     file://run-ptest \
+     file://h-test.patch \
++    file://openssl3.patch \
+ "
+ 
+ inherit pypi setuptools3
+-- 
+2.25.1
+
ci/meta-openembedded.yml +4 -0
index 4b95217b..cc5ff46f 100644
@@ -9,3 +9,7 @@ repos:
       meta-networking:
       meta-oe:
       meta-python:
+    patches:
+      crypto-ssl3:
+        repo: meta-arm
+        path: ci/crypto-ssl3.patch
Signature · 1 line
2.25.1
#3 lore raw

PATCH 4/4 gem5/gem5-aarch64-native: fix fuzz in patch

In reply to Ross Burton

Not sure how this wasn't caught by the CI, human error no doubt.

---
 meta-gem5/recipes-devtools/gem5/files/mapping.patch | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
meta-gem5/recipes-devtools/gem5/files/mapping.patch +5 -5
index 5eb34d82..3a7cb437 100644
@@ -23,13 +23,13 @@ diff --git a/src/python/m5/debug.py b/src/python/m5/debug.py
 index d808850cc..787a39ece 100644
 --- a/src/python/m5/debug.py
 +++ b/src/python/m5/debug.py
-@@ -24,7 +24,7 @@
- # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- 
+@@ -26,7 +26,7 @@
+
+ from __future__ import print_function
+
 -from collections import Mapping
 +from collections.abc import Mapping
- 
+
  import _m5.debug
  from _m5.debug import SimpleFlag, CompoundFlag
 -- 
Signature · 1 line
2.25.1