tomcrypt_test.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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. #ifdef LTC_VERBOSE
  15. #define DO(x) do { fprintf(stderr, "%s:\n", #x); run_cmd((x), __LINE__, __FILE__, #x); } while (0);
  16. #else
  17. #define DO(x) do { run_cmd((x), __LINE__, __FILE__, #x); } while (0);
  18. #endif
  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 katja_test(void);
  27. int ecc_tests(void);
  28. int dsa_test(void);
  29. int der_tests(void);
  30. /* timing */
  31. #define KTIMES 25
  32. #define TIMES 100000
  33. extern struct list {
  34. int id;
  35. unsigned long spd1, spd2, avg;
  36. } results[];
  37. extern int no_results;
  38. int sorter(const void *a, const void *b);
  39. void tally_results(int type);
  40. ulong64 rdtsc (void);
  41. void t_start(void);
  42. ulong64 t_read(void);
  43. void init_timer(void);
  44. /* register default algs */
  45. void reg_algs(void);
  46. int time_keysched(void);
  47. int time_cipher(void);
  48. int time_cipher2(void);
  49. int time_cipher3(void);
  50. int time_hash(void);
  51. void time_mult(void);
  52. void time_sqr(void);
  53. void time_prng(void);
  54. void time_rsa(void);
  55. void time_dsa(void);
  56. void time_katja(void);
  57. void time_ecc(void);
  58. void time_macs_(unsigned long MAC_SIZE);
  59. void time_macs(void);
  60. void time_encmacs(void);
  61. #endif
  62. /* $Source$ */
  63. /* $Revision$ */
  64. /* $Date$ */