Crypto++  7.0
Free C++ class library of cryptographic schemes
config.h
Go to the documentation of this file.
1 // config.h - originally written and placed in the public domain by Wei Dai
2 
3 /// \file config.h
4 /// \brief Library configuration file
5 
6 #ifndef CRYPTOPP_CONFIG_H
7 #define CRYPTOPP_CONFIG_H
8 
9 // ***************** Important Settings ********************
10 
11 // define this if running on a big-endian CPU
12 // big endian will be assumed if CRYPTOPP_LITTLE_ENDIAN is not non-0
13 #if !defined(CRYPTOPP_LITTLE_ENDIAN) && !defined(CRYPTOPP_BIG_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 CRYPTOPP_BIG_ENDIAN 1
15 #endif
16 
17 // define this if running on a little-endian CPU
18 // big endian will be assumed if CRYPTOPP_LITTLE_ENDIAN is not non-0
19 #if !defined(CRYPTOPP_BIG_ENDIAN) && !defined(CRYPTOPP_LITTLE_ENDIAN)
20 # define CRYPTOPP_LITTLE_ENDIAN 1
21 #endif
22 
23 // Sanity checks. Some processors have more than big, little and bi-endian modes. PDP mode, where order results in "4312", should
24 // raise red flags immediately. Additionally, mis-classified machines, like (previosuly) S/390, should raise red flags immediately.
25 #if (CRYPTOPP_BIG_ENDIAN) && defined(__GNUC__) && defined(__BYTE_ORDER__) && (__BYTE_ORDER__ != __ORDER_BIG_ENDIAN__)
26 # error "(CRYPTOPP_BIG_ENDIAN) is set, but __BYTE_ORDER__ is not __ORDER_BIG_ENDIAN__"
27 #endif
28 #if (CRYPTOPP_LITTLE_ENDIAN) && defined(__GNUC__) && defined(__BYTE_ORDER__) && (__BYTE_ORDER__ != __ORDER_LITTLE_ENDIAN__)
29 # error "(CRYPTOPP_LITTLE_ENDIAN) is set, but __BYTE_ORDER__ is not __ORDER_LITTLE_ENDIAN__"
30 #endif
31 
32 // Define this if you want to disable all OS-dependent features,
33 // such as sockets and OS-provided random number generators
34 // #define NO_OS_DEPENDENCE
35 
36 // Define this to use features provided by Microsoft's CryptoAPI.
37 // Currently the only feature used is Windows random number generation.
38 // This macro will be ignored if NO_OS_DEPENDENCE is defined.
39 // #define USE_MS_CRYPTOAPI
40 
41 // Define this to use features provided by Microsoft's CryptoNG API.
42 // CryptoNG API is available in Vista and above and its cross platform,
43 // including desktop apps and store apps. Currently the only feature
44 // used is Windows random number generation.
45 // This macro will be ignored if NO_OS_DEPENDENCE is defined.
46 // #define USE_MS_CNGAPI
47 
48 // If the user did not make a choice, then select CryptoNG if
49 // targeting Windows 8 or above.
50 #if !defined(USE_MS_CRYPTOAPI) && !defined(USE_MS_CNGAPI)
51 # if !defined(_USING_V110_SDK71_) && ((WINVER >= 0x0602 /*_WIN32_WINNT_WIN8*/) || (_WIN32_WINNT >= 0x0602 /*_WIN32_WINNT_WIN8*/))
52 # define USE_MS_CNGAPI
53 # else
54 # define USE_MS_CRYPTOAPI
55 # endif
56 #endif
57 
58 // Define this to disable ASM, intrinsics and built-ins. The library will be
59 // compiled using C++ only. The library code will not include SSE2 (and
60 // above), NEON, Aarch32, Aarch64, or Altivec (and above). Note the compiler
61 // may use higher ISAs depending on compiler options, but the library will not
62 // explictly use the ISAs. When disabling ASM, it is best to do it from
63 // config.h to ensure the library and all programs share the setting.
64 // #define CRYPTOPP_DISABLE_ASM 1
65 
66 // https://github.com/weidai11/cryptopp/issues/719
67 #if defined(__native_client__)
68 # define CRYPTOPP_DISABLE_ASM 1
69 #endif
70 
71 // Define CRYPTOPP_NO_CXX11 to avoid C++11 related features shown at the
72 // end of this file. Some compilers and standard C++ headers advertise C++11
73 // but they are really just C++03 with some additional C++11 headers and
74 // non-conforming classes. You might also consider `-std=c++03` or
75 // `-std=gnu++03`, but they are required options when building the library
76 // and all programs. CRYPTOPP_NO_CXX11 is probably easier to manage but it may
77 // cause -Wterminate warnings under GCC. MSVC++ has a similar warning.
78 // Also see https://github.com/weidai11/cryptopp/issues/529
79 // #define CRYPTOPP_NO_CXX11 1
80 
81 // Define CRYPTOPP_NO_CXX17 to avoid C++17 related features shown at the end of
82 // this file. At the moment it should only affect std::uncaught_exceptions.
83 // #define CRYPTOPP_NO_CXX17 1
84 
85 // CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS is no longer honored. It
86 // was removed at https://github.com/weidai11/cryptopp/issues/682
87 // #define CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS 1
88 
89 // ***************** Less Important Settings ***************
90 
91 // Library version macro. Since this macro is in a header, it reflects
92 // the version of the library the headers came from. It is not
93 // necessarily the version of the library built as a shared object if
94 // versions are inadvertently mixed and matched.
95 #define CRYPTOPP_VERSION 700
96 
97 // Define this if you want to set a prefix for TestData/ and TestVectors/
98 // Be sure to add the trailing slash since its simple concatenation.
99 // After https://github.com/weidai11/cryptopp/issues/760 the library
100 // should find the test vectors and data without much effort. It
101 // will search in "./" and "$ORIGIN/../share/cryptopp" automatically.
102 #ifndef CRYPTOPP_DATA_DIR
103 # define CRYPTOPP_DATA_DIR ""
104 #endif
105 
106 // Define this to disable the test suite from searching for test
107 // vectors and data in "./" and "$ORIGIN/../share/cryptopp". The
108 // library will still search in CRYPTOPP_DATA_DIR, regardless.
109 // Some distros may want to disable this feature. Also see
110 // https://github.com/weidai11/cryptopp/issues/760
111 // #ifndef CRYPTOPP_DISABLE_DATA_DIR_SEARCH
112 // # define CRYPTOPP_DISABLE_DATA_DIR_SEARCH
113 // #endif
114 
115 // Define this if you want or need the library's memcpy_s and memmove_s.
116 // See http://github.com/weidai11/cryptopp/issues/28.
117 // #if !defined(CRYPTOPP_WANT_SECURE_LIB)
118 // # define CRYPTOPP_WANT_SECURE_LIB
119 // #endif
120 
121 // File system code to write to GZIP archive.
122 // http://www.gzip.org/format.txt
123 #if !defined(GZIP_OS_CODE)
124 # if defined(__macintosh__)
125 # define GZIP_OS_CODE 7
126 # elif defined(__unix__) || defined(__linux__)
127 # define GZIP_OS_CODE 3
128 # else
129 # define GZIP_OS_CODE 0
130 # endif
131 #endif
132 
133 // Try this if your CPU has 256K internal cache or a slow multiply instruction
134 // and you want a (possibly) faster IDEA implementation using log tables
135 // #define IDEA_LARGECACHE
136 
137 // Define this if, for the linear congruential RNG, you want to use
138 // the original constants as specified in S.K. Park and K.W. Miller's
139 // CACM paper.
140 // #define LCRNG_ORIGINAL_NUMBERS
141 
142 // Define this if you want Integer's operator<< to honor std::showbase (and
143 // std::noshowbase). If defined, Integer will use a suffix of 'b', 'o', 'h'
144 // or '.' (the last for decimal) when std::showbase is in effect. If
145 // std::noshowbase is set, then the suffix is not added to the Integer. If
146 // not defined, existing behavior is preserved and Integer will use a suffix
147 // of 'b', 'o', 'h' or '.' (the last for decimal).
148 // #define CRYPTOPP_USE_STD_SHOWBASE
149 
150 // Define this if ARMv8 shifts are slow. ARM Cortex-A53 and Cortex-A57 shift
151 // operation perform poorly, so NEON and ASIMD code that relies on shifts
152 // or rotates often performs worse than C/C++ code. Also see
153 // http://github.com/weidai11/cryptopp/issues/367.
154 #define CRYPTOPP_SLOW_ARMV8_SHIFT 1
155 
156 // Define this if you want to decouple AlgorithmParameters and Integer
157 // The decoupling should make it easier for the linker to remove Integer
158 // related code for those who do not need Integer, and avoid a potential
159 // race during AssignIntToInteger pointer initialization. Also
160 // see http://github.com/weidai11/cryptopp/issues/389.
161 // #define CRYPTOPP_NO_ASSIGN_TO_INTEGER
162 
163 // set the name of Rijndael cipher, was "Rijndael" before version 5.3
164 #define CRYPTOPP_RIJNDAEL_NAME "AES"
165 
166 // CRYPTOPP_DEBUG enables the library's CRYPTOPP_ASSERT. CRYPTOPP_ASSERT
167 // raises a SIGTRAP (Unix) or calls DebugBreak() (Windows). CRYPTOPP_ASSERT
168 // is only in effect when CRYPTOPP_DEBUG, DEBUG or _DEBUG is defined. Unlike
169 // Posix assert, CRYPTOPP_ASSERT is not affected by NDEBUG (or failure to
170 // define it).
171 // Also see http://github.com/weidai11/cryptopp/issues/277, CVE-2016-7420
172 #if (defined(DEBUG) || defined(_DEBUG)) && !defined(CRYPTOPP_DEBUG)
173 # define CRYPTOPP_DEBUG 1
174 #endif
175 
176 // ***************** Important Settings Again ********************
177 // But the defaults should be ok.
178 
179 // namespace support is now required
180 #ifdef NO_NAMESPACE
181 # error namespace support is now required
182 #endif
183 
184 #ifdef CRYPTOPP_DOXYGEN_PROCESSING
185 // Document the namespce exists. Put it here before CryptoPP is undefined below.
186 /// \namespace CryptoPP
187 /// \brief Crypto++ library namespace
188 /// \details Nearly all classes are located in the CryptoPP namespace. Within
189 /// the namespace, there are two additional namespaces.
190 /// <ul>
191 /// <li>Name - namespace for names used with \p NameValuePairs and documented in argnames.h
192 /// <li>NaCl - namespace for NaCl library functions like crypto_box, crypto_box_open, crypto_sign, and crypto_sign_open
193 /// <li>Donna - namespace for curve25519 library operations. The name was selected due to use of Adam Langley's curve25519-donna.
194 /// <li>Test - namespace for testing and benchmarks classes
195 /// <li>Weak - namespace for weak and wounded algorithms, like ARC4, MD5 and Pananma
196 /// </ul>
197 namespace CryptoPP { }
198 // Bring in the symbols found in the weak namespace; and fold Weak1 into Weak
199 # define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1
200 # define Weak1 Weak
201 // Avoid putting "CryptoPP::" in front of everything in Doxygen output
202 # define CryptoPP
203 # define NAMESPACE_BEGIN(x)
204 # define NAMESPACE_END
205 // Get Doxygen to generate better documentation for these typedefs
206 # define DOCUMENTED_TYPEDEF(x, y) class y : public x {};
207 // Make "protected" "private" so the functions and members are not documented
208 # define protected private
209 #else
210 # define NAMESPACE_BEGIN(x) namespace x {
211 # define NAMESPACE_END }
212 # define DOCUMENTED_TYPEDEF(x, y) typedef x y;
213 #endif
214 #define ANONYMOUS_NAMESPACE_BEGIN namespace {
215 #define ANONYMOUS_NAMESPACE_END }
216 #define USING_NAMESPACE(x) using namespace x;
217 #define DOCUMENTED_NAMESPACE_BEGIN(x) namespace x {
218 #define DOCUMENTED_NAMESPACE_END }
219 
220 // Originally in global namespace to avoid ambiguity with other byte typedefs.
221 // Moved to Crypto++ namespace due to C++17, std::byte and potential compile problems. Also see
222 // http://www.cryptopp.com/wiki/std::byte and http://github.com/weidai11/cryptopp/issues/442
223 // typedef unsigned char byte;
224 #define CRYPTOPP_NO_GLOBAL_BYTE 1
225 
226 NAMESPACE_BEGIN(CryptoPP)
227 
228 // Signed words added at Issue 609 for early versions of and Visual Studio and
229 // the NaCl gear. Also see https://github.com/weidai11/cryptopp/issues/609.
230 
231 typedef unsigned char byte;
232 typedef unsigned short word16;
233 typedef unsigned int word32;
234 
235 typedef signed char sbyte;
236 typedef signed short sword16;
237 typedef signed int sword32;
238 
239 #if defined(_MSC_VER) || defined(__BORLANDC__)
240  typedef signed __int64 sword64;
241  typedef unsigned __int64 word64;
242  #define SW64LIT(x) x##i64
243  #define W64LIT(x) x##ui64
244 #elif (_LP64 || __LP64__)
245  typedef signed long sword64;
246  typedef unsigned long word64;
247  #define SW64LIT(x) x##L
248  #define W64LIT(x) x##UL
249 #else
250  typedef signed long long sword64;
251  typedef unsigned long long word64;
252  #define SW64LIT(x) x##LL
253  #define W64LIT(x) x##ULL
254 #endif
255 
256 // define large word type, used for file offsets and such
257 typedef word64 lword;
258 const lword LWORD_MAX = W64LIT(0xffffffffffffffff);
259 
260 // It is OK to remove the hard stop below, but you are on your own.
261 // After building the library be sure to run self tests described
262 // https://www.cryptopp.com/wiki/Release_Process#Self_Tests
263 // Some relevant bug reports can be found at:
264 // * Clang: http://github.com/weidai11/cryptopp/issues/147
265 // * Native Client: https://github.com/weidai11/cryptopp/issues/719
266 #if (defined(_MSC_VER) && defined(__clang__))
267 # error: "Unsupported configuration"
268 #endif
269 
270 #ifdef __GNUC__
271  #define CRYPTOPP_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
272 #endif
273 
274 #if defined(__xlc__) || defined(__xlC__)
275  #define CRYPTOPP_XLC_VERSION ((__xlC__ / 256) * 10000 + (__xlC__ % 256) * 100)
276 #endif
277 
278 // Apple and LLVM's Clang. Apple Clang version 7.0 roughly equals LLVM Clang version 3.7
279 #if defined(__clang__) && defined(__apple_build_version__)
280  #define CRYPTOPP_APPLE_CLANG_VERSION (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__)
281 #elif defined(__clang__)
282  #define CRYPTOPP_LLVM_CLANG_VERSION (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__)
283 #endif
284 
285 #ifdef _MSC_VER
286  #define CRYPTOPP_MSC_VERSION (_MSC_VER)
287 #endif
288 
289 // Need GCC 4.6/Clang 1.7/Apple Clang 2.0 or above due to "GCC diagnostic {push|pop}"
290 #if (CRYPTOPP_GCC_VERSION >= 40600) || (CRYPTOPP_LLVM_CLANG_VERSION >= 10700) || (CRYPTOPP_APPLE_CLANG_VERSION >= 20000)
291  #define CRYPTOPP_GCC_DIAGNOSTIC_AVAILABLE 1
292 #endif
293 
294 // Some Clang cannot handle mixed asm with positional arguments, where the
295 // body is Intel style with no prefix and the templates are AT&T style.
296 // Define this is the Makefile misdetects the configuration.
297 // Also see https://bugs.llvm.org/show_bug.cgi?id=39895 .
298 // #define CRYPTOPP_DISABLE_MIXED_ASM 1
299 
300 // define hword, word, and dword. these are used for multiprecision integer arithmetic
301 // Intel compiler won't have _umul128 until version 10.0. See http://softwarecommunity.intel.com/isn/Community/en-US/forums/thread/30231625.aspx
302 #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__))
303  typedef word32 hword;
304  typedef word64 word;
305 #else
306  #define CRYPTOPP_NATIVE_DWORD_AVAILABLE 1
307  #if defined(__alpha__) || defined(__ia64__) || defined(_ARCH_PPC64) || defined(__x86_64__) || defined(__mips64) || defined(__sparc64__)
308  #if ((CRYPTOPP_GCC_VERSION >= 30400) || (CRYPTOPP_LLVM_CLANG_VERSION >= 30000) || (CRYPTOPP_APPLE_CLANG_VERSION >= 40300)) && (__SIZEOF_INT128__ >= 16)
309  // GCC 4.0.1 on MacOS X is missing __umodti3 and __udivti3
310  // GCC 4.8.3 and bad uint128_t ops on PPC64/POWER7 (Issue 421)
311  // mode(TI) division broken on amd64 with GCC earlier than GCC 3.4
312  typedef word32 hword;
313  typedef word64 word;
314  typedef __uint128_t dword;
315  typedef __uint128_t word128;
316  #define CRYPTOPP_WORD128_AVAILABLE 1
317  #else
318  // if we're here, it means we're on a 64-bit CPU but we don't have a way to obtain 128-bit multiplication results
319  typedef word16 hword;
320  typedef word32 word;
321  typedef word64 dword;
322  #endif
323  #else
324  // being here means the native register size is probably 32 bits or less
325  #define CRYPTOPP_BOOL_SLOW_WORD64 1
326  typedef word16 hword;
327  typedef word32 word;
328  typedef word64 dword;
329  #endif
330 #endif
331 #ifndef CRYPTOPP_BOOL_SLOW_WORD64
332  #define CRYPTOPP_BOOL_SLOW_WORD64 0
333 #endif
334 
335 const unsigned int WORD_SIZE = sizeof(word);
336 const unsigned int WORD_BITS = WORD_SIZE * 8;
337 
338 NAMESPACE_END
339 
340 #ifndef CRYPTOPP_L1_CACHE_LINE_SIZE
341  // This should be a lower bound on the L1 cache line size. It's used for defense against timing attacks.
342  // Also see http://stackoverflow.com/questions/794632/programmatically-get-the-cache-line-size.
343  #if defined(_M_X64) || defined(__x86_64__) || defined(__arm64__) || defined(__aarch64__) || defined(__powerpc64__) || defined(_ARCH_PPC64)
344  #define CRYPTOPP_L1_CACHE_LINE_SIZE 64
345  #else
346  // L1 cache line size is 32 on Pentium III and earlier
347  #define CRYPTOPP_L1_CACHE_LINE_SIZE 32
348  #endif
349 #endif
350 
351 // Sun Studio Express 3 (December 2006) provides GCC-style attributes.
352 // IBM XL C/C++ alignment modifier per Optimization Guide, pp. 19-20.
353 // __IBM_ATTRIBUTES per XLC 12.1 AIX Compiler Manual, p. 473.
354 // CRYPTOPP_ALIGN_DATA may not be reliable on AIX.
355 #ifndef CRYPTOPP_ALIGN_DATA
356  #if defined(_MSC_VER)
357  #define CRYPTOPP_ALIGN_DATA(x) __declspec(align(x))
358  #elif defined(__GNUC__) || (__SUNPRO_CC >= 0x5100)
359  #define CRYPTOPP_ALIGN_DATA(x) __attribute__((aligned(x)))
360  #elif defined(__xlc__) || defined(__xlC__)
361  #define CRYPTOPP_ALIGN_DATA(x) __attribute__((aligned(x)))
362  #else
363  #define CRYPTOPP_ALIGN_DATA(x)
364  #endif
365 #endif
366 
367 // The section attribute attempts to initialize CPU flags to avoid Valgrind findings above -O1
368 #if ((defined(__MACH__) && defined(__APPLE__)) && ((CRYPTOPP_LLVM_CLANG_VERSION >= 30600) || (CRYPTOPP_APPLE_CLANG_VERSION >= 70100) || (CRYPTOPP_GCC_VERSION >= 40300)))
369  #define CRYPTOPP_SECTION_INIT __attribute__((section ("__DATA,__data")))
370 #elif (defined(__ELF__) && (CRYPTOPP_GCC_VERSION >= 40300))
371  #define CRYPTOPP_SECTION_INIT __attribute__((section ("nocommon")))
372 #elif defined(__ELF__) && (defined(__xlC__) || defined(__ibmxl__))
373  #define CRYPTOPP_SECTION_INIT __attribute__((section ("nocommon")))
374 #else
375  #define CRYPTOPP_SECTION_INIT
376 #endif
377 
378 #if defined(_MSC_VER) || defined(__fastcall)
379  #define CRYPTOPP_FASTCALL __fastcall
380 #else
381  #define CRYPTOPP_FASTCALL
382 #endif
383 
384 #ifdef _MSC_VER
385 #define CRYPTOPP_NO_VTABLE __declspec(novtable)
386 #else
387 #define CRYPTOPP_NO_VTABLE
388 #endif
389 
390 #ifdef _MSC_VER
391  // 4127: conditional expression is constant
392  // 4512: assignment operator not generated
393  // 4661: no suitable definition provided for explicit template instantiation request
394  // 4910: '__declspec(dllexport)' and 'extern' are incompatible on an explicit instantiation
395 # pragma warning(disable: 4127 4512 4661 4910)
396  // Security related, possible defects
397  // http://blogs.msdn.com/b/vcblog/archive/2010/12/14/off-by-default-compiler-warnings-in-visual-c.aspx
398 # pragma warning(once: 4191 4242 4263 4264 4266 4302 4826 4905 4906 4928)
399 #endif
400 
401 #ifdef __BORLANDC__
402 // 8037: non-const function called for const object. needed to work around BCB2006 bug
403 # pragma warn -8037
404 #endif
405 
406 // [GCC Bug 53431] "C++ preprocessor ignores #pragma GCC diagnostic". Clang honors it.
407 #if CRYPTOPP_GCC_DIAGNOSTIC_AVAILABLE
408 # pragma GCC diagnostic ignored "-Wunknown-pragmas"
409 # pragma GCC diagnostic ignored "-Wunused-function"
410 #endif
411 
412 // You may need to force include a C++ header on Android when using STLPort to ensure
413 // _STLPORT_VERSION is defined: CXXFLAGS="-DNDEBUG -g2 -O2 -std=c++11 -include iosfwd"
414 // TODO: Figure out C++17 and lack of std::uncaught_exception
415 #if (defined(_MSC_VER) && _MSC_VER <= 1300) || defined(__MWERKS__) || (defined(_STLPORT_VERSION) && ((_STLPORT_VERSION < 0x450) || defined(_STLP_NO_UNCAUGHT_EXCEPT_SUPPORT)))
416 #define CRYPTOPP_DISABLE_UNCAUGHT_EXCEPTION
417 #endif
418 
419 #ifndef CRYPTOPP_DISABLE_UNCAUGHT_EXCEPTION
420 #define CRYPTOPP_UNCAUGHT_EXCEPTION_AVAILABLE
421 #endif
422 
423 // ***************** Platform and CPU features ********************
424 
425 // Linux provides X32, which is 32-bit integers, longs and pointers on x86_64
426 // using the full x86_64 register set. Detect via __ILP32__
427 // (http://wiki.debian.org/X32Port). However, __ILP32__ shows up in more places
428 // than the System V ABI specs calls out, like on some Solaris installations
429 // and just about any 32-bit system with Clang.
430 #if (defined(__ILP32__) || defined(_ILP32)) && defined(__x86_64__)
431  #define CRYPTOPP_BOOL_X32 1
432 #endif
433 
434 // see http://predef.sourceforge.net/prearch.html
435 #if (defined(_M_IX86) || defined(__i386__) || defined(__i386) || defined(_X86_) || defined(__I86__) || defined(__INTEL__)) && !CRYPTOPP_BOOL_X32
436  #define CRYPTOPP_BOOL_X86 1
437 #endif
438 
439 #if (defined(_M_X64) || defined(__x86_64__)) && !CRYPTOPP_BOOL_X32
440  #define CRYPTOPP_BOOL_X64 1
441 #endif
442 
443 // Undo the ASM related defines due to X32.
444 #if CRYPTOPP_BOOL_X32
445 # undef CRYPTOPP_BOOL_X64
446 # undef CRYPTOPP_X64_ASM_AVAILABLE
447 # undef CRYPTOPP_X64_MASM_AVAILABLE
448 #endif
449 
450 // Microsoft added ARM64 define December 2017.
451 #if defined(__arm64__) || defined(__aarch32__) || defined(__aarch64__) || defined(_M_ARM64)
452  #define CRYPTOPP_BOOL_ARMV8 1
453 #elif defined(__arm__) || defined(_M_ARM)
454  #define CRYPTOPP_BOOL_ARM32 1
455 #endif
456 
457 // AltiVec and Power8 crypto
458 #if defined(__ppc64__) || defined(__powerpc64__) || defined(_ARCH_PPC64)
459  #define CRYPTOPP_BOOL_PPC64 1
460 #elif defined(__powerpc__) || defined(_ARCH_PPC)
461  #define CRYPTOPP_BOOL_PPC32 1
462 #endif
463 
464 // And MIPS. TODO: finish these defines
465 #if defined(__mips64__)
466  #define CRYPTOPP_BOOL_MIPS64 1
467 #elif defined(__mips__)
468  #define CRYPTOPP_BOOL_MIPS32 1
469 #endif
470 
471 #if defined(_MSC_VER) || defined(__BORLANDC__)
472 # define CRYPTOPP_MS_STYLE_INLINE_ASSEMBLY 1
473 #else
474 # define CRYPTOPP_GNU_STYLE_INLINE_ASSEMBLY 1
475 #endif
476 
477 // ***************** IA32 CPU features ********************
478 
479 #if (CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X32 || CRYPTOPP_BOOL_X64)
480 
481 // Apple Clang prior to 5.0 cannot handle SSE2
482 #if defined(CRYPTOPP_APPLE_CLANG_VERSION) && (CRYPTOPP_APPLE_CLANG_VERSION < 50000)
483 # define CRYPTOPP_DISABLE_ASM 1
484 #endif
485 
486 // Sun Studio 12.1 provides GCC inline assembly
487 // http://blogs.oracle.com/x86be/entry/gcc_style_asm_inlining_support
488 #if !defined(CRYPTOPP_DISABLE_ASM) && defined(__SUNPRO_CC) && (__SUNPRO_CC < 0x5100)
489 # define CRYPTOPP_DISABLE_ASM 1
490 #endif
491 
492 #if !defined(CRYPTOPP_DISABLE_ASM) && ((defined(_MSC_VER) && defined(_M_IX86)) || (defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))))
493  // C++Builder 2010 does not allow "call label" where label is defined within inline assembly
494  #define CRYPTOPP_X86_ASM_AVAILABLE 1
495 
496  #if !defined(CRYPTOPP_DISABLE_SSE2) && (defined(_MSC_VER) || CRYPTOPP_GCC_VERSION >= 30300 || defined(__SSE2__))
497  #define CRYPTOPP_SSE2_ASM_AVAILABLE 1
498  #endif
499 
500  #if !defined(CRYPTOPP_DISABLE_SSSE3) && (_MSC_VER >= 1500 || CRYPTOPP_GCC_VERSION >= 40300 || defined(__SSSE3__))
501  #define CRYPTOPP_SSSE3_ASM_AVAILABLE 1
502  #endif
503 #endif
504 
505 #if !defined(CRYPTOPP_DISABLE_ASM) && defined(_MSC_VER) && defined(_M_X64)
506  #define CRYPTOPP_X64_MASM_AVAILABLE 1
507 #endif
508 
509 #if !defined(CRYPTOPP_DISABLE_ASM) && defined(__GNUC__) && defined(__x86_64__)
510  #define CRYPTOPP_X64_ASM_AVAILABLE 1
511 #endif
512 
513 // 32-bit SunCC does not enable SSE2 by default.
514 #if !defined(CRYPTOPP_DISABLE_ASM) && (defined(_MSC_VER) || CRYPTOPP_GCC_VERSION >= 30300 || defined(__SSE2__) || (__SUNPRO_CC >= 0x5100))
515  #define CRYPTOPP_SSE2_INTRIN_AVAILABLE 1
516 #endif
517 
518 #if !defined(CRYPTOPP_DISABLE_ASM) && !defined(CRYPTOPP_DISABLE_SSSE3)
519 # if defined(__SSSE3__) || (_MSC_VER >= 1500) || \
520  (CRYPTOPP_GCC_VERSION >= 40300) || (__INTEL_COMPILER >= 1000) || (__SUNPRO_CC >= 0x5110) || \
521  (CRYPTOPP_LLVM_CLANG_VERSION >= 20300) || (CRYPTOPP_APPLE_CLANG_VERSION >= 40000)
522  #define CRYPTOPP_SSSE3_AVAILABLE 1
523 # endif
524 #endif
525 
526 // Intrinsics availible in GCC 4.3 (http://gcc.gnu.org/gcc-4.3/changes.html) and
527 // MSVC 2008 (http://msdn.microsoft.com/en-us/library/bb892950%28v=vs.90%29.aspx)
528 // SunCC could generate SSE4 at 12.1, but the intrinsics are missing until 12.4.
529 #if !defined(CRYPTOPP_DISABLE_SSE4) && defined(CRYPTOPP_SSSE3_AVAILABLE) && \
530  (defined(__SSE4_1__) || (CRYPTOPP_MSC_VERSION >= 1500) || \
531  (CRYPTOPP_GCC_VERSION >= 40300) || (__INTEL_COMPILER >= 1000) || (__SUNPRO_CC >= 0x5110) || \
532  (CRYPTOPP_LLVM_CLANG_VERSION >= 20300) || (CRYPTOPP_APPLE_CLANG_VERSION >= 40000))
533  #define CRYPTOPP_SSE41_AVAILABLE 1
534 #endif
535 
536 #if !defined(CRYPTOPP_DISABLE_SSE4) && defined(CRYPTOPP_SSSE3_AVAILABLE) && \
537  (defined(__SSE4_2__) || (CRYPTOPP_MSC_VERSION >= 1500) || (__SUNPRO_CC >= 0x5110) || \
538  (CRYPTOPP_GCC_VERSION >= 40300) || (__INTEL_COMPILER >= 1000) || \
539  (CRYPTOPP_LLVM_CLANG_VERSION >= 20300) || (CRYPTOPP_APPLE_CLANG_VERSION >= 40000))
540  #define CRYPTOPP_SSE42_AVAILABLE 1
541 #endif
542 
543 // Couple to CRYPTOPP_DISABLE_AESNI, but use CRYPTOPP_CLMUL_AVAILABLE so we can selectively
544 // disable for misbehaving platofrms and compilers, like Solaris or some Clang.
545 #if defined(CRYPTOPP_DISABLE_AESNI)
546  #define CRYPTOPP_DISABLE_CLMUL 1
547 #endif
548 
549 // Requires Sun Studio 12.3 (SunCC 0x5120) in theory.
550 #if !defined(CRYPTOPP_DISABLE_ASM) && !defined(CRYPTOPP_DISABLE_CLMUL) && defined(CRYPTOPP_SSE42_AVAILABLE) && \
551  (defined(__PCLMUL__) || (_MSC_FULL_VER >= 150030729) || (__SUNPRO_CC >= 0x5120) || \
552  (CRYPTOPP_GCC_VERSION >= 40300) || (__INTEL_COMPILER >= 1110) || \
553  (CRYPTOPP_LLVM_CLANG_VERSION >= 30200) || (CRYPTOPP_APPLE_CLANG_VERSION >= 40300))
554  #define CRYPTOPP_CLMUL_AVAILABLE 1
555 #endif
556 
557 // Requires Sun Studio 12.3 (SunCC 0x5120)
558 #if !defined(CRYPTOPP_DISABLE_ASM) && !defined(CRYPTOPP_DISABLE_AESNI) && defined(CRYPTOPP_SSE42_AVAILABLE) && \
559  (defined(__AES__) || (_MSC_FULL_VER >= 150030729) || (__SUNPRO_CC >= 0x5120) || \
560  (CRYPTOPP_GCC_VERSION >= 40300) || (__INTEL_COMPILER >= 1110) || \
561  (CRYPTOPP_LLVM_CLANG_VERSION >= 30200) || (CRYPTOPP_APPLE_CLANG_VERSION >= 40300))
562  #define CRYPTOPP_AESNI_AVAILABLE 1
563 #endif
564 
565 // Requires Binutils 2.24
566 #if !defined(CRYPTOPP_DISABLE_AVX) && defined(CRYPTOPP_SSE42_AVAILABLE) && \
567  (defined(__AVX2__) || (CRYPTOPP_MSC_VERSION >= 1800) || (__SUNPRO_CC >= 0x5130) || \
568  (CRYPTOPP_GCC_VERSION >= 40700) || (__INTEL_COMPILER >= 1400) || \
569  (CRYPTOPP_LLVM_CLANG_VERSION >= 30100) || (CRYPTOPP_APPLE_CLANG_VERSION >= 40600))
570 #define CRYPTOPP_AVX_AVAILABLE 1
571 #endif
572 
573 // Requires Binutils 2.24
574 #if !defined(CRYPTOPP_DISABLE_AVX2) && defined(CRYPTOPP_AVX_AVAILABLE) && \
575  (defined(__AVX2__) || (CRYPTOPP_MSC_VERSION >= 1800) || (__SUNPRO_CC >= 0x5130) || \
576  (CRYPTOPP_GCC_VERSION >= 40700) || (__INTEL_COMPILER >= 1400) || \
577  (CRYPTOPP_LLVM_CLANG_VERSION >= 30100) || (CRYPTOPP_APPLE_CLANG_VERSION >= 40600))
578 #define CRYPTOPP_AVX2_AVAILABLE 1
579 #endif
580 
581 // Guessing at SHA for SunCC. Its not in Sun Studio 12.6. Also see
582 // http://stackoverflow.com/questions/45872180/which-xarch-for-sha-extensions-on-solaris
583 #if !defined(CRYPTOPP_DISABLE_ASM) && !defined(CRYPTOPP_DISABLE_SHANI) && defined(CRYPTOPP_SSE42_AVAILABLE) && \
584  (defined(__SHA__) || (CRYPTOPP_MSC_VERSION >= 1900) || (__SUNPRO_CC >= 0x5160) || \
585  (CRYPTOPP_GCC_VERSION >= 40900) || (__INTEL_COMPILER >= 1300) || \
586  (CRYPTOPP_LLVM_CLANG_VERSION >= 30400) || (CRYPTOPP_APPLE_CLANG_VERSION >= 50100))
587  #define CRYPTOPP_SHANI_AVAILABLE 1
588 #endif
589 
590 // Fixup Android and SSE, Crypto. It may be enabled based on compiler version.
591 #if (defined(__ANDROID__) || defined(ANDROID))
592 # if (CRYPTOPP_BOOL_X86)
593 # undef CRYPTOPP_SSE41_AVAILABLE
594 # undef CRYPTOPP_SSE42_AVAILABLE
595 # undef CRYPTOPP_CLMUL_AVAILABLE
596 # undef CRYPTOPP_AESNI_AVAILABLE
597 # undef CRYPTOPP_SHANI_AVAILABLE
598 # endif
599 # if (CRYPTOPP_BOOL_X64)
600 # undef CRYPTOPP_CLMUL_AVAILABLE
601 # undef CRYPTOPP_AESNI_AVAILABLE
602 # undef CRYPTOPP_SHANI_AVAILABLE
603 # endif
604 #endif
605 
606 // Fixup for SunCC 12.1-12.4. Bad code generation in AES_Encrypt and friends.
607 #if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x5130)
608 # undef CRYPTOPP_AESNI_AVAILABLE
609 #endif
610 
611 // Fixup for SunCC 12.1-12.6. Compiler crash on GCM_Reduce_CLMUL and friends.
612 // http://github.com/weidai11/cryptopp/issues/226
613 #if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x5150)
614 # undef CRYPTOPP_CLMUL_AVAILABLE
615 #endif
616 
617 #endif // X86, X32, X64
618 
619 // ***************** ARM CPU features ********************
620 
621 #if (CRYPTOPP_BOOL_ARM32 || CRYPTOPP_BOOL_ARMV8)
622 
623 // We don't have an ARM big endian test rig. Disable
624 // ARM-BE ASM and instrinsics until we can test it.
625 #if (CRYPTOPP_BIG_ENDIAN)
626 # define CRYPTOPP_DISABLE_ASM 1
627 #endif
628 
629 // Requires ARMv7 and ACLE 1.0. -march=armv7-a or above must be present
630 // Requires GCC 4.3, Clang 2.8 or Visual Studio 2012
631 // Do not use APPLE_CLANG_VERSION; use __ARM_FEATURE_XXX instead.
632 #if !defined(CRYPTOPP_ARM_NEON_AVAILABLE) && !defined(CRYPTOPP_DISABLE_ASM)
633 # if defined(__arm__) || defined(__ARM_NEON) || defined(__ARM_FEATURE_NEON) || defined(_M_ARM)
634 # if (CRYPTOPP_GCC_VERSION >= 40300) || (CRYPTOPP_CLANG_VERSION >= 20800) || \
635  (CRYPTOPP_MSC_VERSION >= 1700)
636 # define CRYPTOPP_ARM_NEON_AVAILABLE 1
637 # endif // Compilers
638 # endif // Platforms
639 #endif
640 
641 // ARMv8 and ASIMD. -march=armv8-a or above must be present
642 // Requires GCC 4.8, Clang 3.3 or Visual Studio 2017
643 // Do not use APPLE_CLANG_VERSION; use __ARM_FEATURE_XXX instead.
644 #if !defined(CRYPTOPP_ARM_ASIMD_AVAILABLE) && !defined(CRYPTOPP_DISABLE_ASM)
645 # if defined(__aarch32__) || defined(__aarch64__) || defined(_M_ARM64)
646 # if defined(__ARM_NEON) || defined(__ARM_FEATURE_NEON) || defined(__ARM_FEATURE_ASIMD) || \
647  (CRYPTOPP_GCC_VERSION >= 40800) || (CRYPTOPP_CLANG_VERSION >= 30300) || \
648  (CRYPTOPP_MSC_VERSION >= 1910)
649 # define CRYPTOPP_ARM_NEON_AVAILABLE 1
650 # define CRYPTOPP_ARM_ASIMD_AVAILABLE 1
651 # endif // Compilers
652 # endif // Platforms
653 #endif
654 
655 // ARMv8 and ASIMD. -march=armv8-a+crc or above must be present
656 // Requires GCC 4.8, Clang 3.3 or Visual Studio 2017
657 // Do not use APPLE_CLANG_VERSION; use __ARM_FEATURE_XXX instead.
658 #if !defined(CRYPTOPP_ARM_CRC32_AVAILABLE) && !defined(CRYPTOPP_DISABLE_ASM)
659 # if defined(__aarch32__) || defined(__aarch64__) || defined(_M_ARM64)
660 # if defined(__ARM_FEATURE_CRC32) || (CRYPTOPP_GCC_VERSION >= 40800) || \
661  (CRYPTOPP_CLANG_VERSION >= 30300) || (CRYPTOPP_MSC_VERSION >= 1910)
662 # define CRYPTOPP_ARM_CRC32_AVAILABLE 1
663 # endif // Compilers
664 # endif // Platforms
665 #endif
666 
667 // ARMv8 and ASIMD. -march=armv8-a+crypto or above must be present
668 // Requires GCC 4.8, Clang 3.3 or Visual Studio 2017
669 // Do not use APPLE_CLANG_VERSION; use __ARM_FEATURE_XXX instead.
670 #if !defined(CRYPTOPP_ARM_PMULL_AVAILABLE) && !defined(CRYPTOPP_DISABLE_ASM)
671 # if defined(__aarch32__) || defined(__aarch64__) || defined(_M_ARM64)
672 # if defined(__ARM_FEATURE_CRYPTO) || (CRYPTOPP_GCC_VERSION >= 40800) || \
673  (CRYPTOPP_CLANG_VERSION >= 30300) || (CRYPTOPP_MSC_VERSION >= 1910)
674 # define CRYPTOPP_ARM_PMULL_AVAILABLE 1
675 # endif // Compilers
676 # endif // Platforms
677 #endif
678 
679 // ARMv8 and AES. -march=armv8-a+crypto or above must be present
680 // Requires GCC 4.8, Clang 3.3 or Visual Studio 2017
681 // Do not use APPLE_CLANG_VERSION; use __ARM_FEATURE_XXX instead.
682 #if !defined(CRYPTOPP_ARM_AES_AVAILABLE) && !defined(CRYPTOPP_DISABLE_ASM)
683 # if defined(__aarch32__) || defined(__aarch64__) || defined(_M_ARM64)
684 # if defined(__ARM_FEATURE_CRYPTO) || (CRYPTOPP_GCC_VERSION >= 40800) || \
685  (CRYPTOPP_CLANG_VERSION >= 30300) || (CRYPTOPP_MSC_VERSION >= 1910)
686 # define CRYPTOPP_ARM_AES_AVAILABLE 1
687 # endif // Compilers
688 # endif // Platforms
689 #endif
690 
691 // ARMv8 and SHA-1, SHA-256. -march=armv8-a+crypto or above must be present
692 // Requires GCC 4.8, Clang 3.3 or Visual Studio 2017
693 // Do not use APPLE_CLANG_VERSION; use __ARM_FEATURE_XXX instead.
694 #if !defined(CRYPTOPP_ARM_SHA_AVAILABLE) && !defined(CRYPTOPP_DISABLE_ASM)
695 # if defined(__aarch32__) || defined(__aarch64__) || defined(_M_ARM64)
696 # if defined(__ARM_FEATURE_CRYPTO) || (CRYPTOPP_GCC_VERSION >= 40800) || \
697  (CRYPTOPP_CLANG_VERSION >= 30300) || (CRYPTOPP_MSC_VERSION >= 1910)
698 # define CRYPTOPP_ARM_SHA1_AVAILABLE 1
699 # define CRYPTOPP_ARM_SHA2_AVAILABLE 1
700 # endif // Compilers
701 # endif // Platforms
702 #endif
703 
704 // ARMv8 and SHA-512, SHA-3. -march=armv8.4-a+crypto or above must be present
705 // Requires GCC 8.0, Clang 6.0 or Visual Studio 2021???
706 // Do not use APPLE_CLANG_VERSION; use __ARM_FEATURE_XXX instead.
707 #if !defined(CRYPTOPP_ARM_SHA_AVAILABLE) && !defined(CRYPTOPP_DISABLE_ASM)
708 # if defined(__aarch32__) || defined(__aarch64__) || defined(_M_ARM64)
709 # if defined(__ARM_FEATURE_SHA3) || (CRYPTOPP_GCC_VERSION >= 80000) || \
710  (CRYPTOPP_MSC_VERSION >= 2100)
711 # define CRYPTOPP_ARM_SHA512_AVAILABLE 1
712 # define CRYPTOPP_ARM_SHA3_AVAILABLE 1
713 # endif // Compilers
714 # endif // Platforms
715 #endif
716 
717 // ARMv8 and SM3, SM4. -march=armv8.4-a+crypto or above must be present
718 // Requires GCC 8.0, Clang 6.0 or Visual Studio 2021???
719 // Do not use APPLE_CLANG_VERSION; use __ARM_FEATURE_XXX instead.
720 #if !defined(CRYPTOPP_ARM_SM3_AVAILABLE) && !defined(CRYPTOPP_DISABLE_ASM)
721 # if defined(__aarch32__) || defined(__aarch64__) || defined(_M_ARM64)
722 # if defined(__ARM_FEATURE_SM3) || (CRYPTOPP_GCC_VERSION >= 80000) || \
723  (CRYPTOPP_MSC_VERSION >= 2100)
724 # define CRYPTOPP_ARM_SM3_AVAILABLE 1
725 # define CRYPTOPP_ARM_SM4_AVAILABLE 1
726 # endif // Compilers
727 # endif // Platforms
728 #endif
729 
730 // Limit the <arm_acle.h> include.
731 #if !defined(CRYPTOPP_ARM_ACLE_AVAILABLE)
732 # if defined(__aarch32__) || defined(__aarch64__) || (__ARM_ARCH >= 8) || defined(__ARM_ACLE)
733 # if !defined(__ANDROID__) && !defined(ANDROID) && !defined(__APPLE__)
734 # define CRYPTOPP_ARM_ACLE_AVAILABLE 1
735 # endif
736 # endif
737 #endif
738 
739 // Fixup Apple Clang and PMULL. Apple defines __ARM_FEATURE_CRYPTO for Xcode 6
740 // but does not provide PMULL. TODO: determine when PMULL is available.
741 #if defined(CRYPTOPP_APPLE_CLANG_VERSION) && (CRYPTOPP_APPLE_CLANG_VERSION < 70000)
742 # undef CRYPTOPP_ARM_PMULL_AVAILABLE
743 #endif
744 
745 // Fixup Android and CRC32. It may be enabled based on compiler version.
746 #if (defined(__ANDROID__) || defined(ANDROID)) && !defined(__ARM_FEATURE_CRC32)
747 # undef CRYPTOPP_ARM_CRC32_AVAILABLE
748 #endif
749 
750 // Fixup Android and Crypto. It may be enabled based on compiler version.
751 #if (defined(__ANDROID__) || defined(ANDROID)) && !defined(__ARM_FEATURE_CRYPTO)
752 # undef CRYPTOPP_ARM_PMULL_AVAILABLE
753 # undef CRYPTOPP_ARM_AES_AVAILABLE
754 # undef CRYPTOPP_ARM_SHA1_AVAILABLE
755 # undef CRYPTOPP_ARM_SHA2_AVAILABLE
756 #endif
757 
758 // Cryptogams offers an ARM asm AES implementation. Crypto++ does
759 // not provide an asm implementation. The Cryptogams implementation
760 // is about 2x faster than C/C++. Define this to use the Cryptogams
761 // AES implementation on GNU Linux systems. When defined, Crypto++
762 // will use aes_armv4.S. LLVM miscompiles aes_armv4.S so disable
763 // under Clang. See https://bugs.llvm.org/show_bug.cgi?id=38133.
764 #if !defined(CRYPTOPP_DISABLE_ASM) && defined(__arm__)
765 # if defined(__GNUC__) && !defined(__clang__)
766 # define CRYPTOGAMS_ARM_AES 1
767 # endif
768 #endif
769 
770 #endif // ARM32, ARM64
771 
772 // ***************** AltiVec and Power8 ********************
773 
774 #if (CRYPTOPP_BOOL_PPC32 || CRYPTOPP_BOOL_PPC64)
775 
776 #if defined(CRYPTOPP_DISABLE_ALTIVEC) || defined(CRYPTOPP_DISABLE_ASM)
777 # undef CRYPTOPP_DISABLE_ALTIVEC
778 # undef CRYPTOPP_DISABLE_POWER7
779 # undef CRYPTOPP_DISABLE_POWER8
780 # undef CRYPTOPP_DISABLE_POWER9
781 # define CRYPTOPP_DISABLE_ALTIVEC 1
782 # define CRYPTOPP_DISABLE_POWER7 1
783 # define CRYPTOPP_DISABLE_POWER8 1
784 # define CRYPTOPP_DISABLE_POWER9 1
785 #endif
786 
787 // An old Apple G5 with GCC 4.01 has AltiVec, but its only Power4 or so.
788 #if !defined(CRYPTOPP_ALTIVEC_AVAILABLE) && !defined(CRYPTOPP_DISABLE_ALTIVEC)
789 # if defined(_ARCH_PWR4) || defined(__ALTIVEC__) || \
790  (CRYPTOPP_XLC_VERSION >= 100000) || (CRYPTOPP_GCC_VERSION >= 40001) || \
791  (CRYPTOPP_CLANG_VERSION >= 20900)
792 # define CRYPTOPP_ALTIVEC_AVAILABLE 1
793 # endif
794 #endif
795 
796 // We need Power7 for unaligned loads and stores
797 #if !defined(CRYPTOPP_POWER7_AVAILABLE) && !defined(CRYPTOPP_DISABLE_POWER7) && defined(CRYPTOPP_ALTIVEC_AVAILABLE)
798 # if defined(_ARCH_PWR7) || (CRYPTOPP_XLC_VERSION >= 100000) || \
799  (CRYPTOPP_GCC_VERSION >= 40100) || (CRYPTOPP_CLANG_VERSION >= 30100)
800 # define CRYPTOPP_POWER7_AVAILABLE 1
801 # endif
802 #endif
803 
804 // We need Power8 for in-core crypto and 64-bit vector types
805 #if !defined(CRYPTOPP_POWER8_AVAILABLE) && !defined(CRYPTOPP_DISABLE_POWER8) && defined(CRYPTOPP_POWER7_AVAILABLE)
806 # if defined(_ARCH_PWR8) || (CRYPTOPP_XLC_VERSION >= 130000) || \
807  (CRYPTOPP_GCC_VERSION >= 40800) || (CRYPTOPP_CLANG_VERSION >= 70000)
808 # define CRYPTOPP_POWER8_AVAILABLE 1
809 # endif
810 #endif
811 
812 // Power9 for random numbers
813 #if !defined(CRYPTOPP_POWER9_AVAILABLE) && !defined(CRYPTOPP_DISABLE_POWER9) && defined(CRYPTOPP_POWER8_AVAILABLE)
814 # if defined(_ARCH_PWR9) || (CRYPTOPP_XLC_VERSION >= 130200) || \
815  (CRYPTOPP_GCC_VERSION >= 70000) || (CRYPTOPP_CLANG_VERSION >= 80000)
816 # define CRYPTOPP_POWER9_AVAILABLE 1
817 # endif
818 #endif
819 
820 #if !defined(CRYPTOPP_POWER8_AES_AVAILABLE) && !defined(CRYPTOPP_DISABLE_POWER8_AES) && defined(CRYPTOPP_POWER8_AVAILABLE)
821 # if defined(__CRYPTO__) || defined(_ARCH_PWR8) || (CRYPTOPP_XLC_VERSION >= 130000) || \
822  (CRYPTOPP_GCC_VERSION >= 40800) || (CRYPTOPP_CLANG_VERSION >= 70000)
823 //# define CRYPTOPP_POWER8_CRC_AVAILABLE 1
824 # define CRYPTOPP_POWER8_AES_AVAILABLE 1
825 # define CRYPTOPP_POWER8_VMULL_AVAILABLE 1
826 # define CRYPTOPP_POWER8_SHA_AVAILABLE 1
827 # endif
828 #endif
829 
830 #endif // PPC32, PPC64
831 
832 // ***************** Miscellaneous ********************
833 
834 // Nearly all Intel's and AMD's have SSE. Enable it independent of SSE ASM and intrinscs
835 #if (CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X32 || CRYPTOPP_BOOL_X64 || CRYPTOPP_BOOL_PPC32 || CRYPTOPP_BOOL_PPC64) && !defined(CRYPTOPP_DISABLE_ASM)
836  #define CRYPTOPP_BOOL_ALIGN16 1
837 #else
838  #define CRYPTOPP_BOOL_ALIGN16 0
839 #endif
840 
841 // How to allocate 16-byte aligned memory (for SSE2)
842 // posix_memalign see https://forum.kde.org/viewtopic.php?p=66274
843 #if defined(_MSC_VER)
844  #define CRYPTOPP_MM_MALLOC_AVAILABLE
845 #elif defined(__linux__) || defined(__sun__) || defined(__CYGWIN__)
846  #define CRYPTOPP_MEMALIGN_AVAILABLE
847 #elif defined(__APPLE__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
848  #define CRYPTOPP_MALLOC_ALIGNMENT_IS_16
849 #elif (defined(_GNU_SOURCE) || ((_XOPEN_SOURCE + 0) >= 600)) && (_POSIX_ADVISORY_INFO > 0)
850  #define CRYPTOPP_POSIX_MEMALIGN_AVAILABLE
851 #else
852  #define CRYPTOPP_NO_ALIGNED_ALLOC
853 #endif
854 
855 // how to disable inlining
856 #if defined(_MSC_VER)
857 # define CRYPTOPP_NOINLINE_DOTDOTDOT
858 # define CRYPTOPP_NOINLINE __declspec(noinline)
859 #elif defined(__xlc__) || defined(__xlC__) || defined(__ibmxl__)
860 # define CRYPTOPP_NOINLINE_DOTDOTDOT ...
861 # define CRYPTOPP_NOINLINE __attribute__((noinline))
862 #elif defined(__GNUC__)
863 # define CRYPTOPP_NOINLINE_DOTDOTDOT
864 # define CRYPTOPP_NOINLINE __attribute__((noinline))
865 #else
866 # define CRYPTOPP_NOINLINE_DOTDOTDOT ...
867 # define CRYPTOPP_NOINLINE
868 #endif
869 
870 // How to declare class constants
871 #if defined(CRYPTOPP_DOXYGEN_PROCESSING) || defined(__BORLANDC__)
872 # define CRYPTOPP_CONSTANT(x) static const int x;
873 #else
874 # define CRYPTOPP_CONSTANT(x) enum {x};
875 #endif
876 
877 // How to disable CPU feature probing. We determine machine
878 // capabilities by performing an os/platform *query* first,
879 // like getauxv(). If the *query* fails, we move onto a
880 // cpu *probe*. The cpu *probe* tries to exeute an instruction
881 // and then catches a SIGILL on Linux or the exception
882 // EXCEPTION_ILLEGAL_INSTRUCTION on Windows. Some OSes
883 // fail to hangle a SIGILL gracefully, like Apple OSes. Apple
884 // machines corrupt memory and variables around the probe.
885 #if defined(__APPLE__)
886 # define CRYPTOPP_NO_CPU_FEATURE_PROBES 1
887 #endif
888 
889 // ***************** Initialization and Constructor priorities ********************
890 
891 // CRYPTOPP_INIT_PRIORITY attempts to manage initialization of C++ static objects.
892 // Under GCC, the library uses init_priority attribute in the range
893 // [CRYPTOPP_INIT_PRIORITY, CRYPTOPP_INIT_PRIORITY+100]. Under Windows,
894 // CRYPTOPP_INIT_PRIORITY enlists "#pragma init_seg(lib)". The platforms
895 // with gaps are Apple and Sun because they require linker scripts. Apple and
896 // Sun will use the library's Singletons to initialize and acquire resources.
897 // Also see http://cryptopp.com/wiki/Static_Initialization_Order_Fiasco
898 #ifndef CRYPTOPP_INIT_PRIORITY
899 # define CRYPTOPP_INIT_PRIORITY 250
900 #endif
901 
902 // CRYPTOPP_USER_PRIORITY is for other libraries and user code that is using Crypto++
903 // and managing C++ static object creation. It is guaranteed not to conflict with
904 // values used by (or would be used by) the Crypto++ library.
905 #ifndef CRYPTOPP_USER_PRIORITY
906 # define CRYPTOPP_USER_PRIORITY (CRYPTOPP_INIT_PRIORITY+101)
907 #endif
908 
909 // Most platforms allow us to specify when to create C++ objects. Apple and Sun do not.
910 #if (CRYPTOPP_INIT_PRIORITY > 0) && !(defined(NO_OS_DEPENDENCE) || defined(__APPLE__) || defined(__sun__))
911 # if (CRYPTOPP_GCC_VERSION >= 30000) || (CRYPTOPP_LLVM_CLANG_VERSION >= 20900) || (_INTEL_COMPILER >= 800)
912 # define HAVE_GCC_INIT_PRIORITY 1
913 # elif (CRYPTOPP_MSC_VERSION >= 1310)
914 # define HAVE_MSC_INIT_PRIORITY 1
915 # elif defined(__xlc__) || defined(__xlC__) || defined(__ibmxl__)
916 # define HAVE_XLC_INIT_PRIORITY 1
917 # endif
918 #endif // CRYPTOPP_INIT_PRIORITY, NO_OS_DEPENDENCE, Apple, Sun
919 
920 // ***************** determine availability of OS features ********************
921 
922 #ifndef NO_OS_DEPENDENCE
923 
924 #if defined(_WIN32) || defined(__CYGWIN__)
925 #define CRYPTOPP_WIN32_AVAILABLE
926 #endif
927 
928 #if defined(__unix__) || defined(__MACH__) || defined(__NetBSD__) || defined(__sun)
929 #define CRYPTOPP_UNIX_AVAILABLE
930 #endif
931 
932 #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
933 #define CRYPTOPP_BSD_AVAILABLE
934 #endif
935 
936 #if defined(CRYPTOPP_WIN32_AVAILABLE) || defined(CRYPTOPP_UNIX_AVAILABLE)
937 # define HIGHRES_TIMER_AVAILABLE
938 #endif
939 
940 #ifdef CRYPTOPP_WIN32_AVAILABLE
941 # if !defined(WINAPI_FAMILY)
942 # define THREAD_TIMER_AVAILABLE
943 # elif defined(WINAPI_FAMILY)
944 # if (WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP))
945 # define THREAD_TIMER_AVAILABLE
946 # endif
947 # endif
948 #endif
949 
950 #if defined(CRYPTOPP_UNIX_AVAILABLE) || defined(CRYPTOPP_DOXYGEN_PROCESSING)
951 # define NONBLOCKING_RNG_AVAILABLE
952 # define BLOCKING_RNG_AVAILABLE
953 # define OS_RNG_AVAILABLE
954 #endif
955 
956 // Cygwin/Newlib requires _XOPEN_SOURCE=600
957 #if defined(CRYPTOPP_UNIX_AVAILABLE)
958 # define UNIX_SIGNALS_AVAILABLE 1
959 #endif
960 
961 #ifdef CRYPTOPP_WIN32_AVAILABLE
962 # if !defined(WINAPI_FAMILY)
963 # define NONBLOCKING_RNG_AVAILABLE
964 # define OS_RNG_AVAILABLE
965 # elif defined(WINAPI_FAMILY)
966 # if (WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP))
967 # define NONBLOCKING_RNG_AVAILABLE
968 # define OS_RNG_AVAILABLE
969 # elif !(WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP))
970 # if ((WINVER >= 0x0A00 /*_WIN32_WINNT_WIN10*/) || (_WIN32_WINNT >= 0x0A00 /*_WIN32_WINNT_WIN10*/))
971 # define NONBLOCKING_RNG_AVAILABLE
972 # define OS_RNG_AVAILABLE
973 # endif
974 # endif
975 # endif
976 #endif
977 
978 #endif // NO_OS_DEPENDENCE
979 
980 // ***************** DLL related ********************
981 
982 #if defined(CRYPTOPP_WIN32_AVAILABLE) && !defined(CRYPTOPP_DOXYGEN_PROCESSING)
983 
984 #ifdef CRYPTOPP_EXPORTS
985 #define CRYPTOPP_IS_DLL
986 #define CRYPTOPP_DLL __declspec(dllexport)
987 #elif defined(CRYPTOPP_IMPORTS)
988 #define CRYPTOPP_IS_DLL
989 #define CRYPTOPP_DLL __declspec(dllimport)
990 #else
991 #define CRYPTOPP_DLL
992 #endif
993 
994 // C++ makes const internal linkage
995 #define CRYPTOPP_TABLE extern
996 #define CRYPTOPP_API __cdecl
997 
998 #else // not CRYPTOPP_WIN32_AVAILABLE
999 
1000 // C++ makes const internal linkage
1001 #define CRYPTOPP_TABLE extern
1002 #define CRYPTOPP_DLL
1003 #define CRYPTOPP_API
1004 
1005 #endif // CRYPTOPP_WIN32_AVAILABLE
1006 
1007 #if defined(__MWERKS__)
1008 #define CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS extern class CRYPTOPP_DLL
1009 #elif defined(__BORLANDC__) || defined(__SUNPRO_CC)
1010 #define CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS template class CRYPTOPP_DLL
1011 #else
1012 #define CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS extern template class CRYPTOPP_DLL
1013 #endif
1014 
1015 #if defined(CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES) && !defined(CRYPTOPP_IMPORTS)
1016 #define CRYPTOPP_DLL_TEMPLATE_CLASS template class CRYPTOPP_DLL
1017 #else
1018 #define CRYPTOPP_DLL_TEMPLATE_CLASS CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS
1019 #endif
1020 
1021 #if defined(__MWERKS__)
1022 #define CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS extern class
1023 #elif defined(__BORLANDC__) || defined(__SUNPRO_CC)
1024 #define CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS template class
1025 #else
1026 #define CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS extern template class
1027 #endif
1028 
1029 #if defined(CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES) && !defined(CRYPTOPP_EXPORTS)
1030 #define CRYPTOPP_STATIC_TEMPLATE_CLASS template class
1031 #else
1032 #define CRYPTOPP_STATIC_TEMPLATE_CLASS CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS
1033 #endif
1034 
1035 // ************** Unused variable ***************
1036 
1037 // Portable way to suppress warnings.
1038 // Moved from misc.h due to circular depenedencies.
1039 #define CRYPTOPP_UNUSED(x) ((void)(x))
1040 
1041 // ************** Deprecated ***************
1042 
1043 #if (CRYPTOPP_GCC_VERSION >= 40500) || (CRYPTOPP_LLVM_CLANG_VERSION >= 20800) || (CRYPTOPP_APPLE_CLANG_VERSION >= 40200)
1044 # define CRYPTOPP_DEPRECATED(msg) __attribute__((deprecated (msg)))
1045 #elif (CRYPTOPP_GCC_VERSION)
1046 # define CRYPTOPP_DEPRECATED(msg) __attribute__((deprecated))
1047 #else
1048 # define CRYPTOPP_DEPRECATED(msg)
1049 #endif
1050 
1051 // ***************** C++11 related ********************
1052 
1053 // Visual Studio began at VS2010, http://msdn.microsoft.com/en-us/library/hh567368%28v=vs.110%29.aspx
1054 // and https://docs.microsoft.com/en-us/cpp/visual-cpp-language-conformance .
1055 // Intel, http://software.intel.com/en-us/articles/c0x-features-supported-by-intel-c-compiler
1056 // GCC, http://gcc.gnu.org/projects/cxx0x.html
1057 // Clang, http://clang.llvm.org/cxx_status.html
1058 
1059 // Compatibility with non-clang compilers.
1060 #ifndef __has_feature
1061 # define __has_feature(x) 0
1062 #endif
1063 
1064 #if !defined(CRYPTOPP_NO_CXX11)
1065 # if ((_MSC_VER >= 1600) || (__cplusplus >= 201103L)) && !defined(_STLPORT_VERSION)
1066 # define CRYPTOPP_CXX11 1
1067 # endif
1068 #endif
1069 
1070 // Hack ahead. Apple's standard library does not have C++'s unique_ptr in C++11. We can't
1071 // test for unique_ptr directly because some of the non-Apple Clangs on OS X fail the same
1072 // way. However, modern standard libraries have <forward_list>, so we test for it instead.
1073 // Thanks to Jonathan Wakely for devising the clever test for modern/ancient versions.
1074 // TODO: test under Xcode 3, where g++ is really g++.
1075 #if defined(__APPLE__) && defined(__clang__)
1076 # if !(defined(__has_include) && __has_include(<forward_list>))
1077 # undef CRYPTOPP_CXX11
1078 # endif
1079 #endif
1080 
1081 // C++11 or C++14 is available
1082 #if defined(CRYPTOPP_CXX11)
1083 
1084 // atomics: MS at VS2012 (17.00); GCC at 4.4; Clang at 3.1/3.2; Intel 13.0; SunCC 5.14.
1085 #if (CRYPTOPP_MSC_VERSION >= 1700) || __has_feature(cxx_atomic) || \
1086  (__INTEL_COMPILER >= 1300) || (CRYPTOPP_GCC_VERSION >= 40400) || (__SUNPRO_CC >= 0x5140)
1087 # define CRYPTOPP_CXX11_ATOMICS 1
1088 #endif // atomics
1089 
1090 // synchronization: MS at VS2012 (17.00); GCC at 4.4; Clang at 3.3; Xcode 5.0; Intel 12.0; SunCC 5.13.
1091 // TODO: verify Clang and Intel versions; find __has_feature(x) extension for Clang
1092 #if (CRYPTOPP_MSC_VERSION >= 1700) || (CRYPTOPP_LLVM_CLANG_VERSION >= 30300) || \
1093  (CRYPTOPP_APPLE_CLANG_VERSION >= 50000) || (__INTEL_COMPILER >= 1200) || \
1094  (CRYPTOPP_GCC_VERSION >= 40400) || (__SUNPRO_CC >= 0x5130)
1095 // Hack ahead. New GCC compilers like GCC 6 on AIX 7.0 or earlier as well as original MinGW
1096 // don't have the synchronization gear. However, Wakely's test used for Apple does not work
1097 // on the GCC/AIX combination. Another twist is we need other stuff from C++11,
1098 // like no-except destructors. Dumping preprocessors shows the following may
1099 // apply: http://stackoverflow.com/q/14191566/608639.
1100 # include <cstddef>
1101 # if !defined(__GLIBCXX__) || defined(_GLIBCXX_HAS_GTHREADS)
1102 # define CRYPTOPP_CXX11_SYNCHRONIZATION 1
1103 # endif
1104 #endif // synchronization
1105 
1106 // Dynamic Initialization and Destruction with Concurrency ("Magic Statics")
1107 // MS at VS2015 with Vista (19.00); GCC at 4.3; LLVM Clang at 2.9; Apple Clang at 4.0; Intel 11.1; SunCC 5.13.
1108 // Microsoft's implementation only works for Vista and above, so its further
1109 // limited. http://connect.microsoft.com/VisualStudio/feedback/details/1789709
1110 #if (CRYPTOPP_MSC_VERSION >= 1900) && ((WINVER >= 0x0600) || (_WIN32_WINNT >= 0x0600)) || \
1111  (CRYPTOPP_LLVM_CLANG_VERSION >= 20900) || (CRYPTOPP_APPLE_CLANG_VERSION >= 40000) || \
1112  (__INTEL_COMPILER >= 1110) || (CRYPTOPP_GCC_VERSION >= 40300) || (__SUNPRO_CC >= 0x5130)
1113 # define CRYPTOPP_CXX11_DYNAMIC_INIT 1
1114 #endif // Dynamic Initialization compilers
1115 
1116 // alignof/alignas: MS at VS2015 (19.00); GCC at 4.8; Clang at 3.0; Intel 15.0; SunCC 5.13.
1117 #if (CRYPTOPP_MSC_VERSION >= 1900) || __has_feature(cxx_alignas) || \
1118  (__INTEL_COMPILER >= 1500) || (CRYPTOPP_GCC_VERSION >= 40800) || (__SUNPRO_CC >= 0x5130)
1119 # define CRYPTOPP_CXX11_ALIGNAS 1
1120 #endif // alignas
1121 
1122 // alignof: MS at VS2015 (19.00); GCC at 4.5; Clang at 2.9; Intel 15.0; SunCC 5.13.
1123 #if (CRYPTOPP_MSC_VERSION >= 1900) || __has_feature(cxx_alignof) || \
1124  (__INTEL_COMPILER >= 1500) || (CRYPTOPP_GCC_VERSION >= 40500) || (__SUNPRO_CC >= 0x5130)
1125 # define CRYPTOPP_CXX11_ALIGNOF 1
1126 #endif // alignof
1127 
1128 // lambdas: MS at VS2012 (17.00); GCC at 4.9; Clang at 3.3; Intel 12.0; SunCC 5.14.
1129 #if (CRYPTOPP_MSC_VERSION >= 1700) || __has_feature(cxx_lambdas) || \
1130  (__INTEL_COMPILER >= 1200) || (CRYPTOPP_GCC_VERSION >= 40900) || (__SUNPRO_CC >= 0x5140)
1131 # define CRYPTOPP_CXX11_LAMBDA 1
1132 #endif // lambdas
1133 
1134 // noexcept: MS at VS2015 (19.00); GCC at 4.6; Clang at 3.0; Intel 14.0; SunCC 5.13.
1135 #if (CRYPTOPP_MSC_VERSION >= 1900) || __has_feature(cxx_noexcept) || \
1136  (__INTEL_COMPILER >= 1400) || (CRYPTOPP_GCC_VERSION >= 40600) || (__SUNPRO_CC >= 0x5130)
1137 # define CRYPTOPP_CXX11_NOEXCEPT 1
1138 #endif // noexcept compilers
1139 
1140 // variadic templates: MS at VS2013 (18.00); GCC at 4.3; Clang at 2.9; Intel 12.1; SunCC 5.13.
1141 #if (CRYPTOPP_MSC_VERSION >= 1800) || __has_feature(cxx_variadic_templates) || \
1142  (__INTEL_COMPILER >= 1210) || (CRYPTOPP_GCC_VERSION >= 40300) || (__SUNPRO_CC >= 0x5130)
1143 # define CRYPTOPP_CXX11_VARIADIC_TEMPLATES 1
1144 #endif // variadic templates
1145 
1146 // constexpr: MS at VS2015 (19.00); GCC at 4.6; Clang at 3.1; Intel 16.0; SunCC 5.13.
1147 // Intel has mis-supported the feature since at least ICPC 13.00
1148 #if (CRYPTOPP_MSC_VERSION >= 1900) || __has_feature(cxx_constexpr) || \
1149  (__INTEL_COMPILER >= 1600) || (CRYPTOPP_GCC_VERSION >= 40600) || (__SUNPRO_CC >= 0x5130)
1150 # define CRYPTOPP_CXX11_CONSTEXPR 1
1151 #endif // constexpr compilers
1152 
1153 // strong typed enums: MS at VS2012 (17.00); GCC at 4.4; Clang at 3.3; Intel 14.0; SunCC 5.12.
1154 // Mircorosft and Intel had partial support earlier, but we require full support.
1155 #if (CRYPTOPP_MSC_VERSION >= 1700) || __has_feature(cxx_strong_enums) || \
1156  (__INTEL_COMPILER >= 1400) || (CRYPTOPP_GCC_VERSION >= 40400) || (__SUNPRO_CC >= 0x5120)
1157 # define CRYPTOPP_CXX11_ENUM 1
1158 #endif // constexpr compilers
1159 
1160 // nullptr_t: MS at VS2010 (16.00); GCC at 4.6; Clang at 3.3; Intel 10.0; SunCC 5.13.
1161 #if (CRYPTOPP_MSC_VERSION >= 1600) || __has_feature(cxx_nullptr) || \
1162  (__INTEL_COMPILER >= 1000) || (CRYPTOPP_GCC_VERSION >= 40600) || \
1163  (__SUNPRO_CC >= 0x5130) || defined(__IBMCPP_NULLPTR)
1164 # define CRYPTOPP_CXX11_NULLPTR 1
1165 #endif // nullptr_t compilers
1166 
1167 #endif // CRYPTOPP_CXX11
1168 
1169 // ***************** C++17 related ********************
1170 
1171 // C++17 macro version, https://stackoverflow.com/q/38456127/608639
1172 #if defined(CRYPTOPP_CXX11) && !defined(CRYPTOPP_NO_CXX17)
1173 # if ((_MSC_VER >= 1900) || (__cplusplus >= 201703L)) && !defined(_STLPORT_VERSION)
1174 # define CRYPTOPP_CXX17 1
1175 # endif
1176 #endif
1177 
1178 // C++17 is available
1179 #if defined(CRYPTOPP_CXX17)
1180 
1181 // C++17 uncaught_exceptions: MS at VS2015 (19.00); GCC at 6.0; Clang at 3.5; Intel 18.0.
1182 // Clang and __EXCEPTIONS see http://releases.llvm.org/3.6.0/tools/clang/docs/ReleaseNotes.html
1183 #if defined(__clang__)
1184 # if __EXCEPTIONS && __has_feature(cxx_exceptions)
1185 # if __cpp_lib_uncaught_exceptions
1186 # define CRYPTOPP_CXX17_EXCEPTIONS 1
1187 # endif
1188 # endif
1189 #elif (CRYPTOPP_MSC_VERSION >= 1900) || (__INTEL_COMPILER >= 1800) || (CRYPTOPP_GCC_VERSION >= 60000) || (__cpp_lib_uncaught_exceptions)
1190 # define CRYPTOPP_CXX17_EXCEPTIONS 1
1191 #endif // uncaught_exceptions compilers
1192 
1193 #endif // CRYPTOPP_CXX17
1194 
1195 // ***************** C++ fixups ********************
1196 
1197 #if defined(CRYPTOPP_CXX11_NOEXCEPT)
1198 # define CRYPTOPP_THROW noexcept(false)
1199 # define CRYPTOPP_NO_THROW noexcept(true)
1200 #else
1201 # define CRYPTOPP_THROW
1202 # define CRYPTOPP_NO_THROW
1203 #endif // CRYPTOPP_CXX11_NOEXCEPT
1204 
1205 // http://stackoverflow.com/a/13867690/608639
1206 #if defined(CRYPTOPP_CXX11_CONSTEXPR)
1207 # define CRYPTOPP_STATIC_CONSTEXPR static constexpr
1208 # define CRYPTOPP_CONSTEXPR constexpr
1209 #else
1210 # define CRYPTOPP_STATIC_CONSTEXPR static
1211 # define CRYPTOPP_CONSTEXPR
1212 #endif // CRYPTOPP_CXX11_CONSTEXPR
1213 
1214 // Hack... CRYPTOPP_ALIGN_DATA is defined earlier, before C++11 alignas availability is determined
1215 #if defined(CRYPTOPP_CXX11_ALIGNAS)
1216 # undef CRYPTOPP_ALIGN_DATA
1217 # define CRYPTOPP_ALIGN_DATA(x) alignas(x)
1218 #endif // CRYPTOPP_CXX11_ALIGNAS
1219 
1220 // Hack... CRYPTOPP_CONSTANT is defined earlier, before C++11 constexpr availability is determined
1221 // http://stackoverflow.com/q/35213098/608639
1222 // #if defined(CRYPTOPP_CXX11_CONSTEXPR)
1223 // # undef CRYPTOPP_CONSTANT
1224 // # define CRYPTOPP_CONSTANT(x) constexpr static int x;
1225 // #endif
1226 
1227 // Hack... CRYPTOPP_CONSTANT is defined earlier, before C++11 constexpr availability is determined
1228 // http://stackoverflow.com/q/35213098/608639
1229 #if defined(CRYPTOPP_CXX11_ENUM)
1230 # undef CRYPTOPP_CONSTANT
1231 # define CRYPTOPP_CONSTANT(x) enum : int { x };
1232 #elif defined(CRYPTOPP_CXX11_CONSTEXPR)
1233 # undef CRYPTOPP_CONSTANT
1234 # define CRYPTOPP_CONSTANT(x) constexpr static int x;
1235 #endif
1236 
1237 // Hack... C++11 nullptr_t type safety and analysis
1238 #if defined(CRYPTOPP_CXX11_NULLPTR) && !defined(NULLPTR)
1239 # define NULLPTR nullptr
1240 #elif !defined(NULLPTR)
1241 # define NULLPTR NULL
1242 #endif // CRYPTOPP_CXX11_NULLPTR
1243 
1244 // OK to comment the following out, but please report it so we can fix it.
1245 // C++17 value taken from http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4567.pdf.
1246 #if (defined(__cplusplus) && (__cplusplus >= 199711L) && (__cplusplus < 201402L)) && !defined(CRYPTOPP_UNCAUGHT_EXCEPTION_AVAILABLE)
1247 # error "std::uncaught_exception is not available. This is likely a configuration error."
1248 #endif
1249 
1250 #endif // CRYPTOPP_CONFIG_H
Crypto++ library namespace.