Lines Matching refs:key
8 /**< Close key(s) */
11 /**< Destroy key(s) */
14 /**< Purge key(s) */
20 /**< Close key(s) then terminate and re-initialize */
23 /**< Destroy key(s) then terminate and re-initialize */
26 /**< Purge key(s) then terminate and re-initialize */
43 /** Apply \p invalidate_method to invalidate the specified key:
47 mbedtls_svc_key_id_t key)
50 /* Closing the key invalidate only volatile keys, not persistent ones. */
53 PSA_ASSERT(psa_close_key(key));
57 PSA_ASSERT(psa_destroy_key(key));
59 /* Purging the key just purges RAM data of persistent keys. */
62 PSA_ASSERT(psa_purge_key(key));
103 /* Artificially restrictable dynamic key store */
118 #else /* Effectively unbounded dynamic key store */
122 #else /* Static key store */
143 mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
149 /* Import a key. */
162 &key));
163 TEST_ASSERT(!mbedtls_svc_key_id_is_null(key));
164 PSA_ASSERT(psa_get_key_attributes(key, &attributes));
172 MBEDTLS_SVC_KEY_ID_GET_KEY_ID(key));
176 MBEDTLS_SVC_KEY_ID_GET_OWNER_ID(key)));
183 * Purge the key and make sure that it is still valid, as purging a
184 * volatile key shouldn't invalidate/destroy it.
186 PSA_ASSERT(psa_purge_key(key));
187 PSA_ASSERT(psa_get_key_attributes(key, &attributes));
191 /* Do something that invalidates the key. */
193 if (!invalidate_key(invalidate_method, key)) {
200 /* Test that the key is now invalid. */
201 TEST_EQUAL(psa_get_key_attributes(key, &attributes),
203 TEST_EQUAL(psa_close_key(key), PSA_ERROR_INVALID_HANDLE);
272 /* Close the key and then open it. */
293 * Do something that wipes key data in volatile memory or destroy the
294 * key.
304 /* Try to reaccess the key. If we destroyed it, check that it doesn't
347 * Test that the key handle and identifier are now not referring to an
348 * existing key.
380 const uint8_t material1[5] = "a key";
381 const uint8_t material2[5] = "b key";
391 /* Create a key. */
405 /* Attempt to create a new key in the same slot. */
415 /* Check that the original key hasn't changed. */
482 * Not possible to set a key identifier different from 0 through
483 * PSA key attributes APIs thus accessing to the attributes
562 /* Copy the key. */
569 /* If the target key is persistent, restart the system to make
609 /* Check that the key is actually non-exportable. */
619 * Source and target key attributes may have been returned by
754 /* Allocate a handle and store a key in it. */
772 * key identifier as the imported key is a volatile key. Volatile
773 * key identifiers are in the range from PSA_KEY_ID_VOLATILE_MIN
871 * 1. Fill the key store with volatile keys.
872 * 2. Check that attempting to create another volatile key fails without
873 * corrupting the key store.
874 * 3. Destroy the key specified by key_to_destroy. This is the number of the
875 * key in creation order (e.g. 0 means the first key that was created).
877 * -1 means to destroy the last key that was created).
878 * 4. Check that creating another volatile key succeeds.
898 /* Account for any system-created volatile key, e.g. for the RNG. */
906 /* Fill the key store. */
937 /* Destroy one key and try again. */
949 /* Since the key store was full except for one key, the new key must be
950 * in the same slot in the key store as the destroyed key.
952 * the key, the new key should have the same ID as the destroyed key.
990 mbedtls_svc_key_id_t key, returned_key_id;
1002 key = mbedtls_svc_key_id_make(i, i + 1);
1003 psa_set_key_id(&attributes, key);
1007 TEST_ASSERT(mbedtls_svc_key_id_equal(returned_key_id, key));
1011 * Create a new persistent or volatile key. When creating the key,
1013 * is removed from the RAM key slots. This makes room to store its
1017 key = mbedtls_svc_key_id_make(i, i + 1);
1018 psa_set_key_id(&attributes, key);
1025 TEST_ASSERT(mbedtls_svc_key_id_equal(returned_key_id, key));
1034 * the description of the persistent key that was evicted from the RAM
1035 * slots when creating the last key is restored in a RAM slot to export
1040 key = mbedtls_svc_key_id_make(i, i + 1);
1042 key = returned_key_id;
1045 PSA_ASSERT(psa_export_key(key,
1050 PSA_ASSERT(psa_destroy_key(key));
1087 * Create a persistent key
1116 * Check that we cannot access the persistent key as all slots are
1118 * persistent key description in a slot to be able to access it.
1124 * Check we can export the volatile key created last and that it has the
1135 * Check that we can now access the persistent key again.
1142 * Check that we cannot copy the persistent key as all slots are occupied
1143 * by the persistent key and the volatile keys and the slot containing the
1144 * persistent key cannot be reclaimed as it contains the key to copy.
1165 * Check we can export the persistent key and that it have the expected