mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-04-02 07:20:26 +00:00
Test restarting after creating a key in a specific slot
This commit is contained in:
parent
46d9439a5e
commit
0a1104474b
@ -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,8 +588,18 @@ 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 )
|
||||||
{
|
{
|
||||||
|
mbedtls_psa_crypto_free( );
|
||||||
|
PSA_ASSERT( psa_register_se_driver( lifetime, &driver ) );
|
||||||
|
PSA_ASSERT( psa_crypto_init( ) );
|
||||||
|
PSA_ASSERT( psa_open_key( id, &handle ) );
|
||||||
|
}
|
||||||
|
|
||||||
/* Test that the key was created in the expected slot. */
|
/* Test that the key was created in the expected slot. */
|
||||||
TEST_EQUAL( ram_slots[wanted_slot].type, PSA_KEY_TYPE_RAW_DATA );
|
TEST_EQUAL( ram_slots[wanted_slot].type, PSA_KEY_TYPE_RAW_DATA );
|
||||||
|
|
||||||
@ -597,7 +608,6 @@ void key_creation_in_chosen_slot( int slot_arg,
|
|||||||
PSA_ASSERT( psa_get_key_attributes( handle, &attributes ) );
|
PSA_ASSERT( psa_get_key_attributes( handle, &attributes ) );
|
||||||
|
|
||||||
PSA_ASSERT( psa_destroy_key( handle ) );
|
PSA_ASSERT( psa_destroy_key( handle ) );
|
||||||
}
|
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
PSA_DONE( );
|
PSA_DONE( );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user