Set output length to 0 at start of function

This behaviour was present previously, and is depended on by the
test suites.

Signed-off-by: Steven Cooreman <steven.cooreman@silabs.com>
This commit is contained in:
Steven Cooreman 2021-03-08 18:41:12 +01:00
parent f66d5fd2bd
commit fbe09284cf

View file

@ -2244,6 +2244,7 @@ psa_status_t psa_hash_finish( psa_hash_operation_t *operation,
size_t hash_size,
size_t *hash_length )
{
*hash_length = 0;
if( operation->id == 0 )
return( PSA_ERROR_BAD_STATE );
@ -2277,6 +2278,7 @@ psa_status_t psa_hash_compute( psa_algorithm_t alg,
uint8_t *hash, size_t hash_size,
size_t *hash_length )
{
*hash_length = 0;
if( !PSA_ALG_IS_HASH( alg ) )
return( PSA_ERROR_INVALID_ARGUMENT );