From f7cd419ade72aec1ea47ee537dfbba5b629b7e1d Mon Sep 17 00:00:00 2001 From: Valerio Setti Date: Fri, 30 Jun 2023 18:11:29 +0200 Subject: [PATCH] pk: ignore opaque EC keys in pk_setup when they are not supported Signed-off-by: Valerio Setti --- library/pk.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/library/pk.c b/library/pk.c index fefd0af729..77bf29183b 100644 --- a/library/pk.c +++ b/library/pk.c @@ -181,9 +181,12 @@ int mbedtls_pk_setup_opaque(mbedtls_pk_context *ctx, type = psa_get_key_type(&attributes); psa_reset_key_attributes(&attributes); +#if defined(MBEDTLS_PK_HAVE_ECC_KEYS) if (PSA_KEY_TYPE_IS_ECC_KEY_PAIR(type)) { info = &mbedtls_ecdsa_opaque_info; - } else if (type == PSA_KEY_TYPE_RSA_KEY_PAIR) { + } else +#endif /* MBEDTLS_PK_HAVE_ECC_KEYS */ + if (type == PSA_KEY_TYPE_RSA_KEY_PAIR) { info = &mbedtls_rsa_opaque_info; } else { return MBEDTLS_ERR_PK_FEATURE_UNAVAILABLE;