Skip to content

Commit b16d54b

Browse files
committed
Add missing psa_destroy_key call
1 parent a967ede commit b16d54b

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

tests/suites/test_suite_psa_crypto_se_driver_hal_mocks.function

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,12 @@ void mock_generate( int mock_generate_return_value, int expected_result )
367367
TEST_ASSERT( psa_generate_key( &attributes, &handle ) == expected_result );
368368
TEST_ASSERT( mock_generate_data.called == 1 );
369369

370+
if( expected_result == PSA_SUCCESS )
371+
{
372+
PSA_ASSERT( psa_destroy_key( handle ) );
373+
TEST_ASSERT( mock_destroy_data.called == 1 );
374+
}
375+
370376
exit:
371377
PSA_DONE( );
372378
mock_teardown( );
@@ -414,6 +420,10 @@ void mock_export_public( int mock_export_public_return_value,
414420
&exported_length ) == expected_result );
415421
TEST_ASSERT( mock_export_public_data.called == 1 );
416422

423+
PSA_ASSERT( psa_destroy_key( handle ) );
424+
425+
TEST_ASSERT( mock_destroy_data.called == 1 );
426+
417427
exit:
418428
PSA_DONE( );
419429
mock_teardown( );
@@ -468,6 +478,10 @@ void mock_sign( int mock_sign_return_value, int expected_result )
468478
== expected_result );
469479
TEST_ASSERT( mock_sign_data.called == 1 );
470480

481+
PSA_ASSERT( psa_destroy_key( handle ) );
482+
483+
TEST_ASSERT( mock_destroy_data.called == 1 );
484+
471485
exit:
472486
PSA_DONE( );
473487
mock_teardown( );
@@ -520,6 +534,10 @@ void mock_verify( int mock_verify_return_value, int expected_result )
520534
== expected_result );
521535
TEST_ASSERT( mock_verify_data.called == 1 );
522536

537+
PSA_ASSERT( psa_destroy_key( handle ) );
538+
539+
TEST_ASSERT( mock_destroy_data.called == 1 );
540+
523541
exit:
524542
PSA_DONE( );
525543
mock_teardown( );

0 commit comments

Comments
 (0)