Ensure the casper and hashcrypt accelerator functions are using mutexes - #11315
AlexLanzano wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR tightens thread-safety guarantees for the NXP CASPER and HashCrypt hardware acceleration ports by ensuring they consistently serialize access to shared peripherals/state via the wolfCrypt crypto HW mutex, and by preventing builds that would silently compile out that serialization.
Changes:
- Auto-enable
WOLFSSL_CRYPT_HW_MUTEXfor NXP CASPER/HashCrypt and add a compile-time error when those ports are enabled in non-SINGLE_THREADEDbuilds with the mutex forced off. - Add crypto HW mutex initialization and lock/unlock coverage around HashCrypt SHA/AES operations.
- Add PK mutex initialization and lock/unlock coverage around CASPER RSA/ECC operations; update NXP port README to document the serialization and limitations.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| wolfssl/wolfcrypt/wc_port.h | Auto-enables crypto HW mutex for CASPER/HashCrypt and adds a compile-time guard against disabling it in threaded builds. |
| wolfcrypt/src/port/nxp/README.md | Documents HashCrypt behavior constraints and the mutex-based serialization requirement/limitations. |
| wolfcrypt/src/port/nxp/hashcrypt_port.c | Adds crypto HW mutex init + locking around HashCrypt SHA/AES operations to serialize shared engine access. |
| wolfcrypt/src/port/nxp/casper_port.c | Adds PK mutex init + locking around CASPER RSA/ECC operations to serialize shared peripheral and scratch buffers. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
Can one of the admins verify this patch? |
1b2ddb4 to
c4274e4
Compare
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
Review effort: Lite
Findings: 4
Open (5)
retis returned uninitialized on the success path (whenHASHCRYPT_SHA_Updatesucceeds).… · Newretcan be returned uninitialized: (1) whenfinish_calledis true, and (2) when… · Newretis returned uninitialized on the success path (whenHASHCRYPT_SHA_Updatesucceeds).… · Newretcan be returned uninitialized: (1) whenfinish_calledis true, and (2) when… · New The return value ofHASHCRYPT_SHA_Initis ignored here. Since other HashCrypt calls treat… · New
Resolved since last review (1)
|
retest this please |
c4274e4 to
abf53fa
Compare
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #11315
Scan targets checked: wolfcrypt-src, wolfcrypt-bugs, wolfcrypt-port-bugs, wolfssl-src, wolfssl-bugs
Coverage: 3 of 3 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: Lite
philljj
left a comment
There was a problem hiding this comment.
merge conflict in wc_port.h
abf53fa to
052973c
Compare
|
Retest this please. (test aborted from network) |



Serialize NXP CASPER and HashCrypt accelerator access
The LPC55S69 CASPER and HashCrypt ports did no locking. They also refused to build with
WOLFSSL_CRYPT_HW_MUTEX=1, which FreeRTOS builds turn on automatically.Changes
wc_casper_init()initializes that mutex.lock.
WOLFSSL_CRYPT_HW_MUTEXis enabled automatically for CASPER and HashCrypt. A threaded build that sets it to 0 now fails to compile.