@@ -550,6 +550,7 @@ exit:
550
550
551
551
/* BEGIN_CASE */
552
552
void key_creation_in_chosen_slot( int slot_arg,
553
+ int restart,
553
554
int expected_status_arg )
554
555
{
555
556
psa_key_slot_number_t wanted_slot = slot_arg;
@@ -587,17 +588,26 @@ void key_creation_in_chosen_slot( int slot_arg,
587
588
&handle );
588
589
TEST_EQUAL( status, expected_status );
589
590
590
- if( status == PSA_SUCCESS )
591
+ if( status != PSA_SUCCESS )
592
+ goto exit;
593
+
594
+ /* Maybe restart, to check that the information is saved correctly. */
595
+ if( restart )
591
596
{
592
- /* Test that the key was created in the expected slot. */
593
- TEST_EQUAL( ram_slots[wanted_slot].type, PSA_KEY_TYPE_RAW_DATA );
597
+ mbedtls_psa_crypto_free( );
598
+ PSA_ASSERT( psa_register_se_driver( lifetime, &driver ) );
599
+ PSA_ASSERT( psa_crypto_init( ) );
600
+ PSA_ASSERT( psa_open_key( id, &handle ) );
601
+ }
602
+
603
+ /* Test that the key was created in the expected slot. */
604
+ TEST_EQUAL( ram_slots[wanted_slot].type, PSA_KEY_TYPE_RAW_DATA );
594
605
595
- /* Test that the key is reported with the correct attributes,
596
- * including the expected slot. */
597
- PSA_ASSERT( psa_get_key_attributes( handle, &attributes ) );
606
+ /* Test that the key is reported with the correct attributes,
607
+ * including the expected slot. */
608
+ PSA_ASSERT( psa_get_key_attributes( handle, &attributes ) );
598
609
599
- PSA_ASSERT( psa_destroy_key( handle ) );
600
- }
610
+ PSA_ASSERT( psa_destroy_key( handle ) );
601
611
602
612
exit:
603
613
PSA_DONE( );
0 commit comments