Crypto++
config.h
1 /* config.h. Generated from config.h.in by configure. */
2 // Debian note: This is a copy of the original config.h file except for the two
3 // endianness undefs below; they are substituted by the autoconf process
4 // according to the build architecture.
5 
6 #ifndef CRYPTOPP_CONFIG_H
7 #define CRYPTOPP_CONFIG_H
8 
9 // ***************** Important Settings ********************
10 
11 // Endianness
12 /* #undef IS_BIG_ENDIAN */
13 #define IS_LITTLE_ENDIAN /**/
14 
15 // define this if you want to disable all OS-dependent features,
16 // such as sockets and OS-provided random number generators
17 // #define NO_OS_DEPENDENCE
18 
19 // Define this to use features provided by Microsoft's CryptoAPI.
20 // Currently the only feature used is random number generation.
21 // This macro will be ignored if NO_OS_DEPENDENCE is defined.
22 #define USE_MS_CRYPTOAPI
23 
24 // Define this to 1 to enforce the requirement in FIPS 186-2 Change Notice 1 that only 1024 bit moduli be used
25 #ifndef DSA_1024_BIT_MODULUS_ONLY
26 # define DSA_1024_BIT_MODULUS_ONLY 1
27 #endif
28 
29 // ***************** Less Important Settings ***************
30 
31 // define this to retain (as much as possible) old deprecated function and class names
32 // #define CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY
33 
34 #define GZIP_OS_CODE 0
35 
36 // Try this if your CPU has 256K internal cache or a slow multiply instruction
37 // and you want a (possibly) faster IDEA implementation using log tables
38 // #define IDEA_LARGECACHE
39 
40 // Define this if, for the linear congruential RNG, you want to use
41 // the original constants as specified in S.K. Park and K.W. Miller's
42 // CACM paper.
43 // #define LCRNG_ORIGINAL_NUMBERS
44 
45 // choose which style of sockets to wrap (mostly useful for cygwin which has both)
46 #define PREFER_BERKELEY_STYLE_SOCKETS
47 // #define PREFER_WINDOWS_STYLE_SOCKETS
48 
49 // set the name of Rijndael cipher, was "Rijndael" before version 5.3
50 #define CRYPTOPP_RIJNDAEL_NAME "AES"
51 
52 // ***************** Important Settings Again ********************
53 // But the defaults should be ok.
54 
55 // namespace support is now required
56 #ifdef NO_NAMESPACE
57 # error namespace support is now required
58 #endif
59 
60 // Define this to workaround a Microsoft CryptoAPI bug where
61 // each call to CryptAcquireContext causes a 100 KB memory leak.
62 // Defining this will cause Crypto++ to make only one call to CryptAcquireContext.
63 #define WORKAROUND_MS_BUG_Q258000
64 
65 #ifdef CRYPTOPP_DOXYGEN_PROCESSING
66 // Avoid putting "CryptoPP::" in front of everything in Doxygen output
67 # define CryptoPP
68 # define NAMESPACE_BEGIN(x)
69 # define NAMESPACE_END
70 // Get Doxygen to generate better documentation for these typedefs
71 # define DOCUMENTED_TYPEDEF(x, y) class y : public x {};
72 #else
73 # define NAMESPACE_BEGIN(x) namespace x {
74 # define NAMESPACE_END }
75 # define DOCUMENTED_TYPEDEF(x, y) typedef x y;
76 #endif
77 #define ANONYMOUS_NAMESPACE_BEGIN namespace {
78 #define USING_NAMESPACE(x) using namespace x;
79 #define DOCUMENTED_NAMESPACE_BEGIN(x) namespace x {
80 #define DOCUMENTED_NAMESPACE_END }
81 
82 // What is the type of the third parameter to bind?
83 // For Unix, the new standard is ::socklen_t (typically unsigned int), and the old standard is int.
84 // Unfortunately there is no way to tell whether or not socklen_t is defined.
85 // To work around this, TYPE_OF_SOCKLEN_T is a macro so that you can change it from the makefile.
86 #ifndef TYPE_OF_SOCKLEN_T
87 # if defined(_WIN32) || defined(__CYGWIN__)
88 # define TYPE_OF_SOCKLEN_T int
89 # else
90 # define TYPE_OF_SOCKLEN_T ::socklen_t
91 # endif
92 #endif
93 
94 #if defined(__CYGWIN__) && defined(PREFER_WINDOWS_STYLE_SOCKETS)
95 # define __USE_W32_SOCKETS
96 #endif
97 
98 typedef unsigned char byte; // put in global namespace to avoid ambiguity with other byte typedefs
99 
100 NAMESPACE_BEGIN(CryptoPP)
101 
102 typedef unsigned short word16;
103 typedef unsigned int word32;
104 
105 #if defined(_MSC_VER) || defined(__BORLANDC__)
106  typedef unsigned __int64 word64;
107  #define W64LIT(x) x##ui64
108 #else
109  typedef unsigned long long word64;
110  #define W64LIT(x) x##ULL
111 #endif
112 
113 // define large word type, used for file offsets and such
114 typedef word64 lword;
115 const lword LWORD_MAX = W64LIT(0xffffffffffffffff);
116 
117 #ifdef __GNUC__
118  #define CRYPTOPP_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
119 #endif
120 
121 // define hword, word, and dword. these are used for multiprecision integer arithmetic
122 // Intel compiler won't have _umul128 until version 10.0. See http://softwarecommunity.intel.com/isn/Community/en-US/forums/thread/30231625.aspx
123 #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__))
124  typedef word32 hword;
125  typedef word64 word;
126 #else
127  #define CRYPTOPP_NATIVE_DWORD_AVAILABLE
128  #if defined(__alpha__) || defined(__ia64__) || defined(_ARCH_PPC64) || defined(__x86_64__) || defined(__mips64) || defined(__sparc64__)
129  #if defined(__GNUC__) && !defined(__INTEL_COMPILER) && !(CRYPTOPP_GCC_VERSION == 40001 && defined(__APPLE__)) && CRYPTOPP_GCC_VERSION >= 30400
130  // GCC 4.0.1 on MacOS X is missing __umodti3 and __udivti3
131  // mode(TI) division broken on amd64 with GCC earlier than GCC 3.4
132  typedef word32 hword;
133  typedef word64 word;
134  typedef __uint128_t dword;
135  typedef __uint128_t word128;
136  #define CRYPTOPP_WORD128_AVAILABLE
137  #else
138  // 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
139  typedef word16 hword;
140  typedef word32 word;
141  typedef word64 dword;
142  #endif
143  #else
144  // being here means the native register size is probably 32 bits or less
145  #define CRYPTOPP_BOOL_SLOW_WORD64 1
146  typedef word16 hword;
147  typedef word32 word;
148  typedef word64 dword;
149  #endif
150 #endif
151 #ifndef CRYPTOPP_BOOL_SLOW_WORD64
152  #define CRYPTOPP_BOOL_SLOW_WORD64 0
153 #endif
154 
155 const unsigned int WORD_SIZE = sizeof(word);
156 const unsigned int WORD_BITS = WORD_SIZE * 8;
157 
158 NAMESPACE_END
159 
160 #ifndef CRYPTOPP_L1_CACHE_LINE_SIZE
161  // This should be a lower bound on the L1 cache line size. It's used for defense against timing attacks.
162  #if defined(_M_X64) || defined(__x86_64__)
163  #define CRYPTOPP_L1_CACHE_LINE_SIZE 64
164  #else
165  // L1 cache line size is 32 on Pentium III and earlier
166  #define CRYPTOPP_L1_CACHE_LINE_SIZE 32
167  #endif
168 #endif
169 
170 #if defined(_MSC_VER)
171  #if _MSC_VER == 1200
172  #include <malloc.h>
173  #endif
174  #if _MSC_VER > 1200 || defined(_mm_free)
175  #define CRYPTOPP_MSVC6PP_OR_LATER // VC 6 processor pack or later
176  #else
177  #define CRYPTOPP_MSVC6_NO_PP // VC 6 without processor pack
178  #endif
179 #endif
180 
181 #ifndef CRYPTOPP_ALIGN_DATA
182  #if defined(CRYPTOPP_MSVC6PP_OR_LATER)
183  #define CRYPTOPP_ALIGN_DATA(x) __declspec(align(x))
184  #elif defined(__GNUC__)
185  #define CRYPTOPP_ALIGN_DATA(x) __attribute__((aligned(x)))
186  #else
187  #define CRYPTOPP_ALIGN_DATA(x)
188  #endif
189 #endif
190 
191 #ifndef CRYPTOPP_SECTION_ALIGN16
192  #if defined(__GNUC__) && !defined(__APPLE__)
193  // the alignment attribute doesn't seem to work without this section attribute when -fdata-sections is turned on
194  #define CRYPTOPP_SECTION_ALIGN16 __attribute__((section ("CryptoPP_Align16")))
195  #else
196  #define CRYPTOPP_SECTION_ALIGN16
197  #endif
198 #endif
199 
200 #if defined(_MSC_VER) || defined(__fastcall)
201  #define CRYPTOPP_FASTCALL __fastcall
202 #else
203  #define CRYPTOPP_FASTCALL
204 #endif
205 
206 // VC60 workaround: it doesn't allow typename in some places
207 #if defined(_MSC_VER) && (_MSC_VER < 1300)
208 #define CPP_TYPENAME
209 #else
210 #define CPP_TYPENAME typename
211 #endif
212 
213 // VC60 workaround: can't cast unsigned __int64 to float or double
214 #if defined(_MSC_VER) && !defined(CRYPTOPP_MSVC6PP_OR_LATER)
215 #define CRYPTOPP_VC6_INT64 (__int64)
216 #else
217 #define CRYPTOPP_VC6_INT64
218 #endif
219 
220 #ifdef _MSC_VER
221 #define CRYPTOPP_NO_VTABLE __declspec(novtable)
222 #else
223 #define CRYPTOPP_NO_VTABLE
224 #endif
225 
226 #ifdef _MSC_VER
227  // 4231: nonstandard extension used : 'extern' before template explicit instantiation
228  // 4250: dominance
229  // 4251: member needs to have dll-interface
230  // 4275: base needs to have dll-interface
231  // 4660: explicitly instantiating a class that's already implicitly instantiated
232  // 4661: no suitable definition provided for explicit template instantiation request
233  // 4786: identifer was truncated in debug information
234  // 4355: 'this' : used in base member initializer list
235  // 4910: '__declspec(dllexport)' and 'extern' are incompatible on an explicit instantiation
236 # pragma warning(disable: 4231 4250 4251 4275 4660 4661 4786 4355 4910)
237 #endif
238 
239 #ifdef __BORLANDC__
240 // 8037: non-const function called for const object. needed to work around BCB2006 bug
241 # pragma warn -8037
242 #endif
243 
244 #if (defined(_MSC_VER) && _MSC_VER <= 1300) || defined(__MWERKS__) || defined(_STLPORT_VERSION)
245 #define CRYPTOPP_DISABLE_UNCAUGHT_EXCEPTION
246 #endif
247 
248 #ifndef CRYPTOPP_DISABLE_UNCAUGHT_EXCEPTION
249 #define CRYPTOPP_UNCAUGHT_EXCEPTION_AVAILABLE
250 #endif
251 
252 #ifdef CRYPTOPP_DISABLE_X86ASM // for backwards compatibility: this macro had both meanings
253 #define CRYPTOPP_DISABLE_ASM
254 #define CRYPTOPP_DISABLE_SSE2
255 #endif
256 
257 #if !defined(CRYPTOPP_DISABLE_ASM) && ((defined(_MSC_VER) && defined(_M_IX86)) || (defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))))
258  // C++Builder 2010 does not allow "call label" where label is defined within inline assembly
259  #define CRYPTOPP_X86_ASM_AVAILABLE
260 
261  #if !defined(CRYPTOPP_DISABLE_SSE2) && (defined(CRYPTOPP_MSVC6PP_OR_LATER) || CRYPTOPP_GCC_VERSION >= 30300)
262  #define CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE 1
263  #else
264  #define CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE 0
265  #endif
266 
267  // SSSE3 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.
268  // GCC 4.1.2 was released on 2/13/2007, so we'll use that as a proxy for the binutils version.
269  #if !defined(CRYPTOPP_DISABLE_SSSE3) && (_MSC_VER >= 1400 || CRYPTOPP_GCC_VERSION >= 40102)
270  #define CRYPTOPP_BOOL_SSSE3_ASM_AVAILABLE 1
271  #else
272  #define CRYPTOPP_BOOL_SSSE3_ASM_AVAILABLE 0
273  #endif
274 #endif
275 
276 #if !defined(CRYPTOPP_DISABLE_ASM) && defined(_MSC_VER) && defined(_M_X64)
277  #define CRYPTOPP_X64_MASM_AVAILABLE
278 #endif
279 
280 #if !defined(CRYPTOPP_DISABLE_ASM) && defined(__GNUC__) && defined(__x86_64__)
281  #define CRYPTOPP_X64_ASM_AVAILABLE
282 #endif
283 
284 #if !defined(CRYPTOPP_DISABLE_SSE2) && (defined(CRYPTOPP_MSVC6PP_OR_LATER) || defined(__SSE2__))
285  #define CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE 1
286 #else
287  #define CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE 0
288 #endif
289 
290 #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)
291  #define CRYPTOPP_BOOL_AESNI_INTRINSICS_AVAILABLE 1
292 #else
293  #define CRYPTOPP_BOOL_AESNI_INTRINSICS_AVAILABLE 0
294 #endif
295 
296 #if CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE || CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE || defined(CRYPTOPP_X64_MASM_AVAILABLE)
297  #define CRYPTOPP_BOOL_ALIGN16_ENABLED 1
298 #else
299  #define CRYPTOPP_BOOL_ALIGN16_ENABLED 0
300 #endif
301 
302 // how to allocate 16-byte aligned memory (for SSE2)
303 #if defined(CRYPTOPP_MSVC6PP_OR_LATER)
304  #define CRYPTOPP_MM_MALLOC_AVAILABLE
305 #elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
306  #define CRYPTOPP_MALLOC_ALIGNMENT_IS_16
307 #elif defined(__linux__) || defined(__sun__) || defined(__CYGWIN__)
308  #define CRYPTOPP_MEMALIGN_AVAILABLE
309 #else
310  #define CRYPTOPP_NO_ALIGNED_ALLOC
311 #endif
312 
313 // how to disable inlining
314 #if defined(_MSC_VER) && _MSC_VER >= 1300
315 # define CRYPTOPP_NOINLINE_DOTDOTDOT
316 # define CRYPTOPP_NOINLINE __declspec(noinline)
317 #elif defined(__GNUC__)
318 # define CRYPTOPP_NOINLINE_DOTDOTDOT
319 # define CRYPTOPP_NOINLINE __attribute__((noinline))
320 #else
321 # define CRYPTOPP_NOINLINE_DOTDOTDOT ...
322 # define CRYPTOPP_NOINLINE
323 #endif
324 
325 // how to declare class constants
326 #if (defined(_MSC_VER) && _MSC_VER <= 1300) || defined(__INTEL_COMPILER)
327 # define CRYPTOPP_CONSTANT(x) enum {x};
328 #else
329 # define CRYPTOPP_CONSTANT(x) static const int x;
330 #endif
331 
332 #if defined(_M_X64) || defined(__x86_64__)
333  #define CRYPTOPP_BOOL_X64 1
334 #else
335  #define CRYPTOPP_BOOL_X64 0
336 #endif
337 
338 // see http://predef.sourceforge.net/prearch.html
339 #if defined(_M_IX86) || defined(__i386__) || defined(__i386) || defined(_X86_) || defined(__I86__) || defined(__INTEL__)
340  #define CRYPTOPP_BOOL_X86 1
341 #else
342  #define CRYPTOPP_BOOL_X86 0
343 #endif
344 
345 #if CRYPTOPP_BOOL_X64 || CRYPTOPP_BOOL_X86 || defined(__powerpc__)
346  #define CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS
347 #endif
348 
349 #define CRYPTOPP_VERSION 561
350 
351 // ***************** determine availability of OS features ********************
352 
353 #ifndef NO_OS_DEPENDENCE
354 
355 #if defined(_WIN32) || defined(__CYGWIN__)
356 #define CRYPTOPP_WIN32_AVAILABLE
357 #endif
358 
359 #if defined(__unix__) || defined(__MACH__) || defined(__NetBSD__) || defined(__sun)
360 #define CRYPTOPP_UNIX_AVAILABLE
361 #endif
362 
363 #if defined(CRYPTOPP_WIN32_AVAILABLE) || defined(CRYPTOPP_UNIX_AVAILABLE)
364 # define HIGHRES_TIMER_AVAILABLE
365 #endif
366 
367 #ifdef CRYPTOPP_UNIX_AVAILABLE
368 # define HAS_BERKELEY_STYLE_SOCKETS
369 #endif
370 
371 #ifdef CRYPTOPP_WIN32_AVAILABLE
372 # define HAS_WINDOWS_STYLE_SOCKETS
373 #endif
374 
375 #if defined(HIGHRES_TIMER_AVAILABLE) && (defined(HAS_BERKELEY_STYLE_SOCKETS) || defined(HAS_WINDOWS_STYLE_SOCKETS))
376 # define SOCKETS_AVAILABLE
377 #endif
378 
379 #if defined(HAS_WINDOWS_STYLE_SOCKETS) && (!defined(HAS_BERKELEY_STYLE_SOCKETS) || defined(PREFER_WINDOWS_STYLE_SOCKETS))
380 # define USE_WINDOWS_STYLE_SOCKETS
381 #else
382 # define USE_BERKELEY_STYLE_SOCKETS
383 #endif
384 
385 #if defined(HIGHRES_TIMER_AVAILABLE) && defined(CRYPTOPP_WIN32_AVAILABLE) && !defined(USE_BERKELEY_STYLE_SOCKETS)
386 # define WINDOWS_PIPES_AVAILABLE
387 #endif
388 
389 #if defined(CRYPTOPP_WIN32_AVAILABLE) && defined(USE_MS_CRYPTOAPI)
390 # define NONBLOCKING_RNG_AVAILABLE
391 # define OS_RNG_AVAILABLE
392 #endif
393 
394 #if defined(CRYPTOPP_UNIX_AVAILABLE) || defined(CRYPTOPP_DOXYGEN_PROCESSING)
395 # define NONBLOCKING_RNG_AVAILABLE
396 # define BLOCKING_RNG_AVAILABLE
397 # define OS_RNG_AVAILABLE
398 # define HAS_PTHREADS
399 # define THREADS_AVAILABLE
400 #endif
401 
402 #ifdef CRYPTOPP_WIN32_AVAILABLE
403 # define HAS_WINTHREADS
404 # define THREADS_AVAILABLE
405 #endif
406 
407 #endif // NO_OS_DEPENDENCE
408 
409 // ***************** DLL related ********************
410 
411 #if defined(CRYPTOPP_WIN32_AVAILABLE) && !defined(CRYPTOPP_DOXYGEN_PROCESSING)
412 
413 #ifdef CRYPTOPP_EXPORTS
414 #define CRYPTOPP_IS_DLL
415 #define CRYPTOPP_DLL __declspec(dllexport)
416 #elif defined(CRYPTOPP_IMPORTS)
417 #define CRYPTOPP_IS_DLL
418 #define CRYPTOPP_DLL __declspec(dllimport)
419 #else
420 #define CRYPTOPP_DLL
421 #endif
422 
423 #define CRYPTOPP_API __cdecl
424 
425 #else // CRYPTOPP_WIN32_AVAILABLE
426 
427 #define CRYPTOPP_DLL
428 #define CRYPTOPP_API
429 
430 #endif // CRYPTOPP_WIN32_AVAILABLE
431 
432 #if defined(__MWERKS__)
433 #define CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS extern class CRYPTOPP_DLL
434 #elif defined(__BORLANDC__) || defined(__SUNPRO_CC)
435 #define CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS template class CRYPTOPP_DLL
436 #else
437 #define CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS extern template class CRYPTOPP_DLL
438 #endif
439 
440 #if defined(CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES) && !defined(CRYPTOPP_IMPORTS)
441 #define CRYPTOPP_DLL_TEMPLATE_CLASS template class CRYPTOPP_DLL
442 #else
443 #define CRYPTOPP_DLL_TEMPLATE_CLASS CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS
444 #endif
445 
446 #if defined(__MWERKS__)
447 #define CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS extern class
448 #elif defined(__BORLANDC__) || defined(__SUNPRO_CC)
449 #define CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS template class
450 #else
451 #define CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS extern template class
452 #endif
453 
454 #if defined(CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES) && !defined(CRYPTOPP_EXPORTS)
455 #define CRYPTOPP_STATIC_TEMPLATE_CLASS template class
456 #else
457 #define CRYPTOPP_STATIC_TEMPLATE_CLASS CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS
458 #endif
459 
460 #endif