1 #ifndef _OSCONFIG_DEFINED 2 #define _OSCONFIG_DEFINED 3 4 /* Pull in cryptlib-wide configuration options */ 5 6 #include "crypt.h" 7 8 /* OpenSSL-specific defines */ 9 10 #define OPENSSL_EXTERN extern 11 #define OPENSSL_GLOBAL 12 #if defined( _WINDOWS ) && !defined( WINDOWS ) /* Windows */ 13 #define WINDOWS /* Old format */ 14 #define OPENSSL_SYS_WINDOWS /* New fomat */ 15 #endif /* OpenSSL Windows not defined */ 16 #if defined( _WIN32 ) /* Win32 and WinCE */ 17 #ifndef WIN32 18 #define WIN32 /* Old format OpenSSL Win32 identifier */ 19 #endif /* WIN32 */ 20 #define OPENSSL_SYS_WIN32 /* New format OpenSSL Win32 identifier */ 21 /* Note that the following asm defines are duplicated in misc/os_spec.h, 22 because the OpenSSL headers are non-orthogonal to the cryptlib ones. 23 Any changes made here need to be reflected in os_spec.h */ 24 #if !( defined( _WIN32_WCE ) || defined( _M_X64 ) || \ 25 defined( __BORLANDC__ ) || defined( NO_ASM ) ) 26 #define USE_ASM /* Always enabled for x86 Win32 */ 27 #endif /* WinCE || x86-64 || Borland compilers */ 28 #endif /* OpenSSL Win32 not defined */ 29 #include <stdlib.h> /* For malloc() */ 30 #include <string.h> /* For memset() */ 31 #if defined( USE_ASM ) && defined( __WATCOMC__ ) 32 #define ASM_EXPORT __cdecl 33 #else 34 #define ASM_EXPORT 35 #endif /* System-specific interface to ASM files */ 36 37 /* General defines. An older generic config from the original OpenSSL 38 version can be found at 39 http://lists.alioth.debian.org/pipermail/pkg-openssl-changes/2005-October/000012.html 40 (which is just the OpenSSL Configure file, posted to the web), the 41 current one is at 42 https://github.com/openssl/openssl/blob/master/Configurations/10-main.conf */ 43 44 #include <limits.h> 45 #if ULONG_MAX > 0xFFFFFFFFUL 46 #define SIXTY_FOUR_BIT 47 #else 48 #define THIRTY_TWO_BIT 49 #endif /* Machine word size */ 50 51 #if defined( _MSC_VER ) 52 /* cryptlib is built with the highest warning level, disable some of the 53 more irritating warnings produced by the OpenSSL code */ 54 #pragma warning( disable: 4244 ) /* int <-> unsigned char/short */ 55 #pragma warning( disable: 4100 ) /* Unreferenced parameter */ 56 #pragma warning( disable: 4127 ) /* Conditional is constant: while( TRUE ) */ 57 #endif /* Visual C++ */ 58 59 /* Aches */ 60 #ifdef _AIX 61 #define B_ENDIAN 62 #define BN_LLONG 63 #define RC4_CHAR 64 #endif /* AIX */ 65 66 /* Alpha */ 67 #if defined( __osf__ ) || defined( __alpha__ ) 68 #define L_ENDIAN 69 #undef SIXTY_FOUR_BIT 70 #define SIXTY_FOUR_BIT_LONG 71 #define DES_INT 72 #define DES_UNROLL 73 #define DES_RISC1 74 #define RC4_CHUNK 75 #endif /* Alpha */ 76 77 /* BeOS */ 78 #ifdef __BEOS__ 79 #if defined( __i386__ ) 80 #define L_ENDIAN 81 #define BN_LLONG 82 #define DES_PTR 83 #define DES_RISC1 84 #define DES_UNROLL 85 #define RC4_INDEX 86 #elif defined( __ppc__ ) 87 #define B_ENDIAN 88 #define BN_LLONG 89 #define DES_RISC1 90 #define DES_UNROLL 91 #define RC4_CHAR 92 #define RC4_CHUNK 93 #else 94 #error Need to define CPU type for non-x86/non-PPC BeOS 95 #endif /* BeoS variants */ 96 #endif /* BeOS */ 97 98 /* The BSDs and Linux. For low-level code-generation purposes these are 99 identical, even if they differ at a higher level */ 100 #if (defined( __FreeBSD__ )||defined(__DragonFly__)) || defined( __bsdi__ ) || \ 101 defined( __OpenBSD__ ) || defined( __NetBSD__ ) || \ 102 defined( __linux__ ) 103 #if defined( __x86_64__ ) || defined( __amd64__ ) 104 /* 64-bit x86 has both 'long' and 'long long' as 64 bits. In addition 105 we use DES_INT since int's are 64-bit. We have to check for the 106 64-bit x86 variants before the generic ones because they're a 107 variation on the generics (e.g. AMD64 defines both __athlon__ and 108 __x86_64__, so if we checked for __athlon__ first we'd identify it 109 as a generic rather than 64-bit build) */ 110 #define L_ENDIAN 111 #undef SIXTY_FOUR_BIT 112 #define SIXTY_FOUR_BIT_LONG 113 #define DES_INT 114 #define DES_RISC1 115 #define DES_UNROLL 116 #define RC4_INDEX 117 #elif defined( __i386__ ) 118 #define L_ENDIAN 119 #define BN_LLONG 120 #define DES_PTR 121 #define DES_RISC1 122 #define DES_UNROLL 123 #define RC4_INDEX 124 #elif defined( __arm ) || defined( __arm__ ) 125 #ifdef DATA_BIGENDIAN 126 #define B_ENDIAN 127 #else 128 #define L_ENDIAN 129 #endif /* Usually little-endian but may be big-endian */ 130 #define BN_LLONG 131 #define DES_RISC1 132 #elif defined( __mips__ ) 133 #ifdef DATA_BIGENDIAN 134 #define B_ENDIAN 135 #else 136 #define L_ENDIAN 137 #endif /* Usually little-endian but may be big-endian */ 138 #define BN_LLONG 139 #define DES_RISC2 140 #define DES_PTR 141 #define DES_UNROLL 142 #define RC4_INDEX 143 #define RC4_CHAR 144 #define RC4_CHUNK 145 #elif defined( __ppc__ ) || defined( __powerpc ) || defined( __powerpc__ ) 146 #ifdef DATA_LITTLEENDIAN 147 #define L_ENDIAN 148 #else 149 #define B_ENDIAN 150 #endif /* Usually big-endian but may be little-endian */ 151 #ifdef __LP64__ 152 #undef SIXTY_FOUR_BIT 153 #define SIXTY_FOUR_BIT_LONG 154 #endif 155 #define BN_LLONG 156 #define DES_RISC1 157 #define DES_UNROLL 158 #define RC4_CHAR 159 #define RC4_CHUNK 160 #elif defined( __hppa__ ) 161 #define B_ENDIAN 162 #define BN_DIV2W 163 #define BN_LLONG 164 #define DES_PTR 165 #define DES_UNROLL 166 #define DES_RISC1 167 #define MD32_XARRAY 168 #elif defined( __sparc__ ) 169 #define B_ENDIAN 170 #define BN_DIV2W 171 #define BN_LLONG 172 #define DES_UNROLL 173 #define RC4_CHAR 174 #define RC4_CHUNK 175 #elif defined( __sh__ ) 176 /* Super-H has defines for subtypes, __sh1__ to __sh3__ and then 177 __SH3__ to __SH5__, but we treat them all as the same general 178 architecture. 179 180 There isn't any official config for Super-H (specifically SH4), the 181 following is the config for MIPS which seems to work OK (the only 182 one that really matters is BN_LLONG which is generic for any 32-bit 183 CPU, Blowfish and RC4 are disabled by default and 3DES isn't used 184 much any more */ 185 #ifdef DATA_BIGENDIAN 186 #define B_ENDIAN 187 #else 188 #define L_ENDIAN 189 #endif /* Usually little-endian but may be big-endian */ 190 #define BN_LLONG 191 #define DES_RISC2 192 #define DES_PTR 193 #define DES_UNROLL 194 #define RC4_INDEX 195 #define RC4_CHAR 196 #define RC4_CHUNK 197 #else 198 #error Need to define CPU type for non-x86/Arm/MIPS/PA-Risc/PPC/Sparc Linux 199 #endif /* *BSD/Linux variants */ 200 #endif /* *BSD/Linux */ 201 #if defined( __LINUX__ ) && defined( __WATCOMC__ ) 202 #define L_ENDIAN 203 #define BN_LLONG 204 #define RC4_INDEX 205 #endif /* Linux */ 206 207 /* Cray Unicos */ 208 #ifdef _CRAY 209 /* Crays are big-endian, but if B_ENDIAN is defined the code implicitly 210 assumes 32-bit ints whereas Crays have 64-bit ints and longs. However, 211 the non-B/L_ENDIAN code happens to work, so we don't define either */ 212 #undef SIXTY_FOUR_BIT 213 #define SIXTY_FOUR_BIT_LONG 214 #define DES_INT 215 #endif /* Cray Unicos */ 216 217 /* DGUX */ 218 #ifdef __dgux 219 #define L_ENDIAN 220 #define RC4_INDEX 221 #define DES_UNROLL 222 #endif /* DGUX */ 223 224 /* DOS */ 225 #if defined( MSDOS ) || defined( __MSDOS__ ) 226 #if defined(__WATCOMC__) 227 /* 32-bit DOS */ 228 #define L_ENDIAN 229 #define BN_LLONG 230 #define RC4_INDEX 231 #else 232 /* 16-bit DOS */ 233 #define L_ENDIAN 234 #define BN_LLONG 235 #define MD2_CHAR 236 #define DES_UNROLL 237 #define DES_PTR 238 #define RC4_INDEX 239 #undef THIRTY_TWO_BIT 240 #define SIXTEEN_BIT 241 #endif /* 16- vs.32-bit DOS */ 242 #endif /* DOS */ 243 244 /* Irix */ 245 #ifdef __sgi 246 247 /* Irix 5.x and lower */ 248 #if ( OSVERSION <= 5 ) 249 #define B_ENDIAN 250 #define BN_LLONG 251 #define DES_RISC2 252 #define DES_PTR 253 #define DES_UNROLL 254 #define RC4_INDEX 255 #define RC4_CHAR 256 #define RC4_CHUNK 257 #define MD2_CHAR 258 259 /* Irix 6.x and higher */ 260 #else 261 #define B_ENDIAN 262 #define BN_DIV3W 263 #define MD2_CHAR 264 #define RC4_INDEX 265 #define RC4_CHAR 266 #define RC4_CHUNK_LL 267 #define DES_UNROLL 268 #define DES_RISC2 269 #define DES_PTR 270 /* Pure 64-bit should also define SIXTY_FOUR_BIT_LONG */ 271 #endif /* Irix versions */ 272 #endif /* Irix */ 273 274 /* Mac */ 275 #if defined( __MWERKS__ ) || defined( SYMANTEC_C ) || defined( __MRC__ ) 276 #define B_ENDIAN 277 #define BN_LLONG 278 #define DES_UNROLL 279 #define RC4_CHAR 280 #define RC4_CHUNK 281 #endif /* Mac */ 282 283 /* Mac OS X / iOS */ 284 #if defined( __APPLE__ ) && !defined( __MAC__ ) 285 #include <TargetConditionals.h> 286 #if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR || TARGET_OS_WATCH 287 #define L_ENDIAN 288 #define BN_LLONG 289 #define DES_RISC1 290 #elif defined( __ppc__ ) 291 #define B_ENDIAN 292 #define BN_LLONG 293 #define DES_RISC1 294 #define DES_UNROLL 295 #define RC4_CHAR 296 #define RC4_CHUNK 297 #elif defined( __x86_64__ ) 298 /* See the comment for the BSDs and Linux above */ 299 #define L_ENDIAN 300 #define DES_INT 301 #define DES_RISC1 302 #define DES_UNROLL 303 #define RC4_CHUNK 304 #undef SIXTY_FOUR_BIT 305 #define SIXTY_FOUR_BIT_LONG 306 #else 307 #define L_ENDIAN 308 #define BN_LLONG 309 #define DES_PTR 310 #define DES_RISC1 311 #define DES_UNROLL 312 #define RC4_INDEX 313 #endif /* Mac OS variants */ 314 #endif /* Mac OS X / iOS */ 315 316 /* MSDOS */ 317 #ifdef __MSDOS__ 318 #define L_ENDIAN 319 #define BN_LLONG 320 #define MD2_CHAR 321 #define DES_UNROLL 322 #define DES_PTR 323 #define RC4_INDEX 324 #undef THIRTY_TWO_BIT 325 #define SIXTEEN_BIT 326 #endif /* __MSDOS__ */ 327 328 /* MVS */ 329 #ifdef __MVS__ 330 #define B_ENDIAN 331 #endif /* MVS */ 332 333 /* NCR MP-RAS */ 334 #ifdef __UNIX_SV__ 335 #define L_ENDIAN 336 #define BN_LLONG 337 #define DES_PTR 338 #define DES_RISC1 339 #define DES_UNROLL 340 #define RC4_INDEX 341 #endif /* UNIX_SV */ 342 343 /* Nucleus */ 344 #if defined( __Nucleus__ ) 345 #ifdef DATA_BIGENDIAN 346 #define B_ENDIAN 347 #else 348 #define L_ENDIAN 349 #endif /* Big vs.little-endian */ 350 #define BN_LLONG 351 #define DES_RISC1 352 #endif /* __Nucleus__ */ 353 354 /* Palm OS: ARM */ 355 #if defined( __PALMSOURCE__ ) 356 #if defined( __arm ) || defined( __arm__ ) 357 #define L_ENDIAN 358 #define BN_LLONG 359 #define DES_RISC1 360 #else 361 #error Need to define architecture-specific values for crypto code 362 #endif /* Palm OS variants */ 363 #endif /* Palm OS */ 364 365 /* PHUX */ 366 #ifdef __hpux 367 368 /* PHUX 9.x (some versions report it as 09 so we also check for 0) */ 369 #if ( OSVERSION == 0 || OSVERSION == 9 ) 370 #define B_ENDIAN 371 #define BN_DIV2W 372 #define BN_LLONG 373 #define DES_PTR 374 #define DES_UNROLL 375 #define DES_RISC1 376 #define MD32_XARRAY 377 378 /* PHUX 10.x, 11.x */ 379 #else 380 #define B_ENDIAN 381 #define BN_DIV2W 382 #define BN_LLONG 383 #define DES_PTR 384 #define DES_UNROLL 385 #define DES_RISC1 386 #define MD32_XARRAY 387 /* Pure 64-bit should also define SIXTY_FOUR_BIT_LONG MD2_CHAR RC4_INDEX 388 RC4_CHAR DES_INT */ 389 #endif /* PHUX versions */ 390 #endif /* PHUX */ 391 392 /* QNX */ 393 #ifdef __QNX__ 394 #define L_ENDIAN 395 #define BN_LLONG 396 #define DES_PTR 397 #define DES_RISC1 398 #define DES_UNROLL 399 #define RC4_INDEX 400 #if OSVERSION <= 4 401 /* The Watcom compiler can't handle 64-bit ints even though the hardware 402 can, so we have to build it as 16-bit code with 16x16 -> 32 multiplies 403 rather than 32x32 -> 64 */ 404 #undef THIRTY_TWO_BIT 405 #define SIXTEEN_BIT 406 #endif /* QNX 4.x */ 407 #endif /* QNX */ 408 409 /* SCO/UnixWare */ 410 #ifdef __SCO_VERSION__ 411 412 /* SCO gcc */ 413 #if defined( __GNUC__ ) 414 #define L_ENDIAN 415 #define BN_LLONG 416 #define DES_PTR 417 #define DES_RISC1 418 #define DES_UNROLL 419 #define RC4_INDEX 420 421 /* SCO cc */ 422 #else 423 #define L_ENDIAN 424 #define BN_LLONG 425 #define DES_PTR 426 #define DES_RISC1 427 #define DES_UNROLL 428 #define RC4_INDEX 429 #define MD2_CHAR 430 #endif /* SCO gcc/cc */ 431 #endif /* SCO */ 432 433 /* Solaris */ 434 #ifdef sun 435 436 /* Solaris Sparc */ 437 #ifdef sparc 438 #define B_ENDIAN 439 440 /* Solaris Sparc gcc */ 441 #if defined( __GNUC__ ) 442 #if !defined( __sparc64 ) /* No obvious test for 32-bit Sparc */ 443 #define BN_DIV2W 444 #define BN_LLONG 445 #define DES_UNROLL 446 #define RC4_CHAR 447 #define RC4_CHUNK 448 #elif defined( __sparc64__ ) 449 #define DES_INT 450 #define DES_PTR 451 #define DES_RISC1 452 #define DES_UNROLL 453 #define RC4_CHAR 454 #define RC4_CHUNK 455 #undef SIXTY_FOUR_BIT 456 #define SIXTY_FOUR_BIT_LONG 457 #else 458 #error Unknown Sparc architecture (neither 32- nor 64-bit) encountered 459 #endif /* 32- vs 64-bit */ 460 461 /* Solaris Sparc Sun C */ 462 #elif defined( __SUNPRO_C ) 463 #if !defined( __sparc64 ) /* No obvious test for 32-bit Sparc */ 464 #define BN_DIV2W 465 #define BN_LLONG 466 #define DES_PTR 467 #define DES_RISC1 468 #define DES_UNROLL 469 #define RC4_CHAR 470 #define RC4_CHUNK 471 #elif defined( __sparc64 ) 472 #define DES_INT 473 #define DES_PTR 474 #define DES_RISC1 475 #define DES_UNROLL 476 #define RC4_CHAR 477 #define RC4_CHUNK 478 #undef SIXTY_FOUR_BIT 479 #define SIXTY_FOUR_BIT_LONG 480 #else 481 #error Unknown Sparc architecture (neither 32- nor 64-bit) encountered 482 #endif /* 32- vs 64-bit */ 483 484 #else 485 #error Unknown Solaris architecture (neither x86/x64 nor Sparc) encountered 486 #endif /* Solaris Sparc */ 487 488 /* Solaris x86 */ 489 #else 490 #define L_ENDIAN 491 492 /* Solaris x86 gcc */ 493 #if defined( __GNUC__ ) 494 #if defined( __i386__ ) 495 #define BN_LLONG 496 #define DES_PTR 497 #define DES_RISC1 498 #define DES_UNROLL 499 #define RC4_INDEX 500 #elif defined( __x86_64__ ) 501 #define DES_INT 502 #define DES_UNROLL 503 #define RC4_CHUNK 504 #undef SIXTY_FOUR_BIT 505 #define SIXTY_FOUR_BIT_LONG 506 #else 507 #error Unknown Sparc architecture (neither 32- nor 64-bit) encountered 508 #endif /* 32- vs 64-bit */ 509 510 /* Solaris x86 Sun C */ 511 #elif defined( __SUNPRO_C ) 512 #if defined( __i386__ ) 513 #define BN_LLONG 514 #define DES_PTR 515 #define DES_UNROLL 516 #define RC4_CHAR 517 #define RC4_CHUNK 518 #elif defined( __x86_64__ ) 519 #define DES_INT 520 #define DES_UNROLL 521 #define RC4_CHUNK 522 #undef SIXTY_FOUR_BIT 523 #define SIXTY_FOUR_BIT_LONG 524 #else 525 #error Unknown Sparc architecture (neither 32- nor 64-bit) encountered 526 #endif /* 32- vs 64-bit */ 527 528 #else 529 #error Unknown Solaris architecture (neither x86/x64 nor Sparc) encountered 530 #endif /* Solaris x86 */ 531 #endif /* Solaris Sparc vs x86 */ 532 #endif /* Slowaris */ 533 534 /* Symbian OS: Usually ARM, but we may be running under the x86 emulator */ 535 #if defined( __SYMBIAN32__ ) 536 #if defined( __MARM__ ) 537 #define L_ENDIAN 538 #define BN_LLONG 539 #define DES_RISC1 540 #elif defined( __EMU_SYMBIAN_OS__ ) 541 #define L_ENDIAN 542 #define BN_LLONG 543 #define DES_PTR 544 #define DES_UNROLL 545 #define RC4_INDEX 546 #else 547 #error Need to define architecture-specific values for crypto code 548 #endif /* Symbian OS variants */ 549 #endif /* Symbian OS */ 550 551 /* Tandem NSK/OSS */ 552 #ifdef __TANDEM 553 #define B_ENDIAN 554 #define DES_RISC2 555 #define DES_PTR 556 #define DES_UNROLL 557 #define RC4_INDEX 558 #define RC4_CHAR 559 #define RC4_CHUNK 560 #define MD2_CHAR 561 #endif /* Tandem */ 562 563 /* Ultrix */ 564 #ifdef __ultrix__ 565 #define L_ENDIAN 566 #define DES_PTR 567 #define DES_RISC2 568 #define DES_UNROLL 569 #endif /* Ultrix */ 570 571 /* VM/CMS */ 572 #ifdef __VMCMS__ 573 #define B_ENDIAN 574 #endif /* VM/CMS */ 575 576 /* Windows */ 577 #if ( defined( _WINDOWS ) || defined( WIN32 ) || defined( _WIN32 ) ) 578 #define L_ENDIAN 579 580 /* VC++ */ 581 #if defined( _MSC_VER ) 582 583 /* VS 64-bit */ 584 #if defined( _M_X64 ) 585 /* Win64's ULONG_MAX (via limits.h) is 32 bits so the system isn't 586 detected as a 64-bit one, to fix this we manually override the 587 detected machine word size here */ 588 #undef THIRTY_TWO_BIT 589 #define SIXTY_FOUR_BIT 590 #define RC4_CHUNK_LL 591 #define DES_INT 592 593 /* VC++ 32-bit */ 594 #elif ( _MSC_VER >= 1000 ) 595 #define BN_LLONG 596 #define RC4_INDEX 597 598 /* VC++ 16-bit */ 599 #else 600 #define BN_LLONG 601 #define MD2_CHAR 602 #define DES_UNROLL 603 #define DES_PTR 604 #define RC4_INDEX 605 #undef THIRTY_TWO_BIT 606 #define SIXTEEN_BIT 607 #endif /* VC++ 32 vs 16-bit */ 608 609 /* BC++ */ 610 #elif defined( __BORLANDC__ ) 611 #define BN_LLONG 612 #define DES_PTR 613 #define RC4_INDEX 614 615 /* gcc */ 616 #else 617 #define BN_LLONG 618 #define DES_PTR 619 #define DES_RISC1 620 #define DES_UNROLL 621 #define RC4_INDEX 622 #endif /* Assorted Windows compilers */ 623 #endif /* Windows */ 624 #ifdef __CYGWIN__ 625 #define L_ENDIAN 626 #define BN_LLONG 627 #define DES_PTR 628 #define DES_RISC1 629 #define DES_UNROLL 630 #define RC4_INDEX 631 #endif /* gcc native under Cygwin (i.e. not a Cygwin-hosted 632 cross-development toolchain */ 633 634 /* Embeded OSes get a bit complicated because they're usually cross- 635 compiled, first we try for OS-specific options, then we try for the most 636 obvious generic options like the GNU toolchain, and finally if we can't 637 find anything we bail out with an error message */ 638 639 #if defined( USE_EMBEDDED_OS ) 640 641 /* Xilinx XMK */ 642 #if defined ( _XMK ) || defined( __XMK__ ) 643 #if defined( __mb__ ) 644 #define B_ENDIAN 645 /* Not sure what other options the MicroBlaze build should enable... */ 646 #elif defined( __ppc__ ) || defined( __powerpc ) || defined( __powerpc__ ) 647 #ifdef DATA_LITTLEENDIAN 648 #define L_ENDIAN 649 #else 650 #define B_ENDIAN 651 #endif /* Usually big-endian but may be little-endian */ 652 #define BN_LLONG 653 #define DES_RISC1 654 #define DES_UNROLL 655 #define RC4_CHAR 656 #define RC4_CHUNK 657 #else 658 #error Need to define CPU type for non-MicroBlaze/non-PPC XMK. 659 #endif /* XMK target variants */ 660 661 /* Generic gcc */ 662 #elif defined( __i386__ ) 663 #define L_ENDIAN 664 #define BN_LLONG 665 #define DES_PTR 666 #define DES_RISC1 667 #define DES_UNROLL 668 #define RC4_INDEX 669 #elif defined( __ppc__ ) || defined( __powerpc ) || defined( __powerpc__ ) 670 #ifdef DATA_LITTLEENDIAN 671 #define L_ENDIAN 672 #else 673 #define B_ENDIAN 674 #endif /* Usually big-endian but may be little-endian */ 675 #define BN_LLONG 676 #define DES_RISC1 677 #define DES_UNROLL 678 #define RC4_CHAR 679 #define RC4_CHUNK 680 #elif defined( __arm ) || defined( __arm__ ) 681 #define L_ENDIAN 682 #define BN_LLONG 683 #define DES_RISC1 684 685 /* TI ARM compilers */ 686 #elif defined( __TI_ARM__ ) 687 #ifdef DATA_LITTLEENDIAN 688 #define L_ENDIAN 689 #else 690 #define B_ENDIAN 691 #endif 692 #define BN_LLONG 693 #define DES_RISC1 694 695 /* Generic 68K */ 696 #elif defined( __m68k__ ) 697 /* This one is CISC-y enough that any of the (mostly) RISC-specific 698 optimisations won't have much effect, so the generic code is as good 699 as any */ 700 #define B_ENDIAN 701 702 /* We need the developer's help to sort it out */ 703 #else 704 #error Need to configure the crypto build options for your toolchain. 705 #endif /* Embedded OS variants */ 706 #endif /* Embedded OSes */ 707 708 /* RC4_CHUNK is actually a data type rather than a straight define so we 709 redefine it as a data type if it's been defined */ 710 711 #ifdef RC4_CHUNK 712 #undef RC4_CHUNK 713 #define RC4_CHUNK unsigned long 714 #endif /* RC4_CHUNK */ 715 716 /* Make sure that we weren't missed out. See the comment in the Cray 717 section for the exception for Crays */ 718 719 #if !defined( _CRAY ) && !defined( L_ENDIAN ) && !defined( B_ENDIAN ) 720 #error You need to add system-specific configuration settings to osconfig.h. 721 #endif /* Endianness not defined */ 722 #if defined( L_ENDIAN ) && defined( B_ENDIAN ) 723 #error Incorrect endianness detection in osconfig.h, both L_ENDIAN and B_ENDIAN are defined. 724 #endif /* Endianness defined erratically */ 725 #if defined( CHECK_ENDIANNESS ) && !defined( OSX_UNIVERSAL_BINARY ) 726 /* One-off check in des_enc.c, however for OS X universal (fat) binaries 727 we're effectively cross-compiling for multiple targets so we don't 728 perform the check, which would yield false positives */ 729 #if defined( DATA_LITTLEENDIAN ) && defined( DATA_BIGENDIAN ) 730 #error Incorrect endianness detection in crypt.h, 731 #error both DATA_LITTLEENDIAN and DATA_BIGENDIAN are defined. 732 #endif /* Global endianness defined erratically */ 733 #if ( defined( L_ENDIAN ) && !defined( DATA_LITTLEENDIAN ) ) 734 #error You need to synchronise the endianness configuration settings 735 #error in osconfig.h and crypt.h. The cryptlib config is set to 736 #error DATA_BIGENDIAN but osconfig.h has detected L_ENDIAN. 737 #endif /* L_ENDIAN && !DATA_LITTLEENDIAN */ 738 #if ( defined( B_ENDIAN ) && !defined( DATA_BIGENDIAN ) ) 739 #error You need to synchronise the endianness configuration settings 740 #error in osconfig.h and crypt.h. The cryptlib config is set to 741 #error DATA_LITTLEENDIAN but osconfig.h has detected B_ENDIAN. 742 #endif /* B_ENDIAN && !DATA_BIGENDIAN */ 743 #endif /* One-off check */ 744 745 #endif /* _OSCONFIG_DEFINED */ 746