mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-26 20:55:36 +01:00
Test that deinit deactivates random generation and key slots
This commit is contained in:
parent
b309eec4a5
commit
445e225745
@ -1,8 +1,14 @@
|
||||
PSA init/deinit
|
||||
init_deinit:
|
||||
init_deinit:2
|
||||
|
||||
PSA validate module initialization: random
|
||||
validate_module_init_generate_random:
|
||||
No random without init
|
||||
validate_module_init_generate_random:0
|
||||
|
||||
PSA validate module initialization: key based
|
||||
validate_module_init_key_based:
|
||||
No key slot access without init
|
||||
validate_module_init_key_based:0
|
||||
|
||||
No random after deinit
|
||||
validate_module_init_generate_random:1
|
||||
|
||||
No key slot access after deinit
|
||||
validate_module_init_key_based:1
|
||||
|
@ -14,11 +14,11 @@
|
||||
*/
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void init_deinit( )
|
||||
void init_deinit( int count )
|
||||
{
|
||||
psa_status_t status;
|
||||
int i;
|
||||
for( i = 0; i <= 1; i++ )
|
||||
for( i = 0; i < count; i++ )
|
||||
{
|
||||
status = psa_crypto_init( );
|
||||
TEST_ASSERT( status == PSA_SUCCESS );
|
||||
@ -30,20 +30,34 @@ void init_deinit( )
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void validate_module_init_generate_random( )
|
||||
void validate_module_init_generate_random( int count )
|
||||
{
|
||||
psa_status_t status;
|
||||
uint8_t random[10] = { 0 };
|
||||
int i;
|
||||
for( i = 0; i < count; i++ )
|
||||
{
|
||||
status = psa_crypto_init( );
|
||||
TEST_ASSERT( status == PSA_SUCCESS );
|
||||
mbedtls_psa_crypto_free( );
|
||||
}
|
||||
status = psa_generate_random( random, sizeof( random ) );
|
||||
TEST_ASSERT( status == PSA_ERROR_BAD_STATE );
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void validate_module_init_key_based( )
|
||||
void validate_module_init_key_based( int count )
|
||||
{
|
||||
psa_status_t status;
|
||||
uint8_t data[10] = { 0 };
|
||||
int i;
|
||||
for( i = 0; i < count; i++ )
|
||||
{
|
||||
status = psa_crypto_init( );
|
||||
TEST_ASSERT( status == PSA_SUCCESS );
|
||||
mbedtls_psa_crypto_free( );
|
||||
}
|
||||
status = psa_import_key( 1, PSA_KEY_TYPE_RAW_DATA, data, sizeof( data ) );
|
||||
TEST_ASSERT( status == PSA_ERROR_BAD_STATE );
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user