From ee9fa4611131f2b18b2c64ea6706b82e64e54481 Mon Sep 17 00:00:00 2001 From: Valerio Setti Date: Mon, 27 Mar 2023 11:28:49 +0200 Subject: [PATCH] check_config: add helper symbol for SECP256R1 Signed-off-by: Valerio Setti --- include/mbedtls/check_config.h | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/include/mbedtls/check_config.h b/include/mbedtls/check_config.h index 97fd3ce1d..efaa02a16 100644 --- a/include/mbedtls/check_config.h +++ b/include/mbedtls/check_config.h @@ -315,6 +315,17 @@ #endif #endif /* MBEDTLS_USE_PSA_CRYPTO */ +/* Helper for curve SECP256R1 */ +#if defined(MBEDTLS_USE_PSA_CRYPTO) +#if defined(PSA_WANT_ECC_SECP_R1_256) +#define MBEDTLS_PK_HAVE_CURVE_SECP256R1 +#endif +#else /* MBEDTLS_USE_PSA_CRYPTO */ +#if defined(MBEDTLS_ECP_DP_SECP256R1_ENABLED) +#define MBEDTLS_PK_HAVE_CURVE_SECP256R1 +#endif +#endif /* MBEDTLS_USE_PSA_CRYPTO */ + #if defined(MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED) && \ ( !defined(MBEDTLS_PK_HAVE_ECDH) || \ !defined(MBEDTLS_PK_HAVE_ECDSA) || \ @@ -369,9 +380,8 @@ #endif #if defined(MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED) && \ - ( !defined(MBEDTLS_PK_HAVE_JPAKE) || \ - !(defined(MBEDTLS_ECP_DP_SECP256R1_ENABLED) || \ - defined(PSA_WANT_ECC_SECP_R1_256) ) ) + ( !defined(MBEDTLS_PK_HAVE_JPAKE) || \ + !defined(MBEDTLS_PK_HAVE_CURVE_SECP256R1) ) #error "MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED defined, but not all prerequisites" #endif @@ -1120,6 +1130,7 @@ #undef MBEDTLS_MD_HAVE_SHA256 #undef MBEDTLS_MD_HAVE_SHA384 #undef MBEDTLS_MD_HAVE_SHA512 +#undef MBEDTLS_PK_HAVE_CURVE_SECP256R1 /* * Avoid warning from -pedantic. This is a convenient place for this