pk_wrap: check if curve conversion is successful

diff --git a/library/pk_wrap.c b/library/pk_wrap.c
index 3e150a2..6007a23 100644
--- a/library/pk_wrap.c
+++ b/library/pk_wrap.c
@@ -677,6 +677,9 @@
     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;