2017-06-19 09:49:18 -04:00
|
|
|
/* LibTomCrypt, modular cryptographic library -- Tom St Denis
|
|
|
|
*
|
|
|
|
* LibTomCrypt is a library that provides various cryptographic
|
|
|
|
* algorithms in a highly modular and flexible manner.
|
|
|
|
*
|
|
|
|
* The library is free for all purposes without any express
|
|
|
|
* guarantee it works.
|
|
|
|
*/
|
2017-05-05 07:52:39 -04:00
|
|
|
#ifndef DEMOS_COMMON_H_
|
|
|
|
#define DEMOS_COMMON_H_
|
|
|
|
|
|
|
|
#include <tomcrypt.h>
|
|
|
|
|
|
|
|
extern prng_state yarrow_prng;
|
|
|
|
|
2017-05-24 15:06:40 -04:00
|
|
|
#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)
|
2018-04-13 03:42:47 -04:00
|
|
|
#define SHOULD_FAIL(x) do { fprintf(stderr, "%s:\n", #x); run_cmd((x) != CRYPT_OK ? CRYPT_OK : CRYPT_FAIL_TESTVECTOR, __LINE__, __FILE__, #x, NULL); } while (0)
|
2017-05-24 15:06:40 -04:00
|
|
|
#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)
|
2018-04-13 03:42:47 -04:00
|
|
|
#define SHOULD_FAIL(x) do { run_cmd((x) != CRYPT_OK ? CRYPT_OK : CRYPT_FAIL_TESTVECTOR, __LINE__, __FILE__, #x, NULL); } while (0)
|
2017-05-24 15:06:40 -04:00
|
|
|
#endif
|
|
|
|
|
2017-09-18 03:24:19 -04:00
|
|
|
void run_cmd(int res, int line, const char *file, const char *cmd, const char *algorithm);
|
2017-05-24 15:06:40 -04:00
|
|
|
|
2017-05-05 07:52:39 -04:00
|
|
|
void print_hex(const char* what, const void* v, const unsigned long l);
|
|
|
|
|
|
|
|
#endif /* DEMOS_COMMON_H_ */
|
2017-06-19 09:49:18 -04:00
|
|
|
|
|
|
|
/* ref: $Format:%D$ */
|
|
|
|
/* git commit: $Format:%H$ */
|
|
|
|
/* commit time: $Format:%ai$ */
|