diff --git a/tests/suites/test_suite_psa_crypto.function b/tests/suites/test_suite_psa_crypto.function index ac6746d06..773163ba1 100644 --- a/tests/suites/test_suite_psa_crypto.function +++ b/tests/suites/test_suite_psa_crypto.function @@ -13,18 +13,18 @@ * \param buffer Pointer to the beginning of the buffer. * \param size Size of the buffer in bytes. * - * \return 0 if the buffer is all-bits-zero. - * \return A nonzero value otherwise. + * \return 1 if the buffer is all-bits-zero. + * \return 0 if there is at least one nonzero byte. */ -int mem_is_nonzero( void *buffer, size_t size ) +static int mem_is_zero( void *buffer, size_t size ) { size_t i; for( i = 0; i < size; i++ ) { if( ( (unsigned char *) buffer )[i] != 0 ) - return( i + 1 ); + return( 0 ); } - return( 0 ); + return( 1 ); } static int exercise_mac_key( psa_key_slot_t key, @@ -349,8 +349,8 @@ void import_export( data_t *data, exported, export_size, &exported_length ); TEST_ASSERT( status == (psa_status_t) expected_export_status ); - TEST_ASSERT( ! mem_is_nonzero( exported + exported_length, - export_size - exported_length ) ); + TEST_ASSERT( mem_is_zero( exported + exported_length, + export_size - exported_length ) ); if( status != PSA_SUCCESS ) { TEST_ASSERT( exported_length == 0 );