15
|
1 #ifndef __TEST_H_ |
|
2 #define __TEST_H_ |
|
3 |
|
4 #include "mycrypt.h" |
|
5 |
143
|
6 /* enable stack testing */ |
|
7 // #define STACK_TEST |
|
8 |
|
9 /* stack testing, define this if stack usage goes downwards [e.g. x86] */ |
|
10 #define STACK_DOWN |
|
11 |
15
|
12 typedef struct { |
|
13 char *name, *prov, *req; |
|
14 int (*entry)(void); |
|
15 } test_entry; |
|
16 |
|
17 extern prng_state test_yarrow; |
|
18 |
143
|
19 |
|
20 void stack_masker(void); |
|
21 void stack_check(void); |
|
22 extern unsigned long stack_cur; |
|
23 #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__); } } |
|
24 |
15
|
25 void run_cmd(int res, int line, char *file, char *cmd); |
143
|
26 #define DO(x) { stack_masker(); run_cmd((x), __LINE__, __FILE__, #x); stack_chk(#x); } |
15
|
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 ecc_tests(void); |
|
36 int dsa_test(void); |
|
37 int dh_tests(void); |
143
|
38 int der_tests(void); |
15
|
39 |
|
40 #endif |