mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-02-19 09:40:29 +00:00
PSA: Adapt cipher.c, pk.c, pk_wrap.c to new key slot allocation API
This commit is contained in:
parent
32809e8c70
commit
e34f636f8d
@ -308,7 +308,7 @@ int mbedtls_cipher_setkey( mbedtls_cipher_context_t *ctx,
|
|||||||
return( MBEDTLS_ERR_CIPHER_FEATURE_UNAVAILABLE );
|
return( MBEDTLS_ERR_CIPHER_FEATURE_UNAVAILABLE );
|
||||||
|
|
||||||
/* Allocate a key slot to use. */
|
/* Allocate a key slot to use. */
|
||||||
status = psa_allocate_key( key_type, key_bitlen, &cipher_psa->slot );
|
status = psa_allocate_key( &cipher_psa->slot );
|
||||||
if( status != PSA_SUCCESS )
|
if( status != PSA_SUCCESS )
|
||||||
return( MBEDTLS_ERR_CIPHER_HW_ACCEL_FAILED );
|
return( MBEDTLS_ERR_CIPHER_HW_ACCEL_FAILED );
|
||||||
|
|
||||||
|
@ -576,7 +576,7 @@ int mbedtls_pk_wrap_as_opaque( mbedtls_pk_context *pk,
|
|||||||
mbedtls_psa_parse_tls_ecc_group ( curve_id ) );
|
mbedtls_psa_parse_tls_ecc_group ( curve_id ) );
|
||||||
|
|
||||||
/* allocate a key slot */
|
/* allocate a key slot */
|
||||||
if( PSA_SUCCESS != psa_allocate_key( key_type, d_len * 8, &key ) )
|
if( PSA_SUCCESS != psa_allocate_key( &key ) )
|
||||||
return( MBEDTLS_ERR_PK_HW_ACCEL_FAILED );
|
return( MBEDTLS_ERR_PK_HW_ACCEL_FAILED );
|
||||||
|
|
||||||
/* set policy */
|
/* set policy */
|
||||||
|
@ -577,9 +577,7 @@ static int ecdsa_verify_wrap( void *ctx, mbedtls_md_type_t md_alg,
|
|||||||
psa_sig_md = PSA_ALG_ECDSA( psa_md );
|
psa_sig_md = PSA_ALG_ECDSA( psa_md );
|
||||||
psa_type = PSA_KEY_TYPE_ECC_PUBLIC_KEY( curve );
|
psa_type = PSA_KEY_TYPE_ECC_PUBLIC_KEY( curve );
|
||||||
|
|
||||||
if( ( ret = psa_allocate_key( psa_type,
|
if( ( ret = psa_allocate_key( &key_slot ) ) != PSA_SUCCESS )
|
||||||
MBEDTLS_PSA_ECC_KEY_BITS_OF_CURVE(curve),
|
|
||||||
&key_slot ) ) != PSA_SUCCESS )
|
|
||||||
return( mbedtls_psa_err_translate_pk( ret ) );
|
return( mbedtls_psa_err_translate_pk( ret ) );
|
||||||
|
|
||||||
psa_key_policy_init( &policy );
|
psa_key_policy_init( &policy );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user