Test restarting after creating a key in a specific slot
diff --git a/tests/suites/test_suite_psa_crypto_se_driver_hal.data b/tests/suites/test_suite_psa_crypto_se_driver_hal.data
index 57aa47f..e6482dd 100644
--- a/tests/suites/test_suite_psa_crypto_se_driver_hal.data
+++ b/tests/suites/test_suite_psa_crypto_se_driver_hal.data
@@ -40,13 +40,19 @@
 key_creation_import_export:3:1
 
 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_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_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:PSA_KEY_TYPE_AES:PSA_ALG_CTR:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
diff --git a/tests/suites/test_suite_psa_crypto_se_driver_hal.function b/tests/suites/test_suite_psa_crypto_se_driver_hal.function
index 8924ae1..0fab043 100644
--- a/tests/suites/test_suite_psa_crypto_se_driver_hal.function
+++ b/tests/suites/test_suite_psa_crypto_se_driver_hal.function
@@ -550,6 +550,7 @@
 
 /* BEGIN_CASE */
 void key_creation_in_chosen_slot( int slot_arg,
+                                  int restart,
                                   int expected_status_arg )
 {
     psa_key_slot_number_t wanted_slot = slot_arg;
@@ -587,18 +588,27 @@
                              &handle );
     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. */
-        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 ) );
+        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_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:
     PSA_DONE( );
     ram_slots_reset( );