Skip to content

Wolfhsm no keystore#798

Merged
dgarske merged 9 commits into
wolfSSL:masterfrom
bigbrett:wolfhsm-no-keystore
Jun 18, 2026
Merged

Wolfhsm no keystore#798
dgarske merged 9 commits into
wolfSSL:masterfrom
bigbrett:wolfhsm-no-keystore

Conversation

@bigbrett

@bigbrett bigbrett commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Main Change

wolfHSM client mode (and server mode with cert-chain verify) now builds without a local wolfBoot keystore. Public keys live on the HSM, referenced by key ID or resolved from a verified certificate chain. The old hybrid path that loaded keys from keystore.c and pushed them to the HSM as ephemeral keys is removed.

  • No keystore linked with wolfHSM: WOLFHSM_CLIENT=1 (or WOLFHSM_SERVER=1 with CERT_CHAIN_VERIFY=1) no longer compiles/links src/keystore.o. Defines WOLFBOOT_NO_KEYSTORE, which skips the keystore permission-mask check and pubkey-hash lookups since key authorization is enforced by the HSM.

Other changes

  • Removed WOLFBOOT_USE_WOLFHSM_PUBKEY_ID and the WOLFHSM_CLIENT_LOCAL_KEYS make option. Clients now always use HSM-resident keys. This simplifies the #ifspaghetti in src/image.c.

  • Parameterizable client ID: new WOLFHSM_CLIENT_ID make variable (default 1) replaces hardcoded IDs all of the various HALs.

  • Server mode requires cert chain: WOLFHSM_SERVER=1 without
    CERT_CHAIN_VERIFY=1 now fails the build with a clear error (was always disallowed, now just added explicit error)

  • ML-DSA wolfHSM fixes: added missing server-side ML-DSA key export and post-verify key eviction for client and server cert-chain modes.

  • Doc updates

@bigbrett bigbrett self-assigned this Jun 15, 2026
Copilot AI review requested due to automatic review settings June 15, 2026 23:12

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

Note

Copilot was unable to run its full agentic suite in this review.

This PR removes support for “local keystore public keys” in wolfHSM client mode and introduces a WOLFBOOT_NO_KEYSTORE build path to avoid compiling/linking the built-in keystore when wolfHSM is the source of trust.

Changes:

  • Make wolfHSM client builds always use HSM-resident public keys and drop WOLFBOOT_USE_WOLFHSM_PUBKEY_ID configuration.
  • Add WOLFBOOT_NO_KEYSTORE build logic and guard keystore-dependent code paths accordingly.
  • Update wolfHSM documentation to reflect the new configuration behavior.

Reviewed changes

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

File Description
src/image.c Adjusts signature verification and authenticity checks to support HSM-only keying and optional “no keystore” builds.
options.mk Forces --nolocalkeys and removes conditional WOLFBOOT_USE_WOLFHSM_PUBKEY_ID behavior for wolfHSM client builds.
docs/wolfHSM.md Removes WOLFBOOT_USE_WOLFHSM_PUBKEY_ID docs and clarifies key sourcing in client mode.
Makefile Adds WOLFHSM_NO_KEYSTORE logic and defines WOLFBOOT_NO_KEYSTORE to omit keystore linkage when applicable.
Comments suppressed due to low confidence (1)

src/image.c:1

  • When WOLFBOOT_NO_KEYSTORE is defined, the per-partition key authorization check is entirely bypassed. If the HSM policy is guaranteed to enforce equivalent constraints, that should be made explicit in code via a compile-time constraint (e.g., require WOLFBOOT_CERT_CHAIN_VERIFY and/or a specific HSM policy flag when WOLFBOOT_NO_KEYSTORE is set). Otherwise, consider introducing an HSM-backed partition/key-usage check so you don’t lose this authorization control in no-keystore builds.
/* image.c

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/image.c
Comment thread src/image.c
Comment thread src/image.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 #798

Scan targets checked: wolfboot-bugs, wolfboot-src

Findings: 1
1 finding(s) posted as inline comments (see file-level comments below)

This review was generated automatically by Fenrir. Findings are non-blocking.

Comment thread src/image.c
@bigbrett bigbrett force-pushed the wolfhsm-no-keystore branch from 5766936 to 9582aee Compare June 17, 2026 04:03
Comment thread src/image.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 #798

Scan targets checked: wolfboot-bugs, wolfboot-src

Findings: 1
1 finding(s) posted as inline comments (see file-level comments below)

This review was generated automatically by Fenrir. Findings are non-blocking.

Comment thread src/image.c
Comment thread src/image.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 #798

Scan targets checked: wolfboot-bugs, wolfboot-src

Findings: 2
2 finding(s) posted as inline comments (see file-level comments below)

This review was generated automatically by Fenrir. Findings are non-blocking.

Comment thread src/image.c
Comment thread src/image.c
@bigbrett bigbrett force-pushed the wolfhsm-no-keystore branch from a4435a2 to 11394b3 Compare June 17, 2026 20:38
@bigbrett bigbrett marked this pull request as ready for review June 17, 2026 21:32
@bigbrett bigbrett assigned dgarske and unassigned bigbrett Jun 17, 2026
@bigbrett bigbrett requested a review from dgarske June 17, 2026 21:39

@dgarske dgarske left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Skoll Code Review

Scan type: reviewOverall recommendation: COMMENT
Findings: 4 total — 4 posted, 0 skipped
2 finding(s) posted as inline comments (see file-level comments below)

Posted findings

  • [Low] Removed make option WOLFHSM_CLIENT_LOCAL_KEYS left dangling; new WOLFHSM_CLIENT_ID not registeredtools/config.mk:95,137 (and config/examples/sim-wolfHSM-client-ecc.config:28, sim-wolfHSM-client-mldsa.config:49)
  • [Low] Potential hybrid-signing build break in wolfHSM no-keystore modesrc/image.c:2455-2459
  • [Info] $(error) continuation line embeds leading whitespace into the messageoptions.mk:1423-1426
  • [Info] WOLFHSM_SERVER misconfiguration $(error) also aborts clean targetsoptions.mk:1420-1426

Review generated by Skoll

Comment thread options.mk
Comment thread options.mk

@dgarske dgarske left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@bigbrett

bigbrett commented Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

@dgarske

[Low] Potential hybrid-signing build break in wolfHSM no-keystore mode — src/image.c:2455-2459

wolfHSM was not intended to be useable with hybrid signatures, since that would require a secondary public key ID to be registered for all woflHSM HALs. It is definitely something we can do and support, but was not within the scope of this PR.

[Low] Removed make option WOLFHSM_CLIENT_LOCAL_KEYS left dangling; new WOLFHSM_CLIENT_ID not registered — tools/config.mk:95,137 (and config/examples/sim-wolfHSM-client-ecc.config:28, sim-wolfHSM-client-mldsa.config:49)

This is the one thing my local skolling didn't seem to find (though innocuous). Fixed in my latest commit. I will re-request review when CI clears.

Also pushed an unrelated commit as I forgot to rename the Makefile variable to match the macro name

@bigbrett bigbrett requested a review from dgarske June 18, 2026 02:22
@dgarske dgarske merged commit 7a76369 into wolfSSL:master Jun 18, 2026
385 checks passed
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