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