mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-02-24 04:36:47 +00:00
tests: psa: Use PSA_KEY_LIFETIME_IS_VOLATILE where it should
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
This commit is contained in:
parent
390f607f7f
commit
f1ff9a83fa
|
@ -112,7 +112,7 @@ int lifetime_is_secure_element( psa_key_lifetime_t lifetime )
|
||||||
{
|
{
|
||||||
/* At the moment, anything that isn't a built-in lifetime is either
|
/* At the moment, anything that isn't a built-in lifetime is either
|
||||||
* a secure element or unassigned. */
|
* a secure element or unassigned. */
|
||||||
return( lifetime != PSA_KEY_LIFETIME_VOLATILE &&
|
return( ( ! PSA_KEY_LIFETIME_IS_VOLATILE( lifetime ) ) &&
|
||||||
lifetime != PSA_KEY_LIFETIME_PERSISTENT );
|
lifetime != PSA_KEY_LIFETIME_PERSISTENT );
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
@ -245,7 +245,7 @@ int check_key_attributes_sanity( mbedtls_svc_key_id_t key )
|
||||||
bits = psa_get_key_bits( &attributes );
|
bits = psa_get_key_bits( &attributes );
|
||||||
|
|
||||||
/* Persistence */
|
/* Persistence */
|
||||||
if( lifetime == PSA_KEY_LIFETIME_VOLATILE )
|
if( PSA_KEY_LIFETIME_IS_VOLATILE( lifetime ) )
|
||||||
{
|
{
|
||||||
TEST_ASSERT(
|
TEST_ASSERT(
|
||||||
( PSA_KEY_ID_VOLATILE_MIN <=
|
( PSA_KEY_ID_VOLATILE_MIN <=
|
||||||
|
|
|
@ -561,7 +561,7 @@ void copy_across_lifetimes( int source_lifetime_arg, int source_owner_id_arg,
|
||||||
|
|
||||||
/* If the target key is persistent, restart the system to make
|
/* If the target key is persistent, restart the system to make
|
||||||
* sure that the material is still alive. */
|
* sure that the material is still alive. */
|
||||||
if( target_lifetime != PSA_KEY_LIFETIME_VOLATILE )
|
if( ! PSA_KEY_LIFETIME_IS_VOLATILE( target_lifetime ) )
|
||||||
{
|
{
|
||||||
mbedtls_psa_crypto_free( );
|
mbedtls_psa_crypto_free( );
|
||||||
PSA_ASSERT( psa_crypto_init( ) );
|
PSA_ASSERT( psa_crypto_init( ) );
|
||||||
|
@ -573,7 +573,7 @@ void copy_across_lifetimes( int source_lifetime_arg, int source_owner_id_arg,
|
||||||
PSA_ASSERT( psa_get_key_attributes( returned_target_id,
|
PSA_ASSERT( psa_get_key_attributes( returned_target_id,
|
||||||
&target_attributes ) );
|
&target_attributes ) );
|
||||||
|
|
||||||
if( target_lifetime != PSA_KEY_LIFETIME_VOLATILE )
|
if( ! PSA_KEY_LIFETIME_IS_VOLATILE( target_lifetime ) )
|
||||||
{
|
{
|
||||||
TEST_ASSERT( mbedtls_svc_key_id_equal(
|
TEST_ASSERT( mbedtls_svc_key_id_equal(
|
||||||
target_id, psa_get_key_id( &target_attributes ) ) );
|
target_id, psa_get_key_id( &target_attributes ) ) );
|
||||||
|
@ -657,7 +657,7 @@ void copy_to_occupied( int source_lifetime_arg, int source_id_arg,
|
||||||
PSA_ASSERT( psa_crypto_init( ) );
|
PSA_ASSERT( psa_crypto_init( ) );
|
||||||
|
|
||||||
/* Populate the source slot. */
|
/* Populate the source slot. */
|
||||||
if( source_lifetime != PSA_KEY_LIFETIME_VOLATILE )
|
if( ! PSA_KEY_LIFETIME_IS_VOLATILE( source_lifetime ) )
|
||||||
{
|
{
|
||||||
psa_set_key_id( &attributes, source_id );
|
psa_set_key_id( &attributes, source_id );
|
||||||
psa_set_key_lifetime( &attributes, source_lifetime );
|
psa_set_key_lifetime( &attributes, source_lifetime );
|
||||||
|
|
Loading…
Reference in a new issue