test: test OpenSSL provider and engine if available - #950
Open
moritzbuhl wants to merge 8 commits into
Open
moritzbuhl wants to merge 8 commits into
moritzbuhl wants to merge 8 commits into
Conversation
moritzbuhl
force-pushed
the
mbuhl-run-engine-and-provider
branch
from
September 18, 2026 11:19
b013470 to
8fcd058
Compare
OpenSSL from 4.0 only supports providers. OpenSSL between 3.0 and 3.5 can support engines and providers. OpenSSL before 3.0 only supports engines. So to test both providers and engines, add a dynamic check if engines are supported and run the commands twice, once with the provider, once with the engine. Signed-off-by: Moritz Buhl <moritz.buhl@infineon.com>
We observe this error, specifically when trying to run with tpm2-tss-engine: ERROR: EVP_PKEY_fromdata_init: error:03000096:digital envelope routines::operation not supported for this keytype 40B7BEF79B7F0000:error:41800002:PKCS#11 module:ERR_CKR_error:Host memory error:p11_rsa.c:153: 40B7BEF79B7F0000:error:06880006:asn1 encoding routines:ASN1_item_sign_ctx:EVP lib:../crypto/asn1/a_sign.c:274: The sign operation does not need the EVP pkey field as the TPM is responsible for it. Signed-off-by: Moritz Buhl <moritz.buhl@infineon.com>
moritzbuhl
force-pushed
the
mbuhl-run-engine-and-provider
branch
from
September 19, 2026 08:40
8fcd058 to
ee197d4
Compare
Signed-off-by: Jorge Merlino <jorge.merlino@canonical.com>
Fallback: EVP_PKEY_fromdata_init() requires ctx->keymgmt to be set, which OpenSSL populates via EVP_KEYMGMT_fetch() -- but that fetch is SKIPPED whenever some other component sharing this process (e.g. an ENGINE such as libp11's engine_pkcs11, loaded via "-engine pkcs11" for smartcard support) has registered itself as the process-wide default EVP_PKEY_METHOD provider for RSA via ENGINE_set_default(). That is normal, expected ENGINE usage and not specific to this caller, but it leaves ctx->keymgmt NULL here, and EVP_PKEY_fromdata_init() (unlike OpenSSL releases before the "foreign key" fix was reverted in PR #23063) no longer falls back to a legacy pmeth-based path in that case, so it errors out even though nothing is actually wrong with these e/n values. Since this has nothing to do with providers/keymgmt at all, build the EVP_PKEY directly via the classic RSA_set0_key() + EVP_PKEY_assign_RSA() APIs instead (the same technique used by the pre-OpenSSL-3.0 code path below, and by libp11 itself for wrapping its own "foreign" keys), which sidesteps ENGINE/provider defaults entirely.
moritzbuhl
force-pushed
the
mbuhl-run-engine-and-provider
branch
from
September 21, 2026 11:52
e61a99a to
376db15
Compare
Member
Author
|
Now CI is failing with this error: I already created tpm2-software/tpm2-tss#3151 |
Member
Author
|
Once tpm2-software/tpm2-tss#3161 is in, the tests should pass. |
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.
I hope this can detect what is reported in #948.