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(__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 #ifndef IS_BIG_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 // ************************* Namespace *************************
149 
150 #ifdef CRYPTOPP_DOXYGEN_PROCESSING
151 // Document the namespce exists. Put it here before CryptoPP is undefined below.
152 //! \namespace CryptoPP
153 //! \brief Crypto++ library namespace
154 //! \details Nearly all classes are located in the CryptoPP namespace. Within
155 //! the namespace, there are two additional namespaces.
156 //! <ul>
157 //! <li>Name - namespace for names used with \p NameValuePairs and documented in argnames.h
158 //! <li>Weak - namespace for weak and wounded algorithms, like ARC4, MD5 and Pananma
159 //! </ul>
160 namespace CryptoPP { }
161 // Bring in the symbols fund in the weak namespace; and fold Weak1 into Weak
162 # define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1
163 # define Weak1 Weak
164 // Avoid putting "CryptoPP::" in front of everything in Doxygen output
165 # define CryptoPP
166 # define NAMESPACE_BEGIN(x)
167 # define NAMESPACE_END
168 // Get Doxygen to generate better documentation for these typedefs
169 # define DOCUMENTED_TYPEDEF(x, y) class y : public x {};
170 // Make "protected" "private" so the functions and members are not documented
171 # define protected private
172 #else
173 # define NAMESPACE_BEGIN(x) namespace x {
174 # define NAMESPACE_END }
175 # define DOCUMENTED_TYPEDEF(x, y) typedef x y;
176 #endif
177 #define ANONYMOUS_NAMESPACE_BEGIN namespace {
178 #define ANONYMOUS_NAMESPACE_END }
179 #define USING_NAMESPACE(x) using namespace x;
180 #define DOCUMENTED_NAMESPACE_BEGIN(x) namespace x {
181 #define DOCUMENTED_NAMESPACE_END }
182 
183 // ************************* Compiler versions *************************
184 
185 // Clang pretends to be VC++, too.
186 // See http://github.com/weidai11/cryptopp/issues/147
187 #if defined(_MSC_VER) && defined(__clang__)
188 # error: "Unsupported configuration"
189 #endif
190 
191 #ifdef __GNUC__
192  #define CRYPTOPP_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
193 #endif
194 
195 // Apple and LLVM's Clang. Apple Clang version 7.0 roughly equals LLVM Clang version 3.7
196 #if defined(__clang__ ) && defined(__apple_build_version__)
197  #define CRYPTOPP_APPLE_CLANG_VERSION (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__)
198  #define CRYPTOPP_CLANG_INTEGRATED_ASSEMBLER 1
199 #elif defined(__clang__ )
200  #define CRYPTOPP_LLVM_CLANG_VERSION (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__)
201  #define CRYPTOPP_CLANG_INTEGRATED_ASSEMBLER 1
202 #endif
203 
204 #ifdef _MSC_VER
205  #define CRYPTOPP_MSC_VERSION (_MSC_VER)
206 #endif
207 
208 // Need GCC 4.6/Clang 1.7/Apple Clang 2.0 or above due to "GCC diagnostic {push|pop}"
209 #if (CRYPTOPP_GCC_VERSION >= 40600) || (CRYPTOPP_LLVM_CLANG_VERSION >= 10700) || (CRYPTOPP_APPLE_CLANG_VERSION >= 20000)
210  #define CRYPTOPP_GCC_DIAGNOSTIC_AVAILABLE 1
211 #endif
212 
213 // Clang due to "Inline assembly operands don't work with .intel_syntax", http://llvm.org/bugs/show_bug.cgi?id=24232
214 // TODO: supply the upper version when LLVM fixes it. We set it to 20.0 for compilation purposes.
215 #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)
216  #define CRYPTOPP_DISABLE_INTEL_ASM 1
217 #endif
218 
219 // ************************* Int and word types *************************
220 
221 // put in global namespace to avoid ambiguity with other byte typedefs
222 typedef unsigned char byte;
223 
224 NAMESPACE_BEGIN(CryptoPP)
225 
226 typedef unsigned short word16;
227 typedef unsigned int word32;
228 
229 #if defined(_MSC_VER) || defined(__BORLANDC__)
230  typedef unsigned __int64 word64;
231  #define W64LIT(x) x##ui64
232 #elif (_LP64 || __LP64__)
233  typedef unsigned long word64;
234  #define W64LIT(x) x##UL
235 #else
236  typedef unsigned long long word64;
237  #define W64LIT(x) x##ULL
238 #endif
239 
240 // define large word type, used for file offsets and such
241 typedef word64 lword;
242 const lword LWORD_MAX = W64LIT(0xffffffffffffffff);
243 
244 // define hword, word, and dword. these are used for multiprecision integer arithmetic
245 // Intel compiler won't have _umul128 until version 10.0. See http://softwarecommunity.intel.com/isn/Community/en-US/forums/thread/30231625.aspx
246 #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__))
247  typedef word32 hword;
248  typedef word64 word;
249 #else
250  #define CRYPTOPP_NATIVE_DWORD_AVAILABLE 1
251  #if defined(__alpha__) || defined(__ia64__) || defined(_ARCH_PPC64) || defined(__x86_64__) || defined(__mips64) || defined(__sparc64__)
252  #if defined(__GNUC__) && !defined(__INTEL_COMPILER) && !(CRYPTOPP_GCC_VERSION == 40001 && defined(__APPLE__)) && CRYPTOPP_GCC_VERSION >= 30400
253  // GCC 4.0.1 on MacOS X is missing __umodti3 and __udivti3
254  // mode(TI) division broken on amd64 with GCC earlier than GCC 3.4
255  typedef word32 hword;
256  typedef word64 word;
257  typedef __uint128_t dword;
258  typedef __uint128_t word128;
259  #define CRYPTOPP_WORD128_AVAILABLE 1
260  #else
261  // 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
262  typedef word16 hword;
263  typedef word32 word;
264  typedef word64 dword;
265  #endif
266  #else
267  // being here means the native register size is probably 32 bits or less
268  #define CRYPTOPP_SLOW_WORD64 1
269  typedef word16 hword;
270  typedef word32 word;
271  typedef word64 dword;
272  #endif
273 #endif
274 #ifndef CRYPTOPP_SLOW_WORD64
275  #define CRYPTOPP_SLOW_WORD64 0
276 #endif
277 
278 const unsigned int WORD_SIZE = sizeof(word);
279 const unsigned int WORD_BITS = WORD_SIZE * 8;
280 
281 NAMESPACE_END
282 
283 // ************************* Miscellaneous *************************
284 
285 // What is the type of the third parameter to bind?
286 // For Unix, the new standard is ::socklen_t (typically unsigned int), and the old standard is int.
287 // Unfortunately there is no way to tell whether or not socklen_t is defined.
288 // To work around this, TYPE_OF_SOCKLEN_T is a macro so that you can change it from the makefile.
289 #ifndef TYPE_OF_SOCKLEN_T
290 # if defined(_WIN32) || defined(__CYGWIN__)
291 # define TYPE_OF_SOCKLEN_T int
292 # else
293 # define TYPE_OF_SOCKLEN_T ::socklen_t
294 # endif
295 #endif
296 
297 #if defined(__CYGWIN__) && defined(PREFER_WINDOWS_STYLE_SOCKETS)
298 # define __USE_W32_SOCKETS
299 #endif
300 
301 #ifndef CRYPTOPP_L1_CACHE_LINE_SIZE
302  // This should be a lower bound on the L1 cache line size. It's used for defense against timing attacks.
303  // Also see http://stackoverflow.com/questions/794632/programmatically-get-the-cache-line-size.
304  #if defined(_M_X64) || defined(__x86_64__) || (__arm64__) || (__aarch64__)
305  #define CRYPTOPP_L1_CACHE_LINE_SIZE 64
306  #else
307  // L1 cache line size is 32 on Pentium III and earlier
308  #define CRYPTOPP_L1_CACHE_LINE_SIZE 32
309  #endif
310 #endif
311 
312 // CRYPTOPP_ALIGN_DATA may be adjusted below in C++11 features
313 #ifndef CRYPTOPP_ALIGN_DATA
314  #if defined(_MSC_VER)
315  #define CRYPTOPP_ALIGN_DATA(x) __declspec(align(x))
316  #elif defined(__GNUC__)
317  #define CRYPTOPP_ALIGN_DATA(x) __attribute__((aligned(x)))
318  #else
319  #define CRYPTOPP_ALIGN_DATA(x)
320  #endif
321 #endif
322 
323 #ifndef CRYPTOPP_SECTION_ALIGN16
324 #if defined(__GNUC__) && !defined(__APPLE__)
325  // the alignment attribute doesn't seem to work without this section attribute when -fdata-sections is turned on
326  #define CRYPTOPP_SECTION_ALIGN16 __attribute__((section ("CryptoPP_Align16")))
327  #else
328  #define CRYPTOPP_SECTION_ALIGN16
329  #endif
330 #endif
331 
332 // The section attribute attempts to initialize CPU flags to avoid Valgrind findings above -O1
333 #if ((defined(__MACH__) && defined(__APPLE__)) && ((CRYPTOPP_LLVM_CLANG_VERSION >= 30600) || (CRYPTOPP_APPLE_CLANG_VERSION >= 70100) || (CRYPTOPP_GCC_VERSION >= 40300)))
334  #define CRYPTOPP_SECTION_INIT __attribute__((section ("__DATA,__data")))
335 #elif (defined(__ELF__) && (CRYPTOPP_GCC_VERSION >= 40300))
336  #define CRYPTOPP_SECTION_INIT __attribute__((section ("nocommon")))
337 #else
338  #define CRYPTOPP_SECTION_INIT
339 #endif
340 
341 #if defined(_MSC_VER) || defined(__fastcall)
342  #define CRYPTOPP_FASTCALL __fastcall
343 #else
344  #define CRYPTOPP_FASTCALL
345 #endif
346 
347 #ifdef _MSC_VER
348 #define CRYPTOPP_NO_VTABLE __declspec(novtable)
349 #else
350 #define CRYPTOPP_NO_VTABLE
351 #endif
352 
353 #ifdef _MSC_VER
354  // 4127: conditional expression is constant
355  // 4231: nonstandard extension used : 'extern' before template explicit instantiation
356  // 4250: dominance
357  // 4251: member needs to have dll-interface
358  // 4275: base needs to have dll-interface
359  // 4505: unreferenced local function
360  // 4512: assignment operator not generated
361  // 4660: explicitly instantiating a class that's already implicitly instantiated
362  // 4661: no suitable definition provided for explicit template instantiation request
363  // 4786: identifier was truncated in debug information
364  // 4355: 'this' : used in base member initializer list
365  // 4910: '__declspec(dllexport)' and 'extern' are incompatible on an explicit instantiation
366 # pragma warning(disable: 4127 4231 4250 4251 4275 4505 4512 4660 4661 4786 4355 4910)
367  // Security related, possible defects
368  // http://blogs.msdn.com/b/vcblog/archive/2010/12/14/off-by-default-compiler-warnings-in-visual-c.aspx
369 # pragma warning(once: 4191 4242 4263 4264 4266 4302 4826 4905 4906 4928)
370 #endif
371 
372 #ifdef __BORLANDC__
373 // 8037: non-const function called for const object. needed to work around BCB2006 bug
374 # pragma warn -8037
375 #endif
376 
377 // [GCC Bug 53431] "C++ preprocessor ignores #pragma GCC diagnostic". Clang honors it.
378 #if CRYPTOPP_GCC_DIAGNOSTIC_AVAILABLE
379 # pragma GCC diagnostic ignored "-Wunknown-pragmas"
380 # pragma GCC diagnostic ignored "-Wunused-function"
381 #endif
382 
383 // You may need to force include a C++ header on Android when using STLPort to ensure
384 // _STLPORT_VERSION is defined: CXXFLAGS="-DNDEBUG -g2 -O2 -std=c++11 -include iosfwd"
385 // TODO: Figure out C++17 and lack of std::uncaught_exception
386 #if (defined(_MSC_VER) && _MSC_VER <= 1300) || defined(__MWERKS__) || \
387  (defined(_STLPORT_VERSION) && ((_STLPORT_VERSION < 0x450) || defined(_STLP_NO_UNCAUGHT_EXCEPT_SUPPORT)))
388 # define CRYPTOPP_DISABLE_UNCAUGHT_EXCEPTION
389 #endif
390 
391 #ifndef CRYPTOPP_DISABLE_UNCAUGHT_EXCEPTION
392 # define CRYPTOPP_UNCAUGHT_EXCEPTION_AVAILABLE
393 #endif
394 
395 // ************************* CPU and Platforms *************************
396 
397 // See http://predef.sourceforge.net/prearch.html
398 #if (defined(_M_IX86) || defined(__i386__) || defined(__i386) || defined(_X86_) || defined(__I86__) || defined(__INTEL__))
399  #define CRYPTOPP_X86 1
400 #else
401  #define CRYPTOPP_X86 0
402 #endif
403 
404 // Linux provides X32, which is 32-bit integers, longs and pointers on x86_64 using the
405 // full x86_64 register set. Detect via __ILP32__ (http://wiki.debian.org/X32Port).
406 #if (defined(__ILP32__) || defined(_ILP32)) && defined(__x86_64__)
407  #define CRYPTOPP_X32 1
408 #else
409  #define CRYPTOPP_X32 0
410 #endif
411 
412 #if (defined(_M_X64) || defined(__x86_64__)) && !(defined(__ILP32__) || defined(_ILP32))
413  #define CRYPTOPP_X64 1
414 #else
415  #define CRYPTOPP_X64 0
416 #endif
417 
418 #if defined(__arm__) || defined(__aarch32__) || defined(_M_ARM)
419  #define CRYPTOPP_ARM32 1
420 #else
421  #define CRYPTOPP_ARM32 0
422 #endif
423 
424 // Microsoft plans to support ARM-64, but its not clear how to detect it.
425 // TODO: Add MSC_VER and ARM-64 platform define when available
426 #if defined(__arm64__) || defined(__aarch64__) || defined(_M_ARM64)
427  #define CRYPTOPP_ARM64 1
428 #else
429  #define CRYPTOPP_ARM64 0
430 #endif
431 
432 // ************************* ASM and Intrinsics *************************
433 
434 // X86, X32 and X64 cpu features
435 #if !defined(CRYPTOPP_DISABLE_ASM) && (CRYPTOPP_X86 || CRYPTOPP_X32 || CRYPTOPP_X64)
436 
437 // Sun Studio 12 provides GCC inline assembly, http://blogs.oracle.com/x86be/entry/gcc_style_asm_inlining_support
438 // We can enable SSE2 for Sun Studio in the makefile with -D__SSE2__, but users may not compile with it.
439 #if !defined(CRYPTOPP_DISABLE_ASM) && (__SUNPRO_CC >= 0x5100) && !defined(__SSE2__)
440 # define __SSE2__ 1
441 #endif
442 
443 // Apple's Clang prior to 5.0 cannot handle SSE2 (and Apple does not use LLVM Clang numbering...)
444 #if defined(CRYPTOPP_APPLE_CLANG_VERSION) && (CRYPTOPP_APPLE_CLANG_VERSION < 50000)
445 # define CRYPTOPP_DISABLE_ASM
446 #endif
447 
448 // Visual Studio allows inline ASM for 32-bit only. Clang, GCC and ICC can handle it for 32-bit and 64-bit.
449 #if (defined(CRYPTOPP_MSC_VERSION) && CRYPTOPP_X86) || defined(__GNUC__)
450  // C++Builder 2010 does not allow "call label" where label is defined within inline assembly
451  #define CRYPTOPP_X86_ASM_AVAILABLE
452 
453  #if !defined(CRYPTOPP_DISABLE_SSE2) && ((CRYPTOPP_MSC_VERSION >= 1200) || defined(__GNUC__) || defined(__SSE2__))
454  #define CRYPTOPP_SSE2_ASM_AVAILABLE 1
455  #endif
456 
457  #if !defined(CRYPTOPP_DISABLE_SSSE3) && ((CRYPTOPP_MSC_VERSION >= 1500) || (defined(__SSE3__) && \
458  defined(__SSSE3__)) || (CRYPTOPP_GCC_VERSION >= 40100))
459  #define CRYPTOPP_SSSE3_ASM_AVAILABLE 1
460  #endif
461 #endif
462 
463 #if defined(CRYPTOPP_MSC_VERSION) && defined(_M_X64)
464  #define CRYPTOPP_X64_MASM_AVAILABLE
465 #endif
466 
467 #if defined(__GNUC__) && defined(__x86_64__)
468  #define CRYPTOPP_X64_ASM_AVAILABLE
469 #endif
470 
471 #if !defined(CRYPTOPP_DISABLE_SSE2) && (defined(__SSE2__) || (CRYPTOPP_MSC_VERSION >= 1200) || defined(__GNUC__))
472  #define CRYPTOPP_SSE2_INTRINSICS_AVAILABLE 1
473 #endif
474 
475 // Clang cannot assemble without __SSSE3__ even though it claims to be GCC. Fixed up below.
476 #if !defined(CRYPTOPP_DISABLE_SSSE3) && ((defined(__SSE3__) && defined(__SSSE3__)) || (CRYPTOPP_MSC_VERSION >= 1500) || \
477  (__INTEL_COMPILER >= 900) || (CRYPTOPP_GCC_VERSION >= 40100))
478  #define CRYPTOPP_SSSE3_INTRINSICS_AVAILABLE 1
479 #endif
480 
481 #if !defined(CRYPTOPP_DISABLE_SSE4) && ((defined(__SSE4_1__) && defined(__SSE4_2__)) || (CRYPTOPP_MSC_VERSION >= 1500) || \
482  (__INTEL_COMPILER >= 1000) || (CRYPTOPP_GCC_VERSION >= 40300) || (CRYPTOPP_LLVM_VERSION >= 20300) || (CRYPTOPP_APPLE_VERSION >= 40100))
483  #define CRYPTOPP_SSE4_AVAILABLE 1
484 #endif
485 
486 // AES-NI and CLMUL are separate but grouped under this define.
487 #if !defined(CRYPTOPP_DISABLE_AESNI) && ((defined(__AES__) && defined(__PCLMUL__)) || (_MSC_FULL_VER >= 150030729) || \
488  (__INTEL_COMPILER >= 1110) || (CRYPTOPP_GCC_VERSION >= 40300) || (CRYPTOPP_LLVM_VERSION >= 20300) || (CRYPTOPP_APPLE_VERSION >= 40300))
489  #define CRYPTOPP_AESNI_AVAILABLE 1
490 #endif
491 
492 #if !defined(CRYPTOPP_DISABLE_AVX) && (defined(__AVX__) || (CRYPTOPP_MSC_VERSION >= 1900) || \
493  (__INTEL_COMPILER >= 1110) || (CRYPTOPP_GCC_VERSION >= 40300) || (CRYPTOPP_LLVM_VERSION >= 20300) || (CRYPTOPP_APPLE_VERSION >= 40500))
494  #define CRYPTOPP_AVX_INTRINSICS_AVAILABLE 1
495 #endif
496 
497 // SHA code path uses pblendw from SSE 4.1
498 #if !defined(CRYPTOPP_DISABLE_SHA) && (defined(__SHA__) || (CRYPTOPP_MSC_VERSION >= 1900) || \
499  (__INTEL_COMPILER >= 1400) || (CRYPTOPP_GCC_VERSION >= 40900) || (CRYPTOPP_LLVM_VERSION >= 30400) || (CRYPTOPP_APPLE_VERSION >= 50100))
500  #define CRYPTOPP_SSE_SHA_AVAILABLE 1
501 #endif
502 
503 // Clang cannot assemble without __SSSE3__ even though it claims to be GCC.
504 // We know its a problem upto Clang 3.5 on a P4. A Freedesktop bug report
505 // indicates its still a problem in Clang 3.7.
506 #if defined(__clang__) && ((CRYPTOPP_LLVM_VERSION <= 30700) || (CRYPTOPP_APPLE_VERSION <= 70000)) && !defined(__SSSE3__)
507 # undef CRYPTOPP_SSSE3_ASM_AVAILABLE
508 # undef CRYPTOPP_SSSE3_INTRINSICS_AVAILABLE
509 #endif
510 
511 #endif // CRYPTOPP_X86 || CRYPTOPP_X32 || CRYPTOPP_X64
512 
513 // ARM-32 (A-32 and Aarch32) And ARM-64 (Aarch64) cpu features
514 #if !defined(CRYPTOPP_DISABLE_ASM) && (CRYPTOPP_ARM32 || CRYPTOPP_ARM64)
515 
516 // Requires ARMv7 and ACLE 1.0. Testing shows ARMv7 is really ARMv7a under most toolchains.
517 //#if !defined(CRYPTOPP_NEON_AVAILABLE)
518 //# if defined(__ARM_NEON__) || defined(__ARM_NEON) || defined(_M_ARM)
519 //# define CRYPTOPP_NEON_AVAILABLE 1
520 //# endif
521 //#endif
522 
523 #if !defined(CRYPTOPP_DISABLE_NEON) && (defined(__ARM_NEON__) || (CRYPTOPP_MSC_VERSION >= 1600) || \
524  (CRYPTOPP_GCC_VERSION >= 40300) || (CRYPTOPP_LLVM_VERSION >= 20300) || (CRYPTOPP_APPLE_VERSION >= 40300))
525  #define CRYPTOPP_NEON_AVAILABLE 1
526 #endif
527 
528 // Requires ARMv8 and ACLE 2.0. GCC requires 4.8 and above.
529 // LLVM Clang requires 3.5. Apple Clang is unknown at the moment.
530 // Microsoft plans to support ARM-64, but its not clear how to detect it.
531 // TODO: Add MSC_VER and ARM-64 platform define when available
532 //#if !defined(CRYPTOPP_ARM_CRC32_AVAILABLE)
533 //# if defined(__ARM_FEATURE_CRC32)
534 //# define CRYPTOPP_ARM_CRC32_AVAILABLE 1
535 //# endif
536 //#endif
537 
538 #if !defined(CRYPTOPP_DISABLE_ARM_CRC32) && (defined(__aarch32__) || defined(__aarch64__) || defined(__ARM_FEATURE_CRC32) || \
539  (CRYPTOPP_GCC_VERSION >= 40800) || (CRYPTOPP_LLVM_VERSION >= 30300) || (CRYPTOPP_APPLE_VERSION >= 50000))
540  #define CRYPTOPP_ARM_CRC32_AVAILABLE 1
541 #endif
542 
543 // Requires ARMv8, ACLE 2.0 and Aarch64. GCC requires 4.8 and above.
544 // LLVM Clang requires 3.5. Apple Clang does not support it at the moment.
545 // Microsoft plans to support ARM-64, but its not clear how to detect it.
546 // TODO: Add MSC_VER and ARM-64 platform define when available
547 #if !defined(CRYPTOPP_ARM_PMULL_AVAILABLE)
548 # if defined(__ARM_FEATURE_CRYPTO) && !defined(__apple_build_version__)
549 # if defined(__arm64__) || defined(__aarch64__)
550 # define CRYPTOPP_ARM_PMULL_AVAILABLE 1
551 # endif
552 # endif
553 #endif
554 
555 //#if !defined(CRYPTOPP_DISABLE_ARM_PMULL) && (defined(__aarch32__) || defined(__aarch64__) || defined(__ARM_FEATURE_CRYPTO) || \
556 // (CRYPTOPP_GCC_VERSION >= 40800) || (CRYPTOPP_LLVM_VERSION >= 30300) || (CRYPTOPP_APPLE_VERSION >= 50000))
557 // #define CRYPTOPP_ARM_PMULL_AVAILABLE 1
558 //#endif
559 
560 // Requires ARMv8 and ACLE 2.0. GCC requires 4.8 and above.
561 // LLVM Clang requires 3.5. Apple Clang is unknown at the moment.
562 // Microsoft plans to support ARM-64, but its not clear how to detect it.
563 // TODO: Add MSC_VER and ARM-64 platform define when available
564 #if !defined(CRYPTOPP_ARM_CRYPTO_AVAILABLE)
565 # if defined(__ARM_FEATURE_CRYPTO)
566 # define CRYPTOPP_ARM_CRYPTO_AVAILABLE 1
567 # endif
568 #endif
569 
570 //#if !defined(CRYPTOPP_DISABLE_ARM_CRYPTO) && (defined(__aarch32__) || defined(__aarch64__) || defined(__ARM_FEATURE_CRYPTO) || \
571 // (CRYPTOPP_GCC_VERSION >= 40800) || (CRYPTOPP_LLVM_VERSION >= 30300) || (CRYPTOPP_APPLE_VERSION >= 50000))
572 // #define CRYPTOPP_ARM_CRYPTO_AVAILABLE 1
573 //#endif
574 
575 #endif // CRYPTOPP_ARM32 || CRYPTOPP_ARM64
576 
577 // ************************* Allocations *************************
578 
579 #if CRYPTOPP_SSE2_INTRINSICS_AVAILABLE || CRYPTOPP_SSE2_ASM_AVAILABLE || defined(CRYPTOPP_X64_MASM_AVAILABLE)
580  #define CRYPTOPP_ALIGN16 1
581 #else
582  #define CRYPTOPP_ALIGN16 0
583 #endif
584 
585 // how to allocate 16-byte aligned memory (for SSE2)
586 #if defined(_MSC_VER)
587  #define CRYPTOPP_MM_MALLOC_AVAILABLE
588 #elif defined(__APPLE__)
589  #define CRYPTOPP_APPLE_MALLOC_AVAILABLE
590 #elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
591  #define CRYPTOPP_MALLOC_ALIGNMENT_IS_16
592 #elif defined(__linux__) || defined(__sun__) || defined(__CYGWIN__)
593  #define CRYPTOPP_MEMALIGN_AVAILABLE
594 #else
595  #define CRYPTOPP_NO_ALIGNED_ALLOC
596 #endif
597 
598 // ************************* More miscellaneous *************************
599 
600 // how to disable inlining
601 #if defined(_MSC_VER)
602 # define CRYPTOPP_NOINLINE_DOTDOTDOT
603 # define CRYPTOPP_NOINLINE __declspec(noinline)
604 #elif defined(__GNUC__)
605 # define CRYPTOPP_NOINLINE_DOTDOTDOT
606 # define CRYPTOPP_NOINLINE __attribute__((noinline))
607 #else
608 # define CRYPTOPP_NOINLINE_DOTDOTDOT ...
609 # define CRYPTOPP_NOINLINE
610 #endif
611 
612 // How to declare class constants
613 #if (_MSC_VER == 1300) || defined(__INTEL_COMPILER) || defined(__BORLANDC__)
614 # define CRYPTOPP_CONSTANT(x) enum {x};
615 #else
616 # define CRYPTOPP_CONSTANT(x) static const int x;
617 #endif
618 
619 // Undo the ASM and Intrinsic related defines due to X32.
620 #if CRYPTOPP_X32
621 # undef CRYPTOPP_X64
622 # undef CRYPTOPP_X64_ASM_AVAILABLE
623 # undef CRYPTOPP_X64_MASM_AVAILABLE
624 #endif
625 
626 #if !defined(CRYPTOPP_NO_UNALIGNED_DATA_ACCESS) && !defined(CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS)
627 #if (CRYPTOPP_X64 || CRYPTOPP_X86 || CRYPTOPP_X32 || defined(__powerpc__) || (__ARM_FEATURE_UNALIGNED >= 1))
628  #define CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS
629 #endif
630 #endif
631 
632 // ***************** Initialization and Constructor priorities ********************
633 
634 // CRYPTOPP_INIT_PRIORITY attempts to manage initialization of C++ static objects.
635 // Under GCC, the library uses init_priority attribute in the range
636 // [CRYPTOPP_INIT_PRIORITY, CRYPTOPP_INIT_PRIORITY+100]. Under Windows,
637 // CRYPTOPP_INIT_PRIORITY enlists "#pragma init_seg(lib)". The platforms
638 // with gaps are Apple and Sun because they require linker scripts. Apple and
639 // Sun will use the library's Singletons to initialize and acquire resources.
640 // Also see http://cryptopp.com/wiki/Static_Initialization_Order_Fiasco
641 #ifndef CRYPTOPP_INIT_PRIORITY
642 # define CRYPTOPP_INIT_PRIORITY 250
643 #endif
644 
645 // CRYPTOPP_USER_PRIORITY is for other libraries and user code that is using Crypto++
646 // and managing C++ static object creation. It is guaranteed not to conflict with
647 // values used by (or would be used by) the Crypto++ library.
648 #if defined(CRYPTOPP_INIT_PRIORITY) && (CRYPTOPP_INIT_PRIORITY > 0)
649 # define CRYPTOPP_USER_PRIORITY (CRYPTOPP_INIT_PRIORITY + 101)
650 #else
651 # define CRYPTOPP_USER_PRIORITY 350
652 #endif
653 
654 // Most platforms allow us to specify when to create C++ objects. Apple and Sun do not.
655 #if (CRYPTOPP_INIT_PRIORITY > 0) && !(defined(NO_OS_DEPENDENCE) || defined(__APPLE__) || defined(__sun__))
656 # if (CRYPTOPP_GCC_VERSION >= 30000) || (CRYPTOPP_LLVM_CLANG_VERSION >= 20900) || (_INTEL_COMPILER >= 800)
657 # define HAVE_GCC_INIT_PRIORITY 1
658 # elif (CRYPTOPP_MSC_VERSION >= 1310)
659 # define HAVE_MSC_INIT_PRIORITY 1
660 # endif
661 #endif // CRYPTOPP_INIT_PRIORITY, NO_OS_DEPENDENCE, Apple, Sun
662 
663 // ***************** determine availability of OS features ********************
664 
665 #ifndef NO_OS_DEPENDENCE
666 
667 #if defined(_WIN32) || defined(__CYGWIN__)
668 #define CRYPTOPP_WIN32_AVAILABLE
669 #endif
670 
671 #if defined(__unix__) || defined(__MACH__) || defined(__NetBSD__) || defined(__sun)
672 #define CRYPTOPP_UNIX_AVAILABLE
673 #endif
674 
675 #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
676 #define CRYPTOPP_BSD_AVAILABLE
677 #endif
678 
679 #if defined(CRYPTOPP_WIN32_AVAILABLE) || defined(CRYPTOPP_UNIX_AVAILABLE)
680 # define HIGHRES_TIMER_AVAILABLE
681 #endif
682 
683 #ifdef CRYPTOPP_WIN32_AVAILABLE
684 # if !defined(WINAPI_FAMILY)
685 # define THREAD_TIMER_AVAILABLE
686 # elif defined(WINAPI_FAMILY)
687 # if (WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP))
688 # define THREAD_TIMER_AVAILABLE
689 # endif
690 # endif
691 #endif
692 
693 #ifdef CRYPTOPP_UNIX_AVAILABLE
694 # define HAS_BERKELEY_STYLE_SOCKETS
695 # define SOCKETS_AVAILABLE
696 #endif
697 
698 // Sockets are only available under Windows Runtime desktop partition apps (despite the MSDN literature)
699 #ifdef CRYPTOPP_WIN32_AVAILABLE
700 # define HAS_WINDOWS_STYLE_SOCKETS
701 # if !defined(WINAPI_FAMILY)
702 # define SOCKETS_AVAILABLE
703 # elif defined(WINAPI_FAMILY)
704 # if (WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP))
705 # define SOCKETS_AVAILABLE
706 # endif
707 # endif
708 #endif
709 
710 #if defined(HAS_WINDOWS_STYLE_SOCKETS) && (!defined(HAS_BERKELEY_STYLE_SOCKETS) || defined(PREFER_WINDOWS_STYLE_SOCKETS))
711 # define USE_WINDOWS_STYLE_SOCKETS
712 #else
713 # define USE_BERKELEY_STYLE_SOCKETS
714 #endif
715 
716 #if defined(CRYPTOPP_WIN32_AVAILABLE) && defined(SOCKETS_AVAILABLE) && !defined(USE_BERKELEY_STYLE_SOCKETS)
717 # define WINDOWS_PIPES_AVAILABLE
718 #endif
719 
720 #if defined(CRYPTOPP_UNIX_AVAILABLE) || defined(CRYPTOPP_DOXYGEN_PROCESSING)
721 # define NONBLOCKING_RNG_AVAILABLE
722 # define BLOCKING_RNG_AVAILABLE
723 # define OS_RNG_AVAILABLE
724 # define HAS_PTHREADS
725 # define THREADS_AVAILABLE
726 #endif
727 
728 // Cygwin/Newlib requires _XOPEN_SOURCE=700
729 #if defined(CRYPTOPP_UNIX_AVAILABLE)
730 # define UNIX_SIGNALS_AVAILABLE 1
731 #endif
732 
733 #ifdef CRYPTOPP_WIN32_AVAILABLE
734 # if !defined(WINAPI_FAMILY)
735 # define HAS_WINTHREADS
736 # define THREADS_AVAILABLE
737 # define NONBLOCKING_RNG_AVAILABLE
738 # define OS_RNG_AVAILABLE
739 # elif defined(WINAPI_FAMILY)
740 # if (WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP))
741 # define HAS_WINTHREADS
742 # define THREADS_AVAILABLE
743 # define NONBLOCKING_RNG_AVAILABLE
744 # define OS_RNG_AVAILABLE
745 # elif !(WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP))
746 # if ((WINVER >= 0x0A00 /*_WIN32_WINNT_WIN10*/) || (_WIN32_WINNT >= 0x0A00 /*_WIN32_WINNT_WIN10*/))
747 # define NONBLOCKING_RNG_AVAILABLE
748 # define OS_RNG_AVAILABLE
749 # endif
750 # endif
751 # endif
752 #endif
753 
754 #endif // NO_OS_DEPENDENCE
755 
756 // ***************** DLL related ********************
757 
758 #if defined(CRYPTOPP_WIN32_AVAILABLE) && !defined(CRYPTOPP_DOXYGEN_PROCESSING)
759 
760 #ifdef CRYPTOPP_EXPORTS
761 #define CRYPTOPP_IS_DLL
762 #define CRYPTOPP_DLL __declspec(dllexport)
763 #elif defined(CRYPTOPP_IMPORTS)
764 #define CRYPTOPP_IS_DLL
765 #define CRYPTOPP_DLL __declspec(dllimport)
766 #else
767 #define CRYPTOPP_DLL
768 #endif
769 
770 #define CRYPTOPP_API __cdecl
771 
772 #else // not CRYPTOPP_WIN32_AVAILABLE
773 
774 #define CRYPTOPP_DLL
775 #define CRYPTOPP_API
776 
777 #endif // CRYPTOPP_WIN32_AVAILABLE
778 
779 #if defined(__MWERKS__)
780 #define CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS extern class CRYPTOPP_DLL
781 #elif defined(__BORLANDC__) || defined(__SUNPRO_CC)
782 #define CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS template class CRYPTOPP_DLL
783 #else
784 #define CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS extern template class CRYPTOPP_DLL
785 #endif
786 
787 #if defined(CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES) && !defined(CRYPTOPP_IMPORTS)
788 #define CRYPTOPP_DLL_TEMPLATE_CLASS template class CRYPTOPP_DLL
789 #else
790 #define CRYPTOPP_DLL_TEMPLATE_CLASS CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS
791 #endif
792 
793 #if defined(__MWERKS__)
794 #define CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS extern class
795 #elif defined(__BORLANDC__) || defined(__SUNPRO_CC)
796 #define CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS template class
797 #else
798 #define CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS extern template class
799 #endif
800 
801 #if defined(CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES) && !defined(CRYPTOPP_EXPORTS)
802 #define CRYPTOPP_STATIC_TEMPLATE_CLASS template class
803 #else
804 #define CRYPTOPP_STATIC_TEMPLATE_CLASS CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS
805 #endif
806 
807 // ************** Unused variable ***************
808 
809 // Portable way to suppress warnings.
810 // Moved from misc.h due to circular depenedencies.
811 #define CRYPTOPP_UNUSED(x) ((void)(x))
812 
813 // ************** Deprecated ***************
814 
815 #if (CRYPTOPP_GCC_VERSION >= 40500) || (CRYPTOPP_LLVM_CLANG_VERSION >= 20800)
816 # define CRYPTOPP_DEPRECATED(msg) __attribute__((deprecated (msg)));
817 #elif (CRYPTOPP_GCC_VERSION)
818 # define CRYPTOPP_DEPRECATED(msg) __attribute__((deprecated));
819 #else
820 # define CRYPTOPP_DEPRECATED(msg)
821 #endif
822 
823 // ***************** C++11 related ********************
824 
825 // Visual Studio began at VS2010, http://msdn.microsoft.com/en-us/library/hh567368%28v=vs.110%29.aspx.
826 // Intel and C++11 language features, http://software.intel.com/en-us/articles/c0x-features-supported-by-intel-c-compiler
827 // GCC and C++11 language features, http://gcc.gnu.org/projects/cxx0x.html
828 // Clang and C++11 language features, http://clang.llvm.org/cxx_status.html
829 #if ((_MSC_VER >= 1600) || (__cplusplus >= 201103L)) && !defined(_STLPORT_VERSION)
830 # define CRYPTOPP_CXX11 1
831 #endif
832 
833 // Hack ahead. Apple's standard library does not have C++'s unique_ptr in C++11. We can't
834 // test for unique_ptr directly because some of the non-Apple Clangs on OS X fail the same
835 // way. However, modern standard libraries have <forward_list>, so we test for it instead.
836 // Thanks to Jonathan Wakely for devising the clever test for modern/ancient versions.
837 // TODO: test under Xcode 3, where g++ is really g++.
838 #if defined(__APPLE__) && defined(__clang__)
839 # if !(defined(__has_include) && __has_include(<forward_list>))
840 # undef CRYPTOPP_CXX11
841 # endif
842 #endif
843 
844 // C++11 or C++14 is available
845 #if defined(CRYPTOPP_CXX11)
846 
847 // Compatibility with non-clang compilers.
848 #ifndef __has_feature
849 # define __has_feature(x) 0
850 #endif
851 
852 // atomics: MS at VS2012 (17.00); GCC at 4.4; Clang at 3.1/3.2; Intel 13.0; SunCC 5.14.
853 #if (CRYPTOPP_MSC_VERSION >= 1700)
854 # define CRYPTOPP_CXX11_ATOMICS 1
855 #elif __has_feature(cxx_atomic)
856 # define CRYPTOPP_CXX11_ATOMICS 1
857 #elif (__INTEL_COMPILER >= 1300)
858 # define CRYPTOPP_CXX11_ATOMICS 1
859 #elif (CRYPTOPP_GCC_VERSION >= 40400)
860 # define CRYPTOPP_CXX11_ATOMICS 1
861 #elif (__SUNPRO_CC >= 0x5140)
862 # define CRYPTOPP_CXX11_ATOMICS 1
863 #endif // atomics
864 
865 // synchronization: MS at VS2012 (17.00); GCC at 4.4; Clang at 3.3; Xcode 5.0; Intel 12.0; SunCC 5.13.
866 // TODO: verify Clang and Intel versions; find __has_feature(x) extension for Clang
867 #if (CRYPTOPP_MSC_VERSION >= 1700)
868 # define CRYPTOPP_CXX11_SYNCHRONIZATION 1
869 #elif (CRYPTOPP_LLVM_CLANG_VERSION >= 30300) || (CRYPTOPP_APPLE_CLANG_VERSION >= 50000)
870 # define CRYPTOPP_CXX11_SYNCHRONIZATION 1
871 #elif (__INTEL_COMPILER >= 1200)
872 # define CRYPTOPP_CXX11_SYNCHRONIZATION 1
873 #elif (CRYPTOPP_GCC_VERSION >= 40400)
874 # define CRYPTOPP_CXX11_SYNCHRONIZATION 1
875 #elif (__SUNPRO_CC >= 0x5130)
876 # define CRYPTOPP_CXX11_SYNCHRONIZATION 1
877 #endif // synchronization
878 
879 // Dynamic Initialization and Destruction with Concurrency ("Magic Statics")
880 // 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.
881 // Microsoft's implementation only works for Vista and above, so its further
882 // limited. http://connect.microsoft.com/VisualStudio/feedback/details/1789709
883 #if (CRYPTOPP_MSC_VERSION >= 1900) && ((WINVER >= 0x0600 /*_WIN32_WINNT_VISTA*/) || (_WIN32_WINNT >= 0x0600 /*_WIN32_WINNT_VISTA*/))
884 # define CRYPTOPP_CXX11_DYNAMIC_INIT 1
885 #elif (CRYPTOPP_LLVM_CLANG_VERSION >= 20900) || (CRYPTOPP_APPLE_CLANG_VERSION >= 40000)
886 # define CRYPTOPP_CXX11_DYNAMIC_INIT 1
887 #elif (__INTEL_COMPILER >= 1110)
888 # define CRYPTOPP_CXX11_DYNAMIC_INIT 1
889 #elif (CRYPTOPP_GCC_VERSION >= 40300)
890 # define CRYPTOPP_CXX11_DYNAMIC_INIT 1
891 #elif (__SUNPRO_CC >= 0x5130)
892 # define CRYPTOPP_CXX11_DYNAMIC_INIT 1
893 #endif // Dynamic Initialization compilers
894 
895 // alignof/alignas: MS at VS2015 (19.00); GCC at 4.8; Clang at 3.0; Intel 15.0; SunCC 5.13.
896 #if (CRYPTOPP_MSC_VERSION >= 1900)
897 # define CRYPTOPP_CXX11_ALIGNAS 1
898 #elif __has_feature(cxx_alignas)
899 # define CRYPTOPP_CXX11_ALIGNAS 1
900 #elif (__INTEL_COMPILER >= 1500)
901 # define CRYPTOPP_CXX11_ALIGNAS 1
902 #elif (CRYPTOPP_GCC_VERSION >= 40800)
903 # define CRYPTOPP_CXX11_ALIGNAS 1
904 #elif (__SUNPRO_CC >= 0x5130)
905 # define CRYPTOPP_CXX11_ALIGNAS 1
906 #endif // alignas
907 
908 // alignof: MS at VS2015 (19.00); GCC at 4.5; Clang at 2.9; Intel 15.0; SunCC 5.13.
909 #if (CRYPTOPP_MSC_VERSION >= 1900)
910 # define CRYPTOPP_CXX11_ALIGNOF 1
911 #elif __has_feature(cxx_alignof)
912 # define CRYPTOPP_CXX11_ALIGNOF 1
913 #elif (__INTEL_COMPILER >= 1500)
914 # define CRYPTOPP_CXX11_ALIGNOF 1
915 #elif (CRYPTOPP_GCC_VERSION >= 40500)
916 # define CRYPTOPP_CXX11_ALIGNOF 1
917 #elif (__SUNPRO_CC >= 0x5130)
918 # define CRYPTOPP_CXX11_ALIGNOF 1
919 #endif // alignof
920 
921 // noexcept: MS at VS2015 (19.00); GCC at 4.6; Clang at 3.0; Intel 14.0; SunCC 5.13.
922 #if (CRYPTOPP_MSC_VERSION >= 1900)
923 # define CRYPTOPP_CXX11_NOEXCEPT 1
924 #elif __has_feature(cxx_noexcept)
925 # define CRYPTOPP_CXX11_NOEXCEPT 1
926 #elif (__INTEL_COMPILER >= 1400)
927 # define CRYPTOPP_CXX11_NOEXCEPT 1
928 #elif (CRYPTOPP_GCC_VERSION >= 40600)
929 # define CRYPTOPP_CXX11_NOEXCEPT 1
930 #elif (__SUNPRO_CC >= 0x5130)
931 # define CRYPTOPP_CXX11_NOEXCEPT 1
932 #endif // noexcept compilers
933 
934 // variadic templates: MS at VS2013 (18.00); GCC at 4.3; Clang at 2.9; Intel 12.1; SunCC 5.13.
935 #if (CRYPTOPP_MSC_VERSION >= 1800)
936 # define CRYPTOPP_CXX11_VARIADIC_TEMPLATES 1
937 #elif __has_feature(cxx_variadic_templates)
938 # define CRYPTOPP_CXX11_VARIADIC_TEMPLATES 1
939 #elif (__INTEL_COMPILER >= 1210)
940 # define CRYPTOPP_CXX11_VARIADIC_TEMPLATES 1
941 #elif (CRYPTOPP_GCC_VERSION >= 40300)
942 # define CRYPTOPP_CXX11_VARIADIC_TEMPLATES 1
943 #elif (__SUNPRO_CC >= 0x5130)
944 # define CRYPTOPP_CXX11_VARIADIC_TEMPLATES 1
945 #endif // variadic templates
946 
947 // constexpr: MS at VS2015 (19.00); GCC at 4.6; Clang at 3.1; Intel 16.0; SunCC 5.13.
948 // Intel has mis-supported the feature since at least ICPC 13.00
949 #if (CRYPTOPP_MSC_VERSION >= 1900)
950 # define CRYPTOPP_CXX11_CONSTEXPR 1
951 #elif __has_feature(cxx_constexpr)
952 # define CRYPTOPP_CXX11_CONSTEXPR 1
953 #elif (__INTEL_COMPILER >= 1600)
954 # define CRYPTOPP_CXX11_CONSTEXPR 1
955 #elif (CRYPTOPP_GCC_VERSION >= 40600)
956 # define CRYPTOPP_CXX11_CONSTEXPR 1
957 #elif (__SUNPRO_CC >= 0x5130)
958 # define CRYPTOPP_CXX11_CONSTEXPR 1
959 #endif // constexpr compilers
960 
961 // nullptr_t: MS at VS2010 (16.00); GCC at 4.6; Clang at 3.3; Intel 10.0; SunCC 5.13.
962 #if (CRYPTOPP_MSC_VERSION >= 1600)
963 # define CRYPTOPP_CXX11_NULLPTR 1
964 #elif __has_feature(cxx_nullptr)
965 # define CRYPTOPP_CXX11_NULLPTR 1
966 #elif (__INTEL_COMPILER >= 1000)
967 # define CRYPTOPP_CXX11_NULLPTR 1
968 #elif (CRYPTOPP_GCC_VERSION >= 40600)
969 # define CRYPTOPP_CXX11_NULLPTR 1
970 #elif (__SUNPRO_CC >= 0x5130)
971 # define CRYPTOPP_CXX11_NULLPTR 1
972 #endif // nullptr_t compilers
973 
974 // TODO: Emplacement, R-values and Move semantics
975 // Needed because we are catching warnings with GCC and MSC
976 
977 #endif // CRYPTOPP_CXX11
978 
979 #if defined(CRYPTOPP_CXX11_NOEXCEPT)
980 # define CRYPTOPP_THROW noexcept(false)
981 # define CRYPTOPP_NO_THROW noexcept(true)
982 #else
983 # define CRYPTOPP_THROW
984 # define CRYPTOPP_NO_THROW
985 #endif // CRYPTOPP_CXX11_NOEXCEPT
986 
987 // http://stackoverflow.com/a/13867690/608639
988 #if defined(CRYPTOPP_CXX11_CONSTEXPR)
989 # define CRYPTOPP_STATIC_CONSTEXPR static constexpr
990 # define CRYPTOPP_CONSTEXPR constexpr
991 #else
992 # define CRYPTOPP_STATIC_CONSTEXPR static
993 # define CRYPTOPP_CONSTEXPR
994 #endif // CRYPTOPP_CXX11_CONSTEXPR
995 
996 // Hack... CRYPTOPP_ALIGN_DATA is defined earlier, before C++11 alignas availability is determined
997 #if defined(CRYPTOPP_CXX11_ALIGNAS)
998 # undef CRYPTOPP_ALIGN_DATA
999 # define CRYPTOPP_ALIGN_DATA(x) alignas(x)
1000 #endif // CRYPTOPP_CXX11_ALIGNAS
1001 
1002 // Hack... CRYPTOPP_CONSTANT is defined earlier, before C++11 constexpr availability is determined
1003 // http://stackoverflow.com/q/35213098/608639
1004 #if defined(CRYPTOPP_CXX11_CONSTEXPR)
1005 # undef CRYPTOPP_CONSTANT
1006 # define CRYPTOPP_CONSTANT(x) constexpr static int x;
1007 #endif
1008 
1009 // Hack... C++11 nullptr_t type safety and analysis
1010 #if defined(CRYPTOPP_CXX11_NULLPTR) && !defined(NULLPTR)
1011 # define NULLPTR nullptr
1012 #elif !defined(NULLPTR)
1013 # define NULLPTR NULL
1014 #endif // CRYPTOPP_CXX11_NULLPTR
1015 
1016 // OK to comment the following out, but please report it so we can fix it.
1017 // C++17 value taken from http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4567.pdf.
1018 #if (defined(__cplusplus) && (__cplusplus >= 199711L) && (__cplusplus < 201402L)) && !defined(CRYPTOPP_UNCAUGHT_EXCEPTION_AVAILABLE)
1019 # error "std::uncaught_exception is not available. This is likely a configuration error."
1020 #endif
1021 
1022 #endif
Crypto++ library namespace.