Skip to content

Global SHE keys - #478

Open
bigbrett wants to merge 1 commit into
wolfSSL:mainfrom
bigbrett:she-global
Open

Global SHE keys#478
bigbrett wants to merge 1 commit into
wolfSSL:mainfrom
bigbrett:she-global

Conversation

@bigbrett

@bigbrett bigbrett commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Adds support for global SHE keys. When compiled with WOLFHSM_CFG_SHE_GLOBAL_KEYS, the SHE key ID space is global and keys are shared across clients.

Other fixes:

  • change whnvmtool to fail-fast when an image generation error occurs
  • Enhance whnvmtool test coverage
  • Small code hygene fixes

Copilot AI review requested due to automatic review settings July 22, 2026 16:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_KEYS and route SHE slot key IDs through the global namespace when enabled.
  • Extend whnvmtool config format to support she ... 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.

Comment thread tools/whnvmtool/whnvmtool.c
Comment thread tools/whnvmtool/README.md Outdated

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fenrir Automated Review — PR #478

⚠️ An internal error occurred during the automated review. This error has been logged. Please contact the Fenrir team if you need assistance.

Error: UnicodeDecodeError

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fenrir Automated Review — PR #478

⚠️ An internal error occurred during the automated review. This error has been logged. Please contact the Fenrir team if you need assistance.

Error: UnicodeDecodeError

@bigbrett
bigbrett force-pushed the she-global branch 2 times, most recently from 8afec1b to 995fc9b Compare July 22, 2026 23:20

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fenrir Automated Review — PR #478

Scan targets checked: wolfhsm-core-bugs, wolfhsm-crypto-bugs, wolfhsm-src

No new issues found in the changed files. ✅

@bigbrett
bigbrett force-pushed the she-global branch 2 times, most recently from df1d9df to a39ca43 Compare July 23, 2026 20:38
Comment thread wolfhsm/wh_she_common.h Outdated
Comment thread tools/whnvmtool/test/data/she2.bin
Comment thread src/wh_server_keystore.c Outdated
Comment thread src/wh_server_keystore.c Outdated
Comment thread src/wh_server_keystore.c Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 29 out of 30 changed files in this pull request and generated 3 comments.

Comment thread test/wh_test_multiclient.c
Comment thread test-refactor/misc/wh_test_multiclient.c
Comment thread tools/whnvmtool/whnvmtool.c

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fenrir Automated Review — PR #478

Scan targets checked: wolfhsm-core-bugs, wolfhsm-crypto-bugs, wolfhsm-src

No new issues found in the changed files. ✅

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fenrir Automated Review — PR #478

Scan targets checked: wolfhsm-core-bugs, wolfhsm-crypto-bugs, wolfhsm-src

No new issues found in the changed files. ✅

@bigbrett
bigbrett requested a review from AlexLanzano July 27, 2026 18:33
@bigbrett
bigbrett marked this pull request as ready for review July 27, 2026 18:33
- change whnvmtool to fail-fast when an image generation error occurs
- Enhance whnvmtool test coverage
- Small code hygene fixes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants