tests: Fix checks of volatile key identifier
Volatile keys have now a volatile non-null key identifier. Signed-off-by: Ronald Cron <ronald.cron@arm.com>
This commit is contained in:
parent
432e19c7b2
commit
4184107d2e
2 changed files with 9 additions and 1 deletions
|
@ -19,6 +19,7 @@
|
||||||
#define HAVE_RAM_AVAILABLE_128K
|
#define HAVE_RAM_AVAILABLE_128K
|
||||||
|
|
||||||
#include "psa/crypto.h"
|
#include "psa/crypto.h"
|
||||||
|
#include "psa_crypto_slot_management.h"
|
||||||
|
|
||||||
/** An invalid export length that will never be set by psa_export_key(). */
|
/** An invalid export length that will never be set by psa_export_key(). */
|
||||||
static const size_t INVALID_EXPORT_LENGTH = ~0U;
|
static const size_t INVALID_EXPORT_LENGTH = ~0U;
|
||||||
|
@ -245,7 +246,13 @@ int check_key_attributes_sanity( psa_key_handle_t key )
|
||||||
|
|
||||||
/* Persistence */
|
/* Persistence */
|
||||||
if( lifetime == PSA_KEY_LIFETIME_VOLATILE )
|
if( lifetime == PSA_KEY_LIFETIME_VOLATILE )
|
||||||
TEST_ASSERT( MBEDTLS_SVC_KEY_ID_GET_KEY_ID( id ) == 0 );
|
{
|
||||||
|
TEST_ASSERT(
|
||||||
|
( PSA_KEY_ID_VOLATILE_MIN <=
|
||||||
|
MBEDTLS_SVC_KEY_ID_GET_KEY_ID( id ) ) &&
|
||||||
|
( MBEDTLS_SVC_KEY_ID_GET_KEY_ID( id ) <=
|
||||||
|
PSA_KEY_ID_VOLATILE_MAX ) );
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TEST_ASSERT(
|
TEST_ASSERT(
|
||||||
|
|
|
@ -972,6 +972,7 @@ void key_creation_import_export( int lifetime_arg, int min_slot, int restart )
|
||||||
psa_set_key_bits( &attributes,
|
psa_set_key_bits( &attributes,
|
||||||
PSA_BYTES_TO_BITS( sizeof( key_material ) ) );
|
PSA_BYTES_TO_BITS( sizeof( key_material ) ) );
|
||||||
psa_set_key_slot_number( &attributes, min_slot );
|
psa_set_key_slot_number( &attributes, min_slot );
|
||||||
|
psa_set_key_id( &attributes, handle );
|
||||||
if( ! check_key_attributes( handle, &attributes ) )
|
if( ! check_key_attributes( handle, &attributes ) )
|
||||||
goto exit;
|
goto exit;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue