mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-07-29 11:41:15 +03:00
Don't require a type and size when creating a key slot
Remove the type and bits arguments to psa_allocate_key() and psa_create_key(). They can be useful if the implementation wants to know exactly how much space to allocate for the slot, but many implementations (including ours) don't care, and it's possible to work around their lack by deferring size-dependent actions to the time when the key material is created. They are a burden to applications and make the API more complex, and the benefits aren't worth it. Change the API and adapt the implementation, the units test and the sample code accordingly.
This commit is contained in:
@ -142,13 +142,8 @@ static psa_status_t psa_internal_release_key_slot( psa_key_handle_t handle )
|
||||
return( psa_wipe_key_slot( slot ) );
|
||||
}
|
||||
|
||||
psa_status_t psa_allocate_key( psa_key_type_t type,
|
||||
size_t max_bits,
|
||||
psa_key_handle_t *handle )
|
||||
psa_status_t psa_allocate_key( psa_key_handle_t *handle )
|
||||
{
|
||||
/* This implementation doesn't reserve memory for the keys. */
|
||||
(void) type;
|
||||
(void) max_bits;
|
||||
*handle = 0;
|
||||
return( psa_internal_allocate_key_slot( handle ) );
|
||||
}
|
||||
@ -259,16 +254,10 @@ psa_status_t psa_open_key( psa_key_lifetime_t lifetime,
|
||||
|
||||
psa_status_t psa_create_key( psa_key_lifetime_t lifetime,
|
||||
psa_key_id_t id,
|
||||
psa_key_type_t type,
|
||||
size_t max_bits,
|
||||
psa_key_handle_t *handle )
|
||||
{
|
||||
psa_status_t status;
|
||||
|
||||
/* This implementation doesn't reserve memory for the keys. */
|
||||
(void) type;
|
||||
(void) max_bits;
|
||||
|
||||
status = persistent_key_setup( lifetime, id, handle,
|
||||
PSA_ERROR_EMPTY_SLOT );
|
||||
switch( status )
|
||||
|
Reference in New Issue
Block a user