mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-01-27 15:50:59 +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 );
|
TEST_ASSERT( handle1 != 0 );
|
||||||
|
|
||||||
/* Attempt to close and destroy some invalid handles. */
|
/* 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_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 );
|
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 );
|
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. */
|
/* After all this, check that the original handle is intact. */
|
||||||
PSA_ASSERT( psa_get_key_attributes( handle1, &attributes ) );
|
PSA_ASSERT( psa_get_key_attributes( handle1, &attributes ) );
|
||||||
|
|
Loading…
Reference in a new issue