mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-30 06:54:15 +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
|
PSA init/deinit
|
||||||
init_deinit:
|
init_deinit:2
|
||||||
|
|
||||||
PSA validate module initialization: random
|
No random without init
|
||||||
validate_module_init_generate_random:
|
validate_module_init_generate_random:0
|
||||||
|
|
||||||
PSA validate module initialization: key based
|
No key slot access without init
|
||||||
validate_module_init_key_based:
|
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 */
|
/* BEGIN_CASE */
|
||||||
void init_deinit( )
|
void init_deinit( int count )
|
||||||
{
|
{
|
||||||
psa_status_t status;
|
psa_status_t status;
|
||||||
int i;
|
int i;
|
||||||
for( i = 0; i <= 1; i++ )
|
for( i = 0; i < count; i++ )
|
||||||
{
|
{
|
||||||
status = psa_crypto_init( );
|
status = psa_crypto_init( );
|
||||||
TEST_ASSERT( status == PSA_SUCCESS );
|
TEST_ASSERT( status == PSA_SUCCESS );
|
||||||
@ -30,20 +30,34 @@ void init_deinit( )
|
|||||||
/* END_CASE */
|
/* END_CASE */
|
||||||
|
|
||||||
/* BEGIN_CASE */
|
/* BEGIN_CASE */
|
||||||
void validate_module_init_generate_random( )
|
void validate_module_init_generate_random( int count )
|
||||||
{
|
{
|
||||||
psa_status_t status;
|
psa_status_t status;
|
||||||
uint8_t random[10] = { 0 };
|
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 ) );
|
status = psa_generate_random( random, sizeof( random ) );
|
||||||
TEST_ASSERT( status == PSA_ERROR_BAD_STATE );
|
TEST_ASSERT( status == PSA_ERROR_BAD_STATE );
|
||||||
}
|
}
|
||||||
/* END_CASE */
|
/* END_CASE */
|
||||||
|
|
||||||
/* BEGIN_CASE */
|
/* BEGIN_CASE */
|
||||||
void validate_module_init_key_based( )
|
void validate_module_init_key_based( int count )
|
||||||
{
|
{
|
||||||
psa_status_t status;
|
psa_status_t status;
|
||||||
uint8_t data[10] = { 0 };
|
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 ) );
|
status = psa_import_key( 1, PSA_KEY_TYPE_RAW_DATA, data, sizeof( data ) );
|
||||||
TEST_ASSERT( status == PSA_ERROR_BAD_STATE );
|
TEST_ASSERT( status == PSA_ERROR_BAD_STATE );
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user