Skip to content

SE keys: fix psa_destroy_key; add Github issue numbers for missing code #221

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prev Previous commit
Next Next commit
SE keys: test that psa_destroy_key removes the key from storage
  • Loading branch information
gilles-peskine-arm committed Aug 13, 2019
commit 8fe253ae4abe8e5f3fb7436cedee09e1ec67cd8d
15 changes: 15 additions & 0 deletions tests/suites/test_suite_psa_crypto_se_driver_hal.function
Original file line number Diff line number Diff line change
Expand Up @@ -793,6 +793,9 @@ void key_creation_import_export( int min_slot, int restart )
exported, exported_length );

PSA_ASSERT( psa_destroy_key( handle ) );
handle = 0;
TEST_EQUAL( psa_open_key( id, &handle ),
PSA_ERROR_DOES_NOT_EXIST );

/* Test that the key has been erased from the designated slot. */
TEST_ASSERT( ram_slots[min_slot].type == 0 );
Expand Down Expand Up @@ -864,6 +867,9 @@ void key_creation_in_chosen_slot( int slot_arg,
PSA_ASSERT( psa_get_key_attributes( handle, &attributes ) );

PSA_ASSERT( psa_destroy_key( handle ) );
handle = 0;
TEST_EQUAL( psa_open_key( id, &handle ),
PSA_ERROR_DOES_NOT_EXIST );

exit:
PSA_DONE( );
Expand Down Expand Up @@ -923,6 +929,9 @@ void import_key_smoke( int type_arg, int alg_arg,

/* We're done. */
PSA_ASSERT( psa_destroy_key( handle ) );
handle = 0;
TEST_EQUAL( psa_open_key( id, &handle ),
PSA_ERROR_DOES_NOT_EXIST );

exit:
PSA_DONE( );
Expand Down Expand Up @@ -1016,6 +1025,9 @@ void generate_key_smoke( int type_arg, int bits_arg, int alg_arg )

/* We're done. */
PSA_ASSERT( psa_destroy_key( handle ) );
handle = 0;
TEST_EQUAL( psa_open_key( id, &handle ),
PSA_ERROR_DOES_NOT_EXIST );

exit:
PSA_DONE( );
Expand Down Expand Up @@ -1250,6 +1262,9 @@ void register_key_smoke_test( int lifetime_arg,
goto exit;
/* This time, destroy the key. */
PSA_ASSERT( psa_destroy_key( handle ) );
handle = 0;
TEST_EQUAL( psa_open_key( id, &handle ),
PSA_ERROR_DOES_NOT_EXIST );

exit:
psa_reset_key_attributes( &attributes );
Expand Down