From 03f0674985806efe55791511d3f30ce9cc6ec7f5 Mon Sep 17 00:00:00 2001 From: Steffen Jaeckel Date: Tue, 28 Feb 2017 01:29:45 +0100 Subject: [PATCH] add compare_testvector() prototype to tomcrypt_misc.h --- src/headers/tomcrypt_misc.h | 6 +++++- testprof/tomcrypt_test.h | 2 ++ testprof/x86_prof.c | 2 ++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/headers/tomcrypt_misc.h b/src/headers/tomcrypt_misc.h index 4f5e8fa..91f87c5 100644 --- a/src/headers/tomcrypt_misc.h +++ b/src/headers/tomcrypt_misc.h @@ -101,7 +101,11 @@ int crc32_test(void); /* yeah it's not exactly in misc in the library, but in testprof/x86_prof.c */ #if defined(LTC_TEST) && defined(LTC_TEST_DBG) -void print_hex(const char* what, const void* p, const unsigned long l); +void print_hex(const char* what, const void* v, const unsigned long l); +int compare_testvector(const void* is, const unsigned long is_len, const void* should, const unsigned long should_len, const char* what, int which); +#else +#define compare_testvector(is, is_len, should, should_len, what, which) \ + (((is_len) != (should_len)) || (XMEMCMP((is), (should), (is_len)) != 0)) #endif /* $Source$ */ diff --git a/testprof/tomcrypt_test.h b/testprof/tomcrypt_test.h index 776580e..ce9bfeb 100644 --- a/testprof/tomcrypt_test.h +++ b/testprof/tomcrypt_test.h @@ -81,7 +81,9 @@ extern const struct ltc_prng_descriptor no_prng_desc; #endif void print_hex(const char* what, const void* v, const unsigned long l); +#ifndef compare_testvector int compare_testvector(const void* is, const unsigned long is_len, const void* should, const unsigned long should_len, const char* what, int which); +#endif int sorter(const void *a, const void *b); void tally_results(int type); ulong64 rdtsc (void); diff --git a/testprof/x86_prof.c b/testprof/x86_prof.c index 3d8787c..46ae43a 100644 --- a/testprof/x86_prof.c +++ b/testprof/x86_prof.c @@ -35,6 +35,7 @@ void print_hex(const char* what, const void* v, const unsigned long l) } } +#ifndef compare_testvector int compare_testvector(const void* is, const unsigned long is_len, const void* should, const unsigned long should_len, const char* what, int which) { int res = 0; @@ -51,6 +52,7 @@ int compare_testvector(const void* is, const unsigned long is_len, const void* s return res; } +#endif struct list results[100]; int no_results;