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