Global SHE keys#478
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a build-time option to place all AUTOSAR SHE key slots in the global-keys namespace so all clients share a single SHE device view, and updates keystore/keywrap behavior plus tests and documentation accordingly. It also hardens whnvmtool by adding SHE entry support, stricter bounds checking, fail-fast behavior, and expanded negative test coverage.
Changes:
- Add
WOLFHSM_CFG_SHE_GLOBAL_KEYSand route SHE slot key IDs through the global namespace when enabled. - Extend
whnvmtoolconfig format to supportshe ...entries, add fail-fast behavior, and add negative tests. - Add/extend multiclient + interop tests and update docs/CI workflows to cover the new configuration.
Reviewed changes
Copilot reviewed 28 out of 29 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| wolfhsm/wh_she_common.h | Introduces WH_SHE_MAKE_KEYID() / global-user selection for SHE slot key IDs. |
| wolfhsm/wh_settings.h | Documents and enforces compile-time dependencies for WOLFHSM_CFG_SHE_GLOBAL_KEYS. |
| wolfhsm/wh_client_she.h | Updates API docstring to reflect optional global SHE slot namespace. |
| tools/whnvmtool/whnvmtool.c | Adds she entries, stronger parse-time bounds, and fail-fast entry processing. |
| tools/whnvmtool/test/test_invalid_input.sh | Adds negative test script ensuring invalid configs/files fail with nonzero exit. |
| tools/whnvmtool/test/nvminit/test.nvminit | Updates test init config with a global key and example SHE entries. |
| tools/whnvmtool/test/data/she2.bin | Adds binary test fixture data for SHE provisioning tests. |
| tools/whnvmtool/README.md | Documents new bounds, global namespace semantics, and she entry format. |
| tools/whnvmtool/Makefile | Runs new negative tests as part of the test target. |
| tools/whnvmtool/.gitignore | Ensures test binary fixtures under test/data/*.bin are not ignored. |
| test/wh_test_she.c | Updates SHE key ID construction and adds global/per-client blob interop assertions. |
| test/wh_test_she_no_nvm.c | Updates SHE key ID construction to use WH_SHE_MAKE_KEYID(). |
| test/wh_test_multiclient.c | Adds a global-SHE multiclient test suite and wires in server SHE contexts. |
| test/Makefile | Adds SHE_GLOBAL build option for tests. |
| test-refactor/server/wh_test_she_server.c | Updates SHE key ID construction to use WH_SHE_MAKE_KEYID(). |
| test-refactor/server/wh_test_nvm_optional.c | Updates SHE key ID construction to use WH_SHE_MAKE_KEYID(). |
| test-refactor/posix/Makefile | Adds SHE_GLOBAL build option for refactor posix tests. |
| test-refactor/misc/wh_test_she_no_nvm.c | Updates SHE key ID construction to use WH_SHE_MAKE_KEYID(). |
| test-refactor/misc/wh_test_she_keywrap.c | Adds global/per-client blob interop assertions and updates key ID construction. |
| test-refactor/misc/wh_test_multiclient.c | Adds a global-SHE multiclient test suite and wires in server SHE contexts. |
| test-refactor/client-server/wh_test_she.c | Updates SHE key ID construction to use WH_SHE_MAKE_KEYID(). |
| src/wh_server_she.c | Routes SHE slot lookups through WH_SHE_MAKE_KEYID() so slot IDs resolve correctly under global mode. |
| src/wh_server_keystore.c | Normalizes wrap-export and unwrap-and-cache behavior for global SHE slot IDs (and rejects global-id blobs in per-client mode). |
| src/wh_client_she.c | Updates provisioning to use WH_SHE_MAKE_KEYID() for correct slot ID resolution. |
| docs/src/9-Configuration.md | Documents WOLFHSM_CFG_SHE_GLOBAL_KEYS in the configuration reference. |
| docs/src/5-Features.md | Adds “Global SHE Keys” feature documentation and updates SHE/global-keys discussion. |
| .github/workflows/build-and-test.yml | Adds CI jobs to build/test with SHE_GLOBAL=1. |
| .github/workflows/build-and-test-refactor.yml | Adds CI jobs to build/test refactor suite with SHE_GLOBAL=1. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #478
Error: UnicodeDecodeError
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #478
Error: UnicodeDecodeError
- change whnvmtool to fail-fast when an image generation error occurs - Enhance whnvmtool test coverage - Small code hygene fixes
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #478
Scan targets checked: wolfhsm-core-bugs, wolfhsm-crypto-bugs, wolfhsm-src
No new issues found in the changed files. ✅
Adds support for global SHE keys
Other fixes: