Skip to content

Add PKCS#11 provider support for ML-KEM#663

Open
olszomal wants to merge 3 commits into
OpenSC:masterfrom
olszomal:asym_kem
Open

Add PKCS#11 provider support for ML-KEM#663
olszomal wants to merge 3 commits into
OpenSC:masterfrom
olszomal:asym_kem

Conversation

@olszomal

Copy link
Copy Markdown
Collaborator

Pull Request Type

  • Bug fix
  • New feature
  • Code style / formatting / renaming
  • Refactoring (no functional or API changes)
  • Build / CI related changes
  • Documentation
  • Other (please describe):

Related Issue

Issue number: N/A

Current Behavior

The PKCS#11 provider does not support ML-KEM keys or KEM operations.
PKCS#11 modules are loaded using the legacy function list, so the PKCS#11 3.2 C_DecapsulateKey function is not available.

New Behavior

The PKCS#11 provider supports ML-KEM-512, ML-KEM-768 and ML-KEM-1024 key generation, encapsulation and decapsulation.

Encapsulation is performed using the public key, while decapsulation is performed on the token through the PKCS#11 3.2 C_DecapsulateKey interface.

Scope of Changes

  • Add ML-KEM key generation and provider support.
  • Add encapsulation and PKCS#11 3.2 token-backed decapsulation.
  • Add an ML-KEM-768 example and provider tests.

Testing

  • Existing tests
  • New tests added
  • Manual testing

Tested with:

  • Thales TCT Luna T-5000 Network HSM
  • SoftHSM built from the current master branch
  • OpenSSL 3.5 or later

Additional Notes

License Declaration

  • I hereby agree to license my contribution under the project's license.

olszomal added 3 commits July 22, 2026 10:43
Update the bundled PKCS#11 header to version 3.2 and load the
optional 3.2 function list through `C_GetInterface`, while
preserving the legacy function list.

This enables `C_EncapsulateKey` and `C_DecapsulateKey` for ML-KEM.
Add PKCS#11 provider support for ML-KEM-512, ML-KEM-768
and ML-KEM-1024 key generation, encapsulation and decapsulation.

Use the PKCS#11 3.2 C_DecapsulateKey interface
for private-key decapsulation on the token.
Comment thread src/p11_pkey.c
Comment thread src/p11_front.c
Comment thread src/provider_helpers.c
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