mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-26 04:45:44 +01:00
Refactor lifetime checking to reflect split in location and persistence
Signed-off-by: Steven Cooreman <steven.cooreman@silabs.com>
This commit is contained in:
parent
8335f41cda
commit
c59de6ab7e
@ -1500,7 +1500,7 @@ static psa_status_t psa_validate_key_attributes(
|
||||
{
|
||||
psa_status_t status;
|
||||
|
||||
if( attributes->core.lifetime != PSA_KEY_LIFETIME_VOLATILE )
|
||||
if( ! PSA_KEY_LIFETIME_IS_VOLATILE( attributes->core.lifetime ) )
|
||||
{
|
||||
status = psa_validate_persistent_key_parameters(
|
||||
attributes->core.lifetime, attributes->core.id,
|
||||
@ -1660,7 +1660,7 @@ static psa_status_t psa_finish_key_creation(
|
||||
(void) driver;
|
||||
|
||||
#if defined(MBEDTLS_PSA_CRYPTO_STORAGE_C)
|
||||
if( slot->attr.lifetime != PSA_KEY_LIFETIME_VOLATILE )
|
||||
if( ! PSA_KEY_LIFETIME_IS_VOLATILE( slot->attr.lifetime ) )
|
||||
{
|
||||
#if defined(MBEDTLS_PSA_CRYPTO_SE_C)
|
||||
if( driver != NULL )
|
||||
|
@ -200,7 +200,10 @@ psa_status_t psa_validate_persistent_key_parameters(
|
||||
}
|
||||
else
|
||||
#endif /* MBEDTLS_PSA_CRYPTO_SE_C */
|
||||
if( lifetime != PSA_KEY_LIFETIME_PERSISTENT )
|
||||
if( ( PSA_KEY_LIFETIME_GET_LOCATION( lifetime )
|
||||
!= PSA_KEY_LOCATION_LOCAL_STORAGE ) ||
|
||||
( PSA_KEY_LIFETIME_GET_PERSISTENCE( lifetime )
|
||||
!= PSA_KEY_PERSISTENCE_DEFAULT ) )
|
||||
return( PSA_ERROR_INVALID_ARGUMENT );
|
||||
|
||||
#if defined(MBEDTLS_PSA_CRYPTO_STORAGE_C)
|
||||
|
@ -88,8 +88,8 @@ psa_status_t psa_get_empty_key_slot( psa_key_handle_t *handle,
|
||||
*/
|
||||
static inline int psa_key_lifetime_is_external( psa_key_lifetime_t lifetime )
|
||||
{
|
||||
return( lifetime != PSA_KEY_LIFETIME_VOLATILE &&
|
||||
lifetime != PSA_KEY_LIFETIME_PERSISTENT );
|
||||
return( PSA_KEY_LIFETIME_GET_LOCATION( lifetime )
|
||||
!= PSA_KEY_LOCATION_LOCAL_STORAGE );
|
||||
}
|
||||
|
||||
/** Test whether the given parameters are acceptable for a persistent key.
|
||||
|
Loading…
Reference in New Issue
Block a user