Skip to content

add support for ECC_MAKE_PUB and ECC_CHECK_PUB crypto callbacks#451

Open
rizlik wants to merge 2 commits into
wolfSSL:mainfrom
rizlik:ecc_new_cbs
Open

add support for ECC_MAKE_PUB and ECC_CHECK_PUB crypto callbacks#451
rizlik wants to merge 2 commits into
wolfSSL:mainfrom
rizlik:ecc_new_cbs

Conversation

@rizlik

@rizlik rizlik commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings July 14, 2026 15:19
@rizlik rizlik self-assigned this Jul 14, 2026

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

This PR extends wolfHSM’s ECC public-key handling by adding end-to-end support (wire messages, client APIs, crypto-callback plumbing, server handlers, and tests) for two wolfCrypt callback operations: deriving a public point from a private-only ECC key (WC_PK_TYPE_EC_MAKE_PUB) and validating ECC keys (WC_PK_TYPE_EC_CHECK_PUB_KEY). It also updates server-side public export to handle resident private-only ECC keys by deriving their public half before encoding.

Changes:

  • Add new crypto wire messages + translation helpers for ECC make-public requests/responses, and extend ECC check request fields.
  • Implement client API + crypto callback routing and server request handlers for ECC make-public and check-pubkey operations.
  • Expand test coverage to exercise make-public and check-pubkey paths (including private-only and mismatch scenarios) and update feature documentation.

Reviewed changes

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

Show a summary per file
File Description
wolfhsm/wh_settings.h Adds a client-build compile-time guard against WOLFSSL_VALIDATE_ECC_IMPORT due to unsafe nested transaction/buffer reuse.
wolfhsm/wh_message_crypto.h Introduces ECC make-public request/response structs and extends ECC check request fields.
wolfhsm/wh_client_crypto.h Adds/updates public client APIs for ECC make-public and ECC pubkey validation with detailed contract docs.
src/wh_message_crypto.c Implements translation helpers for new ECC make-public messages and additional ECC check request fields.
src/wh_client_cryptocb.c Routes new wolfCrypt crypto-callback ops (EC_MAKE_PUB, EC_CHECK_PUB_KEY) to wolfHSM client APIs.
src/wh_client_crypto.c Implements request/response flows for wh_Client_EccMakePub and expanded wh_Client_EccCheckPubKey.
src/wh_server_crypto.c Adds server-side handlers for EC_MAKE_PUB and EC_CHECK_PUB_KEY and dispatches them in crypto request handling.
src/wh_server_keystore.c Uses server devId for key init in export helpers and derives ECC public half for resident private-only keys before DER export.
test/wh_test_crypto.c Adds extensive ECC make-public and check-pubkey functional tests; expands DMA public export coverage for private-only ECC keys.
test/wh_test_check_struct_padding.c Includes new ECC make-public structs in padding checks.
docs/src/5-Features.md Updates feature list to reflect ECC public key derivation and key validation support.

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

Comment thread src/wh_client_cryptocb.c
Comment on lines +407 to +413
ecc_key* key = info->pk.ecc_check_pub.key;
const uint8_t* pub_key =
(const uint8_t*)info->pk.ecc_check_pub.pubKey;
uint16_t pub_key_len = (uint16_t)info->pk.ecc_check_pub.pubKeySz;
int check_order = info->pk.ecc_check_pub.checkOrder;
int check_priv = info->pk.ecc_check_pub.checkPriv;

Comment thread src/wh_server_keystore.c
int pub_ret;

ret = wc_ecc_init_ex(key, NULL, INVALID_DEVID);
ret = wc_ecc_init_ex(key, NULL, server->devId);
Comment on lines +619 to +621
uint32_t curveId; /* wolfCrypt curve id, carried as int32:
* ECC_CURVE_INVALID (-1) for a custom curve. The curve
* travels with the key, so the server ignores this */
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.

2 participants