Skip to content

Introduce ECC Make PUB and ECC Check Pub crypto callbacks#10663

Open
rizlik wants to merge 4 commits into
wolfSSL:masterfrom
rizlik:pubkey_ecc_operation_cb
Open

Introduce ECC Make PUB and ECC Check Pub crypto callbacks#10663
rizlik wants to merge 4 commits into
wolfSSL:masterfrom
rizlik:pubkey_ecc_operation_cb

Conversation

@rizlik

@rizlik rizlik commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Description

This branch adds two new ECC crypto-callback operations: WC_PK_TYPE_EC_MAKE_PUB offloads Q = d·G for wc_ecc_make_pub, and WC_PK_TYPE_EC_CHECK_PUB_KEY offloads wc_ecc_check_key and the keygen/import validation paths.

Under WOLF_CRYPTO_CB_ONLY_ECC, HAVE_ECC_MAKE_PUB is now enabled and validation fails closed (NO_VALID_DEVID) rather than silently succeeding when no device services the op.

rizlik added 4 commits June 11, 2026 15:02
Move the software private-scalar range checkout of ecc_make_pub_ex into
a dedicated helper. Pure code motion, no functional change.
…fload

Under WOLF_CRYPTO_CB_ONLY_ECC, HAVE_ECC_MAKE_PUB is now enabled and
backed by the dispatch alone, failing closed with NO_VALID_DEVID when
no device handles the operation (previously NOT_COMPILED_IN).
Add a crypto-callback operation for validating an ECC key.

Under WOLF_CRYPTO_CB_ONLY_ECC validation now fails closed with
NO_VALID_DEVID when no device handles the operation; previously such
keys were accepted unvalidated. This is a deliberate compatibility
break, documented at the dispatch site.
Copilot AI review requested due to automatic review settings June 11, 2026 14:10
@rizlik rizlik self-assigned this Jun 11, 2026
@rizlik rizlik marked this pull request as ready for review June 11, 2026 14:10
@github-actions

Copy link
Copy Markdown

retest this please

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 wolfCrypt’s CryptoCb (crypto callback) interface with two new ECC public-key–related callback operations to offload (1) base-point multiplication used by wc_ecc_make_pub(_ex) and internal callers, and (2) ECC public key validation used by wc_ecc_check_key and keygen/import validation paths. It also adjusts CB-only ECC builds to fail closed when validation/make-pub aren’t handled by a device, and adds test coverage plus swdev support for the new operations.

Changes:

  • Add new PK callback opcodes WC_PK_TYPE_EC_MAKE_PUB and WC_PK_TYPE_EC_CHECK_PUB_KEY, plus new wc_CryptoInfo payloads and wrapper APIs.
  • Route ECC make-pub and public-key validation through CryptoCb device-first paths (with CB-only ECC failing closed when unhandled).
  • Extend wolfcrypt tests and swdev to exercise/implement the new callback operations, including negative tests for malformed device results.

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
wolfssl/wolfcrypt/types.h Adds two new PK operation enum values for ECC make-pub and public-key validation.
wolfssl/wolfcrypt/cryptocb.h Extends wc_CryptoInfo with ECC make-pub/check-pub payloads and declares new CryptoCb wrapper APIs.
wolfcrypt/src/cryptocb.c Implements wc_CryptoCb_EccMakePub() and wc_CryptoCb_EccCheckPubKey() wrappers and adds string names for the new PK types.
wolfcrypt/src/ecc.c Adds device-first dispatch for make-pub and public-key validation; introduces fail-closed behavior under WOLF_CRYPTO_CB_ONLY_ECC.
wolfcrypt/test/test.c Adds callback device logic and regression/negative tests for make-pub and check-pubkey callback behavior.
tests/swdev/swdev.c Adds swdev handlers and dispatcher cases for the new ECC callback operations.
doc/dox_comments/header_files/cryptocb.h Documents the new CryptoCb ECC make-pub and check-pubkey wrapper APIs.

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

Comment thread wolfssl/wolfcrypt/cryptocb.h
Comment thread doc/dox_comments/header_files/cryptocb.h
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