comparison demos/test/test.h @ 143:5d99163f7e32 libtomcrypt-orig

import of libtomcrypt 0.99
author Matt Johnston <matt@ucc.asn.au>
date Sun, 19 Dec 2004 11:34:45 +0000
parents 6362d3854bb4
children
comparison
equal deleted inserted replaced
15:6362d3854bb4 143:5d99163f7e32
1 #ifndef __TEST_H_ 1 #ifndef __TEST_H_
2 #define __TEST_H_ 2 #define __TEST_H_
3 3
4 #include "mycrypt.h" 4 #include "mycrypt.h"
5
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
5 11
6 typedef struct { 12 typedef struct {
7 char *name, *prov, *req; 13 char *name, *prov, *req;
8 int (*entry)(void); 14 int (*entry)(void);
9 } test_entry; 15 } test_entry;
10 16
11 extern prng_state test_yarrow; 17 extern prng_state test_yarrow;
12 18
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
13 void run_cmd(int res, int line, char *file, char *cmd); 25 void run_cmd(int res, int line, char *file, char *cmd);
14 #define DO(x) run_cmd((x), __LINE__, __FILE__, #x) 26 #define DO(x) { stack_masker(); run_cmd((x), __LINE__, __FILE__, #x); stack_chk(#x); }
15
16
17 27
18 /* TESTS */ 28 /* TESTS */
19 int cipher_hash_test(void); 29 int cipher_hash_test(void);
20 int modes_test(void); 30 int modes_test(void);
21 int mac_test(void); 31 int mac_test(void);
23 int store_test(void); 33 int store_test(void);
24 int rsa_test(void); 34 int rsa_test(void);
25 int ecc_tests(void); 35 int ecc_tests(void);
26 int dsa_test(void); 36 int dsa_test(void);
27 int dh_tests(void); 37 int dh_tests(void);
38 int der_tests(void);
28 39
29 #endif 40 #endif