@@ -2415,8 +2415,8 @@ void cipher_encrypt( int alg_arg, int key_type_arg,
2415
2415
&function_output_length ) );
2416
2416
total_output_length += function_output_length;
2417
2417
status = psa_cipher_finish( &operation,
2418
- output + function_output_length ,
2419
- output_buffer_size,
2418
+ output + total_output_length ,
2419
+ output_buffer_size - total_output_length ,
2420
2420
&function_output_length );
2421
2421
total_output_length += function_output_length;
2422
2422
@@ -2483,12 +2483,13 @@ void cipher_encrypt_multipart( int alg_arg, int key_type_arg,
2483
2483
PSA_ASSERT( psa_cipher_update( &operation,
2484
2484
input->x + first_part_size,
2485
2485
input->len - first_part_size,
2486
- output, output_buffer_size,
2486
+ output + total_output_length,
2487
+ output_buffer_size - total_output_length,
2487
2488
&function_output_length ) );
2488
2489
total_output_length += function_output_length;
2489
2490
PSA_ASSERT( psa_cipher_finish( &operation,
2490
- output + function_output_length ,
2491
- output_buffer_size,
2491
+ output + total_output_length ,
2492
+ output_buffer_size - total_output_length ,
2492
2493
&function_output_length ) );
2493
2494
total_output_length += function_output_length;
2494
2495
PSA_ASSERT( psa_cipher_abort( &operation ) );
@@ -2554,12 +2555,13 @@ void cipher_decrypt_multipart( int alg_arg, int key_type_arg,
2554
2555
PSA_ASSERT( psa_cipher_update( &operation,
2555
2556
input->x + first_part_size,
2556
2557
input->len - first_part_size,
2557
- output, output_buffer_size,
2558
+ output + total_output_length,
2559
+ output_buffer_size - total_output_length,
2558
2560
&function_output_length ) );
2559
2561
total_output_length += function_output_length;
2560
2562
PSA_ASSERT( psa_cipher_finish( &operation,
2561
- output + function_output_length ,
2562
- output_buffer_size,
2563
+ output + total_output_length ,
2564
+ output_buffer_size - total_output_length ,
2563
2565
&function_output_length ) );
2564
2566
total_output_length += function_output_length;
2565
2567
PSA_ASSERT( psa_cipher_abort( &operation ) );
@@ -2622,8 +2624,8 @@ void cipher_decrypt( int alg_arg, int key_type_arg,
2622
2624
&function_output_length ) );
2623
2625
total_output_length += function_output_length;
2624
2626
status = psa_cipher_finish( &operation,
2625
- output + function_output_length ,
2626
- output_buffer_size,
2627
+ output + total_output_length ,
2628
+ output_buffer_size - total_output_length ,
2627
2629
&function_output_length );
2628
2630
total_output_length += function_output_length;
2629
2631
TEST_EQUAL( status, expected_status );
@@ -2689,7 +2691,8 @@ void cipher_verify_output( int alg_arg, int key_type_arg,
2689
2691
output1, output1_size,
2690
2692
&output1_length ) );
2691
2693
PSA_ASSERT( psa_cipher_finish( &operation1,
2692
- output1 + output1_length, output1_size,
2694
+ output1 + output1_length,
2695
+ output1_size - output1_length,
2693
2696
&function_output_length ) );
2694
2697
2695
2698
output1_length += function_output_length;
@@ -2707,7 +2710,7 @@ void cipher_verify_output( int alg_arg, int key_type_arg,
2707
2710
function_output_length = 0;
2708
2711
PSA_ASSERT( psa_cipher_finish( &operation2,
2709
2712
output2 + output2_length,
2710
- output2_size,
2713
+ output2_size - output2_length ,
2711
2714
&function_output_length ) );
2712
2715
2713
2716
output2_length += function_output_length;
0 commit comments