Skip to content

Commit 4264147

Browse files
committed
STM32 BARE: cleanup pass -- diag docs and dead-code removal
- Document the WC_STM32_PKA_DIAG and WC_STM32_SAES_DIAG opt-in debug gates near the top of the BARE block in stm32.c. Both go through the board's board_putc retarget and stay off by default; useful for diagnosing PKA init / op timeout / OUT_ERROR and AES/SAES CCF poll timeout when bringing up a new board. - Remove the WOLFSSL_STM32_DHUK_FORCE_SAES_S diagnostic gate. It was added to test whether the DHUK NS-decrypt hang was caused by the SAES <-> SAES_NS alias choice on TZEN=0 silicon. The test returned a negative result -- the alias is not the gating factor -- so the gate has no remaining use. The hand-off in /tmp/stm32-dhuk-tz-harness-2026-05-19.md captures the conclusion and the next-step TZ path. - Drop the orphan WOLFSSL_STM32_DHUK_FORCE_SAES_S entry from .wolfssl_known_macro_extras and re-verify LC_ALL=C lex order.
1 parent 5d84615 commit 4264147

2 files changed

Lines changed: 10 additions & 9 deletions

File tree

.wolfssl_known_macro_extras

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -967,7 +967,6 @@ WOLFSSL_STM32C5
967967
WOLFSSL_STM32F3
968968
WOLFSSL_STM32F427_RNG
969969
WOLFSSL_STM32U0
970-
WOLFSSL_STM32_DHUK_FORCE_SAES_S
971970
WOLFSSL_STM32_DHUK_UNWRAP
972971
WOLFSSL_STRONGEST_HASH_SIG
973972
WOLFSSL_STSAFE_TAKES_SLOT

wolfcrypt/src/port/st/stm32.c

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,16 @@
5151
* PKA_HandleTypeDef and the PKA_ECC / PKA_ECDSA IO typedefs are
5252
* provided by <wolfssl/wolfcrypt/port/st/stm32.h> above. The HAL_PKA_*
5353
* entry points are implemented further down in this file under the
54-
* matching guard. */
54+
* matching guard.
55+
*
56+
* BARE debug switches (off by default, opt-in at -D):
57+
* WC_STM32_PKA_DIAG -- printf on PKA init / op timeout / OUT_ERROR.
58+
* Useful when bringing up a new PKA-capable
59+
* board or diagnosing curve-load failures.
60+
* WC_STM32_SAES_DIAG -- printf on AES/SAES CCF poll timeout.
61+
* DEBUG_STM32_BARE_GCM is treated as a synonym.
62+
* Neither emits any code unless -D is set; both go through the board's
63+
* board_putc retarget so they appear on the same UART as test output. */
5564
#else
5665
#if defined(WOLFSSL_STM32L5)
5766
#include <stm32l5xx_hal_conf.h>
@@ -2276,13 +2285,6 @@ int wc_Stm32_Aes_Gcm(struct Aes* aes, byte* out, const byte* in, word32 sz,
22762285
CMSIS device header"
22772286
#endif
22782287

2279-
/* Diagnostic: force SAES = SAES_S alias (secure). CMSIS binds SAES
2280-
* to SAES_NS on non-CMSE builds; use this gate to test the S alias. */
2281-
#if defined(WOLFSSL_STM32_DHUK_FORCE_SAES_S) && defined(SAES_S)
2282-
#undef SAES
2283-
#define SAES SAES_S
2284-
#endif
2285-
22862288
#ifndef STM32_BARE_SAES_TIMEOUT
22872289
#define STM32_BARE_SAES_TIMEOUT 0x10000
22882290
#endif

0 commit comments

Comments
 (0)