Mercurial > dropbear
comparison src/headers/tomcrypt_custom.h @ 280:59400faa4b44 libtomcrypt-orig libtomcrypt-1.05
Re-import libtomcrypt 1.05 for cleaner propagating.
From crypt-1.05.tar.bz2, SHA1 of 88250202bb51570dc64f7e8f1c943cda9479258f
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Wed, 08 Mar 2006 12:58:00 +0000 |
parents | |
children | 997e6f7dc01e d5faf4814ddb |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 280:59400faa4b44 |
---|---|
1 #ifndef TOMCRYPT_CUSTOM_H_ | |
2 #define TOMCRYPT_CUSTOM_H_ | |
3 | |
4 /* macros for various libc functions you can change for embedded targets */ | |
5 #define XMALLOC malloc | |
6 #define XREALLOC realloc | |
7 #define XCALLOC calloc | |
8 #define XFREE free | |
9 | |
10 #define XMEMSET memset | |
11 #define XMEMCPY memcpy | |
12 | |
13 #define XCLOCK clock | |
14 #define XCLOCKS_PER_SEC CLOCKS_PER_SEC | |
15 | |
16 /* Use small code where possible */ | |
17 /* #define LTC_SMALL_CODE */ | |
18 | |
19 /* Enable self-test test vector checking */ | |
20 #ifndef LTC_NO_TEST | |
21 #define LTC_TEST | |
22 #endif | |
23 | |
24 /* clean the stack of functions which put private information on stack */ | |
25 /* #define LTC_CLEAN_STACK */ | |
26 | |
27 /* disable all file related functions */ | |
28 /* #define LTC_NO_FILE */ | |
29 | |
30 /* disable all forms of ASM */ | |
31 /* #define LTC_NO_ASM */ | |
32 | |
33 /* disable FAST mode */ | |
34 /* #define LTC_NO_FAST */ | |
35 | |
36 /* disable BSWAP on x86 */ | |
37 /* #define LTC_NO_BSWAP */ | |
38 | |
39 /* ---> Symmetric Block Ciphers <--- */ | |
40 #ifndef LTC_NO_CIPHERS | |
41 | |
42 #define BLOWFISH | |
43 #define RC2 | |
44 #define RC5 | |
45 #define RC6 | |
46 #define SAFERP | |
47 #define RIJNDAEL | |
48 #define XTEA | |
49 /* _TABLES tells it to use tables during setup, _SMALL means to use the smaller scheduled key format | |
50 * (saves 4KB of ram), _ALL_TABLES enables all tables during setup */ | |
51 #define TWOFISH | |
52 #ifndef LTC_NO_TABLES | |
53 #define TWOFISH_TABLES | |
54 /* #define TWOFISH_ALL_TABLES */ | |
55 #else | |
56 #define TWOFISH_SMALL | |
57 #endif | |
58 /* #define TWOFISH_SMALL */ | |
59 /* DES includes EDE triple-DES */ | |
60 #define DES | |
61 #define CAST5 | |
62 #define NOEKEON | |
63 #define SKIPJACK | |
64 #define SAFER | |
65 #define KHAZAD | |
66 #define ANUBIS | |
67 #define ANUBIS_TWEAK | |
68 | |
69 #endif /* LTC_NO_CIPHERS */ | |
70 | |
71 | |
72 /* ---> Block Cipher Modes of Operation <--- */ | |
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 | |
95 #define MD4 | |
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 | |
105 #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 | |
133 /* Various tidbits of modern neatoness */ | |
134 #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 | |
245 /* default no functions */ | |
246 #define LTC_MUTEX_GLOBAL(x) | |
247 #define LTC_MUTEX_PROTO(x) | |
248 #define LTC_MUTEX_LOCK(x) | |
249 #define LTC_MUTEX_UNLOCK(x) | |
250 | |
251 #endif | |
252 | |
253 | |
254 /* $Source: /cvs/libtom/libtomcrypt/src/headers/tomcrypt_custom.h,v $ */ | |
255 /* $Revision: 1.17 $ */ | |
256 /* $Date: 2005/06/19 18:00:28 $ */ |