From 8e2775fc89a01fa5d525419c2e1e3f0b1e5b80df Mon Sep 17 00:00:00 2001 From: Lealem Amedie Date: Fri, 12 Jul 2024 13:14:40 -0600 Subject: [PATCH 1/3] Adding ARM ASM build option to STM32CubePack config --- IDE/STM32Cube/default_conf.ftl | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/IDE/STM32Cube/default_conf.ftl b/IDE/STM32Cube/default_conf.ftl index b976c55df2..2ca30c523a 100644 --- a/IDE/STM32Cube/default_conf.ftl +++ b/IDE/STM32Cube/default_conf.ftl @@ -534,6 +534,16 @@ extern ${variable.value} ${variable.name}; #define NO_MD5 #endif +/* ------------------------------------------------------------------------- */ +/* Crypto Accelaration */ +/* ------------------------------------------------------------------------- */ +#if defined(WOLF_CONF_ARMASM) && WOLF_CONF_ARMASM == 1 + #define WOLFSSL_ARMASM + #define WOLFSSL_ARMASM_INLINE + #define WOLFSSL_ARMASM_NO_HW_CRYPTO + #define WOLFSSL_ARMASM_NO_NEON + #define WOLFSSL_ARM_ARCH 7 +#endif /* ------------------------------------------------------------------------- */ /* Benchmark / Test */ From 8c76cab2cb2f5b06239df28b534bb01a0f20f860 Mon Sep 17 00:00:00 2001 From: Lealem Amedie Date: Fri, 12 Jul 2024 14:59:40 -0600 Subject: [PATCH 2/3] Add comment for new option --- IDE/STM32Cube/default_conf.ftl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/IDE/STM32Cube/default_conf.ftl b/IDE/STM32Cube/default_conf.ftl index 2ca30c523a..15f63f3653 100644 --- a/IDE/STM32Cube/default_conf.ftl +++ b/IDE/STM32Cube/default_conf.ftl @@ -537,6 +537,10 @@ extern ${variable.value} ${variable.name}; /* ------------------------------------------------------------------------- */ /* Crypto Accelaration */ /* ------------------------------------------------------------------------- */ +/* This enables inline assembly speedups for SHA2, SHA3, AES, + * ChaCha20/Poly1305 and Ed/Curve25519. These settings work for Cortex M4/M7 + * and the source code is located in wolfcrypt/src/port/arm/ + */ #if defined(WOLF_CONF_ARMASM) && WOLF_CONF_ARMASM == 1 #define WOLFSSL_ARMASM #define WOLFSSL_ARMASM_INLINE From 206d3f47f77b20ef6e7641583d4ababeb0b4f53e Mon Sep 17 00:00:00 2001 From: Lealem Amedie Date: Fri, 12 Jul 2024 15:33:37 -0600 Subject: [PATCH 3/3] Fix typo and disable crypto offload if ARM_ASM enabled --- IDE/STM32Cube/default_conf.ftl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/IDE/STM32Cube/default_conf.ftl b/IDE/STM32Cube/default_conf.ftl index 15f63f3653..5e92dc1ddf 100644 --- a/IDE/STM32Cube/default_conf.ftl +++ b/IDE/STM32Cube/default_conf.ftl @@ -535,7 +535,7 @@ extern ${variable.value} ${variable.name}; #endif /* ------------------------------------------------------------------------- */ -/* Crypto Accelaration */ +/* Crypto Acceleration */ /* ------------------------------------------------------------------------- */ /* This enables inline assembly speedups for SHA2, SHA3, AES, * ChaCha20/Poly1305 and Ed/Curve25519. These settings work for Cortex M4/M7 @@ -547,6 +547,11 @@ extern ${variable.value} ${variable.name}; #define WOLFSSL_ARMASM_NO_HW_CRYPTO #define WOLFSSL_ARMASM_NO_NEON #define WOLFSSL_ARM_ARCH 7 + /* Disable H/W offloading if accelerating S/W crypto */ + #undef NO_STM32_HASH + #define NO_STM32_HASH + #undef NO_STM32_CRYPTO + #define NO_STM32_CRYPTO #endif /* ------------------------------------------------------------------------- */