Skip to contentSkip to conversation

tpm2-tools, tpm2-pkcs11, and OpenSSL 3.0

tpm2 Jerry Snitselaar 3 participants 3 messages May 24, 2021 – May 25, 2021

lore
Share & tools
lore

Jerry Snitselaar

author
#0 lore raw

Both tpm2-tools and tpm2-pkcs11 make use of some functions that are being deprecated in openssl 3.0. Are there plans to move away from using those deprecated functions? Currently tpm2-tools will build with -Wno-error=deprecated-declarations, but tpm2-pkcs11 trips over EVP_PKEY_get0_EC_KEY now returning a const EC_KEY *, and ECDSA_do_verify taking a non const parameter. Someone suggested doing something like:

       EVP_PKEY_CTX    *pctx = NULL;
       if ((pctx = EVP_PKEY_CTX_new(pkey, NULL)) == NULL) {
               goto fail;
       }

       if (EVP_PKEY_verify_init(pctx) != 1 ||
           EVP_PKEY_verify(pctx, sigbuf, siglen,
           dgstbuf, dgstlen) != 1) {
               goto fail;
       }
 fail:
       EVP_PKEY_CTX_free(pctx);

but I imagine the ASN.1 framing stuff mentioned in do_sig_verify_ec() would still be an issue, yes? I don't know openssl, so I don't know if you could get away with casting the pointer to EC_KEY *.

There is work going on to support openssl 3.0 in RHEL9, so this came up.

Regards,
Jerry

#1 lore raw

I can look at compiling with OpenSSL 3.0, I haven't even tried yet. But I would imagine it's all fixable. I don't see anything in the do_sig_verify that requires a non-const key. I would imagine it's just as simple as updating the call sites to match the signatures.

I filed bugs:
- https://github.com/tpm2-software/tpm2-pkcs11/issues/686
- https://github.com/tpm2-software/tpm2-tools/issues/2737

We'll try to get to these soon, as I would imagine distros are eager to start the process of transitioning over.

Bill

________________________________
From: Jerry Snitselaar <jsnitsel(a)redhat.com>
Sent: Monday, May 24, 2021 4:34 PM
To: tpm2(a)lists.01.org <tpm2(a)lists.01.org>
Subject: [tpm2] tpm2-tools, tpm2-pkcs11, and OpenSSL 3.0

Both tpm2-tools and tpm2-pkcs11 make use of some functions that are being deprecated in openssl 3.0. Are there plans to move away from using those deprecated functions? Currently tpm2-tools will build with -Wno-error=deprecated-declarations, but tpm2-pkcs11 trips over EVP_PKEY_get0_EC_KEY now returning a const EC_KEY *, and ECDSA_do_verify taking a non const parameter. Someone suggested doing something like:

       EVP_PKEY_CTX    *pctx = NULL;
       if ((pctx = EVP_PKEY_CTX_new(pkey, NULL)) == NULL) {
               goto fail;
       }

       if (EVP_PKEY_verify_init(pctx) != 1 ||
           EVP_PKEY_verify(pctx, sigbuf, siglen,
           dgstbuf, dgstlen) != 1) {
               goto fail;
       }
 fail:
       EVP_PKEY_CTX_free(pctx);

but I imagine the ASN.1 framing stuff mentioned in do_sig_verify_ec() would still be an issue, yes? I don't know openssl, so I don't know if you could get away with casting the pointer to EC_KEY *.

There is work going on to support openssl 3.0 in RHEL9, so this came up.

Regards,
Jerry
_______________________________________________
tpm2 mailing list -- tpm2(a)lists.01.org
To unsubscribe send an email to tpm2-leave(a)lists.01.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

#2 lore raw
Quoted 2 lines · William C

I don't see anything in the do_sig_verify that
requires a non-const key.

If handed an EVP_PKEY with *only* the private key information populated, OpenSSL could theoretically install the corresponding public key when asked to do the verification.

cf. https://github.com/openssl/openssl/pull/10954