mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-12-23 19:25:28 +00:00
Remove duplicated tests
Signed-off-by: gabor-mezei-arm <gabor.mezei@arm.com>
This commit is contained in:
parent
0e1d31bf06
commit
7aa1efd919
|
@ -1466,38 +1466,6 @@ PSA symmetric encrypt: 3-key 3DES-ECB, 8 bytes, good
|
||||||
depends_on:PSA_WANT_ALG_ECB_NO_PADDING:PSA_WANT_KEY_TYPE_DES
|
depends_on:PSA_WANT_ALG_ECB_NO_PADDING:PSA_WANT_KEY_TYPE_DES
|
||||||
cipher_encrypt_noiv:PSA_ALG_ECB_NO_PADDING:PSA_KEY_TYPE_DES:"01020407080b0d0ec1c2c4c7c8cbcdce31323437383b3d3e":"c78e2b38139610e3":"817ca7d69b80d86a"
|
cipher_encrypt_noiv:PSA_ALG_ECB_NO_PADDING:PSA_KEY_TYPE_DES:"01020407080b0d0ec1c2c4c7c8cbcdce31323437383b3d3e":"c78e2b38139610e3":"817ca7d69b80d86a"
|
||||||
|
|
||||||
PSA symmetric encrypt sanity: AES-CBC-nopad, 16 bytes, good
|
|
||||||
depends_on:PSA_WANT_ALG_CBC_NO_PADDING:PSA_WANT_KEY_TYPE_AES
|
|
||||||
cipher_encrypt_sanity:PSA_ALG_CBC_NO_PADDING:PSA_KEY_TYPE_AES:"2b7e151628aed2a6abf7158809cf4f3c":"6bc1bee22e409f96e93d7e117393172a"
|
|
||||||
|
|
||||||
PSA symmetric encrypt sanity: AES-CBC-PKCS#7, 16 bytes, good
|
|
||||||
depends_on:PSA_WANT_ALG_CBC_NO_PADDING:PSA_WANT_KEY_TYPE_AES
|
|
||||||
cipher_encrypt_sanity:PSA_ALG_CBC_PKCS7:PSA_KEY_TYPE_AES:"2b7e151628aed2a6abf7158809cf4f3c":"6bc1bee22e409f96e93d7e117393172a"
|
|
||||||
|
|
||||||
PSA symmetric encrypt sanity: AES-CBC-PKCS#7, 15 bytes, good
|
|
||||||
depends_on:PSA_WANT_ALG_CBC_PKCS7:PSA_WANT_KEY_TYPE_AES
|
|
||||||
cipher_encrypt_sanity:PSA_ALG_CBC_PKCS7:PSA_KEY_TYPE_AES:"2b7e151628aed2a6abf7158809cf4f3c":"6bc1bee22e409f96e93d7e11739317"
|
|
||||||
|
|
||||||
PSA symmetric encrypt sanity: AES-CTR, 16 bytes, good
|
|
||||||
depends_on:PSA_WANT_ALG_CTR:PSA_WANT_KEY_TYPE_AES
|
|
||||||
cipher_encrypt_sanity:PSA_ALG_CTR:PSA_KEY_TYPE_AES:"2b7e151628aed2a6abf7158809cf4f3c":"6bc1bee22e409f96e93d7e117393172a"
|
|
||||||
|
|
||||||
PSA symmetric encrypt sanity: AES-CTR, 15 bytes, good
|
|
||||||
depends_on:PSA_WANT_ALG_CTR:PSA_WANT_KEY_TYPE_AES
|
|
||||||
cipher_encrypt_sanity:PSA_ALG_CTR:PSA_KEY_TYPE_AES:"2b7e151628aed2a6abf7158809cf4f3c":"6bc1bee22e409f96e93d7e11739317"
|
|
||||||
|
|
||||||
PSA symmetric encrypt sanity: DES-CBC-nopad, 8 bytes, good
|
|
||||||
depends_on:PSA_WANT_ALG_CBC_NO_PADDING:PSA_WANT_KEY_TYPE_DES
|
|
||||||
cipher_encrypt_sanity:PSA_ALG_CBC_NO_PADDING:PSA_KEY_TYPE_DES:"01020407080b0d0e":"eda4011239bc3ac9"
|
|
||||||
|
|
||||||
PSA symmetric encrypt sanity: 2-key 3DES-CBC-nopad, 8 bytes, good
|
|
||||||
depends_on:PSA_WANT_ALG_CBC_NO_PADDING:PSA_WANT_KEY_TYPE_DES
|
|
||||||
cipher_encrypt_sanity:PSA_ALG_CBC_NO_PADDING:PSA_KEY_TYPE_DES:"01020407080b0d0ec1c2c4c7c8cbcdce":"eda4011239bc3ac9"
|
|
||||||
|
|
||||||
PSA symmetric encrypt sanity: 3-key 3DES-CBC-nopad, 8 bytes, good
|
|
||||||
depends_on:PSA_WANT_ALG_CBC_NO_PADDING:PSA_WANT_KEY_TYPE_DES
|
|
||||||
cipher_encrypt_sanity:PSA_ALG_CBC_NO_PADDING:PSA_KEY_TYPE_DES:"01020407080b0d0ec1c2c4c7c8cbcdce31323437383b3d3e":"eda4011239bc3ac9"
|
|
||||||
|
|
||||||
PSA symmetric encrypt validation: AES-CBC-nopad, 16 bytes, good
|
PSA symmetric encrypt validation: AES-CBC-nopad, 16 bytes, good
|
||||||
depends_on:PSA_WANT_ALG_CBC_NO_PADDING:PSA_WANT_KEY_TYPE_AES
|
depends_on:PSA_WANT_ALG_CBC_NO_PADDING:PSA_WANT_KEY_TYPE_AES
|
||||||
cipher_encrypt_validation:PSA_ALG_CBC_NO_PADDING:PSA_KEY_TYPE_AES:"2b7e151628aed2a6abf7158809cf4f3c":"6bc1bee22e409f96e93d7e117393172a"
|
cipher_encrypt_validation:PSA_ALG_CBC_NO_PADDING:PSA_KEY_TYPE_AES:"2b7e151628aed2a6abf7158809cf4f3c":"6bc1bee22e409f96e93d7e117393172a"
|
||||||
|
@ -1906,14 +1874,6 @@ PSA symmetric encrypt/decrypt multipart: AES-CBC-PKCS#7 padding, 4+12 bytes
|
||||||
depends_on:PSA_WANT_ALG_CBC_PKCS7:PSA_WANT_KEY_TYPE_AES
|
depends_on:PSA_WANT_ALG_CBC_PKCS7:PSA_WANT_KEY_TYPE_AES
|
||||||
cipher_verify_output_multipart:PSA_ALG_CBC_PKCS7:PSA_KEY_TYPE_AES:"2b7e151628aed2a6abf7158809cf4f3c":"a076ec9dfbe47d52afc357336f20743b":4
|
cipher_verify_output_multipart:PSA_ALG_CBC_PKCS7:PSA_KEY_TYPE_AES:"2b7e151628aed2a6abf7158809cf4f3c":"a076ec9dfbe47d52afc357336f20743b":4
|
||||||
|
|
||||||
PSA symmetric encrypt sanity: ChaCha20, K=0 N=0
|
|
||||||
depends_on:PSA_WANT_ALG_STREAM_CIPHER:PSA_WANT_KEY_TYPE_CHACHA20
|
|
||||||
cipher_encrypt_sanity:PSA_ALG_STREAM_CIPHER:PSA_KEY_TYPE_CHACHA20:"0000000000000000000000000000000000000000000000000000000000000000":"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
|
||||||
|
|
||||||
PSA symmetric encrypt sanity: ChaCha20, K=rand N=rand
|
|
||||||
depends_on:PSA_WANT_ALG_STREAM_CIPHER:PSA_WANT_KEY_TYPE_CHACHA20
|
|
||||||
cipher_encrypt_sanity:PSA_ALG_STREAM_CIPHER:PSA_KEY_TYPE_CHACHA20:"4bddc98c551a95395ef719557f813656b566bc45aac04eca3866324cc75489f2":"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
|
||||||
|
|
||||||
PSA symmetric encrypt validation: ChaCha20, K=0 N=0
|
PSA symmetric encrypt validation: ChaCha20, K=0 N=0
|
||||||
depends_on:PSA_WANT_ALG_STREAM_CIPHER:PSA_WANT_KEY_TYPE_CHACHA20
|
depends_on:PSA_WANT_ALG_STREAM_CIPHER:PSA_WANT_KEY_TYPE_CHACHA20
|
||||||
cipher_encrypt_validation:PSA_ALG_STREAM_CIPHER:PSA_KEY_TYPE_CHACHA20:"0000000000000000000000000000000000000000000000000000000000000000":"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
cipher_encrypt_validation:PSA_ALG_STREAM_CIPHER:PSA_KEY_TYPE_CHACHA20:"0000000000000000000000000000000000000000000000000000000000000000":"00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
||||||
|
|
|
@ -2508,48 +2508,6 @@ exit:
|
||||||
}
|
}
|
||||||
/* END_CASE */
|
/* END_CASE */
|
||||||
|
|
||||||
/* BEGIN_CASE */
|
|
||||||
void cipher_encrypt_sanity( int alg_arg,
|
|
||||||
int key_type_arg,
|
|
||||||
data_t *key_data,
|
|
||||||
data_t *input )
|
|
||||||
{
|
|
||||||
mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
|
|
||||||
psa_key_type_t key_type = key_type_arg;
|
|
||||||
psa_algorithm_t alg = alg_arg;
|
|
||||||
unsigned char *output = NULL;
|
|
||||||
size_t output_buffer_size = 0;
|
|
||||||
size_t output_length = 0;
|
|
||||||
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
|
|
||||||
|
|
||||||
PSA_ASSERT( psa_crypto_init( ) );
|
|
||||||
|
|
||||||
psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_ENCRYPT );
|
|
||||||
psa_set_key_algorithm( &attributes, alg );
|
|
||||||
psa_set_key_type( &attributes, key_type );
|
|
||||||
|
|
||||||
output_buffer_size = PSA_CIPHER_ENCRYPT_OUTPUT_SIZE( key_type, alg, input->len );
|
|
||||||
ASSERT_ALLOC( output, output_buffer_size );
|
|
||||||
|
|
||||||
PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
|
|
||||||
&key ) );
|
|
||||||
|
|
||||||
PSA_ASSERT( psa_cipher_encrypt( key, alg, input->x, input->len, output,
|
|
||||||
output_buffer_size, &output_length ) );
|
|
||||||
TEST_ASSERT( output_length <=
|
|
||||||
PSA_CIPHER_ENCRYPT_OUTPUT_SIZE( key_type, alg, input->len ) );
|
|
||||||
TEST_ASSERT( output_length <=
|
|
||||||
PSA_CIPHER_ENCRYPT_OUTPUT_MAX_SIZE( input->len ) );
|
|
||||||
|
|
||||||
/* The one-shot cipher encryption uses generated iv so validating
|
|
||||||
the output is not possible. Only sanity checking is done here. */
|
|
||||||
exit:
|
|
||||||
mbedtls_free( output );
|
|
||||||
psa_destroy_key( key );
|
|
||||||
PSA_DONE( );
|
|
||||||
}
|
|
||||||
/* END_CASE */
|
|
||||||
|
|
||||||
/* BEGIN_CASE */
|
/* BEGIN_CASE */
|
||||||
void cipher_encrypt_validation( int alg_arg,
|
void cipher_encrypt_validation( int alg_arg,
|
||||||
int key_type_arg,
|
int key_type_arg,
|
||||||
|
@ -2585,6 +2543,8 @@ void cipher_encrypt_validation( int alg_arg,
|
||||||
PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
|
PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
|
||||||
&key ) );
|
&key ) );
|
||||||
|
|
||||||
|
/* The one-shot cipher encryption uses generated iv so validating
|
||||||
|
the output is not possible. Validating with multipart encryption. */
|
||||||
PSA_ASSERT( psa_cipher_encrypt( key, alg, input->x, input->len, output1,
|
PSA_ASSERT( psa_cipher_encrypt( key, alg, input->x, input->len, output1,
|
||||||
output1_buffer_size, &output1_length ) );
|
output1_buffer_size, &output1_length ) );
|
||||||
TEST_ASSERT( output1_length <=
|
TEST_ASSERT( output1_length <=
|
||||||
|
|
|
@ -117,30 +117,6 @@ export_key private to public through driver: error
|
||||||
depends_on:PSA_WANT_KEY_TYPE_ECC_KEY_PAIR:PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY:MBEDTLS_PK_PARSE_C:MBEDTLS_PK_WRITE_C:PSA_WANT_ECC_SECP_R1_256
|
depends_on:PSA_WANT_KEY_TYPE_ECC_KEY_PAIR:PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY:MBEDTLS_PK_PARSE_C:MBEDTLS_PK_WRITE_C:PSA_WANT_ECC_SECP_R1_256
|
||||||
export_key:PSA_ERROR_GENERIC_ERROR:"":PSA_KEY_TYPE_ECC_KEY_PAIR(PSA_ECC_FAMILY_SECP_R1):"49c9a8c18c4b885638c431cf1df1c994131609b580d4fd43a0cab17db2f13eee":PSA_KEY_TYPE_ECC_PUBLIC_KEY(PSA_ECC_FAMILY_SECP_R1):"":PSA_ERROR_GENERIC_ERROR
|
export_key:PSA_ERROR_GENERIC_ERROR:"":PSA_KEY_TYPE_ECC_KEY_PAIR(PSA_ECC_FAMILY_SECP_R1):"49c9a8c18c4b885638c431cf1df1c994131609b580d4fd43a0cab17db2f13eee":PSA_KEY_TYPE_ECC_PUBLIC_KEY(PSA_ECC_FAMILY_SECP_R1):"":PSA_ERROR_GENERIC_ERROR
|
||||||
|
|
||||||
PSA symmetric encrypt sanity check: AES-CTR, 16 bytes, good
|
|
||||||
depends_on:PSA_WANT_ALG_CTR:PSA_WANT_KEY_TYPE_AES
|
|
||||||
cipher_encrypt_sanity:PSA_ALG_CTR:PSA_KEY_TYPE_AES:"2b7e151628aed2a6abf7158809cf4f3c":"6bc1bee22e409f96e93d7e117393172a":"":0:PSA_SUCCESS:PSA_SUCCESS
|
|
||||||
|
|
||||||
PSA symmetric encrypt sanity check: AES-CTR, 15 bytes, good
|
|
||||||
depends_on:PSA_WANT_ALG_CTR:PSA_WANT_KEY_TYPE_AES
|
|
||||||
cipher_encrypt_sanity:PSA_ALG_CTR:PSA_KEY_TYPE_AES:"2b7e151628aed2a6abf7158809cf4f3c":"6bc1bee22e409f96e93d7e11739317":"":0:PSA_SUCCESS:PSA_SUCCESS
|
|
||||||
|
|
||||||
PSA symmetric encrypt sanity check: AES-CTR, 16 bytes, fallback
|
|
||||||
depends_on:PSA_WANT_ALG_CTR:PSA_WANT_KEY_TYPE_AES:MBEDTLS_PSA_BUILTIN_CIPHER
|
|
||||||
cipher_encrypt_sanity:PSA_ALG_CTR:PSA_KEY_TYPE_AES:"2b7e151628aed2a6abf7158809cf4f3c":"6bc1bee22e409f96e93d7e117393172a":"":0:PSA_ERROR_NOT_SUPPORTED:PSA_SUCCESS
|
|
||||||
|
|
||||||
PSA symmetric encrypt sanity check: AES-CTR, 15 bytes, fallback
|
|
||||||
depends_on:PSA_WANT_ALG_CTR:PSA_WANT_KEY_TYPE_AES:MBEDTLS_PSA_BUILTIN_CIPHER
|
|
||||||
cipher_encrypt_sanity:PSA_ALG_CTR:PSA_KEY_TYPE_AES:"2b7e151628aed2a6abf7158809cf4f3c":"6bc1bee22e409f96e93d7e11739317":"":0:PSA_ERROR_NOT_SUPPORTED:PSA_SUCCESS
|
|
||||||
|
|
||||||
PSA symmetric encrypt sanity check: AES-CTR, 16 bytes, fake
|
|
||||||
depends_on:PSA_WANT_ALG_CTR:PSA_WANT_KEY_TYPE_AES
|
|
||||||
cipher_encrypt_sanity:PSA_ALG_CTR:PSA_KEY_TYPE_AES:"2b7e151628aed2a6abf7158809cf4f3c":"6bc1bee22e409f96e93d7e117393172a":"d07a6a6e2687feb2":1:PSA_SUCCESS:PSA_SUCCESS
|
|
||||||
|
|
||||||
PSA symmetric encrypt sanity check: AES-CTR, 15 bytes, fake
|
|
||||||
depends_on:PSA_WANT_ALG_CTR:PSA_WANT_KEY_TYPE_AES
|
|
||||||
cipher_encrypt_sanity:PSA_ALG_CTR:PSA_KEY_TYPE_AES:"2b7e151628aed2a6abf7158809cf4f3c":"6bc1bee22e409f96e93d7e11739317":"d07a6a6e2687feb2":1:PSA_SUCCESS:PSA_SUCCESS
|
|
||||||
|
|
||||||
PSA symmetric encrypt validation: AES-CTR, 16 bytes, good
|
PSA symmetric encrypt validation: AES-CTR, 16 bytes, good
|
||||||
depends_on:PSA_WANT_ALG_CTR:PSA_WANT_KEY_TYPE_AES
|
depends_on:PSA_WANT_ALG_CTR:PSA_WANT_KEY_TYPE_AES
|
||||||
cipher_encrypt_validation:PSA_ALG_CTR:PSA_KEY_TYPE_AES:"2b7e151628aed2a6abf7158809cf4f3c":"6bc1bee22e409f96e93d7e117393172a"
|
cipher_encrypt_validation:PSA_ALG_CTR:PSA_KEY_TYPE_AES:"2b7e151628aed2a6abf7158809cf4f3c":"6bc1bee22e409f96e93d7e117393172a"
|
||||||
|
|
|
@ -421,67 +421,6 @@ exit:
|
||||||
}
|
}
|
||||||
/* END_CASE */
|
/* END_CASE */
|
||||||
|
|
||||||
/* BEGIN_CASE */
|
|
||||||
void cipher_encrypt_sanity( int alg_arg,
|
|
||||||
int key_type_arg,
|
|
||||||
data_t *key_data,
|
|
||||||
data_t *input,
|
|
||||||
data_t *expected_output,
|
|
||||||
int mock_output_arg,
|
|
||||||
int force_status_arg,
|
|
||||||
int expected_status_arg )
|
|
||||||
{
|
|
||||||
mbedtls_svc_key_id_t key = MBEDTLS_SVC_KEY_ID_INIT;
|
|
||||||
psa_status_t status;
|
|
||||||
psa_key_type_t key_type = key_type_arg;
|
|
||||||
psa_algorithm_t alg = alg_arg;
|
|
||||||
psa_status_t expected_status = expected_status_arg;
|
|
||||||
psa_status_t force_status = force_status_arg;
|
|
||||||
unsigned char *output = NULL;
|
|
||||||
size_t output_buffer_size = 0;
|
|
||||||
size_t output_length = 0;
|
|
||||||
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
|
|
||||||
mbedtls_test_driver_cipher_hooks = mbedtls_test_driver_cipher_hooks_init();
|
|
||||||
mbedtls_test_driver_cipher_hooks.forced_status = force_status;
|
|
||||||
|
|
||||||
PSA_ASSERT( psa_crypto_init( ) );
|
|
||||||
|
|
||||||
psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_ENCRYPT );
|
|
||||||
psa_set_key_algorithm( &attributes, alg );
|
|
||||||
psa_set_key_type( &attributes, key_type );
|
|
||||||
|
|
||||||
output_buffer_size = PSA_CIPHER_ENCRYPT_OUTPUT_SIZE( key_type, alg, input->len );
|
|
||||||
ASSERT_ALLOC( output, output_buffer_size );
|
|
||||||
|
|
||||||
PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
|
|
||||||
&key ) );
|
|
||||||
|
|
||||||
if( mock_output_arg )
|
|
||||||
{
|
|
||||||
mbedtls_test_driver_cipher_hooks.forced_output = expected_output->x;
|
|
||||||
mbedtls_test_driver_cipher_hooks.forced_output_length = expected_output->len;
|
|
||||||
}
|
|
||||||
|
|
||||||
status = psa_cipher_encrypt( key, alg, input->x, input->len, output,
|
|
||||||
output_buffer_size, &output_length );
|
|
||||||
TEST_EQUAL( mbedtls_test_driver_cipher_hooks.hits, 1 );
|
|
||||||
mbedtls_test_driver_cipher_hooks.hits = 0;
|
|
||||||
|
|
||||||
TEST_EQUAL( status, expected_status );
|
|
||||||
if( expected_status == PSA_SUCCESS && mock_output_arg )
|
|
||||||
{
|
|
||||||
ASSERT_COMPARE( expected_output->x, expected_output->len,
|
|
||||||
output, output_length );
|
|
||||||
}
|
|
||||||
|
|
||||||
exit:
|
|
||||||
mbedtls_free( output );
|
|
||||||
psa_destroy_key( key );
|
|
||||||
PSA_DONE( );
|
|
||||||
mbedtls_test_driver_cipher_hooks = mbedtls_test_driver_cipher_hooks_init();
|
|
||||||
}
|
|
||||||
/* END_CASE */
|
|
||||||
|
|
||||||
/* BEGIN_CASE */
|
/* BEGIN_CASE */
|
||||||
void cipher_encrypt_validation( int alg_arg,
|
void cipher_encrypt_validation( int alg_arg,
|
||||||
int key_type_arg,
|
int key_type_arg,
|
||||||
|
|
Loading…
Reference in a new issue