Skip to content

Commit 3b7e084

Browse files
Fix incorrect length check in multipart cipher tests
The output length can be equal to the input length. This wasn't noticed at runtime because we happened to only test with CBC with the first chunk being a partial block.
1 parent ee46fe7 commit 3b7e084

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

tests/suites/test_suite_psa_crypto.function

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2475,7 +2475,7 @@ void cipher_encrypt_multipart( int alg_arg, int key_type_arg,
24752475
PSA_BLOCK_CIPHER_BLOCK_SIZE( key_type ) );
24762476
ASSERT_ALLOC( output, output_buffer_size );
24772477

2478-
TEST_ASSERT( (unsigned int) first_part_size < input->len );
2478+
TEST_ASSERT( (unsigned int) first_part_size <= input->len );
24792479
PSA_ASSERT( psa_cipher_update( &operation, input->x, first_part_size,
24802480
output, output_buffer_size,
24812481
&function_output_length ) );
@@ -2546,7 +2546,7 @@ void cipher_decrypt_multipart( int alg_arg, int key_type_arg,
25462546
PSA_BLOCK_CIPHER_BLOCK_SIZE( key_type ) );
25472547
ASSERT_ALLOC( output, output_buffer_size );
25482548

2549-
TEST_ASSERT( (unsigned int) first_part_size < input->len );
2549+
TEST_ASSERT( (unsigned int) first_part_size <= input->len );
25502550
PSA_ASSERT( psa_cipher_update( &operation,
25512551
input->x, first_part_size,
25522552
output, output_buffer_size,
@@ -2772,7 +2772,7 @@ void cipher_verify_output_multipart( int alg_arg,
27722772
PSA_BLOCK_CIPHER_BLOCK_SIZE( key_type ) );
27732773
ASSERT_ALLOC( output1, output1_buffer_size );
27742774

2775-
TEST_ASSERT( (unsigned int) first_part_size < input->len );
2775+
TEST_ASSERT( (unsigned int) first_part_size <= input->len );
27762776

27772777
PSA_ASSERT( psa_cipher_update( &operation1, input->x, first_part_size,
27782778
output1, output1_buffer_size,

0 commit comments

Comments
 (0)