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 13typedef struct { 14 char *name, *prov, *req; 15 int (*entry)(void); 16} test_entry; 17 18extern prng_state yarrow_prng; 19 20void 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 */ 29int cipher_hash_test(void); 30int modes_test(void); 31int mac_test(void); 32int pkcs_1_test(void); 33int store_test(void); 34int rsa_test(void); 35int katja_test(void); 36int ecc_tests(void); 37int dsa_test(void); 38int der_tests(void); 39 40/* timing */ 41#define KTIMES 25 42#define TIMES 100000 43 44extern struct list { 45 int id; 46 unsigned long spd1, spd2, avg; 47} results[]; 48 49extern int no_results; 50 51int sorter(const void *a, const void *b); 52void tally_results(int type); 53ulong64 rdtsc (void); 54 55void t_start(void); 56ulong64 t_read(void); 57void init_timer(void); 58 59/* register default algs */ 60void reg_algs(void); 61int time_keysched(void); 62int time_cipher(void); 63int time_cipher2(void); 64int time_cipher3(void); 65int time_hash(void); 66void time_mult(void); 67void time_sqr(void); 68void time_prng(void); 69void time_rsa(void); 70void time_dsa(void); 71void time_katja(void); 72void time_ecc(void); 73void time_macs_(unsigned long MAC_SIZE); 74void time_macs(void); 75void 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