Skip to content

Commit 242da1e

Browse files
author
Hanno Becker
committed
PSA: Adapt cipher.c, pk.c, pk_wrap.c to new key slot allocation API
1 parent 330b9a4 commit 242da1e

File tree

3 files changed

+3
-5
lines changed

3 files changed

+3
-5
lines changed

library/cipher.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ int mbedtls_cipher_setkey( mbedtls_cipher_context_t *ctx,
308308
return( MBEDTLS_ERR_CIPHER_FEATURE_UNAVAILABLE );
309309

310310
/* Allocate a key slot to use. */
311-
status = psa_allocate_key( key_type, key_bitlen, &cipher_psa->slot );
311+
status = psa_allocate_key( &cipher_psa->slot );
312312
if( status != PSA_SUCCESS )
313313
return( MBEDTLS_ERR_CIPHER_HW_ACCEL_FAILED );
314314

library/pk.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,7 @@ int mbedtls_pk_wrap_as_opaque( mbedtls_pk_context *pk,
576576
mbedtls_psa_parse_tls_ecc_group ( curve_id ) );
577577

578578
/* allocate a key slot */
579-
if( PSA_SUCCESS != psa_allocate_key( key_type, d_len * 8, &key ) )
579+
if( PSA_SUCCESS != psa_allocate_key( &key ) )
580580
return( MBEDTLS_ERR_PK_HW_ACCEL_FAILED );
581581

582582
/* set policy */

library/pk_wrap.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -577,9 +577,7 @@ static int ecdsa_verify_wrap( void *ctx, mbedtls_md_type_t md_alg,
577577
psa_sig_md = PSA_ALG_ECDSA( psa_md );
578578
psa_type = PSA_KEY_TYPE_ECC_PUBLIC_KEY( curve );
579579

580-
if( ( ret = psa_allocate_key( psa_type,
581-
MBEDTLS_PSA_ECC_KEY_BITS_OF_CURVE(curve),
582-
&key_slot ) ) != PSA_SUCCESS )
580+
if( ( ret = psa_allocate_key( &key_slot ) ) != PSA_SUCCESS )
583581
return( mbedtls_psa_err_translate_pk( ret ) );
584582

585583
psa_key_policy_init( &policy );

0 commit comments

Comments
 (0)