Repository navigation
Conversation
The keymgmt derived OSSL_PKEY_PARAM_SECURITY_CATEGORY from the security bits, so EVP_PKEY_get_security_category() returned 2 for RSA-2048, 3 for P-256 and Ed25519, 3 for ML-KEM-512 and 4 for ML-KEM-768. The OpenSSL default provider returns 0 for all classical keys and the category of the parameter set for ML-KEM (1/3/5), ML-DSA (2/3/5) and SLH-DSA (1/3/5). Map the key type to the category explicitly, using the values of the OpenSSL default provider, and categories 1 and 5 for Falcon-512 and Falcon-1024. Add a provider test comparing the category of token keys with the value the default provider reports for the same public key. Fixes OpenSC#698.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The provider derived OSSL_PKEY_PARAM_SECURITY_CATEGORY from the security bits (>= 256 -> 5, >= 192 -> 4, >= 128 -> 3, >= 112 -> 2), so EVP_PKEY_get_security_category() on a token key gives 2 for RSA-2048, 3 for P-256 and Ed25519, 3 for ML-KEM-512 and 4 for ML-KEM-768. OpenSSL's default provider returns 0 for all classical keys (EVP_PKEY_get_security_category(3): "For all classical algorithms, 0 is returned"; rsa_kmgmt.c, ec_kmgmt.c, ecx_kmgmt.c) and a fixed value per PQC parameter set.
This maps the key type to the category directly, using the OpenSSL 3.6/4.0 values:
The new provider-security-category.softhsm test loads each token key through pkcs11prov and checks that its category matches what the default provider reports for the same public key. I ran it on Ubuntu 24.04 with OpenSSL 4.0.0 built from source (same setup as the ubuntu-latest CI job), SoftHSM 2.6.1 and OpenSC 0.25:
RSA security category: pkcs11prov 2, default 0make checkon the patched tree: 32 passed, 23 skipped, 0 failed (master with only the new test added: 31 passed, 23 skipped, 1 failed)Fixes #698