Use PSA_BLOCK_CIPHER_BLOCK_SIZE() macro to get the cipher block size
Use PSA_BLOCK_CIPHER_BLOCK_SIZE() macro to get the cipher block size instead of accessing the operation struct additionally, for SPM case, the 'block_size' member is not a member in the operation struct
This commit is contained in:
parent
aefb9d0cdd
commit
3d91abefac
1 changed files with 12 additions and 6 deletions
|
@ -1057,7 +1057,8 @@ void cipher_encrypt( int alg_arg, int key_type_arg,
|
||||||
|
|
||||||
TEST_ASSERT( psa_encrypt_set_iv( &operation,
|
TEST_ASSERT( psa_encrypt_set_iv( &operation,
|
||||||
iv, iv_size ) == PSA_SUCCESS );
|
iv, iv_size ) == PSA_SUCCESS );
|
||||||
output_buffer_size = input->len + operation.block_size;
|
output_buffer_size = (size_t) input->len +
|
||||||
|
PSA_BLOCK_CIPHER_BLOCK_SIZE( key_type );
|
||||||
output = mbedtls_calloc( 1, output_buffer_size );
|
output = mbedtls_calloc( 1, output_buffer_size );
|
||||||
TEST_ASSERT( output != NULL );
|
TEST_ASSERT( output != NULL );
|
||||||
|
|
||||||
|
@ -1126,7 +1127,8 @@ void cipher_encrypt_multipart( int alg_arg, int key_type_arg,
|
||||||
|
|
||||||
TEST_ASSERT( psa_encrypt_set_iv( &operation,
|
TEST_ASSERT( psa_encrypt_set_iv( &operation,
|
||||||
iv, sizeof( iv ) ) == PSA_SUCCESS );
|
iv, sizeof( iv ) ) == PSA_SUCCESS );
|
||||||
output_buffer_size = input->len + operation.block_size;
|
output_buffer_size = (size_t) input->len +
|
||||||
|
PSA_BLOCK_CIPHER_BLOCK_SIZE( key_type );
|
||||||
output = mbedtls_calloc( 1, output_buffer_size );
|
output = mbedtls_calloc( 1, output_buffer_size );
|
||||||
TEST_ASSERT( output != NULL );
|
TEST_ASSERT( output != NULL );
|
||||||
|
|
||||||
|
@ -1199,7 +1201,8 @@ void cipher_decrypt_multipart( int alg_arg, int key_type_arg,
|
||||||
TEST_ASSERT( psa_encrypt_set_iv( &operation,
|
TEST_ASSERT( psa_encrypt_set_iv( &operation,
|
||||||
iv, sizeof( iv ) ) == PSA_SUCCESS );
|
iv, sizeof( iv ) ) == PSA_SUCCESS );
|
||||||
|
|
||||||
output_buffer_size = input->len + operation.block_size;
|
output_buffer_size = (size_t) input->len +
|
||||||
|
PSA_BLOCK_CIPHER_BLOCK_SIZE( key_type );
|
||||||
output = mbedtls_calloc( 1, output_buffer_size );
|
output = mbedtls_calloc( 1, output_buffer_size );
|
||||||
TEST_ASSERT( output != NULL );
|
TEST_ASSERT( output != NULL );
|
||||||
|
|
||||||
|
@ -1273,7 +1276,8 @@ void cipher_decrypt( int alg_arg, int key_type_arg,
|
||||||
TEST_ASSERT( psa_encrypt_set_iv( &operation,
|
TEST_ASSERT( psa_encrypt_set_iv( &operation,
|
||||||
iv, iv_size ) == PSA_SUCCESS );
|
iv, iv_size ) == PSA_SUCCESS );
|
||||||
|
|
||||||
output_buffer_size = input->len + operation.block_size;
|
output_buffer_size = (size_t) input->len +
|
||||||
|
PSA_BLOCK_CIPHER_BLOCK_SIZE( key_type );
|
||||||
output = mbedtls_calloc( 1, output_buffer_size );
|
output = mbedtls_calloc( 1, output_buffer_size );
|
||||||
TEST_ASSERT( output != NULL );
|
TEST_ASSERT( output != NULL );
|
||||||
|
|
||||||
|
@ -1343,7 +1347,8 @@ void cipher_verify_output( int alg_arg, int key_type_arg,
|
||||||
TEST_ASSERT( psa_encrypt_generate_iv( &operation1,
|
TEST_ASSERT( psa_encrypt_generate_iv( &operation1,
|
||||||
iv, iv_size,
|
iv, iv_size,
|
||||||
&iv_length ) == PSA_SUCCESS );
|
&iv_length ) == PSA_SUCCESS );
|
||||||
output1_size = input->len + operation1.block_size;
|
output1_size = (size_t) input->len +
|
||||||
|
PSA_BLOCK_CIPHER_BLOCK_SIZE( key_type );
|
||||||
output1 = mbedtls_calloc( 1, output1_size );
|
output1 = mbedtls_calloc( 1, output1_size );
|
||||||
TEST_ASSERT( output1 != NULL );
|
TEST_ASSERT( output1 != NULL );
|
||||||
|
|
||||||
|
@ -1429,7 +1434,8 @@ void cipher_verify_output_multipart( int alg_arg,
|
||||||
TEST_ASSERT( psa_encrypt_generate_iv( &operation1,
|
TEST_ASSERT( psa_encrypt_generate_iv( &operation1,
|
||||||
iv, iv_size,
|
iv, iv_size,
|
||||||
&iv_length ) == PSA_SUCCESS );
|
&iv_length ) == PSA_SUCCESS );
|
||||||
output1_buffer_size = input->len + operation1.block_size;
|
output1_buffer_size = (size_t) input->len +
|
||||||
|
PSA_BLOCK_CIPHER_BLOCK_SIZE( key_type );
|
||||||
output1 = mbedtls_calloc( 1, output1_buffer_size );
|
output1 = mbedtls_calloc( 1, output1_buffer_size );
|
||||||
TEST_ASSERT( output1 != NULL );
|
TEST_ASSERT( output1 != NULL );
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue