1 2 #ifndef __TEST_H_ 3 #define __TEST_H_ 4 5 #include <tomcrypt.h> 6 7 /* enable stack testing */ 8 /* #define STACK_TEST */ 9 10 /* stack testing, define this if stack usage goes downwards [e.g. x86] */ 11 #define STACK_DOWN 12 13 typedef struct { 14 char *name, *prov, *req; 15 int (*entry)(void); 16 } test_entry; 17 18 extern prng_state yarrow_prng; 19 20 void run_cmd(int res, int line, char *file, char *cmd); 21 22 #ifdef LTC_VERBOSE 23 #define DO(x) do { fprintf(stderr, "%s:\n", #x); run_cmd((x), __LINE__, __FILE__, #x); } while (0); 24 #else 25 #define DO(x) do { run_cmd((x), __LINE__, __FILE__, #x); } while (0); 26 #endif 27 28 /* TESTS */ 29 int cipher_hash_test(void); 30 int modes_test(void); 31 int mac_test(void); 32 int pkcs_1_test(void); 33 int store_test(void); 34 int rsa_test(void); 35 int katja_test(void); 36 int ecc_tests(void); 37 int dsa_test(void); 38 int der_tests(void); 39 40 /* timing */ 41 #define KTIMES 25 42 #define TIMES 100000 43 44 extern struct list { 45 int id; 46 unsigned long spd1, spd2, avg; 47 } results[]; 48 49 extern int no_results; 50 51 int sorter(const void *a, const void *b); 52 void tally_results(int type); 53 ulong64 rdtsc (void); 54 55 void t_start(void); 56 ulong64 t_read(void); 57 void init_timer(void); 58 59 /* register default algs */ 60 void reg_algs(void); 61 int time_keysched(void); 62 int time_cipher(void); 63 int time_cipher2(void); 64 int time_cipher3(void); 65 int time_hash(void); 66 void time_mult(void); 67 void time_sqr(void); 68 void time_prng(void); 69 void time_rsa(void); 70 void time_dsa(void); 71 void time_katja(void); 72 void time_ecc(void); 73 void time_macs_(unsigned long MAC_SIZE); 74 void time_macs(void); 75 void time_encmacs(void); 76 77 78 79 #endif 80 81 /* $Source: /cvs/libtom/libtomcrypt/testprof/tomcrypt_test.h,v $ */ 82 /* $Revision: 1.14 $ */ 83 /* $Date: 2006/10/18 03:36:34 $ */ 84