mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-27 16:14:15 +01:00
Merge pull request #62 from gilles-peskine-arm/psa-stream_cipher_update_test
Improve multipart cipher tests: 2 blocks, CTR
This commit is contained in:
commit
548346104a
@ -1012,31 +1012,127 @@ cipher_verify_output:PSA_ALG_CTR:PSA_KEY_TYPE_AES:"2b7e151628aed2a6abf7158809cf4
|
|||||||
|
|
||||||
PSA symmetric encryption multipart: AES-CBC-nopad, 7+9 bytes
|
PSA symmetric encryption multipart: AES-CBC-nopad, 7+9 bytes
|
||||||
depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC
|
depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC
|
||||||
cipher_encrypt_multipart:PSA_ALG_CBC_NO_PADDING:PSA_KEY_TYPE_AES:"2b7e151628aed2a6abf7158809cf4f3c":"6bc1bee22e409f96e93d7e117393172a":7:"a076ec9dfbe47d52afc357336f20743b"
|
cipher_encrypt_multipart:PSA_ALG_CBC_NO_PADDING:PSA_KEY_TYPE_AES:"2b7e151628aed2a6abf7158809cf4f3c":"6bc1bee22e409f96e93d7e117393172a":7:0:16:"a076ec9dfbe47d52afc357336f20743b"
|
||||||
|
|
||||||
PSA symmetric encryption multipart: AES-CBC-nopad, 3+13 bytes
|
PSA symmetric encryption multipart: AES-CBC-nopad, 3+13 bytes
|
||||||
depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC
|
depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC
|
||||||
cipher_encrypt_multipart:PSA_ALG_CBC_NO_PADDING:PSA_KEY_TYPE_AES:"2b7e151628aed2a6abf7158809cf4f3c":"6bc1bee22e409f96e93d7e117393172a":3:"a076ec9dfbe47d52afc357336f20743b"
|
cipher_encrypt_multipart:PSA_ALG_CBC_NO_PADDING:PSA_KEY_TYPE_AES:"2b7e151628aed2a6abf7158809cf4f3c":"6bc1bee22e409f96e93d7e117393172a":3:0:16:"a076ec9dfbe47d52afc357336f20743b"
|
||||||
|
|
||||||
PSA symmetric encryption multipart: AES-CBC-nopad, 4+12 bytes
|
PSA symmetric encryption multipart: AES-CBC-nopad, 4+12 bytes
|
||||||
depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC
|
depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC
|
||||||
cipher_encrypt_multipart:PSA_ALG_CBC_NO_PADDING:PSA_KEY_TYPE_AES:"2b7e151628aed2a6abf7158809cf4f3c":"6bc1bee22e409f96e93d7e117393172a":4:"a076ec9dfbe47d52afc357336f20743b"
|
cipher_encrypt_multipart:PSA_ALG_CBC_NO_PADDING:PSA_KEY_TYPE_AES:"2b7e151628aed2a6abf7158809cf4f3c":"6bc1bee22e409f96e93d7e117393172a":4:0:16:"a076ec9dfbe47d52afc357336f20743b"
|
||||||
|
|
||||||
PSA symmetric encryption multipart: AES-CBC-nopad, 11+5 bytes
|
PSA symmetric encryption multipart: AES-CBC-nopad, 11+5 bytes
|
||||||
depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC
|
depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC
|
||||||
cipher_encrypt_multipart:PSA_ALG_CBC_NO_PADDING:PSA_KEY_TYPE_AES:"2b7e151628aed2a6abf7158809cf4f3c":"6bc1bee22e409f96e93d7e117393172a":11:"a076ec9dfbe47d52afc357336f20743b"
|
cipher_encrypt_multipart:PSA_ALG_CBC_NO_PADDING:PSA_KEY_TYPE_AES:"2b7e151628aed2a6abf7158809cf4f3c":"6bc1bee22e409f96e93d7e117393172a":11:0:16:"a076ec9dfbe47d52afc357336f20743b"
|
||||||
|
|
||||||
|
PSA symmetric encryption multipart: AES-CBC-nopad, 16+16 bytes
|
||||||
|
depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC
|
||||||
|
cipher_encrypt_multipart:PSA_ALG_CBC_NO_PADDING:PSA_KEY_TYPE_AES:"2b7e151628aed2a6abf7158809cf4f3c":"6bc1bee22e409f96e93d7e117393172a5434f378a597bcef1389318c7fc865ef":16:16:16:"a076ec9dfbe47d52afc357336f20743b89906f2f9207ac02aa658cb4ef19c61f"
|
||||||
|
|
||||||
|
PSA symmetric encryption multipart: AES-CBC-nopad, 12+20 bytes
|
||||||
|
depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC
|
||||||
|
cipher_encrypt_multipart:PSA_ALG_CBC_NO_PADDING:PSA_KEY_TYPE_AES:"2b7e151628aed2a6abf7158809cf4f3c":"6bc1bee22e409f96e93d7e117393172a5434f378a597bcef1389318c7fc865ef":12:0:32:"a076ec9dfbe47d52afc357336f20743b89906f2f9207ac02aa658cb4ef19c61f"
|
||||||
|
|
||||||
|
PSA symmetric encryption multipart: AES-CBC-nopad, 20+12 bytes
|
||||||
|
depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC
|
||||||
|
cipher_encrypt_multipart:PSA_ALG_CBC_NO_PADDING:PSA_KEY_TYPE_AES:"2b7e151628aed2a6abf7158809cf4f3c":"6bc1bee22e409f96e93d7e117393172a5434f378a597bcef1389318c7fc865ef":20:16:16:"a076ec9dfbe47d52afc357336f20743b89906f2f9207ac02aa658cb4ef19c61f"
|
||||||
|
|
||||||
|
PSA symmetric encryption multipart: AES-CTR, 11+5 bytes
|
||||||
|
depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CTR
|
||||||
|
cipher_encrypt_multipart:PSA_ALG_CTR:PSA_KEY_TYPE_AES:"2b7e151628aed2a6abf7158809cf4f3c":"6bc1bee22e409f96e93d7e117393172a":11:11:5:"8f9408fe80a81d3e813da3c7b0b2bd32"
|
||||||
|
|
||||||
|
PSA symmetric encryption multipart: AES-CTR, 16+16 bytes
|
||||||
|
depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CTR
|
||||||
|
cipher_encrypt_multipart:PSA_ALG_CTR:PSA_KEY_TYPE_AES:"2b7e151628aed2a6abf7158809cf4f3c":"6bc1bee22e409f96e93d7e117393172a5434f378a597bcef1389318c7fc865ef":16:16:16:"8f9408fe80a81d3e813da3c7b0b2bd321c965bb1de7baf71025f6ef6393ca587"
|
||||||
|
|
||||||
|
PSA symmetric encryption multipart: AES-CTR, 12+20 bytes
|
||||||
|
depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CTR
|
||||||
|
cipher_encrypt_multipart:PSA_ALG_CTR:PSA_KEY_TYPE_AES:"2b7e151628aed2a6abf7158809cf4f3c":"6bc1bee22e409f96e93d7e117393172a5434f378a597bcef1389318c7fc865ef":12:12:20:"8f9408fe80a81d3e813da3c7b0b2bd321c965bb1de7baf71025f6ef6393ca587"
|
||||||
|
|
||||||
|
PSA symmetric encryption multipart: AES-CTR, 20+12 bytes
|
||||||
|
depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CTR
|
||||||
|
cipher_encrypt_multipart:PSA_ALG_CTR:PSA_KEY_TYPE_AES:"2b7e151628aed2a6abf7158809cf4f3c":"6bc1bee22e409f96e93d7e117393172a5434f378a597bcef1389318c7fc865ef":20:20:12:"8f9408fe80a81d3e813da3c7b0b2bd321c965bb1de7baf71025f6ef6393ca587"
|
||||||
|
|
||||||
|
PSA symmetric encryption multipart: AES-CTR, 12+10 bytes
|
||||||
|
depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CTR
|
||||||
|
cipher_encrypt_multipart:PSA_ALG_CTR:PSA_KEY_TYPE_AES:"2b7e151628aed2a6abf7158809cf4f3c":"6bc1bee22e409f96e93d7e117393172a5434f378a597":12:12:10:"8f9408fe80a81d3e813da3c7b0b2bd321c965bb1de7b"
|
||||||
|
|
||||||
|
PSA symmetric encryption multipart: AES-CTR, 0+15 bytes
|
||||||
|
depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CTR
|
||||||
|
cipher_encrypt_multipart:PSA_ALG_CTR:PSA_KEY_TYPE_AES:"2b7e151628aed2a6abf7158809cf4f3c":"6bc1bee22e409f96e93d7e11739317":0:0:15:"8f9408fe80a81d3e813da3c7b0b2bd"
|
||||||
|
|
||||||
|
PSA symmetric encryption multipart: AES-CTR, 15+0 bytes
|
||||||
|
depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CTR
|
||||||
|
cipher_encrypt_multipart:PSA_ALG_CTR:PSA_KEY_TYPE_AES:"2b7e151628aed2a6abf7158809cf4f3c":"6bc1bee22e409f96e93d7e11739317":15:15:0:"8f9408fe80a81d3e813da3c7b0b2bd"
|
||||||
|
|
||||||
|
PSA symmetric encryption multipart: AES-CTR, 0+16 bytes
|
||||||
|
depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CTR
|
||||||
|
cipher_encrypt_multipart:PSA_ALG_CTR:PSA_KEY_TYPE_AES:"2b7e151628aed2a6abf7158809cf4f3c":"6bc1bee22e409f96e93d7e117393172a":0:0:16:"8f9408fe80a81d3e813da3c7b0b2bd32"
|
||||||
|
|
||||||
|
PSA symmetric encryption multipart: AES-CTR, 16+0 bytes
|
||||||
|
depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CTR
|
||||||
|
cipher_encrypt_multipart:PSA_ALG_CTR:PSA_KEY_TYPE_AES:"2b7e151628aed2a6abf7158809cf4f3c":"6bc1bee22e409f96e93d7e117393172a":16:16:0:"8f9408fe80a81d3e813da3c7b0b2bd32"
|
||||||
|
|
||||||
PSA symmetric decryption multipart: AES-CBC-nopad, 7+9 bytes
|
PSA symmetric decryption multipart: AES-CBC-nopad, 7+9 bytes
|
||||||
depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC
|
depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC
|
||||||
cipher_decrypt_multipart:PSA_ALG_CBC_NO_PADDING:PSA_KEY_TYPE_AES:"2b7e151628aed2a6abf7158809cf4f3c":"a076ec9dfbe47d52afc357336f20743b":7:"6bc1bee22e409f96e93d7e117393172a"
|
cipher_decrypt_multipart:PSA_ALG_CBC_NO_PADDING:PSA_KEY_TYPE_AES:"2b7e151628aed2a6abf7158809cf4f3c":"a076ec9dfbe47d52afc357336f20743b":7:0:16:"6bc1bee22e409f96e93d7e117393172a"
|
||||||
|
|
||||||
PSA symmetric decryption multipart: AES-CBC-nopad, 3+13 bytes
|
PSA symmetric decryption multipart: AES-CBC-nopad, 3+13 bytes
|
||||||
depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC
|
depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC
|
||||||
cipher_decrypt_multipart:PSA_ALG_CBC_NO_PADDING:PSA_KEY_TYPE_AES:"2b7e151628aed2a6abf7158809cf4f3c":"a076ec9dfbe47d52afc357336f20743b":3:"6bc1bee22e409f96e93d7e117393172a"
|
cipher_decrypt_multipart:PSA_ALG_CBC_NO_PADDING:PSA_KEY_TYPE_AES:"2b7e151628aed2a6abf7158809cf4f3c":"a076ec9dfbe47d52afc357336f20743b":3:0:16:"6bc1bee22e409f96e93d7e117393172a"
|
||||||
|
|
||||||
PSA symmetric decryption multipart: AES-CBC-nopad, 11+5 bytes
|
PSA symmetric decryption multipart: AES-CBC-nopad, 11+5 bytes
|
||||||
depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC
|
depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC
|
||||||
cipher_decrypt_multipart:PSA_ALG_CBC_NO_PADDING:PSA_KEY_TYPE_AES:"2b7e151628aed2a6abf7158809cf4f3c":"a076ec9dfbe47d52afc357336f20743b":11:"6bc1bee22e409f96e93d7e117393172a"
|
cipher_decrypt_multipart:PSA_ALG_CBC_NO_PADDING:PSA_KEY_TYPE_AES:"2b7e151628aed2a6abf7158809cf4f3c":"a076ec9dfbe47d52afc357336f20743b":11:0:16:"6bc1bee22e409f96e93d7e117393172a"
|
||||||
|
|
||||||
|
PSA symmetric decryption multipart: AES-CBC-nopad, 16+16 bytes
|
||||||
|
depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC
|
||||||
|
cipher_decrypt_multipart:PSA_ALG_CBC_NO_PADDING:PSA_KEY_TYPE_AES:"2b7e151628aed2a6abf7158809cf4f3c":"a076ec9dfbe47d52afc357336f20743b89906f2f9207ac02aa658cb4ef19c61f":16:16:16:"6bc1bee22e409f96e93d7e117393172a5434f378a597bcef1389318c7fc865ef"
|
||||||
|
|
||||||
|
PSA symmetric decryption multipart: AES-CBC-nopad, 12+20 bytes
|
||||||
|
depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC
|
||||||
|
cipher_decrypt_multipart:PSA_ALG_CBC_NO_PADDING:PSA_KEY_TYPE_AES:"2b7e151628aed2a6abf7158809cf4f3c":"a076ec9dfbe47d52afc357336f20743b89906f2f9207ac02aa658cb4ef19c61f":12:0:32:"6bc1bee22e409f96e93d7e117393172a5434f378a597bcef1389318c7fc865ef"
|
||||||
|
|
||||||
|
PSA symmetric decryption multipart: AES-CBC-nopad, 20+12 bytes
|
||||||
|
depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC
|
||||||
|
cipher_decrypt_multipart:PSA_ALG_CBC_NO_PADDING:PSA_KEY_TYPE_AES:"2b7e151628aed2a6abf7158809cf4f3c":"a076ec9dfbe47d52afc357336f20743b89906f2f9207ac02aa658cb4ef19c61f":20:16:16:"6bc1bee22e409f96e93d7e117393172a5434f378a597bcef1389318c7fc865ef"
|
||||||
|
|
||||||
|
PSA symmetric encryption multipart: AES-CTR, 11+5 bytes
|
||||||
|
depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CTR
|
||||||
|
cipher_decrypt_multipart:PSA_ALG_CTR:PSA_KEY_TYPE_AES:"2b7e151628aed2a6abf7158809cf4f3c":"6bc1bee22e409f96e93d7e117393172a":11:11:5:"8f9408fe80a81d3e813da3c7b0b2bd32"
|
||||||
|
|
||||||
|
PSA symmetric encryption multipart: AES-CTR, 16+16 bytes
|
||||||
|
depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CTR
|
||||||
|
cipher_decrypt_multipart:PSA_ALG_CTR:PSA_KEY_TYPE_AES:"2b7e151628aed2a6abf7158809cf4f3c":"6bc1bee22e409f96e93d7e117393172a5434f378a597bcef1389318c7fc865ef":16:16:16:"8f9408fe80a81d3e813da3c7b0b2bd321c965bb1de7baf71025f6ef6393ca587"
|
||||||
|
|
||||||
|
PSA symmetric encryption multipart: AES-CTR, 12+20 bytes
|
||||||
|
depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CTR
|
||||||
|
cipher_decrypt_multipart:PSA_ALG_CTR:PSA_KEY_TYPE_AES:"2b7e151628aed2a6abf7158809cf4f3c":"6bc1bee22e409f96e93d7e117393172a5434f378a597bcef1389318c7fc865ef":12:12:20:"8f9408fe80a81d3e813da3c7b0b2bd321c965bb1de7baf71025f6ef6393ca587"
|
||||||
|
|
||||||
|
PSA symmetric encryption multipart: AES-CTR, 20+12 bytes
|
||||||
|
depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CTR
|
||||||
|
cipher_decrypt_multipart:PSA_ALG_CTR:PSA_KEY_TYPE_AES:"2b7e151628aed2a6abf7158809cf4f3c":"6bc1bee22e409f96e93d7e117393172a5434f378a597bcef1389318c7fc865ef":20:20:12:"8f9408fe80a81d3e813da3c7b0b2bd321c965bb1de7baf71025f6ef6393ca587"
|
||||||
|
|
||||||
|
PSA symmetric encryption multipart: AES-CTR, 12+10 bytes
|
||||||
|
depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CTR
|
||||||
|
cipher_decrypt_multipart:PSA_ALG_CTR:PSA_KEY_TYPE_AES:"2b7e151628aed2a6abf7158809cf4f3c":"6bc1bee22e409f96e93d7e117393172a5434f378a597":12:12:10:"8f9408fe80a81d3e813da3c7b0b2bd321c965bb1de7b"
|
||||||
|
|
||||||
|
PSA symmetric decryption multipart: AES-CTR, 0+15 bytes
|
||||||
|
depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CTR
|
||||||
|
cipher_decrypt_multipart:PSA_ALG_CTR:PSA_KEY_TYPE_AES:"2b7e151628aed2a6abf7158809cf4f3c":"6bc1bee22e409f96e93d7e11739317":0:0:15:"8f9408fe80a81d3e813da3c7b0b2bd"
|
||||||
|
|
||||||
|
PSA symmetric decryption multipart: AES-CTR, 15+0 bytes
|
||||||
|
depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CTR
|
||||||
|
cipher_decrypt_multipart:PSA_ALG_CTR:PSA_KEY_TYPE_AES:"2b7e151628aed2a6abf7158809cf4f3c":"6bc1bee22e409f96e93d7e11739317":15:15:0:"8f9408fe80a81d3e813da3c7b0b2bd"
|
||||||
|
|
||||||
|
PSA symmetric decryption multipart: AES-CTR, 0+16 bytes
|
||||||
|
depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CTR
|
||||||
|
cipher_decrypt_multipart:PSA_ALG_CTR:PSA_KEY_TYPE_AES:"2b7e151628aed2a6abf7158809cf4f3c":"6bc1bee22e409f96e93d7e117393172a":0:0:16:"8f9408fe80a81d3e813da3c7b0b2bd32"
|
||||||
|
|
||||||
|
PSA symmetric decryption multipart: AES-CTR, 16+0 bytes
|
||||||
|
depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CTR
|
||||||
|
cipher_decrypt_multipart:PSA_ALG_CTR:PSA_KEY_TYPE_AES:"2b7e151628aed2a6abf7158809cf4f3c":"6bc1bee22e409f96e93d7e117393172a":16:16:0:"8f9408fe80a81d3e813da3c7b0b2bd32"
|
||||||
|
|
||||||
PSA symmetric encrypt/decrypt multipart: AES-CBC-nopad, 11+5 bytes
|
PSA symmetric encrypt/decrypt multipart: AES-CBC-nopad, 11+5 bytes
|
||||||
depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC
|
depends_on:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC
|
||||||
|
@ -2415,8 +2415,8 @@ void cipher_encrypt( int alg_arg, int key_type_arg,
|
|||||||
&function_output_length ) );
|
&function_output_length ) );
|
||||||
total_output_length += function_output_length;
|
total_output_length += function_output_length;
|
||||||
status = psa_cipher_finish( &operation,
|
status = psa_cipher_finish( &operation,
|
||||||
output + function_output_length,
|
output + total_output_length,
|
||||||
output_buffer_size,
|
output_buffer_size - total_output_length,
|
||||||
&function_output_length );
|
&function_output_length );
|
||||||
total_output_length += function_output_length;
|
total_output_length += function_output_length;
|
||||||
|
|
||||||
@ -2439,12 +2439,16 @@ exit:
|
|||||||
void cipher_encrypt_multipart( int alg_arg, int key_type_arg,
|
void cipher_encrypt_multipart( int alg_arg, int key_type_arg,
|
||||||
data_t *key,
|
data_t *key,
|
||||||
data_t *input,
|
data_t *input,
|
||||||
int first_part_size,
|
int first_part_size_arg,
|
||||||
|
int output1_length_arg, int output2_length_arg,
|
||||||
data_t *expected_output )
|
data_t *expected_output )
|
||||||
{
|
{
|
||||||
psa_key_handle_t handle = 0;
|
psa_key_handle_t handle = 0;
|
||||||
psa_key_type_t key_type = key_type_arg;
|
psa_key_type_t key_type = key_type_arg;
|
||||||
psa_algorithm_t alg = alg_arg;
|
psa_algorithm_t alg = alg_arg;
|
||||||
|
size_t first_part_size = first_part_size_arg;
|
||||||
|
size_t output1_length = output1_length_arg;
|
||||||
|
size_t output2_length = output2_length_arg;
|
||||||
unsigned char iv[16] = {0};
|
unsigned char iv[16] = {0};
|
||||||
size_t iv_size;
|
size_t iv_size;
|
||||||
unsigned char *output = NULL;
|
unsigned char *output = NULL;
|
||||||
@ -2475,20 +2479,23 @@ void cipher_encrypt_multipart( int alg_arg, int key_type_arg,
|
|||||||
PSA_BLOCK_CIPHER_BLOCK_SIZE( key_type ) );
|
PSA_BLOCK_CIPHER_BLOCK_SIZE( key_type ) );
|
||||||
ASSERT_ALLOC( output, output_buffer_size );
|
ASSERT_ALLOC( output, output_buffer_size );
|
||||||
|
|
||||||
TEST_ASSERT( (unsigned int) first_part_size < input->len );
|
TEST_ASSERT( first_part_size <= input->len );
|
||||||
PSA_ASSERT( psa_cipher_update( &operation, input->x, first_part_size,
|
PSA_ASSERT( psa_cipher_update( &operation, input->x, first_part_size,
|
||||||
output, output_buffer_size,
|
output, output_buffer_size,
|
||||||
&function_output_length ) );
|
&function_output_length ) );
|
||||||
|
TEST_ASSERT( function_output_length == output1_length );
|
||||||
total_output_length += function_output_length;
|
total_output_length += function_output_length;
|
||||||
PSA_ASSERT( psa_cipher_update( &operation,
|
PSA_ASSERT( psa_cipher_update( &operation,
|
||||||
input->x + first_part_size,
|
input->x + first_part_size,
|
||||||
input->len - first_part_size,
|
input->len - first_part_size,
|
||||||
output, output_buffer_size,
|
output + total_output_length,
|
||||||
|
output_buffer_size - total_output_length,
|
||||||
&function_output_length ) );
|
&function_output_length ) );
|
||||||
|
TEST_ASSERT( function_output_length == output2_length );
|
||||||
total_output_length += function_output_length;
|
total_output_length += function_output_length;
|
||||||
PSA_ASSERT( psa_cipher_finish( &operation,
|
PSA_ASSERT( psa_cipher_finish( &operation,
|
||||||
output + function_output_length,
|
output + total_output_length,
|
||||||
output_buffer_size,
|
output_buffer_size - total_output_length,
|
||||||
&function_output_length ) );
|
&function_output_length ) );
|
||||||
total_output_length += function_output_length;
|
total_output_length += function_output_length;
|
||||||
PSA_ASSERT( psa_cipher_abort( &operation ) );
|
PSA_ASSERT( psa_cipher_abort( &operation ) );
|
||||||
@ -2507,13 +2514,17 @@ exit:
|
|||||||
void cipher_decrypt_multipart( int alg_arg, int key_type_arg,
|
void cipher_decrypt_multipart( int alg_arg, int key_type_arg,
|
||||||
data_t *key,
|
data_t *key,
|
||||||
data_t *input,
|
data_t *input,
|
||||||
int first_part_size,
|
int first_part_size_arg,
|
||||||
|
int output1_length_arg, int output2_length_arg,
|
||||||
data_t *expected_output )
|
data_t *expected_output )
|
||||||
{
|
{
|
||||||
psa_key_handle_t handle = 0;
|
psa_key_handle_t handle = 0;
|
||||||
|
|
||||||
psa_key_type_t key_type = key_type_arg;
|
psa_key_type_t key_type = key_type_arg;
|
||||||
psa_algorithm_t alg = alg_arg;
|
psa_algorithm_t alg = alg_arg;
|
||||||
|
size_t first_part_size = first_part_size_arg;
|
||||||
|
size_t output1_length = output1_length_arg;
|
||||||
|
size_t output2_length = output2_length_arg;
|
||||||
unsigned char iv[16] = {0};
|
unsigned char iv[16] = {0};
|
||||||
size_t iv_size;
|
size_t iv_size;
|
||||||
unsigned char *output = NULL;
|
unsigned char *output = NULL;
|
||||||
@ -2545,21 +2556,24 @@ void cipher_decrypt_multipart( int alg_arg, int key_type_arg,
|
|||||||
PSA_BLOCK_CIPHER_BLOCK_SIZE( key_type ) );
|
PSA_BLOCK_CIPHER_BLOCK_SIZE( key_type ) );
|
||||||
ASSERT_ALLOC( output, output_buffer_size );
|
ASSERT_ALLOC( output, output_buffer_size );
|
||||||
|
|
||||||
TEST_ASSERT( (unsigned int) first_part_size < input->len );
|
TEST_ASSERT( first_part_size <= input->len );
|
||||||
PSA_ASSERT( psa_cipher_update( &operation,
|
PSA_ASSERT( psa_cipher_update( &operation,
|
||||||
input->x, first_part_size,
|
input->x, first_part_size,
|
||||||
output, output_buffer_size,
|
output, output_buffer_size,
|
||||||
&function_output_length ) );
|
&function_output_length ) );
|
||||||
|
TEST_ASSERT( function_output_length == output1_length );
|
||||||
total_output_length += function_output_length;
|
total_output_length += function_output_length;
|
||||||
PSA_ASSERT( psa_cipher_update( &operation,
|
PSA_ASSERT( psa_cipher_update( &operation,
|
||||||
input->x + first_part_size,
|
input->x + first_part_size,
|
||||||
input->len - first_part_size,
|
input->len - first_part_size,
|
||||||
output, output_buffer_size,
|
output + total_output_length,
|
||||||
|
output_buffer_size - total_output_length,
|
||||||
&function_output_length ) );
|
&function_output_length ) );
|
||||||
|
TEST_ASSERT( function_output_length == output2_length );
|
||||||
total_output_length += function_output_length;
|
total_output_length += function_output_length;
|
||||||
PSA_ASSERT( psa_cipher_finish( &operation,
|
PSA_ASSERT( psa_cipher_finish( &operation,
|
||||||
output + function_output_length,
|
output + total_output_length,
|
||||||
output_buffer_size,
|
output_buffer_size - total_output_length,
|
||||||
&function_output_length ) );
|
&function_output_length ) );
|
||||||
total_output_length += function_output_length;
|
total_output_length += function_output_length;
|
||||||
PSA_ASSERT( psa_cipher_abort( &operation ) );
|
PSA_ASSERT( psa_cipher_abort( &operation ) );
|
||||||
@ -2622,8 +2636,8 @@ void cipher_decrypt( int alg_arg, int key_type_arg,
|
|||||||
&function_output_length ) );
|
&function_output_length ) );
|
||||||
total_output_length += function_output_length;
|
total_output_length += function_output_length;
|
||||||
status = psa_cipher_finish( &operation,
|
status = psa_cipher_finish( &operation,
|
||||||
output + function_output_length,
|
output + total_output_length,
|
||||||
output_buffer_size,
|
output_buffer_size - total_output_length,
|
||||||
&function_output_length );
|
&function_output_length );
|
||||||
total_output_length += function_output_length;
|
total_output_length += function_output_length;
|
||||||
TEST_EQUAL( status, expected_status );
|
TEST_EQUAL( status, expected_status );
|
||||||
@ -2689,7 +2703,8 @@ void cipher_verify_output( int alg_arg, int key_type_arg,
|
|||||||
output1, output1_size,
|
output1, output1_size,
|
||||||
&output1_length ) );
|
&output1_length ) );
|
||||||
PSA_ASSERT( psa_cipher_finish( &operation1,
|
PSA_ASSERT( psa_cipher_finish( &operation1,
|
||||||
output1 + output1_length, output1_size,
|
output1 + output1_length,
|
||||||
|
output1_size - output1_length,
|
||||||
&function_output_length ) );
|
&function_output_length ) );
|
||||||
|
|
||||||
output1_length += function_output_length;
|
output1_length += function_output_length;
|
||||||
@ -2707,7 +2722,7 @@ void cipher_verify_output( int alg_arg, int key_type_arg,
|
|||||||
function_output_length = 0;
|
function_output_length = 0;
|
||||||
PSA_ASSERT( psa_cipher_finish( &operation2,
|
PSA_ASSERT( psa_cipher_finish( &operation2,
|
||||||
output2 + output2_length,
|
output2 + output2_length,
|
||||||
output2_size,
|
output2_size - output2_length,
|
||||||
&function_output_length ) );
|
&function_output_length ) );
|
||||||
|
|
||||||
output2_length += function_output_length;
|
output2_length += function_output_length;
|
||||||
@ -2729,11 +2744,12 @@ void cipher_verify_output_multipart( int alg_arg,
|
|||||||
int key_type_arg,
|
int key_type_arg,
|
||||||
data_t *key,
|
data_t *key,
|
||||||
data_t *input,
|
data_t *input,
|
||||||
int first_part_size )
|
int first_part_size_arg )
|
||||||
{
|
{
|
||||||
psa_key_handle_t handle = 0;
|
psa_key_handle_t handle = 0;
|
||||||
psa_key_type_t key_type = key_type_arg;
|
psa_key_type_t key_type = key_type_arg;
|
||||||
psa_algorithm_t alg = alg_arg;
|
psa_algorithm_t alg = alg_arg;
|
||||||
|
size_t first_part_size = first_part_size_arg;
|
||||||
unsigned char iv[16] = {0};
|
unsigned char iv[16] = {0};
|
||||||
size_t iv_size = 16;
|
size_t iv_size = 16;
|
||||||
size_t iv_length = 0;
|
size_t iv_length = 0;
|
||||||
@ -2769,7 +2785,7 @@ void cipher_verify_output_multipart( int alg_arg,
|
|||||||
PSA_BLOCK_CIPHER_BLOCK_SIZE( key_type ) );
|
PSA_BLOCK_CIPHER_BLOCK_SIZE( key_type ) );
|
||||||
ASSERT_ALLOC( output1, output1_buffer_size );
|
ASSERT_ALLOC( output1, output1_buffer_size );
|
||||||
|
|
||||||
TEST_ASSERT( (unsigned int) first_part_size < input->len );
|
TEST_ASSERT( first_part_size <= input->len );
|
||||||
|
|
||||||
PSA_ASSERT( psa_cipher_update( &operation1, input->x, first_part_size,
|
PSA_ASSERT( psa_cipher_update( &operation1, input->x, first_part_size,
|
||||||
output1, output1_buffer_size,
|
output1, output1_buffer_size,
|
||||||
|
Loading…
Reference in New Issue
Block a user