Skip to content

Commit abe15d2

Browse files
authored
Merge pull request #10487 from embhorn/zd21842
Add check for ARM to set WOLFSS_USE_ALIGN
2 parents b1e0446 + 40de657 commit abe15d2

3 files changed

Lines changed: 19 additions & 0 deletions

File tree

.wolfssl_known_macro_extras

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1012,6 +1012,7 @@ __ARCH_STRNCPY_NO_REDIRECT
10121012
__ARCH_STRSTR_NO_REDIRECT
10131013
__ARM_ARCH_7M__
10141014
__ARM_FEATURE_CRYPTO
1015+
__ARM_FEATURE_UNALIGNED
10151016
__ASSEMBLER__
10161017
__ATOMIC_CONSUME
10171018
__ATOMIC_RELAXED

src/ssl.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7536,6 +7536,11 @@ int wolfDTLS_accept_stateless(WOLFSSL* ssl)
75367536
return ret;
75377537
}
75387538

7539+
/* WC_NO_INLINE: wolfDTLS_accept_stateless passes the address of a stack-local
7540+
* context here; the restore call before return clears it again. Preventing
7541+
* inlining hides that cross-frame assignment from GCC's -Wdangling-pointer
7542+
* analysis, which otherwise flags a false positive on GCC 14+. */
7543+
WC_NO_INLINE
75397544
int wolfDTLS_SetChGoodCb(WOLFSSL* ssl, ClientHelloGoodCb cb, void* user_ctx)
75407545
{
75417546
WOLFSSL_ENTER("wolfDTLS_SetChGoodCb");

wolfssl/wolfcrypt/types.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1726,6 +1726,19 @@ WOLFSSL_API word32 CheckRunTimeSettings(void);
17261726
#endif /* WOLFSSL_AESNI || WOLFSSL_ARMASM || USE_INTEL_SPEEDUP || \
17271727
* WOLFSSL_AFALG_XILINX */
17281728

1729+
/* ARM C-only builds: if the toolchain reports that the target does NOT
1730+
* support unaligned access, force the alignment-safe code paths. This
1731+
* catches Cortex-M (ARMv6-M, and ARMv7-M/v8-M built with
1732+
* -mno-unaligned-access) without penalizing unaligned-capable cores
1733+
* such as Cortex-A and AArch64. __ARM_FEATURE_UNALIGNED is defined by
1734+
* GCC, Clang and armclang per the ARM ACLE when unaligned access is
1735+
* available. */
1736+
#if defined(__arm__) && !defined(__ARM_FEATURE_UNALIGNED)
1737+
#ifndef WOLFSSL_USE_ALIGN
1738+
#define WOLFSSL_USE_ALIGN
1739+
#endif
1740+
#endif
1741+
17291742
/* Helpers for memory alignment */
17301743
#ifndef XALIGNED
17311744
#if defined(__GNUC__) || defined(__llvm__) || \

0 commit comments

Comments
 (0)