fenrir fixes - #518
Conversation
Fixes fenrir 11419
Fixes fenrir: 10226
Fixes fenrir: 11394
Fixes fenrir: 11393
Fixes fenrir: 10219
Fixes fenrir: 11410
There was a problem hiding this comment.
Pull request overview
This PR tightens and documents SHE key-update authorization behavior, improves keystore/NVM consistency, and hardens several client/server crypto edge cases while expanding test coverage for the updated rules.
Changes:
- Enforce AUTOSAR SHE Table 4.5 key-update authorization matrix server-side and add tests validating allowed/denied pairings.
- Improve key/seed consistency by evicting stale cached entries after persisting updates and by persisting revocations before mutating cache state.
- Harden client crypto helpers (SHA state rollback on error; ML-DSA public export buffer sizing) and document the SHE authorization policy.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| test/wh_test_she.c | Adds SHE LOAD_KEY authorization-matrix test coverage (reject/allow cases). |
| test-refactor/client-server/wh_test_she.c | Mirrors authorization-matrix tests and fixes an oversized-auth test to align with new policy checks. |
| src/wh_server.c | Wires optional DMA custom client-copy callback from config into server DMA context. |
| src/wh_server_she.c | Adds explicit LOAD_KEY authorization-matrix enforcement; evicts cached PRNG seed after updates. |
| src/wh_server_keystore.c | Reorders key revocation to persist to NVM before mutating cache/commit state. |
| src/wh_client_crypto.c | Restores SHA state on client-side errors for software fallback; increases ML-DSA export public buffer size. |
| docs/src/5-Features.md | Documents SHE memory update authorization policy and wolfHSM’s SECRET_KEY authorization extension. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #518
Scan targets checked: wolfhsm-core-bugs, wolfhsm-crypto-bugs, wolfhsm-src
Findings: 1
1 finding(s) posted as inline comments (see file-level comments below)
This review was generated automatically by Fenrir. Reported findings require changes before merge.
| rc = server->dma.memCopyCb(server, (uintptr_t)transformedAddr, | ||
| (uintptr_t)serverPtr, len, | ||
| WH_DMA_COPY_OPER_CLIENT_WRITE, flags); |
There was a problem hiding this comment.
@rizlik I think your port is the only one that uses these - can you ensure this is the correct fix? It should be since memcpying from the untransformed client address definitely seemed wrong, but want to make sure I don't break your port
LOAD_KEYaccepted any slot as the authorizing key (e.g. a client-loaded RAM key could overwriteMASTER_ECU_KEY). Changed to now enforce the AUTOSAR SHE update-authorization matrix (Table 4.5), documented indocs/src/5-Features.md.wh_Server_Initdropped the DMAmemCopyCbsupplied throughwhServerConfig. Fixed, it is now installed (underWOLFHSM_CFG_DMA_CUSTOM_CLIENT_COPY)._ExtendSeedre-read a stale seed. Fixed so the cache entry is now evicted after the NVM write.