merge testprof/test_driver.c to testprof/common.c
This commit is contained in:
parent
0a23c6d32e
commit
f7d3c2bfa1
@ -15,6 +15,18 @@
|
||||
Steffen Jaeckel
|
||||
*/
|
||||
|
||||
void run_cmd(int res, int line, char *file, char *cmd, const char *algorithm)
|
||||
{
|
||||
if (res != CRYPT_OK) {
|
||||
fprintf(stderr, "%s (%d)%s%s\n%s:%d:%s\n",
|
||||
error_to_string(res), res,
|
||||
(algorithm ? " - " : ""), (algorithm ? algorithm : ""),
|
||||
file, line, cmd);
|
||||
if (res != CRYPT_NOP) {
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void print_hex(const char* what, const void* v, const unsigned long l)
|
||||
{
|
||||
|
@ -5,6 +5,16 @@
|
||||
|
||||
extern prng_state yarrow_prng;
|
||||
|
||||
#ifdef LTC_VERBOSE
|
||||
#define DO(x) do { fprintf(stderr, "%s:\n", #x); run_cmd((x), __LINE__, __FILE__, #x, NULL); } while (0)
|
||||
#define DOX(x, str) do { fprintf(stderr, "%s - %s:\n", #x, (str)); run_cmd((x), __LINE__, __FILE__, #x, (str)); } while (0)
|
||||
#else
|
||||
#define DO(x) do { run_cmd((x), __LINE__, __FILE__, #x, NULL); } while (0)
|
||||
#define DOX(x, str) do { run_cmd((x), __LINE__, __FILE__, #x, (str)); } while (0)
|
||||
#endif
|
||||
|
||||
void run_cmd(int res, int line, char *file, char *cmd, const char *algorithm);
|
||||
|
||||
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);
|
||||
|
@ -1,18 +0,0 @@
|
||||
#include <tomcrypt_test.h>
|
||||
|
||||
void run_cmd(int res, int line, char *file, char *cmd, const char *algorithm)
|
||||
{
|
||||
if (res != CRYPT_OK) {
|
||||
fprintf(stderr, "%s (%d)%s%s\n%s:%d:%s\n",
|
||||
error_to_string(res), res,
|
||||
(algorithm ? " - " : ""), (algorithm ? algorithm : ""),
|
||||
file, line, cmd);
|
||||
if (res != CRYPT_NOP) {
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* $Source$ */
|
||||
/* $Revision$ */
|
||||
/* $Date$ */
|
@ -30,16 +30,6 @@ typedef struct {
|
||||
int (*entry)(void);
|
||||
} test_entry;
|
||||
|
||||
void run_cmd(int res, int line, char *file, char *cmd, const char *algorithm);
|
||||
|
||||
#ifdef LTC_VERBOSE
|
||||
#define DO(x) do { fprintf(stderr, "%s:\n", #x); run_cmd((x), __LINE__, __FILE__, #x, NULL); } while (0)
|
||||
#define DOX(x, str) do { fprintf(stderr, "%s - %s:\n", #x, (str)); run_cmd((x), __LINE__, __FILE__, #x, (str)); } while (0)
|
||||
#else
|
||||
#define DO(x) do { run_cmd((x), __LINE__, __FILE__, #x, NULL); } while (0)
|
||||
#define DOX(x, str) do { run_cmd((x), __LINE__, __FILE__, #x, (str)); } while (0)
|
||||
#endif
|
||||
|
||||
/* TESTS */
|
||||
int cipher_hash_test(void);
|
||||
int modes_test(void);
|
||||
|
Loading…
x
Reference in New Issue
Block a user