-
Notifications
You must be signed in to change notification settings - Fork 26
server keystore/cert fixes and a fix for test breakage due to upstream wolfCrypt #123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
server keystore/cert fixes and a fix for test breakage due to upstream wolfCrypt #123
Conversation
- pull keyId mapping logic out of wh_Server_CertVerify
There was a problem hiding this comment.
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 addresses issues in key caching and certificate verification by refactoring the keystore and cert verification functions to work with raw (server) key IDs, preventing duplicate key caching across caches, and adding relevant test coverage.
- Refactor wh_Server_CertVerify to use an in/out keyId parameter
- Add cross-cache duplicate detection logic in the keystore functions
- Enhance test cases for duplicate key caching scenarios
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| wolfhsm/wh_server_cert.h | Update function signature and documentation for in/out keyId parameter |
| wolfhsm/wh_message_cert.h | Add keyId field to the verify DMA request structure |
| wolfhsm/wh_error.h | Introduce duplicate key error code |
| test/wh_test_crypto.c | Add and update tests for cross-cache duplicate detection |
| src/wh_server_keystore.c | Add duplicate detection logic in cache functions |
| src/wh_server_cert.c | Adjust certificate verification logic to correctly propagate keyId |
| src/wh_message_cert.c | Translate the new keyId field in the verify DMA request structure |
Comments suppressed due to low confidence (1)
wolfhsm/wh_server_cert.h:90
- Update the function documentation for wh_Server_CertVerify to clearly state that inout_keyId acts as both an input (if already assigned) and as an output (for the generated keyId) when caching the leaf public key.
whCertFlags flags, whKeyId* inout_keyId);
c3b81c1 to
b8ec62a
Compare
…IX testing and prevents RNG seed selection in latest upstream wolfCrypt use cert buffers for wolfCrypt tests now that NO_FILESYSTEM is removed
82376e6 to
866ae84
Compare
billphipps
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Can you consider my comments about duplicate? I'm good either way.
wh_Server_CertVerifyto operate on raw (server) keyIds so it can be used outside a client message handler. Relocates the client keyId mapping on input/output to the message dispatch function better aligning with the rest of the code.Also unrelated fix: wolfCrypt upstream changed default RNG seed generation causing our wolfCrypt tests to break. I removed NO_FILESYSTEM from the POSIX tests so it can use
/dev/randomfor seeding. I added in the use of the cert buffers macro as otherwise filesystem support requires you to run wolfCrypt tests from the wolfCrypt root directory which we don't want.