From 2fae041d6c507315a619e2f29bff86e44cc1d0a1 Mon Sep 17 00:00:00 2001 From: Pauli Date: Wed, 22 Mar 2017 14:27:55 +1000 Subject: Test infrastructure additions. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Richard Levitte Reviewed-by: Emilia Käsper Reviewed-by: Tim Hudson Reviewed-by: Rich Salz (Merged from https://github.com/openssl/openssl/pull/3011) --- test/poly1305_internal_test.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'test/poly1305_internal_test.c') diff --git a/test/poly1305_internal_test.c b/test/poly1305_internal_test.c index 547c2fd..af54ac3 100644 --- a/test/poly1305_internal_test.c +++ b/test/poly1305_internal_test.c @@ -1565,14 +1565,14 @@ static int test_poly1305(int idx) size_t expectedlen = test.expected.size; unsigned char out[16]; - if (expectedlen != sizeof(out)) + if (!TEST_size_t_eq(expectedlen, sizeof(out))) return 0; Poly1305_Init(&poly1305, key); Poly1305_Update(&poly1305, in, inlen); Poly1305_Final(&poly1305, out); - if (memcmp(out, expected, expectedlen) != 0) { + if (!TEST_mem_eq(out, expectedlen, expected, expectedlen)) { fprintf(stderr, "Poly1305 test #%d failed.\n", idx); fprintf(stderr, "got: "); hexdump(out, sizeof(out)); @@ -1588,7 +1588,7 @@ static int test_poly1305(int idx) Poly1305_Update(&poly1305, in+1, inlen-1); Poly1305_Final(&poly1305, out); - if (memcmp(out, expected, expectedlen) != 0) { + if (!TEST_mem_eq(out, expectedlen, expected, expectedlen)) { fprintf(stderr, "Poly1305 test #%d/1+(N-1) failed.\n", idx); fprintf(stderr, "got: "); hexdump(out, sizeof(out)); @@ -1607,7 +1607,7 @@ static int test_poly1305(int idx) Poly1305_Update(&poly1305, in+half, inlen-half); Poly1305_Final(&poly1305, out); - if (memcmp(out, expected, expectedlen) != 0) { + if (!TEST_mem_eq(out, expectedlen, expected, expectedlen)) { fprintf(stderr, "Poly1305 test #%d/2 failed.\n", idx); fprintf(stderr, "got: "); hexdump(out, sizeof(out)); @@ -1623,7 +1623,7 @@ static int test_poly1305(int idx) Poly1305_Update(&poly1305, in+half, inlen-half); Poly1305_Final(&poly1305, out); - if (memcmp(out, expected, expectedlen) != 0) { + if (!TEST_mem_eq(out, expectedlen, expected, expectedlen)) { fprintf(stderr, "Poly1305 test #%d/%" OSSLzu "+%" OSSLzu " failed.\n", idx, half, inlen-half); fprintf(stderr, "got: "); -- cgit v1.1