Skip to content

Commit

Permalink
Improve documentation in some tests
Browse files Browse the repository at this point in the history
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
  • Loading branch information
gilles-peskine-arm committed Aug 8, 2024
1 parent d0ba2b0 commit 4c9d43f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tests/suites/test_suite_psa_crypto_init.function
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ void init_deinit(int count)
PSA_ASSERT(status);
PSA_DONE();
}
exit:
PSA_DONE();
}
/* END_CASE */

Expand Down
15 changes: 15 additions & 0 deletions tests/suites/test_suite_psa_crypto_slot_management.function
Original file line number Diff line number Diff line change
Expand Up @@ -855,6 +855,16 @@ exit:
/* END_CASE */

/* BEGIN_CASE depends_on:MAX_VOLATILE_KEYS */
/*
* 1. Fill the key store with volatile keys.
* 2. Check that attempting to create another volatile key fails without
* corrupting the key store.
* 3. Destroy the key specified by key_to_destroy. This is the number of the
* key in creation order (e.g. 0 means the first key that was created).
* It can also be a negative value to count in reverse order (e.g.
* -1 means to destroy the last key that was created).
* 4. Check that creating another volatile key succeeds.
*/
void fill_key_store(int key_to_destroy_arg)
{
mbedtls_svc_key_id_t *keys = NULL;
Expand Down Expand Up @@ -920,6 +930,11 @@ void fill_key_store(int key_to_destroy_arg)
replacement_value, sizeof(replacement_value),
&keys[key_to_destroy]);
PSA_ASSERT(status);
/* Since the key store was full except for one key, the new key must be
* in the same slot in the key store as the destroyed key.
* Since volatile keys IDs are assigned based on which slot contains
* the key, the new key should have the same ID as the destroyed key.
*/
TEST_ASSERT(mbedtls_svc_key_id_equal(reused_id, keys[key_to_destroy]));

/* Check that the keys are not corrupted and destroy them. */
Expand Down

0 comments on commit 4c9d43f

Please sign in to comment.