mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-30 04:04:21 +01:00
Minor code flow improvements
* group setting of attributes before calling get_builtin_key * return early instead of going to exit when no resources are allocated yet Signed-off-by: Steven Cooreman <steven.cooreman@silabs.com>
This commit is contained in:
parent
2cca9b8f13
commit
966db26779
@ -293,13 +293,14 @@ static psa_status_t psa_load_builtin_key_into_slot( psa_key_slot_t *slot )
|
||||
}
|
||||
|
||||
/* Check the platform function to see whether this key actually exists */
|
||||
psa_set_key_id( &attributes, slot->attr.id );
|
||||
status = mbedtls_psa_platform_get_builtin_key(
|
||||
slot->attr.id, &lifetime, &slot_number );
|
||||
if( status != PSA_SUCCESS )
|
||||
return( status );
|
||||
|
||||
/* Set mapped lifetime on the attributes */
|
||||
/* Set required key attributes to ensure get_builtin_key can retrieve the
|
||||
* full attributes. */
|
||||
psa_set_key_id( &attributes, slot->attr.id );
|
||||
psa_set_key_lifetime( &attributes, lifetime );
|
||||
|
||||
/* Get the full key attributes from the driver in order to be able to
|
||||
@ -312,7 +313,7 @@ static psa_status_t psa_load_builtin_key_into_slot( psa_key_slot_t *slot )
|
||||
/* Builtin keys cannot be defined by the attributes alone */
|
||||
if( status == PSA_SUCCESS )
|
||||
status = PSA_ERROR_CORRUPTION_DETECTED;
|
||||
goto exit;
|
||||
return( status );
|
||||
}
|
||||
|
||||
/* If the key should exist according to the platform, then ask the driver
|
||||
|
Loading…
Reference in New Issue
Block a user