Test restarting after creating a key in a specific slot
This commit is contained in:
parent
46d9439a5e
commit
0a1104474b
2 changed files with 28 additions and 12 deletions
|
@ -40,13 +40,19 @@ SE key import-export, check after restart (slot 3)
|
||||||
key_creation_import_export:3:1
|
key_creation_import_export:3:1
|
||||||
|
|
||||||
Key creation in a specific slot (0)
|
Key creation in a specific slot (0)
|
||||||
key_creation_in_chosen_slot:0:PSA_SUCCESS
|
key_creation_in_chosen_slot:0:0:PSA_SUCCESS
|
||||||
|
|
||||||
Key creation in a specific slot (max)
|
Key creation in a specific slot (max)
|
||||||
key_creation_in_chosen_slot:ARRAY_LENGTH( ram_slots ) - 1:PSA_SUCCESS
|
key_creation_in_chosen_slot:ARRAY_LENGTH( ram_slots ) - 1:0:PSA_SUCCESS
|
||||||
|
|
||||||
|
Key creation in a specific slot (0, restart)
|
||||||
|
key_creation_in_chosen_slot:0:1:PSA_SUCCESS
|
||||||
|
|
||||||
|
Key creation in a specific slot (max, restart)
|
||||||
|
key_creation_in_chosen_slot:ARRAY_LENGTH( ram_slots ) - 1:1:PSA_SUCCESS
|
||||||
|
|
||||||
Key creation in a specific slot (too large)
|
Key creation in a specific slot (too large)
|
||||||
key_creation_in_chosen_slot:ARRAY_LENGTH( ram_slots ):PSA_ERROR_INVALID_ARGUMENT
|
key_creation_in_chosen_slot:ARRAY_LENGTH( ram_slots ):0:PSA_ERROR_INVALID_ARGUMENT
|
||||||
|
|
||||||
Key creation smoke test: AES-CTR
|
Key creation smoke test: AES-CTR
|
||||||
key_creation_smoke:PSA_KEY_TYPE_AES:PSA_ALG_CTR:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
key_creation_smoke:PSA_KEY_TYPE_AES:PSA_ALG_CTR:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
||||||
|
|
|
@ -550,6 +550,7 @@ exit:
|
||||||
|
|
||||||
/* BEGIN_CASE */
|
/* BEGIN_CASE */
|
||||||
void key_creation_in_chosen_slot( int slot_arg,
|
void key_creation_in_chosen_slot( int slot_arg,
|
||||||
|
int restart,
|
||||||
int expected_status_arg )
|
int expected_status_arg )
|
||||||
{
|
{
|
||||||
psa_key_slot_number_t wanted_slot = slot_arg;
|
psa_key_slot_number_t wanted_slot = slot_arg;
|
||||||
|
@ -587,18 +588,27 @@ void key_creation_in_chosen_slot( int slot_arg,
|
||||||
&handle );
|
&handle );
|
||||||
TEST_EQUAL( status, expected_status );
|
TEST_EQUAL( status, expected_status );
|
||||||
|
|
||||||
if( status == PSA_SUCCESS )
|
if( status != PSA_SUCCESS )
|
||||||
|
goto exit;
|
||||||
|
|
||||||
|
/* Maybe restart, to check that the information is saved correctly. */
|
||||||
|
if( restart )
|
||||||
{
|
{
|
||||||
/* Test that the key was created in the expected slot. */
|
mbedtls_psa_crypto_free( );
|
||||||
TEST_EQUAL( ram_slots[wanted_slot].type, PSA_KEY_TYPE_RAW_DATA );
|
PSA_ASSERT( psa_register_se_driver( lifetime, &driver ) );
|
||||||
|
PSA_ASSERT( psa_crypto_init( ) );
|
||||||
/* Test that the key is reported with the correct attributes,
|
PSA_ASSERT( psa_open_key( id, &handle ) );
|
||||||
* including the expected slot. */
|
|
||||||
PSA_ASSERT( psa_get_key_attributes( handle, &attributes ) );
|
|
||||||
|
|
||||||
PSA_ASSERT( psa_destroy_key( handle ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Test that the key was created in the expected slot. */
|
||||||
|
TEST_EQUAL( ram_slots[wanted_slot].type, PSA_KEY_TYPE_RAW_DATA );
|
||||||
|
|
||||||
|
/* Test that the key is reported with the correct attributes,
|
||||||
|
* including the expected slot. */
|
||||||
|
PSA_ASSERT( psa_get_key_attributes( handle, &attributes ) );
|
||||||
|
|
||||||
|
PSA_ASSERT( psa_destroy_key( handle ) );
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
PSA_DONE( );
|
PSA_DONE( );
|
||||||
ram_slots_reset( );
|
ram_slots_reset( );
|
||||||
|
|
Loading…
Reference in a new issue