mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-04-16 08:42:50 +00:00
Update slot management tests now that {close,destroy}_key(0) succeed
This commit is contained in:
parent
1841cf43ee
commit
04129a0d96
@ -643,12 +643,21 @@ void invalid_handle( )
|
||||
TEST_ASSERT( handle1 != 0 );
|
||||
|
||||
/* Attempt to close and destroy some invalid handles. */
|
||||
TEST_EQUAL( psa_close_key( 0 ), PSA_ERROR_INVALID_HANDLE );
|
||||
if( handle1 - 1 != 0 )
|
||||
{
|
||||
TEST_EQUAL( psa_close_key( handle1 - 1 ), PSA_ERROR_INVALID_HANDLE );
|
||||
TEST_EQUAL( psa_close_key( handle1 + 1 ), PSA_ERROR_INVALID_HANDLE );
|
||||
TEST_EQUAL( psa_destroy_key( 0 ), PSA_ERROR_INVALID_HANDLE );
|
||||
TEST_EQUAL( psa_destroy_key( handle1 - 1 ), PSA_ERROR_INVALID_HANDLE );
|
||||
}
|
||||
if( handle1 + 1 != 0 )
|
||||
{
|
||||
TEST_EQUAL( psa_close_key( handle1 + 1 ), PSA_ERROR_INVALID_HANDLE );
|
||||
TEST_EQUAL( psa_destroy_key( handle1 + 1 ), PSA_ERROR_INVALID_HANDLE );
|
||||
}
|
||||
|
||||
/* 0 is special: it isn't a valid handle, but close/destroy
|
||||
* succeeds on it. */
|
||||
TEST_EQUAL( psa_close_key( 0 ), PSA_SUCCESS );
|
||||
TEST_EQUAL( psa_destroy_key( 0 ), PSA_SUCCESS );
|
||||
|
||||
/* After all this, check that the original handle is intact. */
|
||||
PSA_ASSERT( psa_get_key_attributes( handle1, &attributes ) );
|
||||
|
Loading…
x
Reference in New Issue
Block a user