From 7df2ead36d60ef7e8a7b0836106d14976a8773a0 Mon Sep 17 00:00:00 2001 From: Eric Blankenhorn Date: Thu, 14 May 2026 11:50:19 -0500 Subject: [PATCH 1/3] Add check for ARM to set WOLFSS_USE_ALIGN --- wolfssl/wolfcrypt/types.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/wolfssl/wolfcrypt/types.h b/wolfssl/wolfcrypt/types.h index da5a680dbc..c57fc5ad93 100644 --- a/wolfssl/wolfcrypt/types.h +++ b/wolfssl/wolfcrypt/types.h @@ -1706,6 +1706,19 @@ WOLFSSL_API word32 CheckRunTimeSettings(void); #endif /* WOLFSSL_AESNI || WOLFSSL_ARMASM || USE_INTEL_SPEEDUP || \ * WOLFSSL_AFALG_XILINX */ +/* ARM C-only builds: if the toolchain reports that the target does NOT + * support unaligned access, force the alignment-safe code paths. This + * catches Cortex-M (ARMv6-M, and ARMv7-M/v8-M built with + * -mno-unaligned-access) without penalizing unaligned-capable cores + * such as Cortex-A and AArch64. __ARM_FEATURE_UNALIGNED is defined by + * GCC, Clang and armclang per the ARM ACLE when unaligned access is + * available. */ +#if defined(__arm__) && !defined(__ARM_FEATURE_UNALIGNED) + #ifndef WOLFSSL_USE_ALIGN + #define WOLFSSL_USE_ALIGN + #endif +#endif + /* Helpers for memory alignment */ #ifndef XALIGNED #if defined(__GNUC__) || defined(__llvm__) || \ From 47db354fad52dc3b93b69e9414d927e4972112dd Mon Sep 17 00:00:00 2001 From: Eric Blankenhorn Date: Thu, 14 May 2026 12:55:35 -0500 Subject: [PATCH 2/3] Fix from review --- .wolfssl_known_macro_extras | 1 + 1 file changed, 1 insertion(+) diff --git a/.wolfssl_known_macro_extras b/.wolfssl_known_macro_extras index 3d9ac68c8e..9b41842083 100644 --- a/.wolfssl_known_macro_extras +++ b/.wolfssl_known_macro_extras @@ -1012,6 +1012,7 @@ __ARCH_STRNCPY_NO_REDIRECT __ARCH_STRSTR_NO_REDIRECT __ARM_ARCH_7M__ __ARM_FEATURE_CRYPTO +__ARM_FEATURE_UNALIGNED __ASSEMBLER__ __ATOMIC_CONSUME __ATOMIC_RELAXED From 40de65785cd64632f31b9263e21a91ea498656b7 Mon Sep 17 00:00:00 2001 From: Eric Blankenhorn Date: Wed, 13 May 2026 16:17:07 -0500 Subject: [PATCH 3/3] Address warning in wolfDTLS_SetChGoodCb --- src/ssl.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/ssl.c b/src/ssl.c index 1bf913b18f..7d3812d5f3 100644 --- a/src/ssl.c +++ b/src/ssl.c @@ -7536,6 +7536,11 @@ int wolfDTLS_accept_stateless(WOLFSSL* ssl) return ret; } +/* WC_NO_INLINE: wolfDTLS_accept_stateless passes the address of a stack-local + * context here; the restore call before return clears it again. Preventing + * inlining hides that cross-frame assignment from GCC's -Wdangling-pointer + * analysis, which otherwise flags a false positive on GCC 14+. */ +WC_NO_INLINE int wolfDTLS_SetChGoodCb(WOLFSSL* ssl, ClientHelloGoodCb cb, void* user_ctx) { WOLFSSL_ENTER("wolfDTLS_SetChGoodCb");