]> Dogcows Code - chaz/p5-File-KDBX-XS/blob - libtomcrypt/src/headers/tomcrypt_custom.h
initial commit
[chaz/p5-File-KDBX-XS] / libtomcrypt / src / headers / tomcrypt_custom.h
1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis */
2 /* SPDX-License-Identifier: Unlicense */
3
4 #ifndef TOMCRYPT_CUSTOM_H_
5 #define TOMCRYPT_CUSTOM_H_
6
7 /* macros for various libc functions you can change for embedded targets */
8 #ifndef XMALLOC
9 #define XMALLOC malloc
10 #endif
11 #ifndef XREALLOC
12 #define XREALLOC realloc
13 #endif
14 #ifndef XCALLOC
15 #define XCALLOC calloc
16 #endif
17 #ifndef XFREE
18 #define XFREE free
19 #endif
20
21 #ifndef XMEMSET
22 #define XMEMSET memset
23 #endif
24 #ifndef XMEMCPY
25 #define XMEMCPY memcpy
26 #endif
27 #ifndef XMEMMOVE
28 #define XMEMMOVE memmove
29 #endif
30 #ifndef XMEMCMP
31 #define XMEMCMP memcmp
32 #endif
33 /* A memory compare function that has to run in constant time,
34 * c.f. mem_neq() API summary.
35 */
36 #ifndef XMEM_NEQ
37 #define XMEM_NEQ mem_neq
38 #endif
39 #ifndef XSTRCMP
40 #define XSTRCMP strcmp
41 #endif
42 #ifndef XSTRLEN
43 #define XSTRLEN strlen
44 #endif
45 #ifndef XSTRNCPY
46 #define XSTRNCPY strncpy
47 #endif
48
49 #ifndef XCLOCK
50 #define XCLOCK clock
51 #endif
52
53 #ifndef XQSORT
54 #define XQSORT qsort
55 #endif
56
57 #if ( defined(malloc) || defined(realloc) || defined(calloc) || defined(free) || \
58 defined(memset) || defined(memcpy) || defined(memcmp) || defined(strcmp) || \
59 defined(strlen) || defined(strncpy) || defined(clock) || defined(qsort) ) \
60 && !defined(LTC_NO_PROTOTYPES)
61 #define LTC_NO_PROTOTYPES
62 #endif
63
64 /* shortcut to disable automatic inclusion */
65 #if defined LTC_NOTHING && !defined LTC_EASY
66 #define LTC_NO_CIPHERS
67 #define LTC_NO_MODES
68 #define LTC_NO_HASHES
69 #define LTC_NO_MACS
70 #define LTC_NO_PRNGS
71 #define LTC_NO_PK
72 #define LTC_NO_PKCS
73 #define LTC_NO_MISC
74 #endif /* LTC_NOTHING */
75
76 /* Easy button? */
77 #ifdef LTC_EASY
78 #define LTC_NO_CIPHERS
79 #define LTC_RIJNDAEL
80 #define LTC_BLOWFISH
81 #define LTC_DES
82 #define LTC_CAST5
83
84 #define LTC_NO_MODES
85 #define LTC_ECB_MODE
86 #define LTC_CBC_MODE
87 #define LTC_CTR_MODE
88
89 #define LTC_NO_HASHES
90 #define LTC_SHA1
91 #define LTC_SHA3
92 #define LTC_SHA512
93 #define LTC_SHA384
94 #define LTC_SHA256
95 #define LTC_SHA224
96 #define LTC_HASH_HELPERS
97
98 #define LTC_NO_MACS
99 #define LTC_HMAC
100 #define LTC_OMAC
101 #define LTC_CCM_MODE
102
103 #define LTC_NO_PRNGS
104 #define LTC_SPRNG
105 #define LTC_YARROW
106 #define LTC_DEVRANDOM
107 #define LTC_TRY_URANDOM_FIRST
108 #define LTC_RNG_GET_BYTES
109 #define LTC_RNG_MAKE_PRNG
110
111 #define LTC_NO_PK
112 #define LTC_MRSA
113 #define LTC_MECC
114
115 #define LTC_NO_MISC
116 #define LTC_BASE64
117 #endif
118
119 /* The minimal set of functionality to run the tests */
120 #ifdef LTC_MINIMAL
121 #define LTC_RIJNDAEL
122 #define LTC_SHA256
123 #define LTC_YARROW
124 #define LTC_CTR_MODE
125
126 #define LTC_RNG_MAKE_PRNG
127 #define LTC_RNG_GET_BYTES
128 #define LTC_DEVRANDOM
129 #define LTC_TRY_URANDOM_FIRST
130
131 #undef LTC_NO_FILE
132 #endif
133
134 /* Enable self-test test vector checking */
135 #ifndef LTC_NO_TEST
136 #define LTC_TEST
137 #endif
138 /* Enable extended self-tests */
139 /* #define LTC_TEST_EXT */
140
141 /* Use small code where possible */
142 /* #define LTC_SMALL_CODE */
143
144 /* clean the stack of functions which put private information on stack */
145 /* #define LTC_CLEAN_STACK */
146
147 /* disable all file related functions */
148 /* #define LTC_NO_FILE */
149
150 /* disable all forms of ASM */
151 /* #define LTC_NO_ASM */
152
153 /* disable FAST mode */
154 /* #define LTC_NO_FAST */
155
156 /* disable BSWAP on x86 */
157 /* #define LTC_NO_BSWAP */
158
159 /* ---> math provider? <--- */
160 #ifndef LTC_NO_MATH
161
162 /* LibTomMath */
163 /* #define LTM_DESC */
164
165 /* TomsFastMath */
166 /* #define TFM_DESC */
167
168 /* GNU Multiple Precision Arithmetic Library */
169 /* #define GMP_DESC */
170
171 #endif /* LTC_NO_MATH */
172
173 /* ---> Symmetric Block Ciphers <--- */
174 #ifndef LTC_NO_CIPHERS
175
176 #define LTC_BLOWFISH
177 #define LTC_RC2
178 #define LTC_RC5
179 #define LTC_RC6
180 #define LTC_SAFERP
181 #define LTC_RIJNDAEL
182 #define LTC_XTEA
183 /* _TABLES tells it to use tables during setup, _SMALL means to use the smaller scheduled key format
184 * (saves 4KB of ram), _ALL_TABLES enables all tables during setup */
185 #define LTC_TWOFISH
186 #ifndef LTC_NO_TABLES
187 #define LTC_TWOFISH_TABLES
188 /* #define LTC_TWOFISH_ALL_TABLES */
189 #else
190 #define LTC_TWOFISH_SMALL
191 #endif
192 /* #define LTC_TWOFISH_SMALL */
193 /* LTC_DES includes EDE triple-DES */
194 #define LTC_DES
195 #define LTC_CAST5
196 #define LTC_NOEKEON
197 #define LTC_SKIPJACK
198 #define LTC_SAFER
199 #define LTC_KHAZAD
200 #define LTC_ANUBIS
201 #define LTC_ANUBIS_TWEAK
202 #define LTC_KSEED
203 #define LTC_KASUMI
204 #define LTC_MULTI2
205 #define LTC_CAMELLIA
206 #define LTC_IDEA
207 #define LTC_SERPENT
208 #define LTC_TEA
209
210 /* stream ciphers */
211 #define LTC_CHACHA
212 #define LTC_SALSA20
213 #define LTC_XSALSA20
214 #define LTC_SOSEMANUK
215 #define LTC_RABBIT
216 #define LTC_RC4_STREAM
217 #define LTC_SOBER128_STREAM
218
219 #endif /* LTC_NO_CIPHERS */
220
221
222 /* ---> Block Cipher Modes of Operation <--- */
223 #ifndef LTC_NO_MODES
224
225 #define LTC_CFB_MODE
226 #define LTC_OFB_MODE
227 #define LTC_ECB_MODE
228 #define LTC_CBC_MODE
229 #define LTC_CTR_MODE
230
231 /* F8 chaining mode */
232 #define LTC_F8_MODE
233
234 /* LRW mode */
235 #define LTC_LRW_MODE
236 #ifndef LTC_NO_TABLES
237 /* like GCM mode this will enable 16 8x128 tables [64KB] that make
238 * seeking very fast.
239 */
240 #define LTC_LRW_TABLES
241 #endif
242
243 /* XTS mode */
244 #define LTC_XTS_MODE
245
246 #endif /* LTC_NO_MODES */
247
248 /* ---> One-Way Hash Functions <--- */
249 #ifndef LTC_NO_HASHES
250
251 #define LTC_CHC_HASH
252 #define LTC_WHIRLPOOL
253 #define LTC_SHA3
254 #define LTC_KECCAK
255 #define LTC_SHA512
256 #define LTC_SHA512_256
257 #define LTC_SHA512_224
258 #define LTC_SHA384
259 #define LTC_SHA256
260 #define LTC_SHA224
261 #define LTC_TIGER
262 #define LTC_SHA1
263 #define LTC_MD5
264 #define LTC_MD4
265 #define LTC_MD2
266 #define LTC_RIPEMD128
267 #define LTC_RIPEMD160
268 #define LTC_RIPEMD256
269 #define LTC_RIPEMD320
270 #define LTC_BLAKE2S
271 #define LTC_BLAKE2B
272
273 #define LTC_HASH_HELPERS
274
275 #endif /* LTC_NO_HASHES */
276
277
278 /* ---> MAC functions <--- */
279 #ifndef LTC_NO_MACS
280
281 #define LTC_HMAC
282 #define LTC_OMAC
283 #define LTC_PMAC
284 #define LTC_XCBC
285 #define LTC_F9_MODE
286 #define LTC_PELICAN
287 #define LTC_POLY1305
288 #define LTC_BLAKE2SMAC
289 #define LTC_BLAKE2BMAC
290
291 /* ---> Encrypt + Authenticate Modes <--- */
292
293 #define LTC_EAX_MODE
294
295 #define LTC_OCB_MODE
296 #define LTC_OCB3_MODE
297 #define LTC_CCM_MODE
298 #define LTC_GCM_MODE
299 #define LTC_CHACHA20POLY1305_MODE
300
301 /* Use 64KiB tables */
302 #ifndef LTC_NO_TABLES
303 #define LTC_GCM_TABLES
304 #endif
305
306 /* USE SSE2? requires GCC works on x86_32 and x86_64*/
307 #ifdef LTC_GCM_TABLES
308 /* #define LTC_GCM_TABLES_SSE2 */
309 #endif
310
311 #endif /* LTC_NO_MACS */
312
313
314 /* --> Pseudo Random Number Generators <--- */
315 #ifndef LTC_NO_PRNGS
316
317 /* Yarrow */
318 #define LTC_YARROW
319
320 /* a PRNG that simply reads from an available system source */
321 #define LTC_SPRNG
322
323 /* The RC4 stream cipher based PRNG */
324 #define LTC_RC4
325
326 /* The ChaCha20 stream cipher based PRNG */
327 #define LTC_CHACHA20_PRNG
328
329 /* Fortuna PRNG */
330 #define LTC_FORTUNA
331
332 /* Greg's SOBER128 stream cipher based PRNG */
333 #define LTC_SOBER128
334
335 /* the *nix style /dev/random device */
336 #define LTC_DEVRANDOM
337 /* try /dev/urandom before trying /dev/random
338 * are you sure you want to disable this? http://www.2uo.de/myths-about-urandom/ */
339 #define LTC_TRY_URANDOM_FIRST
340 /* rng_get_bytes() */
341 #define LTC_RNG_GET_BYTES
342 /* rng_make_prng() */
343 #define LTC_RNG_MAKE_PRNG
344
345 /* enable the ltc_rng hook to integrate e.g. embedded hardware RNG's easily */
346 /* #define LTC_PRNG_ENABLE_LTC_RNG */
347
348 #endif /* LTC_NO_PRNGS */
349
350 #ifdef LTC_YARROW
351
352 /* which descriptor of AES to use? */
353 /* 0 = rijndael_enc 1 = aes_enc, 2 = rijndael [full], 3 = aes [full] */
354 #ifdef ENCRYPT_ONLY
355 #define LTC_YARROW_AES 0
356 #else
357 #define LTC_YARROW_AES 2
358 #endif
359
360 #endif
361
362 #ifdef LTC_FORTUNA
363
364 #if !defined(LTC_FORTUNA_RESEED_RATELIMIT_STATIC) && \
365 ((defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112L) || defined(_WIN32))
366
367 /* time-based rate limit of the reseeding */
368 #define LTC_FORTUNA_RESEED_RATELIMIT_TIMED
369
370 /* with non-glibc or glibc 2.17+ prefer clock_gettime over gettimeofday */
371 #if defined(__GLIBC__) && defined(__GLIBC_PREREQ)
372 #if __GLIBC_PREREQ(2, 17)
373 #define LTC_CLOCK_GETTIME
374 #endif
375 #elif defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112L
376 #define LTC_CLOCK_GETTIME
377 #endif
378
379 #else
380
381 #ifndef LTC_FORTUNA_WD
382 /* reseed every N calls to the read function */
383 #define LTC_FORTUNA_WD 10
384 #endif
385
386 #ifdef LTC_FORTUNA_RESEED_RATELIMIT_TIMED
387 /* make sure only one of
388 * LTC_FORTUNA_RESEED_RATELIMIT_STATIC
389 * and
390 * LTC_FORTUNA_RESEED_RATELIMIT_TIMED
391 * is defined.
392 */
393 #undef LTC_FORTUNA_RESEED_RATELIMIT_TIMED
394 #warning "undef'ed LTC_FORTUNA_RESEED_RATELIMIT_TIMED, looks like your architecture doesn't support it"
395 #endif
396
397 #endif
398
399 #ifndef LTC_FORTUNA_POOLS
400 /* number of pools (4..32) can save a bit of ram by lowering the count */
401 #define LTC_FORTUNA_POOLS 32
402 #endif
403
404 #endif /* LTC_FORTUNA */
405
406
407 /* ---> Public Key Crypto <--- */
408 #ifndef LTC_NO_PK
409
410 /* Include RSA support */
411 #define LTC_MRSA
412
413 /* Include Diffie-Hellman support */
414 /* is_prime fails for GMP */
415 #define LTC_MDH
416 /* Supported Key Sizes */
417 #define LTC_DH768
418 #define LTC_DH1024
419 #define LTC_DH1536
420 #define LTC_DH2048
421
422 #if defined(LTM_DESC) || defined(GMP_DESC)
423 /* tfm has a problem in fp_isprime for larger key sizes */
424 #define LTC_DH3072
425 #define LTC_DH4096
426 #define LTC_DH6144
427 #define LTC_DH8192
428 #endif
429
430 /* Digital Signature Algorithm */
431 #define LTC_MDSA
432
433 /* Ed25519 & X25519 */
434 #define LTC_CURVE25519
435
436 /* ECC */
437 #define LTC_MECC
438
439 /* use Shamir's trick for point mul (speeds up signature verification) */
440 #define LTC_ECC_SHAMIR
441
442 #if defined(TFM_DESC) && defined(LTC_MECC)
443 #define LTC_MECC_ACCEL
444 #endif
445
446 /* do we want fixed point ECC */
447 /* #define LTC_MECC_FP */
448
449 #endif /* LTC_NO_PK */
450
451 #if defined(LTC_MRSA) && !defined(LTC_NO_RSA_BLINDING)
452 /* Enable RSA blinding when doing private key operations by default */
453 #define LTC_RSA_BLINDING
454 #endif /* LTC_NO_RSA_BLINDING */
455
456 #if defined(LTC_MRSA) && !defined(LTC_NO_RSA_CRT_HARDENING)
457 /* Enable RSA CRT hardening when doing private key operations by default */
458 #define LTC_RSA_CRT_HARDENING
459 #endif /* LTC_NO_RSA_CRT_HARDENING */
460
461 #if defined(LTC_MECC) && !defined(LTC_NO_ECC_TIMING_RESISTANT)
462 /* Enable ECC timing resistant version by default */
463 #define LTC_ECC_TIMING_RESISTANT
464 #endif
465
466 /* PKCS #1 (RSA) and #5 (Password Handling) stuff */
467 #ifndef LTC_NO_PKCS
468
469 #define LTC_PKCS_1
470 #define LTC_PKCS_5
471 #define LTC_PKCS_8
472 #define LTC_PKCS_12
473
474 /* Include ASN.1 DER (required by DSA/RSA) */
475 #define LTC_DER
476
477 #endif /* LTC_NO_PKCS */
478
479 /* misc stuff */
480 #ifndef LTC_NO_MISC
481
482 /* Various tidbits of modern neatoness */
483 #define LTC_BASE64
484 /* ... and it's URL safe version */
485 #define LTC_BASE64_URL
486 /* Base32 encoding/decoding */
487 #define LTC_BASE32
488 /* Base16/hex encoding/decoding */
489 #define LTC_BASE16
490
491 #define LTC_BCRYPT
492
493 #ifndef LTC_BCRYPT_DEFAULT_ROUNDS
494 #define LTC_BCRYPT_DEFAULT_ROUNDS 10
495 #endif
496
497 /* Keep LTC_NO_HKDF for compatibility reasons
498 * superseeded by LTC_NO_MISC*/
499 #ifndef LTC_NO_HKDF
500 /* HKDF Key Derivation/Expansion stuff */
501 #define LTC_HKDF
502 #endif /* LTC_NO_HKDF */
503
504 #define LTC_ADLER32
505
506 #define LTC_CRC32
507
508 #define LTC_SSH
509
510 #define LTC_PADDING
511
512 #define LTC_PBES
513
514 #endif /* LTC_NO_MISC */
515
516 /* cleanup */
517
518 #ifdef LTC_MECC
519 /* Supported ECC Key Sizes */
520 #ifndef LTC_NO_CURVES
521 #define LTC_ECC_BRAINPOOLP160R1
522 #define LTC_ECC_BRAINPOOLP160T1
523 #define LTC_ECC_BRAINPOOLP192R1
524 #define LTC_ECC_BRAINPOOLP192T1
525 #define LTC_ECC_BRAINPOOLP224R1
526 #define LTC_ECC_BRAINPOOLP224T1
527 #define LTC_ECC_BRAINPOOLP256R1
528 #define LTC_ECC_BRAINPOOLP256T1
529 #define LTC_ECC_BRAINPOOLP320R1
530 #define LTC_ECC_BRAINPOOLP320T1
531 #define LTC_ECC_BRAINPOOLP384R1
532 #define LTC_ECC_BRAINPOOLP384T1
533 #define LTC_ECC_BRAINPOOLP512R1
534 #define LTC_ECC_BRAINPOOLP512T1
535 #define LTC_ECC_PRIME192V2
536 #define LTC_ECC_PRIME192V3
537 #define LTC_ECC_PRIME239V1
538 #define LTC_ECC_PRIME239V2
539 #define LTC_ECC_PRIME239V3
540 #define LTC_ECC_SECP112R1
541 #define LTC_ECC_SECP112R2
542 #define LTC_ECC_SECP128R1
543 #define LTC_ECC_SECP128R2
544 #define LTC_ECC_SECP160K1
545 #define LTC_ECC_SECP160R1
546 #define LTC_ECC_SECP160R2
547 #define LTC_ECC_SECP192K1
548 #define LTC_ECC_SECP192R1
549 #define LTC_ECC_SECP224K1
550 #define LTC_ECC_SECP224R1
551 #define LTC_ECC_SECP256K1
552 #define LTC_ECC_SECP256R1
553 #define LTC_ECC_SECP384R1
554 #define LTC_ECC_SECP521R1
555 #endif
556 #endif
557
558 #if defined(LTC_DER)
559 #ifndef LTC_DER_MAX_RECURSION
560 /* Maximum recursion limit when processing nested ASN.1 types. */
561 #define LTC_DER_MAX_RECURSION 30
562 #endif
563 #endif
564
565 #if defined(LTC_MECC) || defined(LTC_MRSA) || defined(LTC_MDSA) || defined(LTC_SSH)
566 /* Include the MPI functionality? (required by the PK algorithms) */
567 #define LTC_MPI
568
569 #ifndef LTC_PK_MAX_RETRIES
570 /* iterations limit for retry-loops */
571 #define LTC_PK_MAX_RETRIES 20
572 #endif
573 #endif
574
575 #ifdef LTC_MRSA
576 #define LTC_PKCS_1
577 #endif
578
579 #if defined(LTC_MRSA) || defined(LTC_MECC)
580 #define LTC_PKCS_8
581 #endif
582
583 #ifdef LTC_PKCS_8
584 #define LTC_PADDING
585 #define LTC_PBES
586 #endif
587
588 #if defined(LTC_CLEAN_STACK)
589 /* if you're sure that you want to use it, remove the line below */
590 #error LTC_CLEAN_STACK is considered as broken
591 #endif
592
593 #if defined(LTC_PBES) && !defined(LTC_PKCS_5)
594 #error LTC_PBES requires LTC_PKCS_5
595 #endif
596
597 #if defined(LTC_PBES) && !defined(LTC_PKCS_12)
598 #error LTC_PBES requires LTC_PKCS_12
599 #endif
600
601 #if defined(LTC_PKCS_5) && !defined(LTC_HMAC)
602 #error LTC_PKCS_5 requires LTC_HMAC
603 #endif
604
605 #if defined(LTC_PKCS_5) && !defined(LTC_HASH_HELPERS)
606 #error LTC_PKCS_5 requires LTC_HASH_HELPERS
607 #endif
608
609 #if defined(LTC_PELICAN) && !defined(LTC_RIJNDAEL)
610 #error Pelican-MAC requires LTC_RIJNDAEL
611 #endif
612
613 #if defined(LTC_EAX_MODE) && !(defined(LTC_CTR_MODE) && defined(LTC_OMAC))
614 #error LTC_EAX_MODE requires CTR and LTC_OMAC mode
615 #endif
616
617 #if defined(LTC_YARROW) && !defined(LTC_CTR_MODE)
618 #error LTC_YARROW requires LTC_CTR_MODE chaining mode to be defined!
619 #endif
620
621 #if defined(LTC_DER) && !defined(LTC_MPI)
622 #error ASN.1 DER requires MPI functionality
623 #endif
624
625 #if (defined(LTC_MDSA) || defined(LTC_MRSA) || defined(LTC_MECC)) && !defined(LTC_DER)
626 #error PK requires ASN.1 DER functionality, make sure LTC_DER is enabled
627 #endif
628
629 #if defined(LTC_BCRYPT) && !defined(LTC_BLOWFISH)
630 #error LTC_BCRYPT requires LTC_BLOWFISH
631 #endif
632
633 #if defined(LTC_CHACHA20POLY1305_MODE) && (!defined(LTC_CHACHA) || !defined(LTC_POLY1305))
634 #error LTC_CHACHA20POLY1305_MODE requires LTC_CHACHA + LTC_POLY1305
635 #endif
636
637 #if defined(LTC_CHACHA20_PRNG) && !defined(LTC_CHACHA)
638 #error LTC_CHACHA20_PRNG requires LTC_CHACHA
639 #endif
640
641 #if defined(LTC_XSALSA20) && !defined(LTC_SALSA20)
642 #error LTC_XSALSA20 requires LTC_SALSA20
643 #endif
644
645 #if defined(LTC_RC4) && !defined(LTC_RC4_STREAM)
646 #error LTC_RC4 requires LTC_RC4_STREAM
647 #endif
648
649 #if defined(LTC_SOBER128) && !defined(LTC_SOBER128_STREAM)
650 #error LTC_SOBER128 requires LTC_SOBER128_STREAM
651 #endif
652
653 #if defined(LTC_BLAKE2SMAC) && !defined(LTC_BLAKE2S)
654 #error LTC_BLAKE2SMAC requires LTC_BLAKE2S
655 #endif
656
657 #if defined(LTC_BLAKE2BMAC) && !defined(LTC_BLAKE2B)
658 #error LTC_BLAKE2BMAC requires LTC_BLAKE2B
659 #endif
660
661 #if defined(LTC_SPRNG) && !defined(LTC_RNG_GET_BYTES)
662 #error LTC_SPRNG requires LTC_RNG_GET_BYTES
663 #endif
664
665 #if defined(LTC_NO_MATH) && (defined(LTM_DESC) || defined(TFM_DESC) || defined(GMP_DESC))
666 #error LTC_NO_MATH defined, but also a math descriptor
667 #endif
668
669 /* THREAD management */
670 #ifdef LTC_PTHREAD
671
672 #include <pthread.h>
673
674 #define LTC_MUTEX_GLOBAL(x) pthread_mutex_t x = PTHREAD_MUTEX_INITIALIZER;
675 #define LTC_MUTEX_PROTO(x) extern pthread_mutex_t x;
676 #define LTC_MUTEX_TYPE(x) pthread_mutex_t x;
677 #define LTC_MUTEX_INIT(x) LTC_ARGCHK(pthread_mutex_init(x, NULL) == 0);
678 #define LTC_MUTEX_LOCK(x) LTC_ARGCHK(pthread_mutex_lock(x) == 0);
679 #define LTC_MUTEX_UNLOCK(x) LTC_ARGCHK(pthread_mutex_unlock(x) == 0);
680 #define LTC_MUTEX_DESTROY(x) LTC_ARGCHK(pthread_mutex_destroy(x) == 0);
681
682 #else
683
684 /* default no functions */
685 #define LTC_MUTEX_GLOBAL(x)
686 #define LTC_MUTEX_PROTO(x)
687 #define LTC_MUTEX_TYPE(x)
688 #define LTC_MUTEX_INIT(x)
689 #define LTC_MUTEX_LOCK(x)
690 #define LTC_MUTEX_UNLOCK(x)
691 #define LTC_MUTEX_DESTROY(x)
692
693 #endif
694
695 /* Debuggers */
696
697 /* define this if you use Valgrind, note: it CHANGES the way SOBER-128 and RC4 work (see the code) */
698 /* #define LTC_VALGRIND */
699
700 #endif
701
702 #ifndef LTC_NO_FILE
703 /* buffer size for reading from a file via fread(..) */
704 #ifndef LTC_FILE_READ_BUFSIZE
705 #define LTC_FILE_READ_BUFSIZE 8192
706 #endif
707 #endif
708
709 /* ECC backwards compatibility */
710 #if !defined(LTC_ECC_SECP112R1) && defined(LTC_ECC112)
711 #define LTC_ECC_SECP112R1
712 #undef LTC_ECC112
713 #endif
714 #if !defined(LTC_ECC_SECP128R1) && defined(LTC_ECC128)
715 #define LTC_ECC_SECP128R1
716 #undef LTC_ECC128
717 #endif
718 #if !defined(LTC_ECC_SECP160R1) && defined(LTC_ECC160)
719 #define LTC_ECC_SECP160R1
720 #undef LTC_ECC160
721 #endif
722 #if !defined(LTC_ECC_SECP192R1) && defined(LTC_ECC192)
723 #define LTC_ECC_SECP192R1
724 #undef LTC_ECC192
725 #endif
726 #if !defined(LTC_ECC_SECP224R1) && defined(LTC_ECC224)
727 #define LTC_ECC_SECP224R1
728 #undef LTC_ECC224
729 #endif
730 #if !defined(LTC_ECC_SECP256R1) && defined(LTC_ECC256)
731 #define LTC_ECC_SECP256R1
732 #undef LTC_ECC256
733 #endif
734 #if !defined(LTC_ECC_SECP384R1) && defined(LTC_ECC384)
735 #define LTC_ECC_SECP384R1
736 #undef LTC_ECC384
737 #endif
738 #if !defined(LTC_ECC_SECP512R1) && defined(LTC_ECC521)
739 #define LTC_ECC_SECP521R1
740 #undef LTC_ECC521
741 #endif
This page took 0.06385 seconds and 4 git commands to generate.