File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -605,6 +605,7 @@ int mbedtls_pk_wrap_as_opaque( mbedtls_pk_context *pk,
605
605
psa_ecc_curve_t curve_id ;
606
606
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT ;
607
607
psa_key_type_t key_type ;
608
+ size_t bits ;
608
609
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED ;
609
610
610
611
/* export the private key material in the format PSA wants */
@@ -616,12 +617,12 @@ int mbedtls_pk_wrap_as_opaque( mbedtls_pk_context *pk,
616
617
if ( ( ret = mbedtls_mpi_write_binary ( & ec -> d , d , d_len ) ) != 0 )
617
618
return ( ret );
618
619
619
- curve_id = mbedtls_ecp_curve_info_from_grp_id ( ec -> grp .id )-> tls_id ;
620
- key_type = PSA_KEY_TYPE_ECC_KEY_PAIR (
621
- mbedtls_psa_parse_tls_ecc_group ( curve_id ) );
620
+ curve_id = mbedtls_ecc_group_to_psa ( ec -> grp .id , & bits );
621
+ key_type = PSA_KEY_TYPE_ECC_KEY_PAIR ( curve_id );
622
622
623
623
/* prepare the key attributes */
624
624
psa_set_key_type ( & attributes , key_type );
625
+ psa_set_key_bits ( & attributes , bits );
625
626
psa_set_key_usage_flags ( & attributes , PSA_KEY_USAGE_SIGN_HASH );
626
627
psa_set_key_algorithm ( & attributes , PSA_ALG_ECDSA (hash_alg ) );
627
628
You can’t perform that action at this time.
0 commit comments