Move library initialization tests to a new test suite
This commit is contained in:
parent
a678f233a7
commit
b309eec4a5
@ -113,6 +113,7 @@ add_test_suite(poly1305)
|
||||
add_test_suite(psa_crypto)
|
||||
add_test_suite(psa_crypto_entropy)
|
||||
add_test_suite(psa_crypto_hash)
|
||||
add_test_suite(psa_crypto_init)
|
||||
add_test_suite(psa_crypto_metadata)
|
||||
add_test_suite(psa_crypto_persistent_key)
|
||||
add_test_suite(psa_crypto_storage_file)
|
||||
|
@ -1,9 +1,6 @@
|
||||
PSA compile-time sanity checks
|
||||
static_checks:
|
||||
|
||||
PSA init/deinit
|
||||
init_deinit:
|
||||
|
||||
PSA fill 250 slots
|
||||
fill_slots:250
|
||||
|
||||
@ -1829,12 +1826,6 @@ PSA generate key: ECC, SECP256R1, incorrect bit size
|
||||
depends_on:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED:MBEDTLS_ECDSA_C
|
||||
generate_key:PSA_KEY_TYPE_ECC_KEYPAIR(PSA_ECC_CURVE_SECP256R1):128:PSA_KEY_USAGE_EXPORT | PSA_KEY_USAGE_SIGN | PSA_KEY_USAGE_VERIFY:PSA_ALG_ECDSA_ANY:PSA_ERROR_INVALID_ARGUMENT
|
||||
|
||||
PSA validate module initialization: random
|
||||
validate_module_init_generate_random:
|
||||
|
||||
PSA validate module initialization: key based
|
||||
validate_module_init_key_based:
|
||||
|
||||
persistent key can be accessed after in-memory deletion: AES, 128 bits, CTR
|
||||
depends_on:MBEDTLS_PK_C:MBEDTLS_PK_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_PSA_CRYPTO_STORAGE_C
|
||||
persistent_key_load_key_from_storage:"2b7e151628aed2a6abf7158809cf4f3c":PSA_KEY_TYPE_AES:128:PSA_KEY_USAGE_EXPORT:PSA_ALG_CTR:IMPORT_KEY:PSA_SUCCESS
|
||||
|
@ -871,22 +871,6 @@ void static_checks( )
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void init_deinit( )
|
||||
{
|
||||
psa_status_t status;
|
||||
int i;
|
||||
for( i = 0; i <= 1; i++ )
|
||||
{
|
||||
status = psa_crypto_init( );
|
||||
TEST_ASSERT( status == PSA_SUCCESS );
|
||||
status = psa_crypto_init( );
|
||||
TEST_ASSERT( status == PSA_SUCCESS );
|
||||
mbedtls_psa_crypto_free( );
|
||||
}
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void fill_slots( int max_arg )
|
||||
{
|
||||
@ -4018,26 +4002,6 @@ exit:
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void validate_module_init_generate_random( )
|
||||
{
|
||||
psa_status_t status;
|
||||
uint8_t random[10] = { 0 };
|
||||
status = psa_generate_random( random, sizeof( random ) );
|
||||
TEST_ASSERT( status == PSA_ERROR_BAD_STATE );
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void validate_module_init_key_based( )
|
||||
{
|
||||
psa_status_t status;
|
||||
uint8_t data[10] = { 0 };
|
||||
status = psa_import_key( 1, PSA_KEY_TYPE_RAW_DATA, data, sizeof( data ) );
|
||||
TEST_ASSERT( status == PSA_ERROR_BAD_STATE );
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE depends_on:MBEDTLS_PSA_CRYPTO_STORAGE_C */
|
||||
void persistent_key_load_key_from_storage( data_t *data, int type_arg,
|
||||
int bits, int usage_arg,
|
||||
|
8
tests/suites/test_suite_psa_crypto_init.data
Normal file
8
tests/suites/test_suite_psa_crypto_init.data
Normal file
@ -0,0 +1,8 @@
|
||||
PSA init/deinit
|
||||
init_deinit:
|
||||
|
||||
PSA validate module initialization: random
|
||||
validate_module_init_generate_random:
|
||||
|
||||
PSA validate module initialization: key based
|
||||
validate_module_init_key_based:
|
50
tests/suites/test_suite_psa_crypto_init.function
Normal file
50
tests/suites/test_suite_psa_crypto_init.function
Normal file
@ -0,0 +1,50 @@
|
||||
/* BEGIN_HEADER */
|
||||
#include <stdint.h>
|
||||
|
||||
#if defined(MBEDTLS_PSA_CRYPTO_SPM)
|
||||
#include "spm/psa_defs.h"
|
||||
#endif
|
||||
#include "psa/crypto.h"
|
||||
|
||||
/* END_HEADER */
|
||||
|
||||
/* BEGIN_DEPENDENCIES
|
||||
* depends_on:MBEDTLS_PSA_CRYPTO_C
|
||||
* END_DEPENDENCIES
|
||||
*/
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void init_deinit( )
|
||||
{
|
||||
psa_status_t status;
|
||||
int i;
|
||||
for( i = 0; i <= 1; i++ )
|
||||
{
|
||||
status = psa_crypto_init( );
|
||||
TEST_ASSERT( status == PSA_SUCCESS );
|
||||
status = psa_crypto_init( );
|
||||
TEST_ASSERT( status == PSA_SUCCESS );
|
||||
mbedtls_psa_crypto_free( );
|
||||
}
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void validate_module_init_generate_random( )
|
||||
{
|
||||
psa_status_t status;
|
||||
uint8_t random[10] = { 0 };
|
||||
status = psa_generate_random( random, sizeof( random ) );
|
||||
TEST_ASSERT( status == PSA_ERROR_BAD_STATE );
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void validate_module_init_key_based( )
|
||||
{
|
||||
psa_status_t status;
|
||||
uint8_t data[10] = { 0 };
|
||||
status = psa_import_key( 1, PSA_KEY_TYPE_RAW_DATA, data, sizeof( data ) );
|
||||
TEST_ASSERT( status == PSA_ERROR_BAD_STATE );
|
||||
}
|
||||
/* END_CASE */
|
Loading…
Reference in New Issue
Block a user