From cf084ae256d0a3fa816db8e5787a686cd82d5f13 Mon Sep 17 00:00:00 2001 From: Valerio Setti Date: Thu, 26 Jan 2023 14:30:12 +0100 Subject: [PATCH] pk: add generic defines for ECDSA capabilities The idea is to state what are ECDSA capabilities independently from how this is achieved Signed-off-by: Valerio Setti --- include/mbedtls/pk.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/include/mbedtls/pk.h b/include/mbedtls/pk.h index 0392bd48e..29cac2793 100644 --- a/include/mbedtls/pk.h +++ b/include/mbedtls/pk.h @@ -155,6 +155,28 @@ typedef struct mbedtls_pk_rsassa_pss_options { #endif #endif /* defined(MBEDTLS_USE_PSA_CRYPTO) */ +/** + * \brief The following defines are meant to list ECDSA capabilities of the + * PK module in a general way (without any reference to how this + * is achieved, which can be either through PSA driver or + * MBEDTLS_ECDSA_C) + */ +#if !defined(MBEDTLS_USE_PSA_CRYPTO) +#if defined(MBEDTLS_ECDSA_C) +#define MBEDTLS_PK_CAN_ECDSA_SIGN +#define MBEDTLS_PK_CAN_ECDSA_VERIFY +#endif +#else /* MBEDTLS_USE_PSA_CRYPTO */ +#if defined(PSA_WANT_ALG_ECDSA) +#if defined(PSA_WANT_KEY_TYPE_ECC_KEY_PAIR) +#define MBEDTLS_PK_CAN_ECDSA_SIGN +#endif +#if defined(PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY) +#define MBEDTLS_PK_CAN_ECDSA_VERIFY +#endif +#endif /* PSA_WANT_ALG_ECDSA */ +#endif /* MBEDTLS_USE_PSA_CRYPTO */ + /** * \brief Types for interfacing with the debug module */