Allow skipping AES-192 for alternative implementations in PSA test suite
Signed-off-by: Steven Cooreman <steven.cooreman@silabs.com>
This commit is contained in:
parent
7c9e7da8d4
commit
d588ea1704
1 changed files with 42 additions and 14 deletions
|
@ -4061,6 +4061,7 @@ void aead_encrypt( int key_type_arg, data_t *key_data,
|
|||
size_t output_length = 0;
|
||||
size_t tag_length = PSA_AEAD_TAG_LENGTH( alg );
|
||||
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
|
||||
psa_status_t status = PSA_ERROR_GENERIC_ERROR;
|
||||
|
||||
output_size = input_data->len + tag_length;
|
||||
/* For all currently defined algorithms, PSA_AEAD_ENCRYPT_OUTPUT_SIZE
|
||||
|
@ -4078,13 +4079,26 @@ void aead_encrypt( int key_type_arg, data_t *key_data,
|
|||
PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
|
||||
&key ) );
|
||||
|
||||
PSA_ASSERT( psa_aead_encrypt( key, alg,
|
||||
status = psa_aead_encrypt( key, alg,
|
||||
nonce->x, nonce->len,
|
||||
additional_data->x, additional_data->len,
|
||||
input_data->x, input_data->len,
|
||||
output_data, output_size,
|
||||
&output_length ) );
|
||||
&output_length );
|
||||
|
||||
#if defined(MBEDTLS_AES_ALT) || \
|
||||
defined(MBEDTLS_AES_SETKEY_ENC_ALT) || \
|
||||
defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_AES)
|
||||
if( status == PSA_ERROR_NOT_SUPPORTED &&
|
||||
key_type == PSA_KEY_TYPE_AES &&
|
||||
key_data->len == 24 )
|
||||
{
|
||||
test_skip( "AES-192 not supported", __LINE__, __FILE__ );
|
||||
goto exit;
|
||||
}
|
||||
#endif /* AES could be alternatively implemented */
|
||||
|
||||
PSA_ASSERT( status );
|
||||
ASSERT_COMPARE( expected_result->x, expected_result->len,
|
||||
output_data, output_length );
|
||||
|
||||
|
@ -4113,6 +4127,7 @@ void aead_decrypt( int key_type_arg, data_t *key_data,
|
|||
size_t tag_length = PSA_AEAD_TAG_LENGTH( alg );
|
||||
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
|
||||
psa_status_t expected_result = expected_result_arg;
|
||||
psa_status_t status = PSA_ERROR_GENERIC_ERROR;
|
||||
|
||||
output_size = input_data->len - tag_length;
|
||||
/* For all currently defined algorithms, PSA_AEAD_DECRYPT_OUTPUT_SIZE
|
||||
|
@ -4131,14 +4146,27 @@ void aead_decrypt( int key_type_arg, data_t *key_data,
|
|||
PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
|
||||
&key ) );
|
||||
|
||||
TEST_EQUAL( psa_aead_decrypt( key, alg,
|
||||
status = psa_aead_decrypt( key, alg,
|
||||
nonce->x, nonce->len,
|
||||
additional_data->x,
|
||||
additional_data->len,
|
||||
input_data->x, input_data->len,
|
||||
output_data, output_size,
|
||||
&output_length ),
|
||||
expected_result );
|
||||
&output_length );
|
||||
|
||||
#if defined(MBEDTLS_AES_ALT) || \
|
||||
defined(MBEDTLS_AES_SETKEY_ENC_ALT) || \
|
||||
defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_AES)
|
||||
if( status == PSA_ERROR_NOT_SUPPORTED &&
|
||||
key_type == PSA_KEY_TYPE_AES &&
|
||||
key_data->len == 24 )
|
||||
{
|
||||
test_skip( "AES-192 not supported", __LINE__, __FILE__ );
|
||||
goto exit;
|
||||
}
|
||||
#endif /* AES could be alternatively implemented */
|
||||
|
||||
TEST_EQUAL( status, expected_result );
|
||||
|
||||
if( expected_result == PSA_SUCCESS )
|
||||
ASSERT_COMPARE( expected_data->x, expected_data->len,
|
||||
|
|
Loading…
Reference in a new issue