test.h 952 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #ifndef __TEST_H_
  2. #define __TEST_H_
  3. #include "tomcrypt.h"
  4. /* enable stack testing */
  5. // #define STACK_TEST
  6. /* stack testing, define this if stack usage goes downwards [e.g. x86] */
  7. #define STACK_DOWN
  8. typedef struct {
  9. char *name, *prov, *req;
  10. int (*entry)(void);
  11. } test_entry;
  12. extern prng_state test_yarrow;
  13. void stack_masker(void);
  14. void stack_check(void);
  15. extern unsigned long stack_cur;
  16. #define stack_chk(x) { stack_check(); if (stack_cur >= 1024) { fprintf(stderr, " Warning: Stack usage of %lu in %s, %s:%d\n", stack_cur, x, __FILE__, __LINE__); } }
  17. void run_cmd(int res, int line, char *file, char *cmd);
  18. #define DO(x) { stack_masker(); run_cmd((x), __LINE__, __FILE__, #x); stack_chk(#x); }
  19. /* TESTS */
  20. int cipher_hash_test(void);
  21. int modes_test(void);
  22. int mac_test(void);
  23. int pkcs_1_test(void);
  24. int store_test(void);
  25. int rsa_test(void);
  26. int ecc_tests(void);
  27. int dsa_test(void);
  28. int dh_tests(void);
  29. int der_tests(void);
  30. #endif