mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-01-22 14:51:13 +00:00
Test that psa_close_key(0) and psa_destroy_key(0) succeed
This commit is contained in:
parent
2493401af4
commit
f102e4e4f6
|
@ -22,6 +22,24 @@ persistence_attributes:0x1234:3:0x1235:0x1235:3
|
|||
PSA key attributes: slot number
|
||||
slot_number_attribute:
|
||||
|
||||
psa_destroy_key(0)
|
||||
destroy_invalid:0:PSA_SUCCESS
|
||||
|
||||
psa_destroy_key(invalid)
|
||||
destroy_invalid:1:PSA_ERROR_INVALID_HANDLE
|
||||
|
||||
psa_destroy_key(huge)
|
||||
destroy_invalid:-1:PSA_ERROR_INVALID_HANDLE
|
||||
|
||||
psa_close_key(0)
|
||||
close_invalid:0:PSA_SUCCESS
|
||||
|
||||
psa_close_key(invalid)
|
||||
close_invalid:1:PSA_ERROR_INVALID_HANDLE
|
||||
|
||||
psa_close_key(huge)
|
||||
close_invalid:-1:PSA_ERROR_INVALID_HANDLE
|
||||
|
||||
PSA import/export raw: 1 bytes
|
||||
import_export:"2a":PSA_KEY_TYPE_RAW_DATA:PSA_KEY_USAGE_EXPORT:0:8:0:PSA_SUCCESS:1
|
||||
|
||||
|
@ -43,15 +61,6 @@ PSA import/export AES-256
|
|||
depends_on:MBEDTLS_AES_C
|
||||
import_export:"0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef":PSA_KEY_TYPE_AES:PSA_KEY_USAGE_EXPORT:PSA_ALG_CTR:256:0:PSA_SUCCESS:1
|
||||
|
||||
PSA invalid handle (0)
|
||||
invalid_handle:0
|
||||
|
||||
PSA invalid handle (smallest plausible handle)
|
||||
invalid_handle:1
|
||||
|
||||
PSA invalid handle (largest plausible handle)
|
||||
invalid_handle:-1
|
||||
|
||||
PSA import: bad usage flag
|
||||
import_with_policy:PSA_KEY_TYPE_RAW_DATA:0x40000000:0:PSA_ERROR_INVALID_ARGUMENT
|
||||
|
||||
|
|
|
@ -1103,9 +1103,6 @@ static int test_operations_on_invalid_handle( psa_key_handle_t handle )
|
|||
buffer, sizeof( buffer ), &length ),
|
||||
PSA_ERROR_INVALID_HANDLE );
|
||||
|
||||
TEST_EQUAL( psa_close_key( handle ), PSA_ERROR_INVALID_HANDLE );
|
||||
TEST_EQUAL( psa_destroy_key( handle ), PSA_ERROR_INVALID_HANDLE );
|
||||
|
||||
ok = 1;
|
||||
|
||||
exit:
|
||||
|
@ -1271,6 +1268,34 @@ void slot_number_attribute( )
|
|||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void destroy_invalid( int handle_arg, int expected_status_arg )
|
||||
{
|
||||
psa_key_handle_t handle = handle_arg;
|
||||
psa_status_t expected_status = expected_status_arg;
|
||||
|
||||
PSA_ASSERT( psa_crypto_init( ) );
|
||||
TEST_EQUAL( psa_destroy_key( handle ), expected_status );
|
||||
|
||||
exit:
|
||||
PSA_DONE( );
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void close_invalid( int handle_arg, int expected_status_arg )
|
||||
{
|
||||
psa_key_handle_t handle = handle_arg;
|
||||
psa_status_t expected_status = expected_status_arg;
|
||||
|
||||
PSA_ASSERT( psa_crypto_init( ) );
|
||||
TEST_EQUAL( psa_close_key( handle ), expected_status );
|
||||
|
||||
exit:
|
||||
PSA_DONE( );
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void import_with_policy( int type_arg,
|
||||
int usage_arg, int alg_arg,
|
||||
|
@ -1535,17 +1560,6 @@ exit:
|
|||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void invalid_handle( int handle )
|
||||
{
|
||||
PSA_ASSERT( psa_crypto_init( ) );
|
||||
test_operations_on_invalid_handle( handle );
|
||||
|
||||
exit:
|
||||
PSA_DONE( );
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void import_export_public_key( data_t *data,
|
||||
int type_arg,
|
||||
|
|
Loading…
Reference in a new issue