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