6 #ifndef CRYPTOPP_CONFIG_H
7 #define CRYPTOPP_CONFIG_H
12 #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__)))
13 # define IS_BIG_ENDIAN
19 # define IS_LITTLE_ENDIAN
24 #if defined(IS_BIG_ENDIAN) && defined(__GNUC__) && defined(__BYTE_ORDER__) && (__BYTE_ORDER__ != __ORDER_BIG_ENDIAN__)
25 # error "IS_BIG_ENDIAN is set, but __BYTE_ORDER__ does not equal __ORDER_BIG_ENDIAN__"
27 #if defined(IS_LITTLE_ENDIAN) && defined(__GNUC__) && defined(__BYTE_ORDER__) && (__BYTE_ORDER__ != __ORDER_LITTLE_ENDIAN__)
28 # error "IS_LITTLE_ENDIAN is set, but __BYTE_ORDER__ does not equal __ORDER_LITTLE_ENDIAN__"
49 #if !defined(USE_MS_CRYPTOAPI) && !defined(USE_MS_CNGAPI)
50 # if (_MSC_VER >= 1900) || ((WINVER >= 0x0A00 ) || (_WIN32_WINNT >= 0x0A00 ))
51 # define USE_MS_CNGAPI
53 # define USE_MS_CRYPTOAPI
59 #ifndef CRYPTOPP_NO_UNALIGNED_DATA_ACCESS
66 #define CRYPTOPP_VERSION 565
71 #ifndef CRYPTOPP_DATA_DIR
72 # define CRYPTOPP_DATA_DIR ""
80 #define CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
89 #if !defined(GZIP_OS_CODE)
90 # define GZIP_OS_CODE 0
111 #if !defined(NO_BERKELEY_STYLE_SOCKETS) && !defined(PREFER_BERKELEY_STYLE_SOCKETS)
112 # define PREFER_BERKELEY_STYLE_SOCKETS
120 #define CRYPTOPP_RIJNDAEL_NAME "AES"
128 #if (defined(DEBUG) || defined(_DEBUG)) && !defined(CRYPTOPP_DEBUG)
129 # define CRYPTOPP_DEBUG 1
141 #ifndef CRYPTOPP_INIT_PRIORITY
148 #if defined(CRYPTOPP_INIT_PRIORITY) && (CRYPTOPP_INIT_PRIORITY > 0)
149 # define CRYPTOPP_USER_PRIORITY (CRYPTOPP_INIT_PRIORITY + 101)
151 # define CRYPTOPP_USER_PRIORITY 350
155 #if (__GNUC__ && (CRYPTOPP_INIT_PRIORITY > 0) && ((CRYPTOPP_GCC_VERSION >= 40300) || (CRYPTOPP_LLVM_CLANG_VERSION >= 20900) || (_INTEL_COMPILER >= 300)) && !(MACPORTS_GCC_COMPILER > 0) && !defined(__sun__))
156 # define HAVE_GCC_CONSTRUCTOR1 1
160 #if (__GNUC__ && (CRYPTOPP_INIT_PRIORITY > 0) && !HAVE_GCC_CONSTRUCTOR1 && !(MACPORTS_GCC_COMPILER > 0) && !defined(__sun__))
161 # define HAVE_GCC_CONSTRUCTOR0 1
164 #if (_MSC_VER && (CRYPTOPP_INIT_PRIORITY > 0))
165 # define HAVE_MSC_INIT_PRIORITY 1
173 # error namespace support is now required
179 #define WORKAROUND_MS_BUG_Q258000
181 #ifdef CRYPTOPP_DOXYGEN_PROCESSING
191 namespace CryptoPP { }
193 # define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1
197 # define NAMESPACE_BEGIN(x)
198 # define NAMESPACE_END
200 # define DOCUMENTED_TYPEDEF(x, y) class y : public x {};
202 # define protected private
204 # define NAMESPACE_BEGIN(x) namespace x {
205 # define NAMESPACE_END }
206 # define DOCUMENTED_TYPEDEF(x, y) typedef x y;
208 #define ANONYMOUS_NAMESPACE_BEGIN namespace {
209 #define ANONYMOUS_NAMESPACE_END }
210 #define USING_NAMESPACE(x) using namespace x;
211 #define DOCUMENTED_NAMESPACE_BEGIN(x) namespace x {
212 #define DOCUMENTED_NAMESPACE_END }
218 #ifndef TYPE_OF_SOCKLEN_T
219 # if defined(_WIN32) || defined(__CYGWIN__)
220 # define TYPE_OF_SOCKLEN_T int
222 # define TYPE_OF_SOCKLEN_T ::socklen_t
226 #if defined(__CYGWIN__) && defined(PREFER_WINDOWS_STYLE_SOCKETS)
227 # define __USE_W32_SOCKETS
230 typedef unsigned char byte;
232 NAMESPACE_BEGIN(CryptoPP)
234 typedef
unsigned short word16;
235 typedef
unsigned int word32;
237 #if defined(_MSC_VER) || defined(__BORLANDC__)
238 typedef unsigned __int64 word64;
239 #define W64LIT(x) x##ui64
240 #elif (_LP64 || __LP64__) && ((__arm64__ || __aarch64__) || !defined(CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562))
241 typedef unsigned long word64;
242 #define W64LIT(x) x##UL
244 typedef unsigned long long word64;
245 #define W64LIT(x) x##ULL
249 typedef word64 lword;
250 const lword LWORD_MAX = W64LIT(0xffffffffffffffff);
254 #if defined(_MSC_VER) && defined(__clang__)
255 # error: "Unsupported configuration"
259 #define CRYPTOPP_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
263 #if defined(__clang__ ) && !defined(__apple_build_version__)
264 #define CRYPTOPP_LLVM_CLANG_VERSION (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__)
265 #define CRYPTOPP_CLANG_INTEGRATED_ASSEMBLER 1
266 #elif defined(__clang__ ) && defined(__apple_build_version__)
267 #define CRYPTOPP_APPLE_CLANG_VERSION (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__)
268 #define CRYPTOPP_CLANG_INTEGRATED_ASSEMBLER 1
272 #define CRYPTOPP_MSC_VERSION (_MSC_VER)
276 #if (CRYPTOPP_GCC_VERSION >= 40600) || (CRYPTOPP_LLVM_CLANG_VERSION >= 10700) || (CRYPTOPP_APPLE_CLANG_VERSION >= 20000)
277 #define CRYPTOPP_GCC_DIAGNOSTIC_AVAILABLE 1
282 #if (defined(CRYPTOPP_LLVM_CLANG_VERSION) && CRYPTOPP_LLVM_CLANG_VERSION <= 200000) || (defined(CRYPTOPP_APPLE_CLANG_VERSION) && CRYPTOPP_APPLE_CLANG_VERSION <= 200000) || defined(CRYPTOPP_CLANG_INTEGRATED_ASSEMBLER)
283 #define CRYPTOPP_DISABLE_INTEL_ASM 1
288 #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__))
289 typedef word32 hword;
292 #define CRYPTOPP_NATIVE_DWORD_AVAILABLE 1
293 #if defined(__alpha__) || defined(__ia64__) || defined(_ARCH_PPC64) || defined(__x86_64__) || defined(__mips64) || defined(__sparc64__)
294 #if defined(__GNUC__) && !defined(__INTEL_COMPILER) && !(CRYPTOPP_GCC_VERSION == 40001 && defined(__APPLE__)) && CRYPTOPP_GCC_VERSION >= 30400
297 typedef word32 hword;
299 typedef __uint128_t dword;
300 typedef __uint128_t word128;
301 #define CRYPTOPP_WORD128_AVAILABLE 1
304 typedef word16 hword;
306 typedef word64 dword;
310 #define CRYPTOPP_BOOL_SLOW_WORD64 1
311 typedef word16 hword;
313 typedef word64 dword;
316 #ifndef CRYPTOPP_BOOL_SLOW_WORD64
317 #define CRYPTOPP_BOOL_SLOW_WORD64 0
320 const unsigned int WORD_SIZE =
sizeof(word);
321 const unsigned int WORD_BITS = WORD_SIZE * 8;
325 #ifndef CRYPTOPP_L1_CACHE_LINE_SIZE
328 #if defined(_M_X64) || defined(__x86_64__) || (__arm64__) || (__aarch64__)
329 #define CRYPTOPP_L1_CACHE_LINE_SIZE 64
332 #define CRYPTOPP_L1_CACHE_LINE_SIZE 32
336 #if defined(_MSC_VER)
340 #if _MSC_VER > 1200 || defined(_mm_free)
341 #define CRYPTOPP_MSVC6PP_OR_LATER // VC 6 processor pack or later
343 #define CRYPTOPP_MSVC6_NO_PP // VC 6 without processor pack
347 #ifndef CRYPTOPP_ALIGN_DATA
348 #if defined(CRYPTOPP_MSVC6PP_OR_LATER)
349 #define CRYPTOPP_ALIGN_DATA(x) __declspec(align(x))
350 #elif defined(__GNUC__)
351 #define CRYPTOPP_ALIGN_DATA(x) __attribute__((aligned(x)))
353 #define CRYPTOPP_ALIGN_DATA(x)
357 #ifndef CRYPTOPP_SECTION_ALIGN16
358 #if defined(__GNUC__) && !defined(__APPLE__)
360 #define CRYPTOPP_SECTION_ALIGN16 __attribute__((section ("CryptoPP_Align16")))
362 #define CRYPTOPP_SECTION_ALIGN16
367 #if ((__MACH__ >= 1) && ((CRYPTOPP_LLVM_CLANG_VERSION >= 30600) || (CRYPTOPP_APPLE_CLANG_VERSION >= 70100) || (CRYPTOPP_GCC_VERSION >= 40300)))
368 #define CRYPTOPP_SECTION_INIT __attribute__((section ("__DATA,__data")))
369 #elif ((__ELF__ >= 1) && (CRYPTOPP_GCC_VERSION >= 40300))
370 #define CRYPTOPP_SECTION_INIT __attribute__((section ("nocommon")))
372 #define CRYPTOPP_SECTION_INIT
375 #if defined(_MSC_VER) || defined(__fastcall)
376 #define CRYPTOPP_FASTCALL __fastcall
378 #define CRYPTOPP_FASTCALL
382 #if defined(_MSC_VER) && (_MSC_VER < 1300)
385 #define CPP_TYPENAME typename
389 #if defined(_MSC_VER) && !defined(CRYPTOPP_MSVC6PP_OR_LATER)
390 #define CRYPTOPP_VC6_INT64 (__int64)
392 #define CRYPTOPP_VC6_INT64
396 #define CRYPTOPP_NO_VTABLE __declspec(novtable)
398 #define CRYPTOPP_NO_VTABLE
414 # pragma warning(disable: 4127 4231 4250 4251 4275 4505 4512 4660 4661 4786 4355 4910)
417 # pragma warning(once: 4191 4242 4263 4264 4266 4302 4826 4905 4906 4928)
426 #if CRYPTOPP_GCC_DIAGNOSTIC_AVAILABLE
427 # pragma GCC diagnostic ignored "-Wunknown-pragmas"
428 # pragma GCC diagnostic ignored "-Wunused-function"
434 #if (defined(_MSC_VER) && _MSC_VER <= 1300) || defined(__MWERKS__) || (defined(_STLPORT_VERSION) && ((_STLPORT_VERSION < 0x450) || defined(_STLP_NO_UNCAUGHT_EXCEPT_SUPPORT)))
435 #define CRYPTOPP_DISABLE_UNCAUGHT_EXCEPTION
438 #ifndef CRYPTOPP_DISABLE_UNCAUGHT_EXCEPTION
439 #define CRYPTOPP_UNCAUGHT_EXCEPTION_AVAILABLE
442 #ifdef CRYPTOPP_DISABLE_X86ASM // for backwards compatibility: this macro had both meanings
443 #define CRYPTOPP_DISABLE_ASM
444 #define CRYPTOPP_DISABLE_SSE2
448 #if defined(CRYPTOPP_APPLE_CLANG_VERSION) && (CRYPTOPP_APPLE_CLANG_VERSION < 50000)
449 # define CRYPTOPP_DISABLE_ASM
454 #if !defined(CRYPTOPP_DISABLE_ASM) && !defined(__SSE2__) && defined(__x86_64__) && (__SUNPRO_CC >= 0x5100)
458 #if !defined(CRYPTOPP_DISABLE_ASM) && ((defined(_MSC_VER) && defined(_M_IX86)) || (defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))))
460 #define CRYPTOPP_X86_ASM_AVAILABLE
462 #if !defined(CRYPTOPP_DISABLE_SSE2) && (defined(CRYPTOPP_MSVC6PP_OR_LATER) || CRYPTOPP_GCC_VERSION >= 30300 || defined(__SSE2__))
463 #define CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE 1
465 #define CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE 0
468 #if !defined(CRYPTOPP_DISABLE_SSE3) && (_MSC_VER >= 1500 || (defined(__SSE3__) && defined(__SSSE3__)))
469 #define CRYPTOPP_BOOL_SSSE3_ASM_AVAILABLE 1
471 #define CRYPTOPP_BOOL_SSSE3_ASM_AVAILABLE 0
475 #if !defined(CRYPTOPP_DISABLE_ASM) && defined(_MSC_VER) && defined(_M_X64)
476 #define CRYPTOPP_X64_MASM_AVAILABLE
479 #if !defined(CRYPTOPP_DISABLE_ASM) && defined(__GNUC__) && defined(__x86_64__)
480 #define CRYPTOPP_X64_ASM_AVAILABLE
483 #if !defined(CRYPTOPP_DISABLE_ASM) && (defined(CRYPTOPP_MSVC6PP_OR_LATER) || defined(__SSE2__)) && !defined(_M_ARM)
484 #define CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE 1
486 #define CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE 0
492 #if !defined(CRYPTOPP_DISABLE_ASM) && !defined(CRYPTOPP_DISABLE_SSE4) && !defined(_M_ARM) && ((_MSC_VER >= 1500) || (defined(__SSE4_1__) && defined(__SSE4_2__)))
493 #define CRYPTOPP_BOOL_SSE4_INTRINSICS_AVAILABLE 1
495 #define CRYPTOPP_BOOL_SSE4_INTRINSICS_AVAILABLE 0
499 #if !defined(CRYPTOPP_DISABLE_ASM) && !defined(CRYPTOPP_DISABLE_AESNI) && !defined(_M_ARM) && (_MSC_FULL_VER >= 150030729 || __INTEL_COMPILER >= 1110 || (defined(__AES__) && defined(__PCLMUL__)))
500 #define CRYPTOPP_BOOL_AESNI_INTRINSICS_AVAILABLE 1
502 #define CRYPTOPP_BOOL_AESNI_INTRINSICS_AVAILABLE 0
506 #if !defined(CRYPTOPP_DISABLE_ASM) && !defined(CRYPTOPP_DISABLE_AVX) && !defined(_M_ARM) && ((_MSC_VER >= 1600) || (defined(__RDRND__) || defined(__RDSEED__) || defined(__AVX__)))
507 #define CRYPTOPP_BOOL_AVX_AVAILABLE 1
509 #define CRYPTOPP_BOOL_AVX_AVAILABLE 0
513 #if !defined(CRYPTOPP_BOOL_NEON_INTRINSICS_AVAILABLE) && !defined(CRYPTOPP_DISABLE_ASM)
514 # if defined(__ARM_NEON__) || defined(__ARM_NEON) || defined(_M_ARM)
515 # define CRYPTOPP_BOOL_NEON_INTRINSICS_AVAILABLE 1
522 #if !defined(CRYPTOPP_BOOL_ARM_CRC32_INTRINSICS_AVAILABLE) && !defined(CRYPTOPP_DISABLE_ASM)
523 # if defined(__ARM_FEATURE_CRC32) || defined(_M_ARM64)
524 # define CRYPTOPP_BOOL_ARM_CRC32_INTRINSICS_AVAILABLE 1
531 #if !defined(CRYPTOPP_BOOL_ARM_CRYPTO_INTRINSICS_AVAILABLE) && !defined(CRYPTOPP_DISABLE_ASM)
532 # if defined(__ARM_FEATURE_CRYPTO) || defined(_M_ARM64)
533 # define CRYPTOPP_BOOL_ARM_CRYPTO_INTRINSICS_AVAILABLE 1
537 #if CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE || CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE || CRYPTOPP_BOOL_NEON_INTRINSICS_AVAILABLE || defined(CRYPTOPP_X64_MASM_AVAILABLE)
538 #define CRYPTOPP_BOOL_ALIGN16 1
540 #define CRYPTOPP_BOOL_ALIGN16 0
544 #if defined(CRYPTOPP_MSVC6PP_OR_LATER)
545 #define CRYPTOPP_MM_MALLOC_AVAILABLE
546 #elif defined(__APPLE__)
547 #define CRYPTOPP_APPLE_MALLOC_AVAILABLE
548 #elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
549 #define CRYPTOPP_MALLOC_ALIGNMENT_IS_16
550 #elif defined(__linux__) || defined(__sun__) || defined(__CYGWIN__)
551 #define CRYPTOPP_MEMALIGN_AVAILABLE
553 #define CRYPTOPP_NO_ALIGNED_ALLOC
560 #if defined(_MSC_VER) && _MSC_VER >= 1300
561 # define CRYPTOPP_NOINLINE_DOTDOTDOT
562 # define CRYPTOPP_NOINLINE __declspec(noinline)
563 #elif defined(__GNUC__)
564 # define CRYPTOPP_NOINLINE_DOTDOTDOT
565 # define CRYPTOPP_NOINLINE __attribute__((noinline))
567 # define CRYPTOPP_NOINLINE_DOTDOTDOT ...
568 # define CRYPTOPP_NOINLINE
573 #if (defined(_MSC_VER) && _MSC_VER <= 1300) || defined(__INTEL_COMPILER) || defined(__BORLANDC__)
574 # define CRYPTOPP_CONSTANT(x) enum {x};
576 # define CRYPTOPP_CONSTANT(x) static const int x;
582 #if ((__ILP32__ >= 1) || (_ILP32 >= 1)) && defined(__x86_64__)
583 #define CRYPTOPP_BOOL_X32 1
585 #define CRYPTOPP_BOOL_X32 0
589 #if (defined(_M_IX86) || defined(__i386__) || defined(__i386) || defined(_X86_) || defined(__I86__) || defined(__INTEL__)) && !CRYPTOPP_BOOL_X32
590 #define CRYPTOPP_BOOL_X86 1
592 #define CRYPTOPP_BOOL_X86 0
595 #if (defined(_M_X64) || defined(__x86_64__)) && !CRYPTOPP_BOOL_X32
596 #define CRYPTOPP_BOOL_X64 1
598 #define CRYPTOPP_BOOL_X64 0
602 #if CRYPTOPP_BOOL_X32
603 # undef CRYPTOPP_BOOL_X64
604 # undef CRYPTOPP_X64_ASM_AVAILABLE
605 # undef CRYPTOPP_X64_MASM_AVAILABLE
608 #if defined(__arm__) || defined(__aarch32__) || defined(_M_ARM)
609 #define CRYPTOPP_BOOL_ARM32 1
611 #define CRYPTOPP_BOOL_ARM32 0
616 #if defined(__arm64__) || defined(__aarch64__) || defined(_M_ARM64)
617 #define CRYPTOPP_BOOL_ARM64 1
619 #define CRYPTOPP_BOOL_ARM64 0
622 #if !defined(CRYPTOPP_NO_UNALIGNED_DATA_ACCESS) && !defined(CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS)
623 #if (CRYPTOPP_BOOL_X64 || CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X32 || defined(__powerpc__) || (__ARM_FEATURE_UNALIGNED >= 1))
624 #define CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS
630 #ifndef NO_OS_DEPENDENCE
632 #if defined(_WIN32) || defined(__CYGWIN__)
633 #define CRYPTOPP_WIN32_AVAILABLE
636 #if defined(__unix__) || defined(__MACH__) || defined(__NetBSD__) || defined(__sun)
637 #define CRYPTOPP_UNIX_AVAILABLE
640 #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
641 #define CRYPTOPP_BSD_AVAILABLE
644 #if defined(CRYPTOPP_WIN32_AVAILABLE) || defined(CRYPTOPP_UNIX_AVAILABLE)
645 # define HIGHRES_TIMER_AVAILABLE
648 #ifdef CRYPTOPP_WIN32_AVAILABLE
649 # if !defined(WINAPI_FAMILY)
650 # define THREAD_TIMER_AVAILABLE
651 # elif defined(WINAPI_FAMILY)
652 # if (WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP))
653 # define THREAD_TIMER_AVAILABLE
658 #ifdef CRYPTOPP_UNIX_AVAILABLE
659 # define HAS_BERKELEY_STYLE_SOCKETS
660 # define SOCKETS_AVAILABLE
664 #ifdef CRYPTOPP_WIN32_AVAILABLE
665 # define HAS_WINDOWS_STYLE_SOCKETS
666 # if !defined(WINAPI_FAMILY)
667 # define SOCKETS_AVAILABLE
668 # elif defined(WINAPI_FAMILY)
669 # if (WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP))
670 # define SOCKETS_AVAILABLE
675 #if defined(HAS_WINDOWS_STYLE_SOCKETS) && (!defined(HAS_BERKELEY_STYLE_SOCKETS) || defined(PREFER_WINDOWS_STYLE_SOCKETS))
676 # define USE_WINDOWS_STYLE_SOCKETS
678 # define USE_BERKELEY_STYLE_SOCKETS
681 #if defined(CRYPTOPP_WIN32_AVAILABLE) && defined(SOCKETS_AVAILABLE) && !defined(USE_BERKELEY_STYLE_SOCKETS)
682 # define WINDOWS_PIPES_AVAILABLE
685 #if defined(CRYPTOPP_UNIX_AVAILABLE) || defined(CRYPTOPP_DOXYGEN_PROCESSING)
686 # define NONBLOCKING_RNG_AVAILABLE
687 # define BLOCKING_RNG_AVAILABLE
688 # define OS_RNG_AVAILABLE
689 # define HAS_PTHREADS
690 # define THREADS_AVAILABLE
693 #if defined(CRYPTOPP_BSD_AVAILABLE) || defined(CRYPTOPP_UNIX_AVAILABLE) || defined(__CYGWIN__)
694 # define UNIX_SIGNALS_AVAILABLE 1
697 #ifdef CRYPTOPP_WIN32_AVAILABLE
698 # if !defined(WINAPI_FAMILY)
699 # define HAS_WINTHREADS
700 # define THREADS_AVAILABLE
701 # define NONBLOCKING_RNG_AVAILABLE
702 # define OS_RNG_AVAILABLE
703 # elif defined(WINAPI_FAMILY)
704 # if (WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP))
705 # define HAS_WINTHREADS
706 # define THREADS_AVAILABLE
707 # define NONBLOCKING_RNG_AVAILABLE
708 # define OS_RNG_AVAILABLE
709 # elif !(WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP))
710 # if ((WINVER >= 0x0A00 ) || (_WIN32_WINNT >= 0x0A00 ))
711 # define NONBLOCKING_RNG_AVAILABLE
712 # define OS_RNG_AVAILABLE
718 #endif // NO_OS_DEPENDENCE
722 #if defined(CRYPTOPP_WIN32_AVAILABLE) && !defined(CRYPTOPP_DOXYGEN_PROCESSING)
724 #ifdef CRYPTOPP_EXPORTS
725 #define CRYPTOPP_IS_DLL
726 #define CRYPTOPP_DLL __declspec(dllexport)
727 #elif defined(CRYPTOPP_IMPORTS)
728 #define CRYPTOPP_IS_DLL
729 #define CRYPTOPP_DLL __declspec(dllimport)
734 #define CRYPTOPP_API __cdecl
736 #else // not CRYPTOPP_WIN32_AVAILABLE
741 #endif // CRYPTOPP_WIN32_AVAILABLE
743 #if defined(__MWERKS__)
744 #define CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS extern class CRYPTOPP_DLL
745 #elif defined(__BORLANDC__) || defined(__SUNPRO_CC)
746 #define CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS template class CRYPTOPP_DLL
748 #define CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS extern template class CRYPTOPP_DLL
751 #if defined(CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES) && !defined(CRYPTOPP_IMPORTS)
752 #define CRYPTOPP_DLL_TEMPLATE_CLASS template class CRYPTOPP_DLL
754 #define CRYPTOPP_DLL_TEMPLATE_CLASS CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS
757 #if defined(__MWERKS__)
758 #define CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS extern class
759 #elif defined(__BORLANDC__) || defined(__SUNPRO_CC)
760 #define CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS template class
762 #define CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS extern template class
765 #if defined(CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES) && !defined(CRYPTOPP_EXPORTS)
766 #define CRYPTOPP_STATIC_TEMPLATE_CLASS template class
768 #define CRYPTOPP_STATIC_TEMPLATE_CLASS CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS
775 #define CRYPTOPP_UNUSED(x) ((void)(x))
779 #if (CRYPTOPP_GCC_VERSION >= 40500) || (CRYPTOPP_LLVM_CLANG_VERSION >= 20800)
780 # define CRYPTOPP_DEPRECATED(msg) __attribute__((deprecated (msg)));
781 #elif (CRYPTOPP_GCC_VERSION)
782 # define CRYPTOPP_DEPRECATED(msg) __attribute__((deprecated));
784 # define CRYPTOPP_DEPRECATED(msg)
793 #if ((_MSC_VER >= 1600) || (__cplusplus >= 201103L)) && !defined(_STLPORT_VERSION)
794 # define CRYPTOPP_CXX11 1
802 #if defined(__APPLE__) && defined(__clang__)
803 # if !(defined(__has_include) && __has_include(<forward_list>))
804 # undef CRYPTOPP_CXX11
809 #if defined(CRYPTOPP_CXX11)
812 #if (CRYPTOPP_MSC_VERSION >= 1700)
813 # define CRYPTOPP_CXX11_ATOMICS 1
814 #elif (__INTEL_COMPILER >= 1300)
815 # define CRYPTOPP_CXX11_ATOMICS 1
816 #elif defined(__clang__)
817 # if __has_feature(cxx_atomic)
818 # define CRYPTOPP_CXX11_ATOMICS 1
820 #elif (CRYPTOPP_GCC_VERSION >= 40400)
821 # define CRYPTOPP_CXX11_ATOMICS 1
822 #elif (__SUNPRO_CC >= 0x5140)
823 # define CRYPTOPP_CXX11_ATOMICS 1
828 #if (CRYPTOPP_MSC_VERSION >= 1700)
829 # define CRYPTOPP_CXX11_SYNCHRONIZATION 1
830 #elif (__INTEL_COMPILER >= 1200)
831 # define CRYPTOPP_CXX11_SYNCHRONIZATION 1
832 #elif (CRYPTOPP_LLVM_CLANG_VERSION >= 30300) || (CRYPTOPP_APPLE_CLANG_VERSION >= 50000)
833 # define CRYPTOPP_CXX11_SYNCHRONIZATION 1
834 #elif (CRYPTOPP_GCC_VERSION >= 40400)
835 # define CRYPTOPP_CXX11_SYNCHRONIZATION 1
836 #elif (__SUNPRO_CC >= 0x5130)
837 # define CRYPTOPP_CXX11_SYNCHRONIZATION 1
838 #endif // synchronization
841 #if (CRYPTOPP_MSC_VERSION >= 1900)
842 # define CRYPTOPP_CXX11_ALIGNAS 1
843 # define CRYPTOPP_CXX11_ALIGNOF 1
844 #elif (__INTEL_COMPILER >= 1500)
845 # define CRYPTOPP_CXX11_ALIGNAS 1
846 # define CRYPTOPP_CXX11_ALIGNOF 1
847 #elif defined(__clang__)
848 # if __has_feature(cxx_alignas)
849 # define CRYPTOPP_CXX11_ALIGNAS 1
851 # if __has_feature(cxx_alignof)
852 # define CRYPTOPP_CXX11_ALIGNOF 1
854 #elif (CRYPTOPP_GCC_VERSION >= 40800)
855 # define CRYPTOPP_CXX11_ALIGNAS 1
856 # define CRYPTOPP_CXX11_ALIGNOF 1
857 #elif (__SUNPRO_CC >= 0x5130)
858 # define CRYPTOPP_CXX11_ALIGNAS 1
859 # define CRYPTOPP_CXX11_ALIGNOF 1
860 #endif // alignof/alignas
863 #if (CRYPTOPP_MSC_VERSION >= 1900)
864 # define CRYPTOPP_CXX11_NOEXCEPT 1
865 #elif (__INTEL_COMPILER >= 1400)
866 # define CRYPTOPP_CXX11_NOEXCEPT 1
867 #elif defined(__clang__)
868 # if __has_feature(cxx_noexcept)
869 # define CRYPTOPP_CXX11_NOEXCEPT 1
871 #elif (CRYPTOPP_GCC_VERSION >= 40600)
872 # define CRYPTOPP_CXX11_NOEXCEPT 1
873 #elif (__SUNPRO_CC >= 0x5130)
874 # define CRYPTOPP_CXX11_NOEXCEPT 1
875 #endif // noexcept compilers
878 #if (CRYPTOPP_MSC_VERSION >= 1800)
879 # define CRYPTOPP_CXX11_VARIADIC_TEMPLATES 1
880 #elif (__INTEL_COMPILER >= 1210)
881 # define CRYPTOPP_CXX11_VARIADIC_TEMPLATES 1
882 #elif defined(__clang__)
883 # if __has_feature(cxx_variadic_templates)
884 # define CRYPTOPP_CXX11_VARIADIC_TEMPLATES 1
886 #elif (CRYPTOPP_GCC_VERSION >= 40300)
887 # define CRYPTOPP_CXX11_VARIADIC_TEMPLATES 1
888 #elif (__SUNPRO_CC >= 0x5130)
889 # define CRYPTOPP_CXX11_VARIADIC_TEMPLATES 1
890 #endif // variadic templates
894 #if (CRYPTOPP_MSC_VERSION >= 1900)
895 # define CRYPTOPP_CXX11_CONSTEXPR 1
896 #elif (__INTEL_COMPILER >= 1600)
897 # define CRYPTOPP_CXX11_CONSTEXPR 1
898 #elif defined(__clang__)
899 # if __has_feature(cxx_constexpr)
900 # define CRYPTOPP_CXX11_CONSTEXPR 1
902 #elif (CRYPTOPP_GCC_VERSION >= 40600)
903 # define CRYPTOPP_CXX11_CONSTEXPR 1
904 #elif (__SUNPRO_CC >= 0x5130)
905 # define CRYPTOPP_CXX11_CONSTEXPR 1
906 #endif // constexpr compilers
911 #endif // CRYPTOPP_CXX11
913 #if defined(CRYPTOPP_CXX11_NOEXCEPT)
914 # define CRYPTOPP_THROW noexcept(false)
915 # define CRYPTOPP_NO_THROW noexcept(true)
917 # define CRYPTOPP_THROW
918 # define CRYPTOPP_NO_THROW
919 #endif // CRYPTOPP_CXX11_NOEXCEPT
921 #if defined(CRYPTOPP_CXX11_CONSTEXPR)
922 # define CRYPTOPP_CONSTEXPR constexpr
924 # define CRYPTOPP_CONSTEXPR
925 #endif // CRYPTOPP_CXX11_CONSTEXPR
928 #if defined(CRYPTOPP_CXX11_ALIGNAS)
929 # undef CRYPTOPP_ALIGN_DATA
930 # define CRYPTOPP_ALIGN_DATA(x) alignas(x)
931 #endif // CRYPTOPP_CXX11_ALIGNAS
934 #if defined(CRYPTOPP_CXX11_CONSTEXPR)
935 # undef CRYPTOPP_CONSTANT
936 # define CRYPTOPP_CONSTANT(x) constexpr static int x;
941 #if (defined(__cplusplus) && (__cplusplus >= 199711L) && (__cplusplus < 201402L)) && !defined(CRYPTOPP_UNCAUGHT_EXCEPTION_AVAILABLE)
942 # error "std::uncaught_exception is not available. This is likely a configuration error."