-
Notifications
You must be signed in to change notification settings - Fork 25
Change wrap object size argument to be in/out instead of in #241
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
Conversation
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 implements issue #196 by changing wrap/unwrap function size arguments from input-only to input/output parameters. This allows callers to provide a buffer size and receive back the actual size of the wrapped/unwrapped object, which may be smaller than the buffer.
Key changes:
- Function signatures updated to use pointer parameters for size arguments (e.g.,
uint16_t wrappedKeySz→uint16_t* wrappedKeySz) - Constants renamed from
WOLFHSM_KEYWRAP_*toWH_KEYWRAP_*prefix for consistency - New
WH_KEYWRAP_AES_GCM_HEADER_SIZEconstant added to simplify size calculations
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| wolfhsm/wh_common.h | Renamed constants to use WH_ prefix and added new header size constant |
| wolfhsm/wh_client.h | Updated function signatures and documentation for in/out size parameters |
| src/wh_client_keywrap.c | Implemented pointer-based size handling with buffer overflow checks and actual size returns |
| src/wh_server_keystore.c | Updated to use renamed constants and improved validation logic for wrapped key metadata |
| test/wh_test_multiclient.c | Updated test calls to pass size variables by reference |
| test/wh_test_keywrap.c | Updated test code to use new API signatures and renamed constants |
| test/wh_test_crypto.c | Updated usage policy test to pass size by reference |
| examples/demo/client/wh_demo_client_keywrap.c | Updated demo to use new pointer-based size parameters |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@AlexLanzano also need to fix CI |
a633525 to
c97e7be
Compare
Implements #196