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