From a2971ea62cfdd930ec89ab99f00800550d50398b Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Thu, 3 Dec 2020 20:36:02 +0100 Subject: [PATCH] Simplify some buffer comparisons in tests Signed-off-by: Gilles Peskine --- tests/suites/test_suite_cipher.function | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/tests/suites/test_suite_cipher.function b/tests/suites/test_suite_cipher.function index ffe328458..5e9a1e3f2 100644 --- a/tests/suites/test_suite_cipher.function +++ b/tests/suites/test_suite_cipher.function @@ -1251,10 +1251,7 @@ void auth_crypt_tv( int cipher_id, data_t * key, data_t * iv, else { TEST_ASSERT( ret == 0 ); - - TEST_ASSERT( outlen == clear->len ); - if( clear->len != 0 ) - TEST_ASSERT( memcmp( decrypt_buf, clear->x, clear->len ) == 0 ); + ASSERT_COMPARE( decrypt_buf, outlen, clear->x, clear->len ); } /* Free this, but keep cipher_plus_tag for deprecated function with PSA */ @@ -1376,9 +1373,7 @@ void auth_crypt_tv( int cipher_id, data_t * key, data_t * iv, { /* authentic message: is the plaintext correct? */ TEST_ASSERT( ret == 0 ); - - TEST_ASSERT( outlen == clear->len ); - TEST_ASSERT( memcmp( decrypt_buf, clear->x, clear->len ) == 0 ); + ASSERT_COMPARE( decrypt_buf, outlen, clear->x, clear->len ); } mbedtls_free( decrypt_buf );