common.h 837 B

1234567891011121314151617181920212223242526272829
  1. #ifndef DEMOS_COMMON_H_
  2. #define DEMOS_COMMON_H_
  3. #include <tomcrypt.h>
  4. #if defined(_WIN32)
  5. #define PRI64 "I64d"
  6. #else
  7. #define PRI64 "ll"
  8. #endif
  9. extern prng_state yarrow_prng;
  10. #ifdef LTC_VERBOSE
  11. #define DO(x) do { fprintf(stderr, "%s:\n", #x); run_cmd((x), __LINE__, __FILE__, #x, NULL); } while (0)
  12. #define DOX(x, str) do { fprintf(stderr, "%s - %s:\n", #x, (str)); run_cmd((x), __LINE__, __FILE__, #x, (str)); } while (0)
  13. #else
  14. #define DO(x) do { run_cmd((x), __LINE__, __FILE__, #x, NULL); } while (0)
  15. #define DOX(x, str) do { run_cmd((x), __LINE__, __FILE__, #x, (str)); } while (0)
  16. #endif
  17. void run_cmd(int res, int line, char *file, char *cmd, const char *algorithm);
  18. void print_hex(const char* what, const void* v, const unsigned long l);
  19. void register_algs(void);
  20. void setup_math(void);
  21. #endif /* DEMOS_COMMON_H_ */