Skip to content

Conversation

@AlexLanzano
Copy link
Contributor

Implements #196

Copy link
Contributor

Copilot AI left a 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 wrappedKeySzuint16_t* wrappedKeySz)
  • Constants renamed from WOLFHSM_KEYWRAP_* to WH_KEYWRAP_* prefix for consistency
  • New WH_KEYWRAP_AES_GCM_HEADER_SIZE constant 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.

@bigbrett
Copy link
Contributor

@AlexLanzano also need to fix CI

@AlexLanzano AlexLanzano force-pushed the keywrap-argument-change branch from a633525 to c97e7be Compare November 14, 2025 20:59
@AlexLanzano AlexLanzano requested a review from bigbrett November 14, 2025 21:04
@bigbrett bigbrett merged commit 0851501 into wolfSSL:main Nov 14, 2025
21 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.

3 participants