Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for using cached keys as input key material for HKDF operations, allowing keys already stored in the HSM to be used directly without passing key data from the client. This extends HKDF functionality by distinguishing between input key IDs (keyIdIn) and output key IDs (keyIdOut).
- Introduces keyIdIn parameter to specify cached input key material
- Updates HKDF request/response structures to separate input and output key IDs
- Adds server-side logic to retrieve and use cached keys for HKDF operations
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| wolfhsm/wh_message_crypto.h | Splits keyId field into keyIdIn and keyIdOut in HKDF request/response structures |
| wolfhsm/wh_client_crypto.h | Updates function signatures to include keyIdIn parameter with documentation |
| src/wh_message_crypto.c | Updates serialization to handle separate keyIdIn and keyIdOut fields |
| src/wh_server_crypto.c | Implements cached key retrieval logic for HKDF input key material |
| src/wh_client_crypto.c | Updates client API implementation to pass keyIdIn parameter |
| src/wh_client_cryptocb.c | Updates crypto callback to use WH_KEYID_ERASED for keyIdIn parameter |
| test/wh_test_crypto.c | Adds test case verifying cached input key functionality |
| examples/demo/client/wh_demo_client_crypto.h | Adds function declaration for new demo |
| examples/demo/client/wh_demo_client_crypto.c | Implements demo showing cached input key usage |
| examples/demo/client/wh_demo_client_all.c | Integrates new demo into demo suite |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
billphipps
reviewed
Oct 16, 2025
Contributor
billphipps
left a comment
There was a problem hiding this comment.
Looks good! Consider freshen key instead of read key API.
billphipps
approved these changes
Oct 16, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds (requested) feature to use cached key as input to HKDF. Follow up to #204
Also makes some unrelated keycache input pointers const-correct