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