Crypto++  5.6.5
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 #if !defined(IS_LITTLE_ENDIAN) && !defined(IS_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__)))
13 # define IS_BIG_ENDIAN
14 #endif
15 
16 // define this if running on a little-endian CPU
17 // big endian will be assumed if IS_LITTLE_ENDIAN is not defined
18 #if !defined(IS_BIG_ENDIAN) && !defined(IS_LITTLE_ENDIAN)
19 # define IS_LITTLE_ENDIAN
20 #endif
21 
22 // Sanity checks. Some processors have more than big-, little- and bi-endian modes. PDP mode, where order results in "4312", should
23 // raise red flags immediately. Additionally, mis-classified machines, like (previosuly) S/390, should raise red flags immediately.
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__"
26 #endif
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__"
29 #endif
30 
31 // Define this if you want to disable all OS-dependent features,
32 // such as sockets and OS-provided random number generators
33 // #define NO_OS_DEPENDENCE
34 
35 // Define this to use features provided by Microsoft's CryptoAPI.
36 // Currently the only feature used is Windows random number generation.
37 // This macro will be ignored if NO_OS_DEPENDENCE is defined.
38 // #define USE_MS_CRYPTOAPI
39 
40 // Define this to use features provided by Microsoft's CryptoNG API.
41 // CryptoNG API is available in Vista and above and its cross platform,
42 // including desktop apps and store apps. Currently the only feature
43 // used is Windows random number generation.
44 // This macro will be ignored if NO_OS_DEPENDENCE is defined.
45 // #define USE_MS_CNGAPI
46 
47 // If the user did not make a choice, then select CryptoNG if either
48 // Visual Studio 2015 is available, or Windows 10 or above is available.
49 #if !defined(USE_MS_CRYPTOAPI) && !defined(USE_MS_CNGAPI)
50 # if (_MSC_VER >= 1900) || ((WINVER >= 0x0A00 /*_WIN32_WINNT_WIN10*/) || (_WIN32_WINNT >= 0x0A00 /*_WIN32_WINNT_WIN10*/))
51 # define USE_MS_CNGAPI
52 # else
53 # define USE_MS_CRYPTOAPI
54 # endif
55 #endif
56 
57 // Define this to ensure C/C++ standard compliance and respect for GCC aliasing rules and other alignment fodder. If you
58 // experience a break with GCC at -O3, you should try this first. Guard it in case its set on the command line (and it differs).
59 #ifndef CRYPTOPP_NO_UNALIGNED_DATA_ACCESS
60 # define CRYPTOPP_NO_UNALIGNED_DATA_ACCESS
61 #endif
62 
63 // ***************** Less Important Settings ***************
64 
65 // Library version macro. Since this macro is in a header, it reflects
66 // the version of the library the headers came from. It is not
67 // necessarily the version of the library built as a shared object if
68 // versions are inadvertently mixed and matched.
69 #define CRYPTOPP_VERSION 565
70 
71 // Define this if you want to set a prefix for TestData/ and TestVectors/
72 // Be mindful of the trailing slash since its simple concatenation.
73 // g++ ... -DCRYPTOPP_DATA_DIR='"/tmp/cryptopp_test/share/"'
74 #ifndef CRYPTOPP_DATA_DIR
75 # define CRYPTOPP_DATA_DIR ""
76 #endif
77 
78 // Define this if you want or need the library's memcpy_s and memmove_s.
79 // See http://github.com/weidai11/cryptopp/issues/28.
80 // #if !defined(CRYPTOPP_WANT_SECURE_LIB)
81 // # define CRYPTOPP_WANT_SECURE_LIB
82 // #endif
83 
84 // File system code to write to GZIP archive.
85 #if !defined(GZIP_OS_CODE)
86 # define GZIP_OS_CODE 0
87 #endif
88 
89 // Try this if your CPU has 256K internal cache or a slow multiply instruction
90 // and you want a (possibly) faster IDEA implementation using log tables
91 // #define IDEA_LARGECACHE
92 
93 // Define this if, for the linear congruential RNG, you want to use
94 // the original constants as specified in S.K. Park and K.W. Miller's
95 // CACM paper.
96 // #define LCRNG_ORIGINAL_NUMBERS
97 
98 // Define this if you want Integer's operator<< to honor std::showbase (and
99 // std::noshowbase). If defined, Integer will use a suffix of 'b', 'o', 'h'
100 // or '.' (the last for decimal) when std::showbase is in effect. If
101 // std::noshowbase is set, then the suffix is not added to the Integer. If
102 // not defined, existing behavior is preserved and Integer will use a suffix
103 // of 'b', 'o', 'h' or '.' (the last for decimal).
104 // #define CRYPTOPP_USE_STD_SHOWBASE
105 
106 // Define this if you want to decouple AlgorithmParameters and Integer
107 // The decoupling should make it easier for the linker to remove Integer
108 // related code for those who do not need Integer, and avoid a potential
109 // race during AssignIntToInteger pointer initialization. Also
110 // see http://github.com/weidai11/cryptopp/issues/389.
111 // #define CRYPTOPP_NO_ASSIGN_TO_INTEGER
112 
113 // choose which style of sockets to wrap (mostly useful for MinGW which has both)
114 #if !defined(NO_BERKELEY_STYLE_SOCKETS) && !defined(PREFER_BERKELEY_STYLE_SOCKETS)
115 # define PREFER_BERKELEY_STYLE_SOCKETS
116 #endif
117 
118 // #if !defined(NO_WINDOWS_STYLE_SOCKETS) && !defined(PREFER_WINDOWS_STYLE_SOCKETS)
119 // # define PREFER_WINDOWS_STYLE_SOCKETS
120 // #endif
121 
122 // set the name of Rijndael cipher, was "Rijndael" before version 5.3
123 #define CRYPTOPP_RIJNDAEL_NAME "AES"
124 
125 // CRYPTOPP_DEBUG enables the library's CRYPTOPP_ASSERT. CRYPTOPP_ASSERT
126 // raises a SIGTRAP (Unix) or calls DebugBreak() (Windows). CRYPTOPP_ASSERT
127 // is only in effect when CRYPTOPP_DEBUG, DEBUG or _DEBUG is defined. Unlike
128 // Posix assert, CRYPTOPP_ASSERT is not affected by NDEBUG (or failure to
129 // define it).
130 // Also see http://github.com/weidai11/cryptopp/issues/277, CVE-2016-7420
131 #if (defined(DEBUG) || defined(_DEBUG)) && !defined(CRYPTOPP_DEBUG)
132 # define CRYPTOPP_DEBUG 1
133 #endif
134 
135 // ***************** Important Settings Again ********************
136 // But the defaults should be ok.
137 
138 // namespace support is now required
139 #ifdef NO_NAMESPACE
140 # error namespace support is now required
141 #endif
142 
143 // Define this to workaround a Microsoft CryptoAPI bug where
144 // each call to CryptAcquireContext causes a 100 KB memory leak.
145 // Defining this will cause Crypto++ to make only one call to CryptAcquireContext.
146 #define WORKAROUND_MS_BUG_Q258000
147 
148 #ifdef CRYPTOPP_DOXYGEN_PROCESSING
149 // Document the namespce exists. Put it here before CryptoPP is undefined below.
150 //! \namespace CryptoPP
151 //! \brief Crypto++ library namespace
152 //! \details Nearly all classes are located in the CryptoPP namespace. Within
153 //! the namespace, there are two additional namespaces.
154 //! <ul>
155 //! <li>Name - namespace for names used with \p NameValuePairs and documented in argnames.h
156 //! <li>Weak - namespace for weak and wounded algorithms, like ARC4, MD5 and Pananma
157 //! </ul>
158 namespace CryptoPP { }
159 // Bring in the symbols fund in the weak namespace; and fold Weak1 into Weak
160 # define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1
161 # define Weak1 Weak
162 // Avoid putting "CryptoPP::" in front of everything in Doxygen output
163 # define CryptoPP
164 # define NAMESPACE_BEGIN(x)
165 # define NAMESPACE_END
166 // Get Doxygen to generate better documentation for these typedefs
167 # define DOCUMENTED_TYPEDEF(x, y) class y : public x {};
168 // Make "protected" "private" so the functions and members are not documented
169 # define protected private
170 #else
171 # define NAMESPACE_BEGIN(x) namespace x {
172 # define NAMESPACE_END }
173 # define DOCUMENTED_TYPEDEF(x, y) typedef x y;
174 #endif
175 #define ANONYMOUS_NAMESPACE_BEGIN namespace {
176 #define ANONYMOUS_NAMESPACE_END }
177 #define USING_NAMESPACE(x) using namespace x;
178 #define DOCUMENTED_NAMESPACE_BEGIN(x) namespace x {
179 #define DOCUMENTED_NAMESPACE_END }
180 
181 // What is the type of the third parameter to bind?
182 // For Unix, the new standard is ::socklen_t (typically unsigned int), and the old standard is int.
183 // Unfortunately there is no way to tell whether or not socklen_t is defined.
184 // To work around this, TYPE_OF_SOCKLEN_T is a macro so that you can change it from the makefile.
185 #ifndef TYPE_OF_SOCKLEN_T
186 # if defined(_WIN32) || defined(__CYGWIN__)
187 # define TYPE_OF_SOCKLEN_T int
188 # else
189 # define TYPE_OF_SOCKLEN_T ::socklen_t
190 # endif
191 #endif
192 
193 #if defined(__CYGWIN__) && defined(PREFER_WINDOWS_STYLE_SOCKETS)
194 # define __USE_W32_SOCKETS
195 #endif
196 
197 typedef unsigned char byte; // put in global namespace to avoid ambiguity with other byte typedefs
198 
199 NAMESPACE_BEGIN(CryptoPP)
200 
201 typedef unsigned short word16;
202 typedef unsigned int word32;
203 
204 #if defined(_MSC_VER) || defined(__BORLANDC__)
205  typedef unsigned __int64 word64;
206  #define W64LIT(x) x##ui64
207 #elif (_LP64 || __LP64__)
208  typedef unsigned long word64;
209  #define W64LIT(x) x##UL
210 #else
211  typedef unsigned long long word64;
212  #define W64LIT(x) x##ULL
213 #endif
214 
215 // define large word type, used for file offsets and such
216 typedef word64 lword;
217 const lword LWORD_MAX = W64LIT(0xffffffffffffffff);
218 
219 // Clang pretends to be VC++, too.
220 // See http://github.com/weidai11/cryptopp/issues/147
221 #if defined(_MSC_VER) && defined(__clang__)
222 # error: "Unsupported configuration"
223 #endif
224 
225 #ifdef __GNUC__
226  #define CRYPTOPP_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
227 #endif
228 
229 // Apple and LLVM's Clang. Apple Clang version 7.0 roughly equals LLVM Clang version 3.7
230 #if defined(__clang__ ) && defined(__apple_build_version__)
231  #define CRYPTOPP_APPLE_CLANG_VERSION (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__)
232  #define CRYPTOPP_CLANG_INTEGRATED_ASSEMBLER 1
233 #elif defined(__clang__ )
234  #define CRYPTOPP_LLVM_CLANG_VERSION (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__)
235  #define CRYPTOPP_CLANG_INTEGRATED_ASSEMBLER 1
236 #endif
237 
238 #ifdef _MSC_VER
239  #define CRYPTOPP_MSC_VERSION (_MSC_VER)
240 #endif
241 
242 // Need GCC 4.6/Clang 1.7/Apple Clang 2.0 or above due to "GCC diagnostic {push|pop}"
243 #if (CRYPTOPP_GCC_VERSION >= 40600) || (CRYPTOPP_LLVM_CLANG_VERSION >= 10700) || (CRYPTOPP_APPLE_CLANG_VERSION >= 20000)
244  #define CRYPTOPP_GCC_DIAGNOSTIC_AVAILABLE 1
245 #endif
246 
247 // Clang due to "Inline assembly operands don't work with .intel_syntax", http://llvm.org/bugs/show_bug.cgi?id=24232
248 // TODO: supply the upper version when LLVM fixes it. We set it to 20.0 for compilation purposes.
249 #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)
250  #define CRYPTOPP_DISABLE_INTEL_ASM 1
251 #endif
252 
253 // define hword, word, and dword. these are used for multiprecision integer arithmetic
254 // Intel compiler won't have _umul128 until version 10.0. See http://softwarecommunity.intel.com/isn/Community/en-US/forums/thread/30231625.aspx
255 #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__))
256  typedef word32 hword;
257  typedef word64 word;
258 #else
259  #define CRYPTOPP_NATIVE_DWORD_AVAILABLE 1
260  #if defined(__alpha__) || defined(__ia64__) || defined(_ARCH_PPC64) || defined(__x86_64__) || defined(__mips64) || defined(__sparc64__)
261 #if defined(__GNUC__) && !defined(__INTEL_COMPILER) && !(CRYPTOPP_GCC_VERSION == 40001 && defined(__APPLE__)) && !(defined(__GNUC__) && CRYPTOPP_GCC_VERSION < 50000 && defined(_ARCH_PPC64)) && CRYPTOPP_GCC_VERSION >= 30400
262  // GCC 4.0.1 on MacOS X is missing __umodti3 and __udivti3
263  // GCC 4.8.3 and bad uint128_t ops on PPC64/POWER7 (Issue 421)
264  // mode(TI) division broken on amd64 with GCC earlier than GCC 3.4
265  typedef word32 hword;
266  typedef word64 word;
267  typedef __uint128_t dword;
268  typedef __uint128_t word128;
269  #define CRYPTOPP_WORD128_AVAILABLE 1
270  #else
271  // 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
272  typedef word16 hword;
273  typedef word32 word;
274  typedef word64 dword;
275  #endif
276  #else
277  // being here means the native register size is probably 32 bits or less
278  #define CRYPTOPP_BOOL_SLOW_WORD64 1
279  typedef word16 hword;
280  typedef word32 word;
281  typedef word64 dword;
282  #endif
283 #endif
284 #ifndef CRYPTOPP_BOOL_SLOW_WORD64
285  #define CRYPTOPP_BOOL_SLOW_WORD64 0
286 #endif
287 
288 const unsigned int WORD_SIZE = sizeof(word);
289 const unsigned int WORD_BITS = WORD_SIZE * 8;
290 
291 NAMESPACE_END
292 
293 #ifndef CRYPTOPP_L1_CACHE_LINE_SIZE
294  // This should be a lower bound on the L1 cache line size. It's used for defense against timing attacks.
295  // Also see http://stackoverflow.com/questions/794632/programmatically-get-the-cache-line-size.
296  #if defined(_M_X64) || defined(__x86_64__) || (__arm64__) || (__aarch64__)
297  #define CRYPTOPP_L1_CACHE_LINE_SIZE 64
298  #else
299  // L1 cache line size is 32 on Pentium III and earlier
300  #define CRYPTOPP_L1_CACHE_LINE_SIZE 32
301  #endif
302 #endif
303 
304 #ifndef CRYPTOPP_ALIGN_DATA
305  #if defined(_MSC_VER)
306  #define CRYPTOPP_ALIGN_DATA(x) __declspec(align(x))
307  #elif defined(__GNUC__)
308  #define CRYPTOPP_ALIGN_DATA(x) __attribute__((aligned(x)))
309  #else
310  #define CRYPTOPP_ALIGN_DATA(x)
311  #endif
312 #endif
313 
314 #ifndef CRYPTOPP_SECTION_ALIGN16
315 #if defined(__GNUC__) && !defined(__APPLE__)
316  // the alignment attribute doesn't seem to work without this section attribute when -fdata-sections is turned on
317  #define CRYPTOPP_SECTION_ALIGN16 __attribute__((section ("CryptoPP_Align16")))
318  #else
319  #define CRYPTOPP_SECTION_ALIGN16
320  #endif
321 #endif
322 
323 // The section attribute attempts to initialize CPU flags to avoid Valgrind findings above -O1
324 #if ((defined(__MACH__) && defined(__APPLE__)) && ((CRYPTOPP_LLVM_CLANG_VERSION >= 30600) || (CRYPTOPP_APPLE_CLANG_VERSION >= 70100) || (CRYPTOPP_GCC_VERSION >= 40300)))
325  #define CRYPTOPP_SECTION_INIT __attribute__((section ("__DATA,__data")))
326 #elif (defined(__ELF__) && (CRYPTOPP_GCC_VERSION >= 40300))
327  #define CRYPTOPP_SECTION_INIT __attribute__((section ("nocommon")))
328 #else
329  #define CRYPTOPP_SECTION_INIT
330 #endif
331 
332 #if defined(_MSC_VER) || defined(__fastcall)
333  #define CRYPTOPP_FASTCALL __fastcall
334 #else
335  #define CRYPTOPP_FASTCALL
336 #endif
337 
338 #ifdef _MSC_VER
339 #define CRYPTOPP_NO_VTABLE __declspec(novtable)
340 #else
341 #define CRYPTOPP_NO_VTABLE
342 #endif
343 
344 #ifdef _MSC_VER
345  // 4127: conditional expression is constant
346  // 4231: nonstandard extension used : 'extern' before template explicit instantiation
347  // 4250: dominance
348  // 4251: member needs to have dll-interface
349  // 4275: base needs to have dll-interface
350  // 4505: unreferenced local function
351  // 4512: assignment operator not generated
352  // 4660: explicitly instantiating a class that's already implicitly instantiated
353  // 4661: no suitable definition provided for explicit template instantiation request
354  // 4786: identifier was truncated in debug information
355  // 4355: 'this' : used in base member initializer list
356  // 4910: '__declspec(dllexport)' and 'extern' are incompatible on an explicit instantiation
357 # pragma warning(disable: 4127 4512 4661)
358  // Security related, possible defects
359  // http://blogs.msdn.com/b/vcblog/archive/2010/12/14/off-by-default-compiler-warnings-in-visual-c.aspx
360 # pragma warning(once: 4191 4242 4263 4264 4266 4302 4826 4905 4906 4928)
361 #endif
362 
363 #ifdef __BORLANDC__
364 // 8037: non-const function called for const object. needed to work around BCB2006 bug
365 # pragma warn -8037
366 #endif
367 
368 // [GCC Bug 53431] "C++ preprocessor ignores #pragma GCC diagnostic". Clang honors it.
369 #if CRYPTOPP_GCC_DIAGNOSTIC_AVAILABLE
370 # pragma GCC diagnostic ignored "-Wunknown-pragmas"
371 # pragma GCC diagnostic ignored "-Wunused-function"
372 #endif
373 
374 // You may need to force include a C++ header on Android when using STLPort to ensure
375 // _STLPORT_VERSION is defined: CXXFLAGS="-DNDEBUG -g2 -O2 -std=c++11 -include iosfwd"
376 // TODO: Figure out C++17 and lack of std::uncaught_exception
377 #if (defined(_MSC_VER) && _MSC_VER <= 1300) || defined(__MWERKS__) || (defined(_STLPORT_VERSION) && ((_STLPORT_VERSION < 0x450) || defined(_STLP_NO_UNCAUGHT_EXCEPT_SUPPORT)))
378 #define CRYPTOPP_DISABLE_UNCAUGHT_EXCEPTION
379 #endif
380 
381 #ifndef CRYPTOPP_DISABLE_UNCAUGHT_EXCEPTION
382 #define CRYPTOPP_UNCAUGHT_EXCEPTION_AVAILABLE
383 #endif
384 
385 // Apple's Clang prior to 5.0 cannot handle SSE2 (and Apple does not use LLVM Clang numbering...)
386 #if defined(CRYPTOPP_APPLE_CLANG_VERSION) && (CRYPTOPP_APPLE_CLANG_VERSION < 50000)
387 # define CRYPTOPP_DISABLE_ASM
388 #endif
389 
390 // Sun Studio 12 provides GCC inline assembly, http://blogs.oracle.com/x86be/entry/gcc_style_asm_inlining_support
391 // We can enable SSE2 for Sun Studio in the makefile with -D__SSE2__, but users may not compile with it.
392 #if !defined(CRYPTOPP_DISABLE_ASM) && !defined(__SSE2__) && defined(__x86_64__) && (__SUNPRO_CC >= 0x5100)
393 # define __SSE2__ 1
394 #endif
395 
396 #if !defined(CRYPTOPP_DISABLE_ASM) && ((defined(_MSC_VER) && defined(_M_IX86)) || (defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))))
397  // C++Builder 2010 does not allow "call label" where label is defined within inline assembly
398  #define CRYPTOPP_X86_ASM_AVAILABLE
399 
400  #if !defined(CRYPTOPP_DISABLE_SSE2) && (defined(_MSC_VER) || CRYPTOPP_GCC_VERSION >= 30300 || defined(__SSE2__))
401  #define CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE 1
402  #else
403  #define CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE 0
404  #endif
405 
406  #if !defined(CRYPTOPP_DISABLE_SSSE3) && (_MSC_VER >= 1500 || (defined(__SSE3__) && defined(__SSSE3__)))
407  #define CRYPTOPP_BOOL_SSSE3_ASM_AVAILABLE 1
408  #else
409  #define CRYPTOPP_BOOL_SSSE3_ASM_AVAILABLE 0
410  #endif
411 #endif
412 
413 #if !defined(CRYPTOPP_DISABLE_ASM) && defined(_MSC_VER) && defined(_M_X64)
414  #define CRYPTOPP_X64_MASM_AVAILABLE
415 #endif
416 
417 #if !defined(CRYPTOPP_DISABLE_ASM) && defined(__GNUC__) && defined(__x86_64__)
418  #define CRYPTOPP_X64_ASM_AVAILABLE
419 #endif
420 
421 #if !defined(CRYPTOPP_DISABLE_ASM) && (defined(_MSC_VER) || defined(__SSE2__)) && !defined(_M_ARM)
422  #define CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE 1
423 #else
424  #define CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE 0
425 #endif
426 
427 #if !defined(CRYPTOPP_DISABLE_ASM) && !defined(CRYPTOPP_DISABLE_SSSE3) && !defined(_M_ARM) && (_MSC_VER >= 1500 || (defined(__SSSE3__) && defined(__SSSE3__)))
428  #define CRYPTOPP_BOOL_SSSE3_INTRINSICS_AVAILABLE 1
429 #else
430  #define CRYPTOPP_BOOL_SSSE3_INTRINSICS_AVAILABLE 0
431 #endif
432 
433 // Intrinsics availible in GCC 4.3 (http://gcc.gnu.org/gcc-4.3/changes.html) and
434 // MSVC 2008 (http://msdn.microsoft.com/en-us/library/bb892950%28v=vs.90%29.aspx)
435 // SunCC could generate SSE4 at 12.1, but the intrinsics are missing until 12.4.
436 #if !defined(CRYPTOPP_DISABLE_ASM) && !defined(CRYPTOPP_DISABLE_SSE4) && !defined(_M_ARM) && ((_MSC_VER >= 1500) || (defined(__SSE4_1__) && defined(__SSE4_2__)))
437  #define CRYPTOPP_BOOL_SSE4_INTRINSICS_AVAILABLE 1
438 #else
439  #define CRYPTOPP_BOOL_SSE4_INTRINSICS_AVAILABLE 0
440 #endif
441 
442 // Don't disgorge AES-NI from CLMUL. There will be two to four subtle breaks
443 #if !defined(CRYPTOPP_DISABLE_ASM) && !defined(CRYPTOPP_DISABLE_AESNI) && !defined(_M_ARM) && (_MSC_FULL_VER >= 150030729 || __INTEL_COMPILER >= 1110 || (defined(__AES__) && defined(__PCLMUL__)))
444  #define CRYPTOPP_BOOL_AESNI_INTRINSICS_AVAILABLE 1
445 #else
446  #define CRYPTOPP_BOOL_AESNI_INTRINSICS_AVAILABLE 0
447 #endif
448 
449 #if !defined(CRYPTOPP_DISABLE_ASM) && !defined(CRYPTOPP_DISABLE_SHA) && !defined(_M_ARM) && ((_MSC_VER >= 1900) || defined(__SHA__))
450  #define CRYPTOPP_BOOL_SSE_SHA_INTRINSICS_AVAILABLE 1
451 #else
452  #define CRYPTOPP_BOOL_SSE_SHA_INTRINSICS_AVAILABLE 0
453 #endif
454 
455 // Requires ARMv7 and ACLE 1.0. Testing shows ARMv7 is really ARMv7a under most toolchains.
456 #if !defined(CRYPTOPP_BOOL_NEON_INTRINSICS_AVAILABLE) && !defined(CRYPTOPP_DISABLE_ASM)
457 # if defined(__ARM_NEON__) || defined(__ARM_NEON) || defined(_M_ARM)
458 # define CRYPTOPP_BOOL_NEON_INTRINSICS_AVAILABLE 1
459 # endif
460 #endif
461 
462 // Requires ARMv8 and ACLE 2.0. GCC requires 4.8 and above.
463 // LLVM Clang requires 3.5. Apple Clang is unknown at the moment.
464 // Microsoft plans to support ARM-64, but its not clear how to detect it.
465 // TODO: Add MSC_VER and ARM-64 platform define when available
466 #if !defined(CRYPTOPP_BOOL_ARM_CRC32_INTRINSICS_AVAILABLE) && !defined(CRYPTOPP_DISABLE_ASM)
467 # if defined(__ARM_FEATURE_CRC32)
468 # define CRYPTOPP_BOOL_ARM_CRC32_INTRINSICS_AVAILABLE 1
469 # endif
470 #endif
471 
472 // Requires ARMv8, ACLE 2.0 and Aarch64. GCC requires 4.8 and above.
473 // LLVM Clang requires 3.5. Apple Clang does not support it at the moment.
474 // Microsoft plans to support ARM-64, but its not clear how to detect it.
475 // TODO: Add MSC_VER and ARM-64 platform define when available
476 #if !defined(CRYPTOPP_BOOL_ARM_PMULL_AVAILABLE) && !defined(CRYPTOPP_DISABLE_ASM)
477 # if defined(__ARM_FEATURE_CRYPTO) && !defined(__apple_build_version__)
478 # if defined(__arm64__) || defined(__aarch64__)
479 # define CRYPTOPP_BOOL_ARM_PMULL_AVAILABLE 1
480 # endif
481 # endif
482 #endif
483 
484 // Requires ARMv8 and ACLE 2.0. GCC requires 4.8 and above.
485 // LLVM Clang requires 3.5. Apple Clang is unknown at the moment.
486 // Microsoft plans to support ARM-64, but its not clear how to detect it.
487 // TODO: Add MSC_VER and ARM-64 platform define when available
488 #if !defined(CRYPTOPP_BOOL_ARM_CRYPTO_INTRINSICS_AVAILABLE) && !defined(CRYPTOPP_DISABLE_ASM)
489 # if defined(__ARM_FEATURE_CRYPTO)
490 # define CRYPTOPP_BOOL_ARM_CRYPTO_INTRINSICS_AVAILABLE 1
491 # endif
492 #endif
493 
494 #if CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE || CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE || CRYPTOPP_BOOL_NEON_INTRINSICS_AVAILABLE || defined(CRYPTOPP_X64_MASM_AVAILABLE)
495  #define CRYPTOPP_BOOL_ALIGN16 1
496 #else
497  #define CRYPTOPP_BOOL_ALIGN16 0
498 #endif
499 
500 // how to allocate 16-byte aligned memory (for SSE2)
501 #if defined(_MSC_VER)
502  #define CRYPTOPP_MM_MALLOC_AVAILABLE
503 #elif defined(__APPLE__)
504  #define CRYPTOPP_APPLE_MALLOC_AVAILABLE
505 #elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
506  #define CRYPTOPP_MALLOC_ALIGNMENT_IS_16
507 #elif defined(__linux__) || defined(__sun__) || defined(__CYGWIN__)
508  #define CRYPTOPP_MEMALIGN_AVAILABLE
509 #else
510  #define CRYPTOPP_NO_ALIGNED_ALLOC
511 #endif
512 
513 // Apple always provides 16-byte aligned, and tells us to use calloc
514 // http://developer.apple.com/library/mac/documentation/Performance/Conceptual/ManagingMemory/Articles/MemoryAlloc.html
515 
516 // how to disable inlining
517 #if defined(_MSC_VER)
518 # define CRYPTOPP_NOINLINE_DOTDOTDOT
519 # define CRYPTOPP_NOINLINE __declspec(noinline)
520 #elif defined(__GNUC__)
521 # define CRYPTOPP_NOINLINE_DOTDOTDOT
522 # define CRYPTOPP_NOINLINE __attribute__((noinline))
523 #else
524 # define CRYPTOPP_NOINLINE_DOTDOTDOT ...
525 # define CRYPTOPP_NOINLINE
526 #endif
527 
528 // How to declare class constants
529 #if (_MSC_VER == 1300) || defined(__INTEL_COMPILER) || defined(__BORLANDC__)
530 # define CRYPTOPP_CONSTANT(x) enum {x};
531 #else
532 # define CRYPTOPP_CONSTANT(x) static const int x;
533 #endif
534 
535 // Linux provides X32, which is 32-bit integers, longs and pointers on x86_64 using the full x86_64 register set.
536 // Detect via __ILP32__ (http://wiki.debian.org/X32Port). However, __ILP32__ shows up in more places than
537 // the System V ABI specs calls out, like on some Solaris installations and just about any 32-bit system with Clang.
538 #if (defined(__ILP32__) || defined(_ILP32)) && defined(__x86_64__)
539  #define CRYPTOPP_BOOL_X32 1
540 #else
541  #define CRYPTOPP_BOOL_X32 0
542 #endif
543 
544 // see http://predef.sourceforge.net/prearch.html
545 #if (defined(_M_IX86) || defined(__i386__) || defined(__i386) || defined(_X86_) || defined(__I86__) || defined(__INTEL__)) && !CRYPTOPP_BOOL_X32
546  #define CRYPTOPP_BOOL_X86 1
547 #else
548  #define CRYPTOPP_BOOL_X86 0
549 #endif
550 
551 #if (defined(_M_X64) || defined(__x86_64__)) && !CRYPTOPP_BOOL_X32
552  #define CRYPTOPP_BOOL_X64 1
553 #else
554  #define CRYPTOPP_BOOL_X64 0
555 #endif
556 
557 // Undo the ASM and Intrinsic related defines due to X32.
558 #if CRYPTOPP_BOOL_X32
559 # undef CRYPTOPP_BOOL_X64
560 # undef CRYPTOPP_X64_ASM_AVAILABLE
561 # undef CRYPTOPP_X64_MASM_AVAILABLE
562 #endif
563 
564 #if defined(__arm__) || defined(__aarch32__) || defined(_M_ARM)
565  #define CRYPTOPP_BOOL_ARM32 1
566 #else
567  #define CRYPTOPP_BOOL_ARM32 0
568 #endif
569 
570 // Microsoft plans to support ARM-64, but its not clear how to detect it.
571 // TODO: Add MSC_VER and ARM-64 platform define when available
572 #if defined(__arm64__) || defined(__aarch64__) || defined(_M_ARM64)
573  #define CRYPTOPP_BOOL_ARM64 1
574 #else
575  #define CRYPTOPP_BOOL_ARM64 0
576 #endif
577 
578 #if !defined(CRYPTOPP_NO_UNALIGNED_DATA_ACCESS) && !defined(CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS)
579 #if (CRYPTOPP_BOOL_X64 || CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X32 || defined(__powerpc__) || (__ARM_FEATURE_UNALIGNED >= 1))
580  #define CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS
581 #endif
582 #endif
583 
584 // ***************** Initialization and Constructor priorities ********************
585 
586 // CRYPTOPP_INIT_PRIORITY attempts to manage initialization of C++ static objects.
587 // Under GCC, the library uses init_priority attribute in the range
588 // [CRYPTOPP_INIT_PRIORITY, CRYPTOPP_INIT_PRIORITY+100]. Under Windows,
589 // CRYPTOPP_INIT_PRIORITY enlists "#pragma init_seg(lib)". The platforms
590 // with gaps are Apple and Sun because they require linker scripts. Apple and
591 // Sun will use the library's Singletons to initialize and acquire resources.
592 // Also see http://cryptopp.com/wiki/Static_Initialization_Order_Fiasco
593 #ifndef CRYPTOPP_INIT_PRIORITY
594 # define CRYPTOPP_INIT_PRIORITY 250
595 #endif
596 
597 // CRYPTOPP_USER_PRIORITY is for other libraries and user code that is using Crypto++
598 // and managing C++ static object creation. It is guaranteed not to conflict with
599 // values used by (or would be used by) the Crypto++ library.
600 #if defined(CRYPTOPP_INIT_PRIORITY) && (CRYPTOPP_INIT_PRIORITY > 0)
601 # define CRYPTOPP_USER_PRIORITY (CRYPTOPP_INIT_PRIORITY + 101)
602 #else
603 # define CRYPTOPP_USER_PRIORITY 350
604 #endif
605 
606 // Most platforms allow us to specify when to create C++ objects. Apple and Sun do not.
607 #if (CRYPTOPP_INIT_PRIORITY > 0) && !(defined(NO_OS_DEPENDENCE) || defined(__APPLE__) || defined(__sun__))
608 # if (CRYPTOPP_GCC_VERSION >= 30000) || (CRYPTOPP_LLVM_CLANG_VERSION >= 20900) || (_INTEL_COMPILER >= 800)
609 # define HAVE_GCC_INIT_PRIORITY 1
610 # elif (CRYPTOPP_MSC_VERSION >= 1310)
611 # define HAVE_MSC_INIT_PRIORITY 1
612 # endif
613 #endif // CRYPTOPP_INIT_PRIORITY, NO_OS_DEPENDENCE, Apple, Sun
614 
615 // ***************** determine availability of OS features ********************
616 
617 #ifndef NO_OS_DEPENDENCE
618 
619 #if defined(_WIN32) || defined(__CYGWIN__)
620 #define CRYPTOPP_WIN32_AVAILABLE
621 #endif
622 
623 #if defined(__unix__) || defined(__MACH__) || defined(__NetBSD__) || defined(__sun)
624 #define CRYPTOPP_UNIX_AVAILABLE
625 #endif
626 
627 #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
628 #define CRYPTOPP_BSD_AVAILABLE
629 #endif
630 
631 #if defined(CRYPTOPP_WIN32_AVAILABLE) || defined(CRYPTOPP_UNIX_AVAILABLE)
632 # define HIGHRES_TIMER_AVAILABLE
633 #endif
634 
635 #ifdef CRYPTOPP_WIN32_AVAILABLE
636 # if !defined(WINAPI_FAMILY)
637 # define THREAD_TIMER_AVAILABLE
638 # elif defined(WINAPI_FAMILY)
639 # if (WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP))
640 # define THREAD_TIMER_AVAILABLE
641 # endif
642 # endif
643 #endif
644 
645 #ifdef CRYPTOPP_UNIX_AVAILABLE
646 # define HAS_BERKELEY_STYLE_SOCKETS
647 # define SOCKETS_AVAILABLE
648 #endif
649 
650 // Sockets are only available under Windows Runtime desktop partition apps (despite the MSDN literature)
651 #ifdef CRYPTOPP_WIN32_AVAILABLE
652 # define HAS_WINDOWS_STYLE_SOCKETS
653 # if !defined(WINAPI_FAMILY)
654 # define SOCKETS_AVAILABLE
655 # elif defined(WINAPI_FAMILY)
656 # if (WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP))
657 # define SOCKETS_AVAILABLE
658 # endif
659 # endif
660 #endif
661 
662 #if defined(HAS_WINDOWS_STYLE_SOCKETS) && (!defined(HAS_BERKELEY_STYLE_SOCKETS) || defined(PREFER_WINDOWS_STYLE_SOCKETS))
663 # define USE_WINDOWS_STYLE_SOCKETS
664 #else
665 # define USE_BERKELEY_STYLE_SOCKETS
666 #endif
667 
668 #if defined(CRYPTOPP_WIN32_AVAILABLE) && defined(SOCKETS_AVAILABLE) && !defined(USE_BERKELEY_STYLE_SOCKETS)
669 # define WINDOWS_PIPES_AVAILABLE
670 #endif
671 
672 #if defined(CRYPTOPP_UNIX_AVAILABLE) || defined(CRYPTOPP_DOXYGEN_PROCESSING)
673 # define NONBLOCKING_RNG_AVAILABLE
674 # define BLOCKING_RNG_AVAILABLE
675 # define OS_RNG_AVAILABLE
676 # define HAS_PTHREADS
677 # define THREADS_AVAILABLE
678 #endif
679 
680 // Cygwin/Newlib requires _XOPEN_SOURCE=700
681 #if defined(CRYPTOPP_UNIX_AVAILABLE)
682 # define UNIX_SIGNALS_AVAILABLE 1
683 #endif
684 
685 #ifdef CRYPTOPP_WIN32_AVAILABLE
686 # if !defined(WINAPI_FAMILY)
687 # define HAS_WINTHREADS
688 # define THREADS_AVAILABLE
689 # define NONBLOCKING_RNG_AVAILABLE
690 # define OS_RNG_AVAILABLE
691 # elif defined(WINAPI_FAMILY)
692 # if (WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP))
693 # define HAS_WINTHREADS
694 # define THREADS_AVAILABLE
695 # define NONBLOCKING_RNG_AVAILABLE
696 # define OS_RNG_AVAILABLE
697 # elif !(WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP))
698 # if ((WINVER >= 0x0A00 /*_WIN32_WINNT_WIN10*/) || (_WIN32_WINNT >= 0x0A00 /*_WIN32_WINNT_WIN10*/))
699 # define NONBLOCKING_RNG_AVAILABLE
700 # define OS_RNG_AVAILABLE
701 # endif
702 # endif
703 # endif
704 #endif
705 
706 #endif // NO_OS_DEPENDENCE
707 
708 // ***************** DLL related ********************
709 
710 #if defined(CRYPTOPP_WIN32_AVAILABLE) && !defined(CRYPTOPP_DOXYGEN_PROCESSING)
711 
712 #ifdef CRYPTOPP_EXPORTS
713 #define CRYPTOPP_IS_DLL
714 #define CRYPTOPP_DLL __declspec(dllexport)
715 #elif defined(CRYPTOPP_IMPORTS)
716 #define CRYPTOPP_IS_DLL
717 #define CRYPTOPP_DLL __declspec(dllimport)
718 #else
719 #define CRYPTOPP_DLL
720 #endif
721 
722 #define CRYPTOPP_API __cdecl
723 
724 #else // not CRYPTOPP_WIN32_AVAILABLE
725 
726 #define CRYPTOPP_DLL
727 #define CRYPTOPP_API
728 
729 #endif // CRYPTOPP_WIN32_AVAILABLE
730 
731 #if defined(__MWERKS__)
732 #define CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS extern class CRYPTOPP_DLL
733 #elif defined(__BORLANDC__) || defined(__SUNPRO_CC)
734 #define CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS template class CRYPTOPP_DLL
735 #else
736 #define CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS extern template class CRYPTOPP_DLL
737 #endif
738 
739 #if defined(CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES) && !defined(CRYPTOPP_IMPORTS)
740 #define CRYPTOPP_DLL_TEMPLATE_CLASS template class CRYPTOPP_DLL
741 #else
742 #define CRYPTOPP_DLL_TEMPLATE_CLASS CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS
743 #endif
744 
745 #if defined(__MWERKS__)
746 #define CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS extern class
747 #elif defined(__BORLANDC__) || defined(__SUNPRO_CC)
748 #define CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS template class
749 #else
750 #define CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS extern template class
751 #endif
752 
753 #if defined(CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES) && !defined(CRYPTOPP_EXPORTS)
754 #define CRYPTOPP_STATIC_TEMPLATE_CLASS template class
755 #else
756 #define CRYPTOPP_STATIC_TEMPLATE_CLASS CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS
757 #endif
758 
759 // ************** Unused variable ***************
760 
761 // Portable way to suppress warnings.
762 // Moved from misc.h due to circular depenedencies.
763 #define CRYPTOPP_UNUSED(x) ((void)(x))
764 
765 // ************** Deprecated ***************
766 
767 #if (CRYPTOPP_GCC_VERSION >= 40500) || (CRYPTOPP_LLVM_CLANG_VERSION >= 20800) || (CRYPTOPP_APPLE_CLANG_VERSION >= 40200)
768 # define CRYPTOPP_DEPRECATED(msg) __attribute__((deprecated (msg)))
769 #elif (CRYPTOPP_GCC_VERSION)
770 # define CRYPTOPP_DEPRECATED(msg) __attribute__((deprecated))
771 #else
772 # define CRYPTOPP_DEPRECATED(msg)
773 #endif
774 
775 // ************** Instrumentation ***************
776 
777 // GCC does not support; see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78204
778 #if (CRYPTOPP_LLVM_CLANG_VERSION >= 30700) || (CRYPTOPP_APPLE_CLANG_VERSION >= 70000)
779 # define CRYPTOPP_NO_SANITIZE(x) __attribute__((no_sanitize(x)))
780 #else
781 # define CRYPTOPP_NO_SANITIZE(x)
782 #endif
783 
784 // ***************** C++11 related ********************
785 
786 // Visual Studio began at VS2010, http://msdn.microsoft.com/en-us/library/hh567368%28v=vs.110%29.aspx.
787 // Intel and C++11 language features, http://software.intel.com/en-us/articles/c0x-features-supported-by-intel-c-compiler
788 // GCC and C++11 language features, http://gcc.gnu.org/projects/cxx0x.html
789 // Clang and C++11 language features, http://clang.llvm.org/cxx_status.html
790 #if ((_MSC_VER >= 1600) || (__cplusplus >= 201103L)) && !defined(_STLPORT_VERSION)
791 # define CRYPTOPP_CXX11 1
792 #endif
793 
794 // Hack ahead. Apple's standard library does not have C++'s unique_ptr in C++11. We can't
795 // test for unique_ptr directly because some of the non-Apple Clangs on OS X fail the same
796 // way. However, modern standard libraries have <forward_list>, so we test for it instead.
797 // Thanks to Jonathan Wakely for devising the clever test for modern/ancient versions.
798 // TODO: test under Xcode 3, where g++ is really g++.
799 #if defined(__APPLE__) && defined(__clang__)
800 # if !(defined(__has_include) && __has_include(<forward_list>))
801 # undef CRYPTOPP_CXX11
802 # endif
803 #endif
804 
805 // C++11 or C++14 is available
806 #if defined(CRYPTOPP_CXX11)
807 
808 // Compatibility with non-clang compilers.
809 #ifndef __has_feature
810 # define __has_feature(x) 0
811 #endif
812 
813 // atomics: MS at VS2012 (17.00); GCC at 4.4; Clang at 3.1/3.2; Intel 13.0; SunCC 5.14.
814 #if (CRYPTOPP_MSC_VERSION >= 1700)
815 # define CRYPTOPP_CXX11_ATOMICS 1
816 #elif __has_feature(cxx_atomic)
817 # define CRYPTOPP_CXX11_ATOMICS 1
818 #elif (__INTEL_COMPILER >= 1300)
819 # 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
824 #endif // atomics
825 
826 // synchronization: MS at VS2012 (17.00); GCC at 4.4; Clang at 3.3; Xcode 5.0; Intel 12.0; SunCC 5.13.
827 // TODO: verify Clang and Intel versions; find __has_feature(x) extension for Clang
828 #if (CRYPTOPP_MSC_VERSION >= 1700)
829 # define CRYPTOPP_CXX11_SYNCHRONIZATION 1
830 #elif (CRYPTOPP_LLVM_CLANG_VERSION >= 30300) || (CRYPTOPP_APPLE_CLANG_VERSION >= 50000)
831 # define CRYPTOPP_CXX11_SYNCHRONIZATION 1
832 #elif (__INTEL_COMPILER >= 1200)
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
839 
840 // Dynamic Initialization and Destruction with Concurrency ("Magic Statics")
841 // MS at VS2015 (19.00); GCC at 4.3; LLVM Clang at 2.9; Apple Clang at 4.0; Intel 11.1; SunCC 5.13.
842 // Microsoft's implementation only works for Vista and above, so its further
843 // limited. http://connect.microsoft.com/VisualStudio/feedback/details/1789709
844 #if (CRYPTOPP_MSC_VERSION >= 1900) && ((WINVER >= 0x0600 /*_WIN32_WINNT_VISTA*/) || (_WIN32_WINNT >= 0x0600 /*_WIN32_WINNT_VISTA*/))
845 # define CRYPTOPP_CXX11_DYNAMIC_INIT 1
846 #elif (CRYPTOPP_LLVM_CLANG_VERSION >= 20900) || (CRYPTOPP_APPLE_CLANG_VERSION >= 40000)
847 # define CRYPTOPP_CXX11_DYNAMIC_INIT 1
848 #elif (__INTEL_COMPILER >= 1110)
849 # define CRYPTOPP_CXX11_DYNAMIC_INIT 1
850 #elif (CRYPTOPP_GCC_VERSION >= 40300)
851 # define CRYPTOPP_CXX11_DYNAMIC_INIT 1
852 #elif (__SUNPRO_CC >= 0x5130)
853 # define CRYPTOPP_CXX11_DYNAMIC_INIT 1
854 #endif // Dynamic Initialization compilers
855 
856 // alignof/alignas: MS at VS2015 (19.00); GCC at 4.8; Clang at 3.0; Intel 15.0; SunCC 5.13.
857 #if (CRYPTOPP_MSC_VERSION >= 1900)
858 # define CRYPTOPP_CXX11_ALIGNAS 1
859 #elif __has_feature(cxx_alignas)
860 # define CRYPTOPP_CXX11_ALIGNAS 1
861 #elif (__INTEL_COMPILER >= 1500)
862 # define CRYPTOPP_CXX11_ALIGNAS 1
863 #elif (CRYPTOPP_GCC_VERSION >= 40800)
864 # define CRYPTOPP_CXX11_ALIGNAS 1
865 #elif (__SUNPRO_CC >= 0x5130)
866 # define CRYPTOPP_CXX11_ALIGNAS 1
867 #endif // alignas
868 
869 // alignof: MS at VS2015 (19.00); GCC at 4.5; Clang at 2.9; Intel 15.0; SunCC 5.13.
870 #if (CRYPTOPP_MSC_VERSION >= 1900)
871 # define CRYPTOPP_CXX11_ALIGNOF 1
872 #elif __has_feature(cxx_alignof)
873 # define CRYPTOPP_CXX11_ALIGNOF 1
874 #elif (__INTEL_COMPILER >= 1500)
875 # define CRYPTOPP_CXX11_ALIGNOF 1
876 #elif (CRYPTOPP_GCC_VERSION >= 40500)
877 # define CRYPTOPP_CXX11_ALIGNOF 1
878 #elif (__SUNPRO_CC >= 0x5130)
879 # define CRYPTOPP_CXX11_ALIGNOF 1
880 #endif // alignof
881 
882 // noexcept: MS at VS2015 (19.00); GCC at 4.6; Clang at 3.0; Intel 14.0; SunCC 5.13.
883 #if (CRYPTOPP_MSC_VERSION >= 1900)
884 # define CRYPTOPP_CXX11_NOEXCEPT 1
885 #elif __has_feature(cxx_noexcept)
886 # define CRYPTOPP_CXX11_NOEXCEPT 1
887 #elif (__INTEL_COMPILER >= 1400)
888 # define CRYPTOPP_CXX11_NOEXCEPT 1
889 #elif (CRYPTOPP_GCC_VERSION >= 40600)
890 # define CRYPTOPP_CXX11_NOEXCEPT 1
891 #elif (__SUNPRO_CC >= 0x5130)
892 # define CRYPTOPP_CXX11_NOEXCEPT 1
893 #endif // noexcept compilers
894 
895 // variadic templates: MS at VS2013 (18.00); GCC at 4.3; Clang at 2.9; Intel 12.1; SunCC 5.13.
896 #if (CRYPTOPP_MSC_VERSION >= 1800)
897 # define CRYPTOPP_CXX11_VARIADIC_TEMPLATES 1
898 #elif __has_feature(cxx_variadic_templates)
899 # define CRYPTOPP_CXX11_VARIADIC_TEMPLATES 1
900 #elif (__INTEL_COMPILER >= 1210)
901 # define CRYPTOPP_CXX11_VARIADIC_TEMPLATES 1
902 #elif (CRYPTOPP_GCC_VERSION >= 40300)
903 # define CRYPTOPP_CXX11_VARIADIC_TEMPLATES 1
904 #elif (__SUNPRO_CC >= 0x5130)
905 # define CRYPTOPP_CXX11_VARIADIC_TEMPLATES 1
906 #endif // variadic templates
907 
908 // constexpr: MS at VS2015 (19.00); GCC at 4.6; Clang at 3.1; Intel 16.0; SunCC 5.13.
909 // Intel has mis-supported the feature since at least ICPC 13.00
910 #if (CRYPTOPP_MSC_VERSION >= 1900)
911 # define CRYPTOPP_CXX11_CONSTEXPR 1
912 #elif __has_feature(cxx_constexpr)
913 # define CRYPTOPP_CXX11_CONSTEXPR 1
914 #elif (__INTEL_COMPILER >= 1600)
915 # define CRYPTOPP_CXX11_CONSTEXPR 1
916 #elif (CRYPTOPP_GCC_VERSION >= 40600)
917 # define CRYPTOPP_CXX11_CONSTEXPR 1
918 #elif (__SUNPRO_CC >= 0x5130)
919 # define CRYPTOPP_CXX11_CONSTEXPR 1
920 #endif // constexpr compilers
921 
922 // nullptr_t: MS at VS2010 (16.00); GCC at 4.6; Clang at 3.3; Intel 10.0; SunCC 5.13.
923 #if (CRYPTOPP_MSC_VERSION >= 1600)
924 # define CRYPTOPP_CXX11_NULLPTR 1
925 #elif __has_feature(cxx_nullptr)
926 # define CRYPTOPP_CXX11_NULLPTR 1
927 #elif (__INTEL_COMPILER >= 1000)
928 # define CRYPTOPP_CXX11_NULLPTR 1
929 #elif (CRYPTOPP_GCC_VERSION >= 40600)
930 # define CRYPTOPP_CXX11_NULLPTR 1
931 #elif (__SUNPRO_CC >= 0x5130)
932 # define CRYPTOPP_CXX11_NULLPTR 1
933 #endif // nullptr_t compilers
934 
935 // TODO: Emplacement, R-values and Move semantics
936 // Needed because we are catching warnings with GCC and MSC
937 
938 #endif // CRYPTOPP_CXX11
939 
940 #if defined(CRYPTOPP_CXX11_NOEXCEPT)
941 # define CRYPTOPP_THROW noexcept(false)
942 # define CRYPTOPP_NO_THROW noexcept(true)
943 #else
944 # define CRYPTOPP_THROW
945 # define CRYPTOPP_NO_THROW
946 #endif // CRYPTOPP_CXX11_NOEXCEPT
947 
948 // http://stackoverflow.com/a/13867690/608639
949 #if defined(CRYPTOPP_CXX11_CONSTEXPR)
950 # define CRYPTOPP_STATIC_CONSTEXPR static constexpr
951 # define CRYPTOPP_CONSTEXPR constexpr
952 #else
953 # define CRYPTOPP_STATIC_CONSTEXPR static
954 # define CRYPTOPP_CONSTEXPR
955 #endif // CRYPTOPP_CXX11_CONSTEXPR
956 
957 // Hack... CRYPTOPP_ALIGN_DATA is defined earlier, before C++11 alignas availability is determined
958 #if defined(CRYPTOPP_CXX11_ALIGNAS)
959 # undef CRYPTOPP_ALIGN_DATA
960 # define CRYPTOPP_ALIGN_DATA(x) alignas(x)
961 #endif // CRYPTOPP_CXX11_ALIGNAS
962 
963 // Hack... CRYPTOPP_CONSTANT is defined earlier, before C++11 constexpr availability is determined
964 // http://stackoverflow.com/q/35213098/608639
965 #if defined(CRYPTOPP_CXX11_CONSTEXPR)
966 # undef CRYPTOPP_CONSTANT
967 # define CRYPTOPP_CONSTANT(x) constexpr static int x;
968 #endif
969 
970 // Hack... C++11 nullptr_t type safety and analysis
971 #if defined(CRYPTOPP_CXX11_NULLPTR) && !defined(NULLPTR)
972 # define NULLPTR nullptr
973 #elif !defined(NULLPTR)
974 # define NULLPTR NULL
975 #endif // CRYPTOPP_CXX11_NULLPTR
976 
977 // OK to comment the following out, but please report it so we can fix it.
978 // C++17 value taken from http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4567.pdf.
979 #if (defined(__cplusplus) && (__cplusplus >= 199711L) && (__cplusplus < 201402L)) && !defined(CRYPTOPP_UNCAUGHT_EXCEPTION_AVAILABLE)
980 # error "std::uncaught_exception is not available. This is likely a configuration error."
981 #endif
982 
983 #endif
Crypto++ library namespace.