pk: add new symbol for generic ECDSA capability

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
This commit is contained in:
Valerio Setti 2023-01-27 13:22:42 +01:00
parent bf74f52920
commit 7ca1318256
3 changed files with 12 additions and 8 deletions

View File

@ -114,7 +114,7 @@ const mbedtls_pk_info_t *mbedtls_pk_info_from_type(mbedtls_pk_type_t pk_type)
case MBEDTLS_PK_ECKEY_DH: case MBEDTLS_PK_ECKEY_DH:
return &mbedtls_eckeydh_info; return &mbedtls_eckeydh_info;
#endif #endif
#if defined(MBEDTLS_PK_CAN_ECDSA_SIGN) || defined(MBEDTLS_PK_CAN_ECDSA_VERIFY) #if defined(MBEDTLS_PK_CAN_ECDSA_SOME)
case MBEDTLS_PK_ECDSA: case MBEDTLS_PK_ECDSA:
return &mbedtls_ecdsa_info; return &mbedtls_ecdsa_info;
#endif #endif

View File

@ -620,7 +620,7 @@ static size_t eckey_get_bitlen(const void *ctx)
return ((mbedtls_ecp_keypair *) ctx)->grp.pbits; return ((mbedtls_ecp_keypair *) ctx)->grp.pbits;
} }
#if defined(MBEDTLS_PK_CAN_ECDSA_SIGN) || defined(MBEDTLS_PK_CAN_ECDSA_VERIFY) #if defined(MBEDTLS_PK_CAN_ECDSA_SOME)
/* Forward declarations */ /* Forward declarations */
static int ecdsa_verify_wrap(void *ctx, mbedtls_md_type_t md_alg, static int ecdsa_verify_wrap(void *ctx, mbedtls_md_type_t md_alg,
const unsigned char *hash, size_t hash_len, const unsigned char *hash, size_t hash_len,
@ -805,17 +805,17 @@ const mbedtls_pk_info_t mbedtls_eckey_info = {
"EC", "EC",
eckey_get_bitlen, eckey_get_bitlen,
eckey_can_do, eckey_can_do,
#if defined(MBEDTLS_PK_CAN_ECDSA_SIGN) || defined(MBEDTLS_PK_CAN_ECDSA_VERIFY) #if defined(MBEDTLS_PK_CAN_ECDSA_SOME)
eckey_verify_wrap, eckey_verify_wrap,
eckey_sign_wrap, eckey_sign_wrap,
#if defined(MBEDTLS_ECP_RESTARTABLE) #if defined(MBEDTLS_ECP_RESTARTABLE)
eckey_verify_rs_wrap, eckey_verify_rs_wrap,
eckey_sign_rs_wrap, eckey_sign_rs_wrap,
#endif #endif
#else /* MBEDTLS_PK_CAN_ECDSA_SIGN || MBEDTLS_PK_CAN_ECDSA_VERIFY */ #else /* MBEDTLS_PK_CAN_ECDSA_SOME */
NULL, NULL,
NULL, NULL,
#endif /* MBEDTLS_PK_CAN_ECDSA_SIGN || MBEDTLS_PK_CAN_ECDSA_VERIFY */ #endif /* MBEDTLS_PK_CAN_ECDSA_SOME */
NULL, NULL,
NULL, NULL,
eckey_check_pair, eckey_check_pair,
@ -861,7 +861,7 @@ const mbedtls_pk_info_t mbedtls_eckeydh_info = {
}; };
#endif /* MBEDTLS_ECP_C */ #endif /* MBEDTLS_ECP_C */
#if defined(MBEDTLS_PK_CAN_ECDSA_SIGN) || defined(MBEDTLS_PK_CAN_ECDSA_VERIFY) #if defined(MBEDTLS_PK_CAN_ECDSA_SOME)
static int ecdsa_can_do(mbedtls_pk_type_t type) static int ecdsa_can_do(mbedtls_pk_type_t type)
{ {
return type == MBEDTLS_PK_ECDSA; return type == MBEDTLS_PK_ECDSA;
@ -1345,7 +1345,7 @@ const mbedtls_pk_info_t mbedtls_ecdsa_info = {
#endif #endif
eckey_debug, /* Compatible key structures */ eckey_debug, /* Compatible key structures */
}; };
#endif /* MBEDTLS_ECDSA_C */ #endif /* MBEDTLS_PK_CAN_ECDSA_SOME */
#if defined(MBEDTLS_PK_RSA_ALT_SUPPORT) #if defined(MBEDTLS_PK_RSA_ALT_SUPPORT)
/* /*

View File

@ -56,6 +56,10 @@ struct mbedtls_pk_info_t {
int (*f_rng)(void *, unsigned char *, size_t), int (*f_rng)(void *, unsigned char *, size_t),
void *p_rng); void *p_rng);
#if defined(MBEDTLS_PK_CAN_ECDSA_VERIFY) || defined(MBEDTLS_PK_CAN_ECDSA_SIGN)
#define MBEDTLS_PK_CAN_ECDSA_SOME
#endif
#if defined(MBEDTLS_ECDSA_C) && defined(MBEDTLS_ECP_RESTARTABLE) #if defined(MBEDTLS_ECDSA_C) && defined(MBEDTLS_ECP_RESTARTABLE)
/** Verify signature (restartable) */ /** Verify signature (restartable) */
int (*verify_rs_func)(void *ctx, mbedtls_md_type_t md_alg, int (*verify_rs_func)(void *ctx, mbedtls_md_type_t md_alg,
@ -125,7 +129,7 @@ extern const mbedtls_pk_info_t mbedtls_eckey_info;
extern const mbedtls_pk_info_t mbedtls_eckeydh_info; extern const mbedtls_pk_info_t mbedtls_eckeydh_info;
#endif #endif
#if defined(MBEDTLS_PK_CAN_ECDSA_SIGN) || defined(MBEDTLS_PK_CAN_ECDSA_VERIFY) #if defined(MBEDTLS_PK_CAN_ECDSA_SOME)
extern const mbedtls_pk_info_t mbedtls_ecdsa_info; extern const mbedtls_pk_info_t mbedtls_ecdsa_info;
#endif #endif