7 #ifndef CRYPTOPP_CONFIG_H 8 #define CRYPTOPP_CONFIG_H 13 #if !defined(IS_LITTLE_ENDIAN) && (defined(__BIG_ENDIAN__) || (defined(__s390__) || defined(__s390x__) || defined(__zarch__)) || (defined(__m68k__) || defined(__MC68K__)) || defined(__sparc) || defined(__sparc__) || defined(__hppa__) || defined(__MIPSEB__) || defined(__ARMEB__) || (defined(__MWERKS__) && !defined(__INTEL__))) 14 # define IS_BIG_ENDIAN 20 # define IS_LITTLE_ENDIAN 25 #if defined(IS_BIG_ENDIAN) && defined(__GNUC__) && defined(__BYTE_ORDER__) && (__BYTE_ORDER__ != __ORDER_BIG_ENDIAN__) 26 # error "IS_BIG_ENDIAN is set, but __BYTE_ORDER__ does not equal __ORDER_BIG_ENDIAN__" 28 #if defined(IS_LITTLE_ENDIAN) && defined(__GNUC__) && defined(__BYTE_ORDER__) && (__BYTE_ORDER__ != __ORDER_LITTLE_ENDIAN__) 29 # error "IS_LITTLE_ENDIAN is set, but __BYTE_ORDER__ does not equal __ORDER_LITTLE_ENDIAN__" 39 #define USE_MS_CRYPTOAPI 43 #ifndef CRYPTOPP_NO_UNALIGNED_DATA_ACCESS 50 #define CRYPTOPP_VERSION 563 57 #if (CRYPTOPP_VERSION <= 600) 58 # if !defined(CRYPTOPP_NO_BACKWARDS_COMPATIBILITY_562) && !defined(CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562) 59 # define CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562 70 #if !defined(GZIP_OS_CODE) 71 # define GZIP_OS_CODE 0 84 #if !defined(NO_BERKELEY_STYLE_SOCKETS) && !defined(PREFER_BERKELEY_STYLE_SOCKETS) 85 # define PREFER_BERKELEY_STYLE_SOCKETS 93 #define CRYPTOPP_RIJNDAEL_NAME "AES" 104 #if defined(CRYPTOPP_INIT_PRIORITY) && (CRYPTOPP_INIT_PRIORITY > 0) 105 # define CRYPTOPP_USER_PRIORITY (CRYPTOPP_INIT_PRIORITY + 101) 107 # define CRYPTOPP_USER_PRIORITY 250 115 # error namespace support is now required 121 #define WORKAROUND_MS_BUG_Q258000 123 #ifdef CRYPTOPP_DOXYGEN_PROCESSING 135 # define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1 139 # define NAMESPACE_BEGIN(x) 140 # define NAMESPACE_END 142 # define DOCUMENTED_TYPEDEF(x, y) class y : public x {}; 144 # define protected private 146 # define NAMESPACE_BEGIN(x) namespace x { 147 # define NAMESPACE_END } 148 # define DOCUMENTED_TYPEDEF(x, y) typedef x y; 150 #define ANONYMOUS_NAMESPACE_BEGIN namespace { 151 #define ANONYMOUS_NAMESPACE_END } 152 #define USING_NAMESPACE(x) using namespace x; 153 #define DOCUMENTED_NAMESPACE_BEGIN(x) namespace x { 154 #define DOCUMENTED_NAMESPACE_END } 160 #ifndef TYPE_OF_SOCKLEN_T 161 # if defined(_WIN32) || defined(__CYGWIN__) 162 # define TYPE_OF_SOCKLEN_T int 164 # define TYPE_OF_SOCKLEN_T ::socklen_t 168 #if defined(__CYGWIN__) && defined(PREFER_WINDOWS_STYLE_SOCKETS) 169 # define __USE_W32_SOCKETS 172 typedef unsigned char byte;
176 typedef
unsigned short word16;
177 typedef
unsigned int word32;
179 #if defined(_MSC_VER) || defined(__BORLANDC__) 180 typedef unsigned __int64 word64;
181 #define W64LIT(x) x##ui64 183 typedef unsigned long long word64;
184 #define W64LIT(x) x##ULL 188 typedef word64 lword;
189 const lword LWORD_MAX = W64LIT(0xffffffffffffffff);
192 #define CRYPTOPP_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) 196 #if defined(__clang__ ) && !defined(__apple_build_version__) 197 #define CRYPTOPP_CLANG_VERSION (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__) 198 #elif defined(__clang__ ) && defined(__apple_build_version__) 199 #define CRYPTOPP_APPLE_CLANG_VERSION (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__) 203 #define CRYPTOPP_MSC_VERSION (_MSC_VER) 207 #if (CRYPTOPP_GCC_VERSION >= 40600) || (CRYPTOPP_CLANG_VERSION >= 10700) || (CRYPTOPP_APPLE_CLANG_VERSION >= 20000) 208 #define CRYPTOPP_GCC_DIAGNOSTIC_AVAILABLE 1 213 #if (defined(CRYPTOPP_CLANG_VERSION) && CRYPTOPP_CLANG_VERSION <= 200000) || (defined(CRYPTOPP_APPLE_CLANG_VERSION) && CRYPTOPP_APPLE_CLANG_VERSION <= 200000) 214 #define CRYPTOPP_DISABLE_INTEL_ASM 1 219 #if (defined(_MSC_VER) && (!defined(__INTEL_COMPILER) || __INTEL_COMPILER >= 1000) && (defined(_M_X64) || defined(_M_IA64))) || (defined(__DECCXX) && defined(__alpha__)) || (defined(__INTEL_COMPILER) && defined(__x86_64__)) || (defined(__SUNPRO_CC) && defined(__x86_64__)) 220 typedef word32 hword;
223 #define CRYPTOPP_NATIVE_DWORD_AVAILABLE 224 #if defined(__alpha__) || defined(__ia64__) || defined(_ARCH_PPC64) || defined(__x86_64__) || defined(__mips64) || defined(__sparc64__) 225 #if defined(__GNUC__) && !defined(__INTEL_COMPILER) && !(CRYPTOPP_GCC_VERSION == 40001 && defined(__APPLE__)) && CRYPTOPP_GCC_VERSION >= 30400 228 typedef word32 hword;
230 typedef __uint128_t dword;
231 typedef __uint128_t word128;
232 #define CRYPTOPP_WORD128_AVAILABLE 235 typedef word16 hword;
237 typedef word64 dword;
241 #define CRYPTOPP_BOOL_SLOW_WORD64 1 242 typedef word16 hword;
244 typedef word64 dword;
247 #ifndef CRYPTOPP_BOOL_SLOW_WORD64 248 #define CRYPTOPP_BOOL_SLOW_WORD64 0 251 const unsigned int WORD_SIZE =
sizeof(word);
252 const unsigned int WORD_BITS = WORD_SIZE * 8;
256 #ifndef CRYPTOPP_L1_CACHE_LINE_SIZE 259 #if defined(_M_X64) || defined(__x86_64__) || (__ILP32__ >= 1) 260 #define CRYPTOPP_L1_CACHE_LINE_SIZE 64 263 #define CRYPTOPP_L1_CACHE_LINE_SIZE 32 267 #if defined(_MSC_VER) 271 #if _MSC_VER > 1200 || defined(_mm_free) 272 #define CRYPTOPP_MSVC6PP_OR_LATER // VC 6 processor pack or later 274 #define CRYPTOPP_MSVC6_NO_PP // VC 6 without processor pack 278 #ifndef CRYPTOPP_ALIGN_DATA 279 #if defined(CRYPTOPP_MSVC6PP_OR_LATER) 280 #define CRYPTOPP_ALIGN_DATA(x) __declspec(align(x)) 281 #elif defined(__GNUC__) 282 #define CRYPTOPP_ALIGN_DATA(x) __attribute__((aligned(x))) 284 #define CRYPTOPP_ALIGN_DATA(x) 288 #ifndef CRYPTOPP_SECTION_ALIGN16 289 #if defined(__GNUC__) && !defined(__APPLE__) 291 #define CRYPTOPP_SECTION_ALIGN16 __attribute__((section ("CryptoPP_Align16"))) 293 #define CRYPTOPP_SECTION_ALIGN16 297 #if defined(_MSC_VER) || defined(__fastcall) 298 #define CRYPTOPP_FASTCALL __fastcall 300 #define CRYPTOPP_FASTCALL 304 #if defined(_MSC_VER) && (_MSC_VER < 1300) 307 #define CPP_TYPENAME typename 311 #if defined(_MSC_VER) && !defined(CRYPTOPP_MSVC6PP_OR_LATER) 312 #define CRYPTOPP_VC6_INT64 (__int64) 314 #define CRYPTOPP_VC6_INT64 318 #define CRYPTOPP_NO_VTABLE __declspec(novtable) 320 #define CRYPTOPP_NO_VTABLE 336 # pragma warning(disable: 4127 4231 4250 4251 4275 4505 4512 4660 4661 4786 4355 4910) 339 # pragma warning(once: 4191 4242 4263 4264 4266 4302 4826 4905 4906 4928) 348 #if CRYPTOPP_GCC_DIAGNOSTIC_AVAILABLE 349 # pragma GCC diagnostic ignored "-Wunknown-pragmas" 350 # pragma GCC diagnostic ignored "-Wunused-function" 353 #if (defined(_MSC_VER) && _MSC_VER <= 1300) || defined(__MWERKS__) || defined(_STLPORT_VERSION) 354 #define CRYPTOPP_DISABLE_UNCAUGHT_EXCEPTION 357 #ifndef CRYPTOPP_DISABLE_UNCAUGHT_EXCEPTION 358 #define CRYPTOPP_UNCAUGHT_EXCEPTION_AVAILABLE 361 #ifdef CRYPTOPP_DISABLE_X86ASM // for backwards compatibility: this macro had both meanings 362 #define CRYPTOPP_DISABLE_ASM 363 #define CRYPTOPP_DISABLE_SSE2 367 #if defined(CRYPTOPP_APPLE_CLANG_VERSION) && (CRYPTOPP_APPLE_CLANG_VERSION < 50000) 368 # define CRYPTOPP_DISABLE_ASM 371 #if !defined(CRYPTOPP_DISABLE_ASM) && ((defined(_MSC_VER) && defined(_M_IX86)) || (defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)))) 373 #define CRYPTOPP_X86_ASM_AVAILABLE 375 #if !defined(CRYPTOPP_DISABLE_SSE2) && (defined(CRYPTOPP_MSVC6PP_OR_LATER) || CRYPTOPP_GCC_VERSION >= 30300 || defined(__SSE2__)) 376 #define CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE 1 378 #define CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE 0 384 #if !defined(CRYPTOPP_DISABLE_SSSE3) && (_MSC_VER >= 1400 || CRYPTOPP_GCC_VERSION >= 40102 || defined(__SSSE3__) || defined(__SSE3__)) 385 #define CRYPTOPP_BOOL_SSSE3_ASM_AVAILABLE 1 387 #define CRYPTOPP_BOOL_SSSE3_ASM_AVAILABLE 0 391 #if !defined(CRYPTOPP_DISABLE_ASM) && defined(_MSC_VER) && defined(_M_X64) 392 #define CRYPTOPP_X64_MASM_AVAILABLE 395 #if !defined(CRYPTOPP_DISABLE_ASM) && defined(__GNUC__) && defined(__x86_64__) 396 #define CRYPTOPP_X64_ASM_AVAILABLE 399 #if !defined(CRYPTOPP_DISABLE_SSE2) && (defined(CRYPTOPP_MSVC6PP_OR_LATER) || defined(__SSE2__)) 400 #define CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE 1 402 #define CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE 0 405 #if !defined(CRYPTOPP_DISABLE_SSSE3) && !defined(CRYPTOPP_DISABLE_AESNI) && CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE && (CRYPTOPP_GCC_VERSION >= 40400 || _MSC_FULL_VER >= 150030729 || __INTEL_COMPILER >= 1110 || defined(__AES__)) 406 #define CRYPTOPP_BOOL_AESNI_INTRINSICS_AVAILABLE 1 408 #define CRYPTOPP_BOOL_AESNI_INTRINSICS_AVAILABLE 0 411 #if CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE || CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE || defined(CRYPTOPP_X64_MASM_AVAILABLE) 412 #define CRYPTOPP_BOOL_ALIGN16 1 414 #define CRYPTOPP_BOOL_ALIGN16 0 418 #if defined(CRYPTOPP_MSVC6PP_OR_LATER) 419 #define CRYPTOPP_MM_MALLOC_AVAILABLE 420 #elif defined(__APPLE__) 421 #define CRYPTOPP_APPLE_MALLOC_AVAILABLE 422 #elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) 423 #define CRYPTOPP_MALLOC_ALIGNMENT_IS_16 424 #elif defined(__linux__) || defined(__sun__) || defined(__CYGWIN__) 425 #define CRYPTOPP_MEMALIGN_AVAILABLE 427 #define CRYPTOPP_NO_ALIGNED_ALLOC 434 #if defined(_MSC_VER) && _MSC_VER >= 1300 435 # define CRYPTOPP_NOINLINE_DOTDOTDOT 436 # define CRYPTOPP_NOINLINE __declspec(noinline) 437 #elif defined(__GNUC__) 438 # define CRYPTOPP_NOINLINE_DOTDOTDOT 439 # define CRYPTOPP_NOINLINE __attribute__((noinline)) 441 # define CRYPTOPP_NOINLINE_DOTDOTDOT ... 442 # define CRYPTOPP_NOINLINE 446 #if (defined(_MSC_VER) && _MSC_VER <= 1300) || defined(__INTEL_COMPILER) 447 # define CRYPTOPP_CONSTANT(x) enum {x}; 449 # define CRYPTOPP_CONSTANT(x) static const int x; 454 #if ((__ILP32__ >= 1) || (_ILP32 >= 1)) 455 #define CRYPTOPP_BOOL_X32 1 457 #define CRYPTOPP_BOOL_X32 0 461 #if (defined(_M_IX86) || defined(__i386__) || defined(__i386) || defined(_X86_) || defined(__I86__) || defined(__INTEL__)) && !CRYPTOPP_BOOL_X32 462 #define CRYPTOPP_BOOL_X86 1 464 #define CRYPTOPP_BOOL_X86 0 467 #if (defined(_M_X64) || defined(__x86_64__)) && !CRYPTOPP_BOOL_X32 468 #define CRYPTOPP_BOOL_X64 1 470 #define CRYPTOPP_BOOL_X64 0 474 #if CRYPTOPP_BOOL_X32 475 # undef CRYPTOPP_BOOL_X64 476 # undef CRYPTOPP_X64_ASM_AVAILABLE 477 # undef CRYPTOPP_X64_MASM_AVAILABLE 480 #if !defined(CRYPTOPP_NO_UNALIGNED_DATA_ACCESS) && !defined(CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS) 481 #if (CRYPTOPP_BOOL_X64 || CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X32 || defined(__powerpc__) || (__ARM_FEATURE_UNALIGNED >= 1)) 482 #define CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS 488 #ifndef NO_OS_DEPENDENCE 490 #if defined(_WIN32) || defined(__CYGWIN__) 491 #define CRYPTOPP_WIN32_AVAILABLE 494 #if defined(__unix__) || defined(__MACH__) || defined(__NetBSD__) || defined(__sun) 495 #define CRYPTOPP_UNIX_AVAILABLE 498 #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) 499 #define CRYPTOPP_BSD_AVAILABLE 502 #if defined(CRYPTOPP_WIN32_AVAILABLE) || defined(CRYPTOPP_UNIX_AVAILABLE) 503 # define HIGHRES_TIMER_AVAILABLE 506 #ifdef CRYPTOPP_UNIX_AVAILABLE 507 # define HAS_BERKELEY_STYLE_SOCKETS 510 #ifdef CRYPTOPP_WIN32_AVAILABLE 511 # define HAS_WINDOWS_STYLE_SOCKETS 514 #if defined(HIGHRES_TIMER_AVAILABLE) && (defined(HAS_BERKELEY_STYLE_SOCKETS) || defined(HAS_WINDOWS_STYLE_SOCKETS)) 515 # define SOCKETS_AVAILABLE 518 #if defined(HAS_WINDOWS_STYLE_SOCKETS) && (!defined(HAS_BERKELEY_STYLE_SOCKETS) || defined(PREFER_WINDOWS_STYLE_SOCKETS)) 519 # define USE_WINDOWS_STYLE_SOCKETS 521 # define USE_BERKELEY_STYLE_SOCKETS 524 #if defined(HIGHRES_TIMER_AVAILABLE) && defined(CRYPTOPP_WIN32_AVAILABLE) && !defined(USE_BERKELEY_STYLE_SOCKETS) 525 # define WINDOWS_PIPES_AVAILABLE 528 #if defined(CRYPTOPP_WIN32_AVAILABLE) && defined(USE_MS_CRYPTOAPI) 529 # define NONBLOCKING_RNG_AVAILABLE 530 # define OS_RNG_AVAILABLE 533 #if defined(CRYPTOPP_UNIX_AVAILABLE) || defined(CRYPTOPP_DOXYGEN_PROCESSING) 534 # define NONBLOCKING_RNG_AVAILABLE 535 # define BLOCKING_RNG_AVAILABLE 536 # define OS_RNG_AVAILABLE 537 # define HAS_PTHREADS 538 # define THREADS_AVAILABLE 541 #ifdef CRYPTOPP_WIN32_AVAILABLE 542 # define HAS_WINTHREADS 543 # define THREADS_AVAILABLE 546 #endif // NO_OS_DEPENDENCE 550 #if defined(CRYPTOPP_WIN32_AVAILABLE) && !defined(CRYPTOPP_DOXYGEN_PROCESSING) 552 #ifdef CRYPTOPP_EXPORTS 553 #define CRYPTOPP_IS_DLL 554 #define CRYPTOPP_DLL __declspec(dllexport) 555 #elif defined(CRYPTOPP_IMPORTS) 556 #define CRYPTOPP_IS_DLL 557 #define CRYPTOPP_DLL __declspec(dllimport) 562 #define CRYPTOPP_API __cdecl 564 #else // not CRYPTOPP_WIN32_AVAILABLE 569 #endif // CRYPTOPP_WIN32_AVAILABLE 571 #if defined(__MWERKS__) 572 #define CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS extern class CRYPTOPP_DLL 573 #elif defined(__BORLANDC__) || defined(__SUNPRO_CC) 574 #define CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS template class CRYPTOPP_DLL 576 #define CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS extern template class CRYPTOPP_DLL 579 #if defined(CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES) && !defined(CRYPTOPP_IMPORTS) 580 #define CRYPTOPP_DLL_TEMPLATE_CLASS template class CRYPTOPP_DLL 582 #define CRYPTOPP_DLL_TEMPLATE_CLASS CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS 585 #if defined(__MWERKS__) 586 #define CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS extern class 587 #elif defined(__BORLANDC__) || defined(__SUNPRO_CC) 588 #define CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS template class 590 #define CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS extern template class 593 #if defined(CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES) && !defined(CRYPTOPP_EXPORTS) 594 #define CRYPTOPP_STATIC_TEMPLATE_CLASS template class 596 #define CRYPTOPP_STATIC_TEMPLATE_CLASS CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS 603 #define CRYPTOPP_UNUSED(x) ((void)x) 611 #if (_MSC_VER >= 1600) || (__cplusplus >= 201103L) 612 # define CRYPTOPP_CXX11 1 620 #if defined(__APPLE__) && defined(__clang__) 621 # if !(defined(__has_include) && __has_include(<forward_list>)) 622 # undef CRYPTOPP_CXX11 627 #if defined(CRYPTOPP_CXX11) 630 #if (CRYPTOPP_MSC_VERSION >= 1900) 631 # define CRYPTOPP_CXX11_ALIGNAS 1 632 # define CRYPTOPP_CXX11_ALIGNOF 1 633 #elif defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1500) 634 # define CRYPTOPP_CXX11_ALIGNAS 1 635 # define CRYPTOPP_CXX11_ALIGNOF 1 636 #elif defined(__clang__) 637 # if __has_feature(cxx_alignof) 638 # define CRYPTOPP_CXX11_ALIGNAS 1 639 # define CRYPTOPP_CXX11_ALIGNOF 1 641 #elif (CRYPTOPP_GCC_VERSION >= 40800) 642 # define CRYPTOPP_CXX11_ALIGNAS 1 643 # define CRYPTOPP_CXX11_ALIGNOF 1 644 #endif // alignof/alignas 647 #if (CRYPTOPP_MSC_VERSION >= 1900) 648 # define CRYPTOPP_CXX11_NOEXCEPT 1 649 #elif defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1400) 650 # define CRYPTOPP_CXX11_NOEXCEPT 1 651 #elif defined(__clang__) 652 # if __has_feature(cxx_noexcept) 653 # define CRYPTOPP_CXX11_NOEXCEPT 1 655 #elif (CRYPTOPP_GCC_VERSION >= 40600) 656 # define CRYPTOPP_CXX11_NOEXCEPT 1 657 #endif // noexcept compilers 660 #if (CRYPTOPP_MSC_VERSION >= 1800) 661 # define CRYPTOPP_CXX11_VARIADIC_TEMPLATES 1 662 #elif defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1210) 663 # define CRYPTOPP_CXX11_VARIADIC_TEMPLATES 1 664 #elif defined(__clang__) 665 # if __has_feature(cxx_variadic_templates) 666 # define CRYPTOPP_CXX11_VARIADIC_TEMPLATES 1 668 #elif (CRYPTOPP_GCC_VERSION >= 40300) 669 # define CRYPTOPP_CXX11_VARIADIC_TEMPLATES 1 670 #endif // variadic templates 675 #endif // CRYPTOPP_CXX11 677 #if defined(CRYPTOPP_CXX11_NOEXCEPT) 678 # define CRYPTOPP_THROW noexcept(false) 679 # define CRYPTOPP_NO_THROW noexcept(true) 681 # define CRYPTOPP_THROW 682 # define CRYPTOPP_NO_THROW 683 #endif // CRYPTOPP_CXX11_NOEXCEPT 686 #if (defined(__cplusplus) && (__cplusplus >= 199711L)) && !defined(CRYPTOPP_UNCAUGHT_EXCEPTION_AVAILABLE) 687 # error "std::uncaught_exception is not available. This is likely a configuration error." Crypto++ library namespace.