tomcrypt_test.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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 yarrow_prng;
  13. void run_cmd(int res, int line, char *file, char *cmd);
  14. #define DO(x) { run_cmd((x), __LINE__, __FILE__, #x); }
  15. /* TESTS */
  16. int cipher_hash_test(void);
  17. int modes_test(void);
  18. int mac_test(void);
  19. int pkcs_1_test(void);
  20. int store_test(void);
  21. int rsa_test(void);
  22. int ecc_tests(void);
  23. int dsa_test(void);
  24. int der_tests(void);
  25. /* timing */
  26. #define KTIMES 25
  27. #define TIMES 100000
  28. extern struct list {
  29. int id;
  30. unsigned long spd1, spd2, avg;
  31. } results[];
  32. extern int no_results;
  33. int sorter(const void *a, const void *b);
  34. void tally_results(int type);
  35. ulong64 rdtsc (void);
  36. void t_start(void);
  37. ulong64 t_read(void);
  38. void init_timer(void);
  39. /* register default algs */
  40. void reg_algs(void);
  41. int time_keysched(void);
  42. int time_cipher(void);
  43. int time_cipher2(void);
  44. int time_cipher3(void);
  45. int time_hash(void);
  46. void time_mult(void);
  47. void time_sqr(void);
  48. void time_prng(void);
  49. void time_rsa(void);
  50. void time_ecc(void);
  51. void time_macs_(unsigned long MAC_SIZE);
  52. void time_macs(void);
  53. void time_encmacs(void);
  54. #endif
  55. /* $Source$ */
  56. /* $Revision$ */
  57. /* $Date$ */