TF-M Reference Manual  1.2.0
TrustedFirmware-M
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
crypto_tests_common.c File Reference
Include dependency graph for crypto_tests_common.c:

Go to the source code of this file.

Macros

#define NR_TEST_AES_MODE
 
#define KEY_DERIVE_OUTPUT_LEN   32
 
#define KEY_DERIV_SECRET_LEN   16
 
#define KEY_DERIV_LABEL_INFO_LEN   8
 
#define KEY_DERIV_SEED_SALT_LEN   8
 

Functions

void psa_key_interface_test (const psa_key_type_t key_type, struct test_result_t *ret)
 Tests the key interfaces with different key types. More...
 
void psa_cipher_test (const psa_key_type_t key_type, const psa_algorithm_t alg, struct test_result_t *ret)
 Run block ciphering tests with different algorithms and key types. More...
 
void psa_invalid_cipher_test (const psa_key_type_t key_type, const psa_algorithm_t alg, const size_t key_size, struct test_result_t *ret)
 Tests invalid key type and algorithm combinations for block ciphers. More...
 
void psa_unsupported_hash_test (const psa_algorithm_t alg, struct test_result_t *ret)
 Tests setup of an unsupported hash algorithm. More...
 
void psa_hash_test (const psa_algorithm_t alg, struct test_result_t *ret)
 Tests different hashing algorithms. More...
 
void psa_unsupported_mac_test (const psa_key_type_t key_type, const psa_algorithm_t alg, struct test_result_t *ret)
 Tests setup of an unsupported MAC algorithm. More...
 
void psa_mac_test (const psa_algorithm_t alg, uint8_t use_long_key, struct test_result_t *ret)
 Tests different MAC algorithms. More...
 
void psa_aead_test (const psa_key_type_t key_type, const psa_algorithm_t alg, struct test_result_t *ret)
 Run AEAD tests with different algorithms and key types. More...
 
void psa_invalid_key_length_test (struct test_result_t *ret)
 Tests invalid key length. More...
 
void psa_policy_key_interface_test (struct test_result_t *ret)
 Tests the policy key interface. More...
 
void psa_policy_invalid_policy_usage_test (struct test_result_t *ret)
 Tests invalid policy usage. More...
 
void psa_persistent_key_test (psa_key_id_t key_id, struct test_result_t *ret)
 Tests persistent keys. More...
 
void psa_key_derivation_test (psa_algorithm_t deriv_alg, struct test_result_t *ret)
 Key derivation test. More...
 

Macro Definition Documentation

#define KEY_DERIV_LABEL_INFO_LEN   8

Definition at line 1052 of file crypto_tests_common.c.

#define KEY_DERIV_SECRET_LEN   16

Definition at line 1051 of file crypto_tests_common.c.

#define KEY_DERIV_SEED_SALT_LEN   8

Definition at line 1053 of file crypto_tests_common.c.

#define KEY_DERIVE_OUTPUT_LEN   32

Definition at line 1050 of file crypto_tests_common.c.

#define NR_TEST_AES_MODE
Value:
(sizeof(test_aes_mode_array) / \
sizeof(test_aes_mode_array[0]) - 1)

Definition at line 797 of file crypto_tests_common.c.

Function Documentation

void psa_aead_test ( const psa_key_type_t  key_type,
const psa_algorithm_t  alg,
struct test_result_t ret 
)

Run AEAD tests with different algorithms and key types.

Parameters
[in]key_typePSA key type
[in]algPSA algorithm
[out]retTest result

Definition at line 650 of file crypto_tests_common.c.

Here is the call graph for this function:

void psa_cipher_test ( const psa_key_type_t  key_type,
const psa_algorithm_t  alg,
struct test_result_t ret 
)

Run block ciphering tests with different algorithms and key types.

Parameters
[in]key_typePSA key type
[in]algPSA algorithm
[out]retTest result

Definition at line 96 of file crypto_tests_common.c.

Here is the call graph for this function:

void psa_hash_test ( const psa_algorithm_t  alg,
struct test_result_t ret 
)

Tests different hashing algorithms.

Parameters
[in]algPSA algorithm
[out]retTest result

Definition at line 415 of file crypto_tests_common.c.

void psa_invalid_cipher_test ( const psa_key_type_t  key_type,
const psa_algorithm_t  alg,
const size_t  key_size,
struct test_result_t ret 
)

Tests invalid key type and algorithm combinations for block ciphers.

Parameters
[in]key_typePSA key type
[in]algPSA algorithm
[in]key_sizeKey size
[out]retTest result

Definition at line 312 of file crypto_tests_common.c.

Here is the call graph for this function:

void psa_invalid_key_length_test ( struct test_result_t ret)

Tests invalid key length.

Parameters
[out]retTest result

Definition at line 800 of file crypto_tests_common.c.

void psa_key_derivation_test ( psa_algorithm_t  deriv_alg,
struct test_result_t ret 
)

Key derivation test.

Parameters
[in]deriv_algKey derivation algorithm
[out]retTest result

Definition at line 1059 of file crypto_tests_common.c.

Here is the call graph for this function:

void psa_key_interface_test ( const psa_key_type_t  key_type,
struct test_result_t ret 
)

Tests the key interfaces with different key types.

Parameters
[in]key_typePSA key type
[out]retTest result

Definition at line 15 of file crypto_tests_common.c.

void psa_mac_test ( const psa_algorithm_t  alg,
uint8_t  use_long_key,
struct test_result_t ret 
)

Tests different MAC algorithms.

Parameters
[in]algPSA algorithm
[in]use_long_keyFlag used to indicate to use the long test key
[out]retTest result

Definition at line 534 of file crypto_tests_common.c.

void psa_persistent_key_test ( psa_key_id_t  key_id,
struct test_result_t ret 
)

Tests persistent keys.

Parameters
[out]retTest result

Definition at line 973 of file crypto_tests_common.c.

Here is the call graph for this function:

void psa_policy_invalid_policy_usage_test ( struct test_result_t ret)

Tests invalid policy usage.

Parameters
[out]retTest result

Definition at line 884 of file crypto_tests_common.c.

void psa_policy_key_interface_test ( struct test_result_t ret)

Tests the policy key interface.

Parameters
[out]retTest result

Definition at line 827 of file crypto_tests_common.c.

void psa_unsupported_hash_test ( const psa_algorithm_t  alg,
struct test_result_t ret 
)

Tests setup of an unsupported hash algorithm.

Parameters
[in]algPSA algorithm
[out]retTest result

Definition at line 361 of file crypto_tests_common.c.

void psa_unsupported_mac_test ( const psa_key_type_t  key_type,
const psa_algorithm_t  alg,
struct test_result_t ret 
)

Tests setup of an unsupported MAC algorithm.

Parameters
[in]key_typePSA key type
[in]algPSA algorithm
[out]retTest result

Definition at line 464 of file crypto_tests_common.c.