Skip to content

kmgmt: import the public key for any keypair selection - #513

Open
ColtonWilley wants to merge 2 commits into
wolfSSL:masterfrom
ColtonWilley:fix/ecx-import-selection
Open

ColtonWilley wants to merge 2 commits into
wolfSSL:masterfrom
ColtonWilley:fix/ecx-import-selection

Conversation

@ColtonWilley

Copy link
Copy Markdown
Contributor

OpenSSL's hybrid KEM keymgmt imports the X25519 public key with DOMAIN_PARAMETERS|PRIVATE_KEY selection, but wp_ecx_import only read PUB_KEY when the PUBLIC_KEY bit was set. With wolfProvider and the default provider both loaded, a TLS 1.3 server therefore rejected every X25519MLKEM768 key share with illegal_parameter. ECX and ML-KEM import now read the public key for any keypair selection, matching ossl_ecx_key_fromdata.

OpenSSL's hybrid KEM keymgmt imports the X25519 public key with selection
DOMAIN_PARAMETERS|PRIVATE_KEY. wp_ecx_import dropped it, so with wolfProvider
and default both loaded a TLS 1.3 server rejected X25519MLKEM768 key shares.
Read PUB_KEY whenever a keypair bit is set, as OpenSSL does; same for ML-KEM.
X25519 (test_ecx_import_pub_with_priv_selection) and ML-KEM (roundtrip test)
public key import with selection DOMAIN_PARAMETERS|PRIVATE_KEY.
Copilot AI balanced review requested due to automatic review settings October 26, 2026 17:04

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

Static review found no blocking issues in the narrow import changes and targeted regression tests; tests were not executed.

No open issues 🎉

What changed in this PR

This PR fixes wolfProvider’s public-key imports for OpenSSL hybrid KEMs, addressing TLS 1.3 X25519MLKEM768 key-share rejection when wolfProvider and the default provider are both loaded.

Changes:

  • Allow ECX and ML-KEM public-key imports when either keypair selection bit is set.
  • Add regression coverage for public-key imports using DOMAIN_PARAMETERS | PRIVATE_KEY.
File Description
test/​unit.h Declare the new X25519 regression test.
test/​unit.c Register the X25519 regression test.
test/​test_mlkem.c Extend roundtrip coverage to private-selection public-key imports.
test/​test_ecx.c Verify X25519 public-key import with private-key selection.
src/​wp_mlkem_kmgmt.c Read public-key parameters for either keypair selection bit.
src/​wp_ecx_kmgmt.c Apply the same selection handling to ECX imports.

Review effort: Balanced

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