comparison libtomcrypt/src/headers/tomcrypt_custom.h @ 1478:3a933956437e coverity

update coverity
author Matt Johnston <matt@ucc.asn.au>
date Fri, 09 Feb 2018 23:49:22 +0800
parents 8305ebe45940
children 2d450c1056e3
comparison
equal deleted inserted replaced
1439:8d24733026c5 1478:3a933956437e
1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis
2 *
3 * LibTomCrypt is a library that provides various cryptographic
4 * algorithms in a highly modular and flexible manner.
5 *
6 * The library is free for all purposes without any express
7 * guarantee it works.
8 */
9
1 #ifndef TOMCRYPT_CUSTOM_H_ 10 #ifndef TOMCRYPT_CUSTOM_H_
2 #define TOMCRYPT_CUSTOM_H_ 11 #define TOMCRYPT_CUSTOM_H_
3 12
4 /* compile options depend on Dropbear options.h */ 13 #include "tomcrypt_dropbear.h"
5 #include "options.h"
6 14
7 /* macros for various libc functions you can change for embedded targets */ 15 /* macros for various libc functions you can change for embedded targets */
8 #ifndef XMALLOC 16 #ifndef XMALLOC
9 #ifdef malloc
10 #define LTC_NO_PROTOTYPES
11 #endif
12 #define XMALLOC malloc 17 #define XMALLOC malloc
13 #endif 18 #endif
14 #ifndef XREALLOC 19 #ifndef XREALLOC
15 #ifdef realloc
16 #define LTC_NO_PROTOTYPES
17 #endif
18 #define XREALLOC realloc 20 #define XREALLOC realloc
19 #endif 21 #endif
20 #ifndef XCALLOC 22 #ifndef XCALLOC
21 #ifdef calloc
22 #define LTC_NO_PROTOTYPES
23 #endif
24 #define XCALLOC calloc 23 #define XCALLOC calloc
25 #endif 24 #endif
26 #ifndef XFREE 25 #ifndef XFREE
27 #ifdef free
28 #define LTC_NO_PROTOTYPES
29 #endif
30 #define XFREE free 26 #define XFREE free
31 #endif 27 #endif
32 28
33 #ifndef XMEMSET 29 #ifndef XMEMSET
34 #ifdef memset
35 #define LTC_NO_PROTOTYPES
36 #endif
37 #define XMEMSET memset 30 #define XMEMSET memset
38 #endif 31 #endif
39 #ifndef XMEMCPY 32 #ifndef XMEMCPY
40 #ifdef memcpy
41 #define LTC_NO_PROTOTYPES
42 #endif
43 #define XMEMCPY memcpy 33 #define XMEMCPY memcpy
44 #endif 34 #endif
35 #ifndef XMEMMOVE
36 #define XMEMMOVE memmove
37 #endif
45 #ifndef XMEMCMP 38 #ifndef XMEMCMP
46 #ifdef memcmp
47 #define LTC_NO_PROTOTYPES
48 #endif
49 #define XMEMCMP memcmp 39 #define XMEMCMP memcmp
50 #endif 40 #endif
41 /* A memory compare function that has to run in constant time,
42 * c.f. mem_neq() API summary.
43 */
44 #ifndef XMEM_NEQ
45 #define XMEM_NEQ mem_neq
46 #endif
51 #ifndef XSTRCMP 47 #ifndef XSTRCMP
52 #ifdef strcmp
53 #define LTC_NO_PROTOTYPES
54 #endif
55 #define XSTRCMP strcmp 48 #define XSTRCMP strcmp
56 #endif 49 #endif
57 50
58 #ifndef XCLOCK 51 #ifndef XCLOCK
59 #define XCLOCK clock 52 #define XCLOCK clock
60 #endif 53 #endif
61 #ifndef XCLOCKS_PER_SEC 54
62 #define XCLOCKS_PER_SEC CLOCKS_PER_SEC 55 #ifndef XQSORT
63 #endif 56 #define XQSORT qsort
57 #endif
58
59 #if ( defined(malloc) || defined(realloc) || defined(calloc) || defined(free) || \
60 defined(memset) || defined(memcpy) || defined(memcmp) || defined(strcmp) || \
61 defined(clock) || defined(qsort) ) && !defined(LTC_NO_PROTOTYPES)
62 #define LTC_NO_PROTOTYPES
63 #endif
64
65 /* shortcut to disable automatic inclusion */
66 #if defined LTC_NOTHING && !defined LTC_EASY
67 #define LTC_NO_CIPHERS
68 #define LTC_NO_MODES
69 #define LTC_NO_HASHES
70 #define LTC_NO_MACS
71 #define LTC_NO_PRNGS
72 #define LTC_NO_PK
73 #define LTC_NO_PKCS
74 #define LTC_NO_MISC
75 #endif /* LTC_NOTHING */
76
77 /* Easy button? */
78 #ifdef LTC_EASY
79 #define LTC_NO_CIPHERS
80 #define LTC_RIJNDAEL
81 #define LTC_BLOWFISH
82 #define LTC_DES
83 #define LTC_CAST5
84
85 #define LTC_NO_MODES
86 #define LTC_ECB_MODE
87 #define LTC_CBC_MODE
88 #define LTC_CTR_MODE
89
90 #define LTC_NO_HASHES
91 #define LTC_SHA1
92 #define LTC_SHA3
93 #define LTC_SHA512
94 #define LTC_SHA384
95 #define LTC_SHA256
96 #define LTC_SHA224
97 #define LTC_HASH_HELPERS
98
99 #define LTC_NO_MACS
100 #define LTC_HMAC
101 #define LTC_OMAC
102 #define LTC_CCM_MODE
64 103
65 #define LTC_NO_PRNGS 104 #define LTC_NO_PRNGS
105 #define LTC_SPRNG
106 #define LTC_YARROW
107 #define LTC_DEVRANDOM
108 #define LTC_TRY_URANDOM_FIRST
109 #define LTC_RNG_GET_BYTES
110 #define LTC_RNG_MAKE_PRNG
111
66 #define LTC_NO_PK 112 #define LTC_NO_PK
67 #ifdef DROPBEAR_SMALL_CODE 113 #define LTC_MRSA
68 #define LTC_SMALL_CODE 114 #define LTC_MECC
69 #endif 115
70 /* These spit out warnings etc */ 116 #define LTC_NO_MISC
71 #define LTC_NO_ROLC 117 #define LTC_BASE64
72 #ifndef XQSORT 118 #endif
73 #ifdef qsort 119
74 #define LTC_NO_PROTOTYPES 120 /* The minimal set of functionality to run the tests */
75 #endif 121 #ifdef LTC_MINIMAL
76 #define XQSORT qsort 122 #define LTC_RIJNDAEL
77 #endif 123 #define LTC_SHA256
78 124 #define LTC_YARROW
125 #define LTC_CTR_MODE
126
127 #define LTC_RNG_MAKE_PRNG
128 #define LTC_RNG_GET_BYTES
129 #define LTC_DEVRANDOM
130 #define LTC_TRY_URANDOM_FIRST
131
132 #undef LTC_NO_FILE
133 #endif
79 134
80 /* Enable self-test test vector checking */ 135 /* Enable self-test test vector checking */
81 /* Not for dropbear */ 136 #ifndef LTC_NO_TEST
82 /*#define LTC_TEST*/ 137 #define LTC_TEST
138 #endif
139 /* Enable extended self-tests */
140 /* #define LTC_TEST_EXT */
141
142 /* Use small code where possible */
143 /* #define LTC_SMALL_CODE */
83 144
84 /* clean the stack of functions which put private information on stack */ 145 /* clean the stack of functions which put private information on stack */
85 /* #define LTC_CLEAN_STACK */ 146 /* #define LTC_CLEAN_STACK */
86 147
87 /* disable all file related functions */ 148 /* disable all file related functions */
88 #define LTC_NO_FILE 149 /* #define LTC_NO_FILE */
89 150
90 /* disable all forms of ASM */ 151 /* disable all forms of ASM */
91 /* #define LTC_NO_ASM */ 152 /* #define LTC_NO_ASM */
92 153
93 /* disable FAST mode */ 154 /* disable FAST mode */
94 /* #define LTC_NO_FAST */ 155 /* #define LTC_NO_FAST */
95 156
96 /* disable BSWAP on x86 */ 157 /* disable BSWAP on x86 */
97 /* #define LTC_NO_BSWAP */ 158 /* #define LTC_NO_BSWAP */
98 159
99 160 /* ---> math provider? <--- */
100 #ifdef DROPBEAR_BLOWFISH 161 #ifndef LTC_NO_MATH
162
163 /* LibTomMath */
164 /* #define LTM_DESC */
165
166 /* TomsFastMath */
167 /* #define TFM_DESC */
168
169 /* GNU Multiple Precision Arithmetic Library */
170 /* #define GMP_DESC */
171
172 #endif /* LTC_NO_MATH */
173
174 /* ---> Symmetric Block Ciphers <--- */
175 #ifndef LTC_NO_CIPHERS
176
101 #define LTC_BLOWFISH 177 #define LTC_BLOWFISH
102 #endif 178 #define LTC_RC2
103 179 #define LTC_RC5
104 #ifdef DROPBEAR_AES 180 #define LTC_RC6
181 #define LTC_SAFERP
105 #define LTC_RIJNDAEL 182 #define LTC_RIJNDAEL
106 #endif 183 #define LTC_XTEA
107
108 #ifdef DROPBEAR_TWOFISH
109 #define LTC_TWOFISH
110
111 /* _TABLES tells it to use tables during setup, _SMALL means to use the smaller scheduled key format 184 /* _TABLES tells it to use tables during setup, _SMALL means to use the smaller scheduled key format
112 * (saves 4KB of ram), _ALL_TABLES enables all tables during setup */ 185 * (saves 4KB of ram), _ALL_TABLES enables all tables during setup */
113 /* enabling just TWOFISH_SMALL will make the binary ~1kB smaller, turning on 186 #define LTC_TWOFISH
114 * TWOFISH_TABLES will make it a few kB bigger, but perhaps reduces runtime 187 #ifndef LTC_NO_TABLES
115 * memory usage? */ 188 #define LTC_TWOFISH_TABLES
116 #define LTC_TWOFISH_SMALL 189 /* #define LTC_TWOFISH_ALL_TABLES */
117 /*#define LTC_TWOFISH_TABLES*/ 190 #else
118 #endif 191 #define LTC_TWOFISH_SMALL
119 192 #endif
120 #ifdef DROPBEAR_3DES 193 /* #define LTC_TWOFISH_SMALL */
194 /* LTC_DES includes EDE triple-DES */
121 #define LTC_DES 195 #define LTC_DES
122 #endif 196 #define LTC_CAST5
123 197 #define LTC_NOEKEON
198 #define LTC_SKIPJACK
199 #define LTC_SAFER
200 #define LTC_KHAZAD
201 #define LTC_ANUBIS
202 #define LTC_ANUBIS_TWEAK
203 #define LTC_KSEED
204 #define LTC_KASUMI
205 #define LTC_MULTI2
206 #define LTC_CAMELLIA
207
208 /* stream ciphers */
209 #define LTC_CHACHA
210 #define LTC_RC4_STREAM
211 #define LTC_SOBER128_STREAM
212
213 #endif /* LTC_NO_CIPHERS */
214
215
216 /* ---> Block Cipher Modes of Operation <--- */
217 #ifndef LTC_NO_MODES
218
219 #define LTC_CFB_MODE
220 #define LTC_OFB_MODE
221 #define LTC_ECB_MODE
124 #define LTC_CBC_MODE 222 #define LTC_CBC_MODE
125
126 #ifdef DROPBEAR_ENABLE_CTR_MODE
127 #define LTC_CTR_MODE 223 #define LTC_CTR_MODE
128 #endif 224
129 225 /* F8 chaining mode */
226 #define LTC_F8_MODE
227
228 /* LRW mode */
229 #define LTC_LRW_MODE
230 #ifndef LTC_NO_TABLES
231 /* like GCM mode this will enable 16 8x128 tables [64KB] that make
232 * seeking very fast.
233 */
234 #define LTC_LRW_TABLES
235 #endif
236
237 /* XTS mode */
238 #define LTC_XTS_MODE
239
240 #endif /* LTC_NO_MODES */
241
242 /* ---> One-Way Hash Functions <--- */
243 #ifndef LTC_NO_HASHES
244
245 #define LTC_CHC_HASH
246 #define LTC_WHIRLPOOL
247 #define LTC_SHA3
248 #define LTC_SHA512
249 #define LTC_SHA512_256
250 #define LTC_SHA512_224
251 #define LTC_SHA384
252 #define LTC_SHA256
253 #define LTC_SHA224
254 #define LTC_TIGER
130 #define LTC_SHA1 255 #define LTC_SHA1
131
132 #ifdef DROPBEAR_MD5
133 #define LTC_MD5 256 #define LTC_MD5
134 #endif 257 #define LTC_MD4
135 258 #define LTC_MD2
136 #ifdef DROPBEAR_SHA256 259 #define LTC_RIPEMD128
137 #define LTC_SHA256 260 #define LTC_RIPEMD160
138 #endif 261 #define LTC_RIPEMD256
139 #ifdef DROPBEAR_SHA384 262 #define LTC_RIPEMD320
140 #define LTC_SHA384 263 #define LTC_BLAKE2S
141 #endif 264 #define LTC_BLAKE2B
142 #ifdef DROPBEAR_SHA512 265
143 #define LTC_SHA512 266 #define LTC_HASH_HELPERS
144 #endif 267
268 #endif /* LTC_NO_HASHES */
269
270
271 /* ---> MAC functions <--- */
272 #ifndef LTC_NO_MACS
145 273
146 #define LTC_HMAC 274 #define LTC_HMAC
147 275 #define LTC_OMAC
148 #ifdef DROPBEAR_ECC 276 #define LTC_PMAC
277 #define LTC_XCBC
278 #define LTC_F9_MODE
279 #define LTC_PELICAN
280 #define LTC_POLY1305
281 #define LTC_BLAKE2SMAC
282 #define LTC_BLAKE2BMAC
283
284 /* ---> Encrypt + Authenticate Modes <--- */
285
286 #define LTC_EAX_MODE
287
288 #define LTC_OCB_MODE
289 #define LTC_OCB3_MODE
290 #define LTC_CCM_MODE
291 #define LTC_GCM_MODE
292 #define LTC_CHACHA20POLY1305_MODE
293
294 /* Use 64KiB tables */
295 #ifndef LTC_NO_TABLES
296 #define LTC_GCM_TABLES
297 #endif
298
299 /* USE SSE2? requires GCC works on x86_32 and x86_64*/
300 #ifdef LTC_GCM_TABLES
301 /* #define LTC_GCM_TABLES_SSE2 */
302 #endif
303
304 #endif /* LTC_NO_MACS */
305
306
307 /* --> Pseudo Random Number Generators <--- */
308 #ifndef LTC_NO_PRNGS
309
310 /* Yarrow */
311 #define LTC_YARROW
312
313 /* a PRNG that simply reads from an available system source */
314 #define LTC_SPRNG
315
316 /* The RC4 stream cipher based PRNG */
317 #define LTC_RC4
318
319 /* The ChaCha20 stream cipher based PRNG */
320 #define LTC_CHACHA20_PRNG
321
322 /* Fortuna PRNG */
323 #define LTC_FORTUNA
324
325 /* Greg's SOBER128 stream cipher based PRNG */
326 #define LTC_SOBER128
327
328 /* the *nix style /dev/random device */
329 #define LTC_DEVRANDOM
330 /* try /dev/urandom before trying /dev/random
331 * are you sure you want to disable this? http://www.2uo.de/myths-about-urandom/ */
332 #define LTC_TRY_URANDOM_FIRST
333 /* rng_get_bytes() */
334 #define LTC_RNG_GET_BYTES
335 /* rng_make_prng() */
336 #define LTC_RNG_MAKE_PRNG
337
338 /* enable the ltc_rng hook to integrate e.g. embedded hardware RNG's easily */
339 /* #define LTC_PRNG_ENABLE_LTC_RNG */
340
341 #endif /* LTC_NO_PRNGS */
342
343 #ifdef LTC_YARROW
344
345 /* which descriptor of AES to use? */
346 /* 0 = rijndael_enc 1 = aes_enc, 2 = rijndael [full], 3 = aes [full] */
347 #ifdef ENCRYPT_ONLY
348 #define LTC_YARROW_AES 0
349 #else
350 #define LTC_YARROW_AES 2
351 #endif
352
353 #endif
354
355 #ifdef LTC_FORTUNA
356
357 #ifndef LTC_FORTUNA_WD
358 /* reseed every N calls to the read function */
359 #define LTC_FORTUNA_WD 10
360 #endif
361
362 #ifndef LTC_FORTUNA_POOLS
363 /* number of pools (4..32) can save a bit of ram by lowering the count */
364 #define LTC_FORTUNA_POOLS 32
365 #endif
366
367 #endif /* LTC_FORTUNA */
368
369
370 /* ---> Public Key Crypto <--- */
371 #ifndef LTC_NO_PK
372
373 /* Include RSA support */
374 #define LTC_MRSA
375
376 /* Include Diffie-Hellman support */
377 /* is_prime fails for GMP */
378 #define LTC_MDH
379 /* Supported Key Sizes */
380 #define LTC_DH768
381 #define LTC_DH1024
382 #define LTC_DH1536
383 #define LTC_DH2048
384
385 #ifndef TFM_DESC
386 /* tfm has a problem in fp_isprime for larger key sizes */
387 #define LTC_DH3072
388 #define LTC_DH4096
389 #define LTC_DH6144
390 #define LTC_DH8192
391 #endif
392
393 /* Include Katja (a Rabin variant like RSA) */
394 /* #define LTC_MKAT */
395
396 /* Digital Signature Algorithm */
397 #define LTC_MDSA
398
399 /* ECC */
149 #define LTC_MECC 400 #define LTC_MECC
401
402 /* use Shamir's trick for point mul (speeds up signature verification) */
150 #define LTC_ECC_SHAMIR 403 #define LTC_ECC_SHAMIR
404
405 #if defined(TFM_DESC) && defined(LTC_MECC)
406 #define LTC_MECC_ACCEL
407 #endif
408
409 /* do we want fixed point ECC */
410 /* #define LTC_MECC_FP */
411
412 #endif /* LTC_NO_PK */
413
414 #if defined(LTC_MRSA) && !defined(LTC_NO_RSA_BLINDING)
415 /* Enable RSA blinding when doing private key operations by default */
416 #define LTC_RSA_BLINDING
417 #endif /* LTC_NO_RSA_BLINDING */
418
419 #if defined(LTC_MRSA) && !defined(LTC_NO_RSA_CRT_HARDENING)
420 /* Enable RSA CRT hardening when doing private key operations by default */
421 #define LTC_RSA_CRT_HARDENING
422 #endif /* LTC_NO_RSA_CRT_HARDENING */
423
424 #if defined(LTC_MECC) && !defined(LTC_NO_ECC_TIMING_RESISTANT)
425 /* Enable ECC timing resistant version by default */
151 #define LTC_ECC_TIMING_RESISTANT 426 #define LTC_ECC_TIMING_RESISTANT
152 #define MPI 427 #endif
153 #define LTM_DESC 428
154 #ifdef DROPBEAR_ECC_256 429 /* PKCS #1 (RSA) and #5 (Password Handling) stuff */
155 #define ECC256 430 #ifndef LTC_NO_PKCS
156 #endif 431
157 #ifdef DROPBEAR_ECC_384 432 #define LTC_PKCS_1
158 #define ECC384 433 #define LTC_PKCS_5
159 #endif 434
160 #ifdef DROPBEAR_ECC_521 435 /* Include ASN.1 DER (required by DSA/RSA) */
161 #define ECC521 436 #define LTC_DER
162 #endif 437
163 #endif 438 #endif /* LTC_NO_PKCS */
439
440 /* misc stuff */
441 #ifndef LTC_NO_MISC
164 442
165 /* Various tidbits of modern neatoness */ 443 /* Various tidbits of modern neatoness */
166 #define LTC_BASE64 444 #define LTC_BASE64
167 445 /* ... and it's URL safe version */
168 /* default no pthread functions */ 446 #define LTC_BASE64_URL
447
448 /* Keep LTC_NO_HKDF for compatibility reasons
449 * superseeded by LTC_NO_MISC*/
450 #ifndef LTC_NO_HKDF
451 /* HKDF Key Derivation/Expansion stuff */
452 #define LTC_HKDF
453 #endif /* LTC_NO_HKDF */
454
455 #define LTC_ADLER32
456
457 #define LTC_CRC32
458
459 #endif /* LTC_NO_MISC */
460
461 /* cleanup */
462
463 #ifdef LTC_MECC
464 /* Supported ECC Key Sizes */
465 #ifndef LTC_NO_CURVES
466 #define LTC_ECC112
467 #define LTC_ECC128
468 #define LTC_ECC160
469 #define LTC_ECC192
470 #define LTC_ECC224
471 #define LTC_ECC256
472 #define LTC_ECC384
473 #define LTC_ECC521
474 #endif
475 #endif
476
477 #if defined(LTC_MECC) || defined(LTC_MRSA) || defined(LTC_MDSA) || defined(LTC_MKAT)
478 /* Include the MPI functionality? (required by the PK algorithms) */
479 #define LTC_MPI
480
481 #ifndef LTC_PK_MAX_RETRIES
482 /* iterations limit for retry-loops */
483 #define LTC_PK_MAX_RETRIES 20
484 #endif
485 #endif
486
487 #ifdef LTC_MRSA
488 #define LTC_PKCS_1
489 #endif
490
491 #if defined(LTC_PELICAN) && !defined(LTC_RIJNDAEL)
492 #error Pelican-MAC requires LTC_RIJNDAEL
493 #endif
494
495 #if defined(LTC_EAX_MODE) && !(defined(LTC_CTR_MODE) && defined(LTC_OMAC))
496 #error LTC_EAX_MODE requires CTR and LTC_OMAC mode
497 #endif
498
499 #if defined(LTC_YARROW) && !defined(LTC_CTR_MODE)
500 #error LTC_YARROW requires LTC_CTR_MODE chaining mode to be defined!
501 #endif
502
503 #if defined(LTC_DER) && !defined(LTC_MPI)
504 #error ASN.1 DER requires MPI functionality
505 #endif
506
507 /* Dropbear patched out LTC_MECC */
508 #if (defined(LTC_MDSA) || defined(LTC_MRSA) || /*defined(LTC_MECC) ||*/ defined(LTC_MKAT)) && !defined(LTC_DER)
509 #error PK requires ASN.1 DER functionality, make sure LTC_DER is enabled
510 #endif
511
512 #if defined(LTC_CHACHA20POLY1305_MODE) && (!defined(LTC_CHACHA) || !defined(LTC_POLY1305))
513 #error LTC_CHACHA20POLY1305_MODE requires LTC_CHACHA + LTC_POLY1305
514 #endif
515
516 #if defined(LTC_CHACHA20_PRNG) && !defined(LTC_CHACHA)
517 #error LTC_CHACHA20_PRNG requires LTC_CHACHA
518 #endif
519
520 #if defined(LTC_RC4) && !defined(LTC_RC4_STREAM)
521 #error LTC_RC4 requires LTC_RC4_STREAM
522 #endif
523
524 #if defined(LTC_SOBER128) && !defined(LTC_SOBER128_STREAM)
525 #error LTC_SOBER128 requires LTC_SOBER128_STREAM
526 #endif
527
528 #if defined(LTC_BLAKE2SMAC) && !defined(LTC_BLAKE2S)
529 #error LTC_BLAKE2SMAC requires LTC_BLAKE2S
530 #endif
531
532 #if defined(LTC_BLAKE2BMAC) && !defined(LTC_BLAKE2B)
533 #error LTC_BLAKE2BMAC requires LTC_BLAKE2B
534 #endif
535
536 #if defined(LTC_SPRNG) && !defined(LTC_RNG_GET_BYTES)
537 #error LTC_SPRNG requires LTC_RNG_GET_BYTES
538 #endif
539
540 #if defined(LTC_NO_MATH) && (defined(LTM_DESC) || defined(TFM_DESC) || defined(GMP_DESC))
541 #error LTC_NO_MATH defined, but also a math descriptor
542 #endif
543
544 /* THREAD management */
545 #ifdef LTC_PTHREAD
546
547 #include <pthread.h>
548
549 #define LTC_MUTEX_GLOBAL(x) pthread_mutex_t x = PTHREAD_MUTEX_INITIALIZER;
550 #define LTC_MUTEX_PROTO(x) extern pthread_mutex_t x;
551 #define LTC_MUTEX_TYPE(x) pthread_mutex_t x;
552 #define LTC_MUTEX_INIT(x) LTC_ARGCHK(pthread_mutex_init(x, NULL) == 0);
553 #define LTC_MUTEX_LOCK(x) LTC_ARGCHK(pthread_mutex_lock(x) == 0);
554 #define LTC_MUTEX_UNLOCK(x) LTC_ARGCHK(pthread_mutex_unlock(x) == 0);
555 #define LTC_MUTEX_DESTROY(x) LTC_ARGCHK(pthread_mutex_destroy(x) == 0);
556
557 #else
558
559 /* default no functions */
169 #define LTC_MUTEX_GLOBAL(x) 560 #define LTC_MUTEX_GLOBAL(x)
170 #define LTC_MUTEX_PROTO(x) 561 #define LTC_MUTEX_PROTO(x)
171 #define LTC_MUTEX_TYPE(x) 562 #define LTC_MUTEX_TYPE(x)
172 #define LTC_MUTEX_INIT(x) 563 #define LTC_MUTEX_INIT(x)
173 #define LTC_MUTEX_LOCK(x) 564 #define LTC_MUTEX_LOCK(x)
174 #define LTC_MUTEX_UNLOCK(x) 565 #define LTC_MUTEX_UNLOCK(x)
175 #define FORTUNA_POOLS 0 566 #define LTC_MUTEX_DESTROY(x)
567
568 #endif
176 569
177 /* Debuggers */ 570 /* Debuggers */
178 571
179 /* define this if you use Valgrind, note: it CHANGES the way SOBER-128 and LTC_RC4 work (see the code) */ 572 /* define this if you use Valgrind, note: it CHANGES the way SOBER-128 and RC4 work (see the code) */
180 /* #define LTC_VALGRIND */ 573 /* #define LTC_VALGRIND */
181 574
182 #endif 575 #endif
183 576
184 577 #ifndef LTC_NO_FILE
185 578 /* buffer size for reading from a file via fread(..) */
186 /* $Source$ */ 579 #ifndef LTC_FILE_READ_BUFSIZE
187 /* $Revision$ */ 580 #define LTC_FILE_READ_BUFSIZE 8192
188 /* $Date$ */ 581 #endif
582 #endif
583
584 /* ref: $Format:%D$ */
585 /* git commit: $Format:%H$ */
586 /* commit time: $Format:%ai$ */