Mercurial > dropbear
comparison src/headers/tomcrypt_custom.h @ 281:997e6f7dc01e libtomcrypt-dropbear
Just import the Dropbear 0.47 libtomcrypt changes
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Wed, 08 Mar 2006 13:02:58 +0000 |
parents | 59400faa4b44 |
children | 999a5eb4ed10 |
comparison
equal
deleted
inserted
replaced
280:59400faa4b44 | 281:997e6f7dc01e |
---|---|
1 #ifndef TOMCRYPT_CUSTOM_H_ | 1 #ifndef TOMCRYPT_CUSTOM_H_ |
2 #define TOMCRYPT_CUSTOM_H_ | 2 #define TOMCRYPT_CUSTOM_H_ |
3 | |
4 /* this will sort out which stuff based on the user-config in options.h */ | |
5 #include "options.h" | |
3 | 6 |
4 /* macros for various libc functions you can change for embedded targets */ | 7 /* macros for various libc functions you can change for embedded targets */ |
5 #define XMALLOC malloc | 8 #define XMALLOC malloc |
6 #define XREALLOC realloc | 9 #define XREALLOC realloc |
7 #define XCALLOC calloc | 10 #define XCALLOC calloc |
11 #define XMEMCPY memcpy | 14 #define XMEMCPY memcpy |
12 | 15 |
13 #define XCLOCK clock | 16 #define XCLOCK clock |
14 #define XCLOCKS_PER_SEC CLOCKS_PER_SEC | 17 #define XCLOCKS_PER_SEC CLOCKS_PER_SEC |
15 | 18 |
16 /* Use small code where possible */ | 19 #ifdef DROPBEAR_SMALL_CODE |
17 /* #define LTC_SMALL_CODE */ | 20 #define LTC_SMALL_CODE |
21 #endif | |
22 | |
23 /* These spit out warnings etc */ | |
24 #define LTC_NO_ROLC | |
18 | 25 |
19 /* Enable self-test test vector checking */ | 26 /* Enable self-test test vector checking */ |
20 #ifndef LTC_NO_TEST | 27 /* Not for dropbear */ |
21 #define LTC_TEST | 28 //#define LTC_TEST |
22 #endif | |
23 | 29 |
24 /* clean the stack of functions which put private information on stack */ | 30 /* clean the stack of functions which put private information on stack */ |
25 /* #define LTC_CLEAN_STACK */ | 31 /* #define LTC_CLEAN_STACK */ |
26 | 32 |
27 /* disable all file related functions */ | 33 /* disable all file related functions */ |
34 /* #define LTC_NO_FAST */ | 40 /* #define LTC_NO_FAST */ |
35 | 41 |
36 /* disable BSWAP on x86 */ | 42 /* disable BSWAP on x86 */ |
37 /* #define LTC_NO_BSWAP */ | 43 /* #define LTC_NO_BSWAP */ |
38 | 44 |
39 /* ---> Symmetric Block Ciphers <--- */ | |
40 #ifndef LTC_NO_CIPHERS | |
41 | 45 |
46 #ifdef DROPBEAR_BLOWFISH_CBC | |
42 #define BLOWFISH | 47 #define BLOWFISH |
43 #define RC2 | 48 #endif |
44 #define RC5 | 49 |
45 #define RC6 | 50 #ifdef DROPBEAR_AES_CBC |
46 #define SAFERP | |
47 #define RIJNDAEL | 51 #define RIJNDAEL |
48 #define XTEA | 52 #endif |
49 /* _TABLES tells it to use tables during setup, _SMALL means to use the smaller scheduled key format | 53 |
50 * (saves 4KB of ram), _ALL_TABLES enables all tables during setup */ | 54 #ifdef DROPBEAR_TWOFISH_CBC |
51 #define TWOFISH | 55 #define TWOFISH |
52 #ifndef LTC_NO_TABLES | 56 |
53 #define TWOFISH_TABLES | 57 /* enabling just TWOFISH_SMALL will make the binary ~1kB smaller, turning on |
54 /* #define TWOFISH_ALL_TABLES */ | 58 * TWOFISH_TABLES will make it a few kB bigger, but perhaps reduces runtime |
55 #else | 59 * memory usage? */ |
56 #define TWOFISH_SMALL | 60 #define TWOFISH_SMALL |
61 /*#define TWOFISH_TABLES*/ | |
57 #endif | 62 #endif |
58 /* #define TWOFISH_SMALL */ | 63 |
59 /* DES includes EDE triple-DES */ | 64 #ifdef DROPBEAR_3DES_CBC |
60 #define DES | 65 #define DES |
61 #define CAST5 | 66 #endif |
62 #define NOEKEON | 67 #define CBC |
63 #define SKIPJACK | |
64 #define SAFER | |
65 #define KHAZAD | |
66 #define ANUBIS | |
67 #define ANUBIS_TWEAK | |
68 | 68 |
69 #endif /* LTC_NO_CIPHERS */ | 69 #if defined(DROPBEAR_DSS) && defined(DSS_PROTOK) |
70 #define SHA512 | |
71 #endif | |
70 | 72 |
73 #define SHA1 | |
71 | 74 |
72 /* ---> Block Cipher Modes of Operation <--- */ | 75 #ifdef DROPBEAR_MD5_HMAC |
73 #ifndef LTC_NO_MODES | |
74 | |
75 #define CFB | |
76 #define OFB | |
77 #define ECB | |
78 #define CBC | |
79 #define CTR | |
80 | |
81 #endif /* LTC_NO_MODES */ | |
82 | |
83 /* ---> One-Way Hash Functions <--- */ | |
84 #ifndef LTC_NO_HASHES | |
85 | |
86 #define CHC_HASH | |
87 #define WHIRLPOOL | |
88 #define SHA512 | |
89 #define SHA384 | |
90 #define SHA256 | |
91 #define SHA224 | |
92 #define TIGER | |
93 #define SHA1 | |
94 #define MD5 | 76 #define MD5 |
95 #define MD4 | 77 #endif |
96 #define MD2 | |
97 #define RIPEMD128 | |
98 #define RIPEMD160 | |
99 | |
100 #endif /* LTC_NO_HASHES */ | |
101 | |
102 /* ---> MAC functions <--- */ | |
103 #ifndef LTC_NO_MACS | |
104 | 78 |
105 #define HMAC | 79 #define HMAC |
106 #define OMAC | |
107 #define PMAC | |
108 #define PELICAN | |
109 | |
110 #if defined(PELICAN) && !defined(RIJNDAEL) | |
111 #error Pelican-MAC requires RIJNDAEL | |
112 #endif | |
113 | |
114 /* ---> Encrypt + Authenticate Modes <--- */ | |
115 | |
116 #define EAX_MODE | |
117 #if defined(EAX_MODE) && !(defined(CTR) && defined(OMAC)) | |
118 #error EAX_MODE requires CTR and OMAC mode | |
119 #endif | |
120 | |
121 #define OCB_MODE | |
122 #define CCM_MODE | |
123 | |
124 #define GCM_MODE | |
125 | |
126 /* Use 64KiB tables */ | |
127 #ifndef LTC_NO_TABLES | |
128 #define GCM_TABLES | |
129 #endif | |
130 | |
131 #endif /* LTC_NO_MACS */ | |
132 | 80 |
133 /* Various tidbits of modern neatoness */ | 81 /* Various tidbits of modern neatoness */ |
134 #define BASE64 | 82 #define BASE64 |
135 | |
136 /* --> Pseudo Random Number Generators <--- */ | |
137 #ifndef LTC_NO_PRNGS | |
138 | |
139 /* Yarrow */ | |
140 #define YARROW | |
141 /* which descriptor of AES to use? */ | |
142 /* 0 = rijndael_enc 1 = aes_enc, 2 = rijndael [full], 3 = aes [full] */ | |
143 #define YARROW_AES 0 | |
144 | |
145 #if defined(YARROW) && !defined(CTR) | |
146 #error YARROW requires CTR chaining mode to be defined! | |
147 #endif | |
148 | |
149 /* a PRNG that simply reads from an available system source */ | |
150 #define SPRNG | |
151 | |
152 /* The RC4 stream cipher */ | |
153 #define RC4 | |
154 | |
155 /* Fortuna PRNG */ | |
156 #define FORTUNA | |
157 /* reseed every N calls to the read function */ | |
158 #define FORTUNA_WD 10 | |
159 /* number of pools (4..32) can save a bit of ram by lowering the count */ | |
160 #define FORTUNA_POOLS 32 | |
161 | |
162 /* Greg's SOBER128 PRNG ;-0 */ | |
163 #define SOBER128 | |
164 | |
165 /* the *nix style /dev/random device */ | |
166 #define DEVRANDOM | |
167 /* try /dev/urandom before trying /dev/random */ | |
168 #define TRY_URANDOM_FIRST | |
169 | |
170 #endif /* LTC_NO_PRNGS */ | |
171 | |
172 /* ---> Public Key Crypto <--- */ | |
173 #ifndef LTC_NO_PK | |
174 | |
175 #define MRSA | |
176 | |
177 /* Digital Signature Algorithm */ | |
178 #define MDSA | |
179 /* Max diff between group and modulus size in bytes */ | |
180 #define MDSA_DELTA 512 | |
181 /* Max DSA group size in bytes (default allows 4k-bit groups) */ | |
182 #define MDSA_MAX_GROUP 512 | |
183 | |
184 /* Diffie-Hellman */ | |
185 #define MDH | |
186 /* Supported Key Sizes */ | |
187 #define DH768 | |
188 #define DH1024 | |
189 #define DH1280 | |
190 #define DH1536 | |
191 #define DH1792 | |
192 #define DH2048 | |
193 #define DH2560 | |
194 #define DH3072 | |
195 #define DH4096 | |
196 | |
197 /* ECC */ | |
198 #define MECC | |
199 /* Supported Key Sizes */ | |
200 #define ECC192 | |
201 #define ECC224 | |
202 #define ECC256 | |
203 #define ECC384 | |
204 #define ECC521 | |
205 | |
206 /* Include the MPI functionality? (required by the PK algorithms) */ | |
207 #define MPI | |
208 | |
209 #endif /* LTC_NO_PK */ | |
210 | |
211 /* PKCS #1 (RSA) and #5 (Password Handling) stuff */ | |
212 #ifndef LTC_NO_PKCS | |
213 | |
214 #define PKCS_1 | |
215 #define PKCS_5 | |
216 | |
217 /* Include ASN.1 DER (required by DSA/RSA) */ | |
218 #define LTC_DER | |
219 #if defined(LTC_DER) && !defined(MPI) | |
220 #error ASN.1 DER requires MPI functionality | |
221 #endif | |
222 | |
223 #if (defined(MDSA) || defined(MRSA)) && !defined(LTC_DER) | |
224 #error RSA/DSA requires ASN.1 DER functionality, make sure LTC_DER is enabled | |
225 #endif | |
226 | |
227 #endif /* LTC_NO_PKCS */ | |
228 | |
229 #endif | |
230 | |
231 | |
232 /* THREAD management */ | |
233 | |
234 #ifdef LTC_PTHREAD | |
235 | |
236 #include <pthread.h> | |
237 | |
238 #define LTC_MUTEX_GLOBAL(x) pthread_mutex_t x = PTHREAD_MUTEX_INITIALIZER; | |
239 #define LTC_MUTEX_PROTO(x) extern pthread_mutex_t x; | |
240 #define LTC_MUTEX_LOCK(x) pthread_mutex_lock(x); | |
241 #define LTC_MUTEX_UNLOCK(x) pthread_mutex_unlock(x); | |
242 | |
243 #else | |
244 | 83 |
245 /* default no functions */ | 84 /* default no functions */ |
246 #define LTC_MUTEX_GLOBAL(x) | 85 #define LTC_MUTEX_GLOBAL(x) |
247 #define LTC_MUTEX_PROTO(x) | 86 #define LTC_MUTEX_PROTO(x) |
248 #define LTC_MUTEX_LOCK(x) | 87 #define LTC_MUTEX_LOCK(x) |
249 #define LTC_MUTEX_UNLOCK(x) | 88 #define LTC_MUTEX_UNLOCK(x) |
89 #define FORTUNA_POOLS 0 | |
250 | 90 |
251 #endif | 91 #endif |
252 | 92 |
253 | 93 |
254 /* $Source: /cvs/libtom/libtomcrypt/src/headers/tomcrypt_custom.h,v $ */ | 94 /* $Source: /cvs/libtom/libtomcrypt/src/headers/tomcrypt_custom.h,v $ */ |