Skip to content

Add PKCS#11 provider compatible with OpenSSL 3.x/4.0#650

Merged
mtrojnar merged 12 commits intoOpenSC:masterfrom
olszomal:provider_v2
Apr 21, 2026
Merged

Add PKCS#11 provider compatible with OpenSSL 3.x/4.0#650
mtrojnar merged 12 commits intoOpenSC:masterfrom
olszomal:provider_v2

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

Fix #631

Current Behavior

The existing PKCS#11 integration relies on legacy EVP_PKEY_METHOD-based implementations, which are deprecated and removed in OpenSSL 4.0. As a result, the current implementation is not compatible with OpenSSL 4.0.

EdDSA support is also conditionally guarded using incorrect macros (OPENSSL_NO_EC instead of OPENSSL_NO_ECX), leading to potential build and feature inconsistencies.

New Behavior

This PR introduces a new PKCS#11 provider implementation compatible with OpenSSL 3.x and forward-compatible with OpenSSL 4.0, replacing legacy EVP_PKEY_METHOD usage with provider-based interfaces (KEYMGMT, SIGNATURE, ASYM_CIPHER).

EdDSA support is properly handled using OPENSSL_NO_ECX, and key handling, reference management, and cleanup logic have been corrected.

Scope of Changes

  • Implement PKCS#11 provider using OpenSSL provider APIs (KEYMGMT, SIGNATURE, ASYM_CIPHER)
  • Remove reliance on deprecated EVP_PKEY_METHOD and ensure compatibility with OpenSSL 4.0
  • Fix conditional compilation guards for EdDSA (OPENSSL_NO_ECX)
  • Improve memory management and resource lifecycle handling
  • Update and extend the test suite to cover the new provider functionality

Testing

  • Existing tests -> fixed and improved
  • New tests added
  • Manual testing -> performed with YubiKey 5

Additional Notes

License Declaration

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

@mtrojnar mtrojnar merged commit 72af41d into OpenSC:master Apr 21, 2026
10 checks passed
@olszomal olszomal deleted the provider_v2 branch April 28, 2026 12:12
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.

Fails to build on OpenSSL-4.x-dev

2 participants