add compare_testvector() prototype to tomcrypt_misc.h

This commit is contained in:
Steffen Jaeckel 2017-02-28 01:29:45 +01:00 committed by Karel Miko
parent 9a29428f8e
commit 03f0674985
3 changed files with 9 additions and 1 deletions

View File

@ -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$ */

View File

@ -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);

View File

@ -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;