File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -244,6 +244,19 @@ static inline int mbedtls_psa_err_translate_pk( psa_status_t status )
244
244
}
245
245
}
246
246
247
+ /* Translations for ECC */
248
+
249
+ /* This function transforms an ECC group identifier from
250
+ * https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#tls-parameters-8
251
+ * into a PSA ECC group identifier. */
252
+ static inline psa_ecc_curve_t mbedtls_psa_parse_tls_ecc_group (
253
+ uint16_t tls_ecc_grp_reg_id )
254
+ {
255
+ /* The PSA identifiers are currently aligned with those from
256
+ * the TLS Supported Groups registry, so no conversion is necessary. */
257
+ return ( (psa_ecc_curve_t ) tls_ecc_grp_reg_id );
258
+ }
259
+
247
260
#endif /* MBEDTLS_USE_PSA_CRYPTO */
248
261
249
262
#endif /* MBEDTLS_PSA_UTIL_H */
Original file line number Diff line number Diff line change @@ -572,7 +572,8 @@ int mbedtls_pk_wrap_as_opaque( mbedtls_pk_context *pk,
572
572
return ( ret );
573
573
574
574
curve_id = mbedtls_ecp_curve_info_from_grp_id ( ec -> grp .id )-> tls_id ;
575
- key_type = PSA_KEY_TYPE_ECC_KEYPAIR (curve_id );
575
+ key_type = PSA_KEY_TYPE_ECC_KEYPAIR (
576
+ mbedtls_psa_parse_tls_ecc_group ( curve_id ) );
576
577
577
578
/* allocate a key slot */
578
579
if ( PSA_SUCCESS != psa_allocate_key ( key_type , d_len * 8 , & key ) )
You can’t perform that action at this time.
0 commit comments