From f8c94a811a45d4e0291dbeba8aa622f1b115c064 Mon Sep 17 00:00:00 2001 From: Andrzej Kurek Date: Wed, 7 Nov 2018 08:18:52 -0500 Subject: [PATCH] pk_wrap: check if curve conversion is successful --- library/pk_wrap.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/library/pk_wrap.c b/library/pk_wrap.c index 3e150a20d..6007a23c8 100644 --- a/library/pk_wrap.c +++ b/library/pk_wrap.c @@ -677,6 +677,9 @@ static int ecdsa_verify_wrap( void *ctx, mbedtls_md_type_t md_alg, psa_algorithm_t psa_sig_md = PSA_ALG_ECDSA( translate_md_to_psa( md_alg ) ); psa_ecc_curve_t curve = mbedtls_ecc_group_to_psa ( ( (mbedtls_ecdsa_context *) ctx )->grp.id ); + if( curve == 0 ) + return( MBEDTLS_ERR_PK_BAD_INPUT_DATA ); + memset( &signature, 0, sizeof( mbedtls_asn1_buf ) ); key.pk_info = &pk_info; key.pk_ctx = ctx;