From 0071b873a3609885597e20be5ec6f428ceb22b95 Mon Sep 17 00:00:00 2001 From: Moran Peker Date: Sun, 22 Apr 2018 20:16:58 +0300 Subject: [PATCH] add missing parameter output_size on psa_cipher_finish --- include/psa/crypto.h | 1 + library/psa_crypto.c | 1 + tests/suites/test_suite_psa_crypto.function | 8 ++++---- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/include/psa/crypto.h b/include/psa/crypto.h index b1c1abb06..089484f19 100644 --- a/include/psa/crypto.h +++ b/include/psa/crypto.h @@ -1064,6 +1064,7 @@ psa_status_t psa_cipher_update(psa_cipher_operation_t *operation, psa_status_t psa_cipher_finish(psa_cipher_operation_t *operation, uint8_t *output, + size_t output_size, size_t *output_length); psa_status_t psa_cipher_abort(psa_cipher_operation_t *operation); diff --git a/library/psa_crypto.c b/library/psa_crypto.c index bb74c2660..fbc5949dd 100644 --- a/library/psa_crypto.c +++ b/library/psa_crypto.c @@ -1461,6 +1461,7 @@ psa_status_t psa_cipher_update(psa_cipher_operation_t *operation, psa_status_t psa_cipher_finish(psa_cipher_operation_t *operation, uint8_t *output, + size_t output_size, size_t *output_length) { int ret = MBEDTLS_ERR_CIPHER_FEATURE_UNAVAILABLE; diff --git a/tests/suites/test_suite_psa_crypto.function b/tests/suites/test_suite_psa_crypto.function index eb217f9f9..bc46ad215 100644 --- a/tests/suites/test_suite_psa_crypto.function +++ b/tests/suites/test_suite_psa_crypto.function @@ -574,7 +574,7 @@ void cipher_test_positive( int alg_arg, int key_type_arg, output, output_size, &output_length) == PSA_SUCCESS ); TEST_ASSERT( psa_cipher_finish( &operation, output + output_length, - &output_length) == PSA_SUCCESS ); + output_size, &output_length) == PSA_SUCCESS ); TEST_ASSERT( psa_cipher_abort( &operation ) == PSA_SUCCESS ); @@ -637,7 +637,7 @@ void cipher_test_decrypt( int alg_arg, int key_type_arg, output, output_size, &output_length) == PSA_SUCCESS ); TEST_ASSERT( psa_cipher_finish( &operation, output + output_length, - &output_length) == PSA_SUCCESS ); + output_size, &output_length) == PSA_SUCCESS ); TEST_ASSERT( psa_cipher_abort( &operation ) == PSA_SUCCESS ); @@ -700,7 +700,7 @@ void cipher_test_verify_output( int alg_arg, int key_type_arg, output1, output1_size, &output1_length) == PSA_SUCCESS ); TEST_ASSERT( psa_cipher_finish( &operation1, output1 + output1_length, - &tmp_output_length) == PSA_SUCCESS ); + output1_size, &tmp_output_length) == PSA_SUCCESS ); output1_length += tmp_output_length; @@ -715,7 +715,7 @@ void cipher_test_verify_output( int alg_arg, int key_type_arg, output2, output2_size, &output2_length) == PSA_SUCCESS ); tmp_output_length = 0; TEST_ASSERT( psa_cipher_finish( &operation2, output2 + output2_length, - &tmp_output_length) == PSA_SUCCESS ); + output2_size, &tmp_output_length) == PSA_SUCCESS ); output2_length += tmp_output_length;