diff options
3 files changed, 70 insertions, 5 deletions
diff --git a/meta-networking/recipes-connectivity/mbedtls/mbedtls/0001-aesce-do-not-specify-an-arch-version-when-enabling-c.patch b/meta-networking/recipes-connectivity/mbedtls/mbedtls/0001-aesce-do-not-specify-an-arch-version-when-enabling-c.patch new file mode 100644 index 0000000000..d98d8fa575 --- /dev/null +++ b/meta-networking/recipes-connectivity/mbedtls/mbedtls/0001-aesce-do-not-specify-an-arch-version-when-enabling-c.patch | |||
| @@ -0,0 +1,33 @@ | |||
| 1 | From 2246925e3cb16183e25d4e2cfd13fb800df86270 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Beniamin Sandu <beniaminsandu@gmail.com> | ||
| 3 | Date: Sun, 25 Jun 2023 19:58:08 +0300 | ||
| 4 | Subject: [PATCH] aesce: do not specify an arch version when enabling crypto | ||
| 5 | instructions | ||
| 6 | |||
| 7 | Building mbedtls with different aarch64 tuning variations revealed | ||
| 8 | that we should use the crypto extensions without forcing a particular | ||
| 9 | architecture version or core, as that can create issues. | ||
| 10 | |||
| 11 | Upstream-Status: Submitted [https://github.com/Mbed-TLS/mbedtls/pull/7834] | ||
| 12 | |||
| 13 | Signed-off-by: Beniamin Sandu <beniaminsandu@gmail.com> | ||
| 14 | --- | ||
| 15 | library/aesce.c | 2 +- | ||
| 16 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
| 17 | |||
| 18 | diff --git a/library/aesce.c b/library/aesce.c | ||
| 19 | index fe056dc4c..843de3973 100644 | ||
| 20 | --- a/library/aesce.c | ||
| 21 | +++ b/library/aesce.c | ||
| 22 | @@ -60,7 +60,7 @@ | ||
| 23 | # error "A more recent GCC is required for MBEDTLS_AESCE_C" | ||
| 24 | # endif | ||
| 25 | # pragma GCC push_options | ||
| 26 | -# pragma GCC target ("arch=armv8-a+crypto") | ||
| 27 | +# pragma GCC target ("+crypto") | ||
| 28 | # define MBEDTLS_POP_TARGET_PRAGMA | ||
| 29 | # else | ||
| 30 | # error "Only GCC and Clang supported for MBEDTLS_AESCE_C" | ||
| 31 | -- | ||
| 32 | 2.25.1 | ||
| 33 | |||
diff --git a/meta-networking/recipes-connectivity/mbedtls/mbedtls/0002-aesce-use-correct-target-attribute-when-building-wit.patch b/meta-networking/recipes-connectivity/mbedtls/mbedtls/0002-aesce-use-correct-target-attribute-when-building-wit.patch new file mode 100644 index 0000000000..4775c8ddb7 --- /dev/null +++ b/meta-networking/recipes-connectivity/mbedtls/mbedtls/0002-aesce-use-correct-target-attribute-when-building-wit.patch | |||
| @@ -0,0 +1,34 @@ | |||
| 1 | From 03d3523f974536f2358047382aadb0d4cc762f8a Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Beniamin Sandu <beniaminsandu@gmail.com> | ||
| 3 | Date: Mon, 26 Jun 2023 12:07:21 +0300 | ||
| 4 | Subject: [PATCH] aesce: use correct target attribute when building with clang | ||
| 5 | |||
| 6 | Seems clang has its own issues when it comes to crypto extensions, | ||
| 7 | and right now the best way to avoid them is to accurately enable | ||
| 8 | the needed instructions instead of the broad crypto feature. | ||
| 9 | |||
| 10 | E.g.: https://github.com/llvm/llvm-project/issues/61645 | ||
| 11 | |||
| 12 | Upstream-Status: Pending | ||
| 13 | |||
| 14 | Signed-off-by: Beniamin Sandu <beniaminsandu@gmail.com> | ||
| 15 | --- | ||
| 16 | library/aesce.c | 2 +- | ||
| 17 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
| 18 | |||
| 19 | diff --git a/library/aesce.c b/library/aesce.c | ||
| 20 | index 843de3973..7bea088ba 100644 | ||
| 21 | --- a/library/aesce.c | ||
| 22 | +++ b/library/aesce.c | ||
| 23 | @@ -53,7 +53,7 @@ | ||
| 24 | # if __clang_major__ < 4 | ||
| 25 | # error "A more recent Clang is required for MBEDTLS_AESCE_C" | ||
| 26 | # endif | ||
| 27 | -# pragma clang attribute push (__attribute__((target("crypto"))), apply_to=function) | ||
| 28 | +# pragma clang attribute push (__attribute__((target("aes"))), apply_to=function) | ||
| 29 | # define MBEDTLS_POP_TARGET_PRAGMA | ||
| 30 | # elif defined(__GNUC__) | ||
| 31 | # if __GNUC__ < 6 | ||
| 32 | -- | ||
| 33 | 2.25.1 | ||
| 34 | |||
diff --git a/meta-networking/recipes-connectivity/mbedtls/mbedtls_3.4.0.bb b/meta-networking/recipes-connectivity/mbedtls/mbedtls_3.4.0.bb index ebc6ba5737..b8c9662de7 100644 --- a/meta-networking/recipes-connectivity/mbedtls/mbedtls_3.4.0.bb +++ b/meta-networking/recipes-connectivity/mbedtls/mbedtls_3.4.0.bb | |||
| @@ -25,8 +25,9 @@ SECTION = "libs" | |||
| 25 | S = "${WORKDIR}/git" | 25 | S = "${WORKDIR}/git" |
| 26 | SRCREV = "1873d3bfc2da771672bd8e7e8f41f57e0af77f33" | 26 | SRCREV = "1873d3bfc2da771672bd8e7e8f41f57e0af77f33" |
| 27 | SRC_URI = "git://github.com/ARMmbed/mbedtls.git;protocol=https;branch=master \ | 27 | SRC_URI = "git://github.com/ARMmbed/mbedtls.git;protocol=https;branch=master \ |
| 28 | file://run-ptest \ | 28 | file://0001-aesce-do-not-specify-an-arch-version-when-enabling-c.patch \ |
| 29 | " | 29 | file://0002-aesce-use-correct-target-attribute-when-building-wit.patch \ |
| 30 | file://run-ptest" | ||
| 30 | 31 | ||
| 31 | inherit cmake update-alternatives ptest | 32 | inherit cmake update-alternatives ptest |
| 32 | 33 | ||
| @@ -41,9 +42,6 @@ PACKAGECONFIG[tests] = "-DENABLE_TESTING=ON,-DENABLE_TESTING=OFF" | |||
| 41 | 42 | ||
| 42 | EXTRA_OECMAKE = "-DLIB_INSTALL_DIR:STRING=${libdir}" | 43 | EXTRA_OECMAKE = "-DLIB_INSTALL_DIR:STRING=${libdir}" |
| 43 | 44 | ||
| 44 | # Needs crypto instructions on aarch64 | ||
| 45 | TUNE_CCARGS_MARCH_OPTS:append:aarch64 = "${@bb.utils.contains('TUNE_FEATURES', 'crypto', '', '+crypto', d)}" | ||
| 46 | |||
| 47 | # For now the only way to enable PSA is to explicitly pass a -D via CFLAGS | 45 | # For now the only way to enable PSA is to explicitly pass a -D via CFLAGS |
| 48 | CFLAGS:append = "${@bb.utils.contains('PACKAGECONFIG', 'psa', ' -DMBEDTLS_USE_PSA_CRYPTO', '', d)}" | 46 | CFLAGS:append = "${@bb.utils.contains('PACKAGECONFIG', 'psa', ' -DMBEDTLS_USE_PSA_CRYPTO', '', d)}" |
| 49 | 47 | ||
