Browse Source

add compare_testvector() prototype to tomcrypt_misc.h

Steffen Jaeckel 8 years ago
parent
commit
03f0674985
3 changed files with 9 additions and 1 deletions
  1. 5 1
      src/headers/tomcrypt_misc.h
  2. 2 0
      testprof/tomcrypt_test.h
  3. 2 0
      testprof/x86_prof.c

+ 5 - 1
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$ */

+ 2 - 0
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);

+ 2 - 0
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;