Repository navigation
Conversation
There was a problem hiding this comment.
🔵 Needs a closer look
New STM32 GCM hardware paths lack on-device testing, and unavailable CMSIS/HAL dependencies leave register semantics and authentication results requiring maintainer validation.
No open issues 🎉
What changed in this PR
This PR improves wolfCrypt’s STM32 hardware acceleration by enabling supported AES-GCM and SHA-2 paths and avoiding hardware paths on parts without the required capabilities.
Changes:
- Adds STM32C5 and SAES register aliases and expands CubeMX GCM support.
- Refines peripheral and algorithm detection, retaining software fallbacks where hardware support is absent.
- Defers the CubeMX GCM-decrypt authentication-block encryption until after HAL processing to prevent premature AES clock shutdown.
| File | Description |
|---|---|
wolfssl/wolfcrypt/settings.h |
Disables hardware AES, hashing, and PKA on parts lacking the corresponding peripherals. |
wolfssl/wolfcrypt/port/st/stm32.h |
Adds register aliases and corrects hash capabilities, GCM detection, and HAL selection. |
wolfcrypt/src/port/st/stm32.c |
Guards SHA-2 HMAC support and enables GCM fallback for unsupported CRYP variants. |
wolfcrypt/src/aes.c |
Reorders GCM-decrypt tag computation and preserves errors before tag verification. |
Review effort: Balanced
|
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #12144
Scan targets checked: wolfcrypt-src, wolfcrypt-bugs, wolfcrypt-port-bugs, wolfssl-src, wolfssl-bugs
Coverage: 4 of 4 in-scope changed file(s) opened by the reviewer
Fenrir result: Approved ✅
No new issues found in the changed files.
Advisory only — this automated result does not count as a GitHub approval.
Review tier: Max
111aa1f to
5dec225
Compare
Description
Several STM32 parts name CMSIS registers differently from what the port tests, so hardware paths were silently skipped or wrongly enabled.
CPHASEtoGCMPHandHASH_DIGESTtoHASHso HW GCM and SHA-2 are used; SHA-384/512 on parts withHASH_CR_ALGO_3.GCMPH/NPBLBaliases for HW GCM, and make the SAES aliases visible to CubeMX builds (H7S CubeMX did not compile).STM32_HW_CLOCK_AUTO, failing non-96-bit IVs.settings.h: dropSTM32_CRYPTO/STM32_HASH/WOLFSSL_STM32_PKAon C5/H5/U5/F7 parts without the peripheral.Testing
wolfcrypt_testpasses bare and CubeMX on NUCLEO-C5A3ZG, F439ZI, F767ZI, U385RG-Q, U545RE-Q, WL55JC and B-U585I-IOT02A, and bare on H563ZI and H7S3L8; on H7S3L8 CubeMX the AES tests pass. Other affected families are build-checked against the base; N6, V8, F415, H503, F2, WB, WBA and G4 with AES are not tested on hardware.