From d872a0914e7d91175b494271c5167eb0bf0d1d48 Mon Sep 17 00:00:00 2001 From: Rob Shearman Date: Sat, 12 Aug 2023 17:30:38 +0100 Subject: [PATCH] ecc: implement get_params for ENCODED_PUBLIC_KEY Implement get_params for OSSL_PKEY_PARAM_ENCODED_PUBLIC_KEY since this is required for OpenSSL's TLS implementation. Signed-off-by: Rob Shearman --- src/tpm2-provider-keymgmt-ec.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/tpm2-provider-keymgmt-ec.c b/src/tpm2-provider-keymgmt-ec.c index 0cc12af..004abbf 100644 --- a/src/tpm2-provider-keymgmt-ec.c +++ b/src/tpm2-provider-keymgmt-ec.c @@ -422,6 +422,10 @@ tpm2_ec_keymgmt_get_params(void *keydata, OSSL_PARAM params[]) p = OSSL_PARAM_locate(params, OSSL_PKEY_PARAM_EC_PUB_Y); if (p != NULL && !tpm2_param_set_BN_from_buffer(p, pkey->data.pub.publicArea.unique.ecc.y)) goto error; + p = OSSL_PARAM_locate(params, OSSL_PKEY_PARAM_ENCODED_PUBLIC_KEY); + if (p != NULL && !tpm2_param_set_ecc_point(p, &pkey->data.pub.publicArea.unique.ecc.x, + &pkey->data.pub.publicArea.unique.ecc.y)) + goto error; free(details); return 1; error: @@ -450,6 +454,7 @@ tpm2_ec_keymgmt_gettable_params(void *provctx) OSSL_PARAM_octet_string(OSSL_PKEY_PARAM_PUB_KEY, NULL, 0), OSSL_PARAM_BN(OSSL_PKEY_PARAM_EC_PUB_X, NULL, 0), OSSL_PARAM_BN(OSSL_PKEY_PARAM_EC_PUB_Y, NULL, 0), + OSSL_PARAM_octet_string(OSSL_PKEY_PARAM_ENCODED_PUBLIC_KEY, NULL, 0), OSSL_PARAM_END };