monotone

monotone Mtn Source Tree

Root/cryptopp/config.h

1#ifndef CRYPTOPP_CONFIG_H
2#define CRYPTOPP_CONFIG_H
3
4// ***************** Important Settings ********************
5
6// define this if running on a big-endian CPU
7#if !defined(IS_LITTLE_ENDIAN) && (defined(__BIG_ENDIAN__) || defined(__sparc) || defined(__sparc__) || defined(__hppa__) || defined(__mips__) || (defined(__MWERKS__) && !defined(__INTEL__)))
8#define IS_BIG_ENDIAN
9#endif
10
11// define this if running on a little-endian CPU
12// big endian will be assumed if IS_LITTLE_ENDIAN is not defined
13#ifndef IS_BIG_ENDIAN
14#define IS_LITTLE_ENDIAN
15#endif
16
17// define this if you want to disable all OS-dependent features,
18// such as sockets and OS-provided random number generators
19// #define NO_OS_DEPENDENCE
20
21// Define this to use features provided by Microsoft's CryptoAPI.
22// Currently the only feature used is random number generation.
23// This macro will be ignored if NO_OS_DEPENDENCE is defined.
24#define USE_MS_CRYPTOAPI
25
26// Define this to 1 to enforce the requirement in FIPS 186-2 Change Notice 1 that only 1024 bit moduli be used
27#ifndef DSA_1024_BIT_MODULUS_ONLY
28#define DSA_1024_BIT_MODULUS_ONLY 1
29#endif
30
31// ***************** Less Important Settings ***************
32
33// define this to retain (as much as possible) old deprecated function and class names
34// #define CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY
35
36#define GZIP_OS_CODE 0
37
38// Try this if your CPU has 256K internal cache or a slow multiply instruction
39// and you want a (possibly) faster IDEA implementation using log tables
40// #define IDEA_LARGECACHE
41
42// Try this if you have a large cache or your CPU is slow manipulating
43// individual bytes.
44// #define DIAMOND_USE_PERMTABLE
45
46// Define this if, for the linear congruential RNG, you want to use
47// the original constants as specified in S.K. Park and K.W. Miller's
48// CACM paper.
49// #define LCRNG_ORIGINAL_NUMBERS
50
51// choose which style of sockets to wrap (mostly useful for cygwin which has both)
52#define PREFER_BERKELEY_STYLE_SOCKETS
53// #define PREFER_WINDOWS_STYLE_SOCKETS
54
55// ***************** Important Settings Again ********************
56// But the defaults should be ok.
57
58// namespace support is now required
59#ifdef NO_NAMESPACE
60#error namespace support is now required
61#endif
62
63// Define this to workaround a Microsoft CryptoAPI bug where
64// each call to CryptAcquireContext causes a 100 KB memory leak.
65// Defining this will cause Crypto++ to make only one call to CryptAcquireContext.
66#define WORKAROUND_MS_BUG_Q258000
67
68// Avoid putting "CryptoPP::" in front of everything in Doxygen output
69#ifdef CRYPTOPP_DOXYGEN_PROCESSING
70#define CryptoPP
71#define NAMESPACE_BEGIN(x)
72#define NAMESPACE_END
73#else
74#define NAMESPACE_BEGIN(x) namespace x {
75#define NAMESPACE_END }
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__) || defined(__MACH__)
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
98typedef unsigned char byte; // moved outside namespace for Borland C++Builder 5
99
100NAMESPACE_BEGIN(CryptoPP)
101
102typedef unsigned short word16;
103#if defined(__alpha) && !defined(_MSC_VER)
104typedef unsigned int word32;
105#else
106typedef unsigned long word32;
107#endif
108
109#if defined(__GNUC__) || defined(__MWERKS__)
110#define WORD64_AVAILABLE
111typedef unsigned long long word64;
112#define W64LIT(x) x##LL
113#elif defined(_MSC_VER) || defined(__BCPLUSPLUS__)
114#define WORD64_AVAILABLE
115typedef unsigned __int64 word64;
116#define W64LIT(x) x##ui64
117#endif
118
119// defined this if your CPU is not 64-bit
120#if defined(WORD64_AVAILABLE) && !defined(__alpha)
121#define SLOW_WORD64
122#endif
123
124// word should have the same size as your CPU registers
125// dword should be twice as big as word
126
127#if (defined(__GNUC__) && !defined(__alpha)) || defined(__MWERKS__)
128typedef unsigned long word;
129typedef unsigned long long dword;
130#elif defined(_MSC_VER) || defined(__BCPLUSPLUS__)
131typedef unsigned __int32 word;
132typedef unsigned __int64 dword;
133#else
134typedef unsigned int word;
135typedef unsigned long dword;
136#endif
137
138const unsigned int WORD_SIZE = sizeof(word);
139const unsigned int WORD_BITS = WORD_SIZE * 8;
140
141#define LOW_WORD(x) (word)(x)
142
143union dword_union
144{
145dword_union (const dword &dw) : dw(dw) {}
146dword dw;
147word w[2];
148};
149
150#ifdef IS_LITTLE_ENDIAN
151#define HIGH_WORD(x) (dword_union(x).w[1])
152#else
153#define HIGH_WORD(x) (dword_union(x).w[0])
154#endif
155
156// if the above HIGH_WORD macro doesn't work (if you are not sure, compile it
157// and run the validation tests), try this:
158// #define HIGH_WORD(x) (word)((x)>>WORD_BITS)
159
160#if defined(_MSC_VER) || defined(__BCPLUSPLUS__)
161#define INTEL_INTRINSICS
162#define FAST_ROTATE
163#elif defined(__MWERKS__) && TARGET_CPU_PPC
164#define PPC_INTRINSICS
165#define FAST_ROTATE
166#elif defined(__GNUC__) && defined(__i386__)
167// GCC does peephole optimizations which should result in using rotate instructions
168#define FAST_ROTATE
169#endif
170
171NAMESPACE_END
172
173// VC60 workaround: it doesn't allow typename in some places
174#if defined(_MSC_VER) && (_MSC_VER < 1300)
175#define CPP_TYPENAME
176#else
177#define CPP_TYPENAME typename
178#endif
179
180#ifdef _MSC_VER
181// 4250: dominance
182// 4660: explicitly instantiating a class that's already implicitly instantiated
183// 4661: no suitable definition provided for explicit template instantiation request
184// 4786: identifer was truncated in debug information
185// 4355: 'this' : used in base member initializer list
186#pragma warning(disable: 4250 4660 4661 4786 4355)
187#endif
188
189// ***************** determine availability of OS features ********************
190
191#ifndef NO_OS_DEPENDENCE
192
193#if defined(_WIN32) || defined(__CYGWIN__)
194#define CRYPTOPP_WIN32_AVAILABLE
195#endif
196
197#if defined(__unix__) || defined(__MACH__)
198#define CRYPTOPP_UNIX_AVAILABLE
199#endif
200
201#if defined(WORD64_AVAILABLE) && (defined(CRYPTOPP_WIN32_AVAILABLE) || defined(CRYPTOPP_UNIX_AVAILABLE) || defined(macintosh))
202#define HIGHRES_TIMER_AVAILABLE
203#endif
204
205#ifdef CRYPTOPP_UNIX_AVAILABLE
206#define HAS_BERKELEY_STYLE_SOCKETS
207#endif
208
209#ifdef CRYPTOPP_WIN32_AVAILABLE
210#define HAS_WINDOWS_STYLE_SOCKETS
211#endif
212
213#if defined(HIGHRES_TIMER_AVAILABLE) && (defined(HAS_BERKELEY_STYLE_SOCKETS) || defined(HAS_WINDOWS_STYLE_SOCKETS))
214#define SOCKETS_AVAILABLE
215#endif
216
217#if defined(HAS_WINDOWS_STYLE_SOCKETS) && (!defined(HAS_BERKELEY_STYLE_SOCKETS) || defined(PREFER_WINDOWS_STYLE_SOCKETS))
218#define USE_WINDOWS_STYLE_SOCKETS
219#else
220#define USE_BERKELEY_STYLE_SOCKETS
221#endif
222
223#if defined(CRYPTOPP_WIN32_AVAILABLE) && !defined(USE_BERKELEY_STYLE_SOCKETS)
224#define WINDOWS_PIPES_AVAILABLE
225#endif
226
227#if defined(CRYPTOPP_WIN32_AVAILABLE) && defined(USE_MS_CRYPTOAPI)
228#define NONBLOCKING_RNG_AVAILABLE
229#define OS_RNG_AVAILABLE
230#endif
231
232#ifdef CRYPTOPP_UNIX_AVAILABLE
233#define NONBLOCKING_RNG_AVAILABLE
234#define BLOCKING_RNG_AVAILABLE
235#define OS_RNG_AVAILABLE
236#define HAS_PTHREADS
237#define THREADS_AVAILABLE
238#endif
239
240#ifdef CRYPTOPP_WIN32_AVAILABLE
241#define HAS_WINTHREADS
242#define THREADS_AVAILABLE
243#endif
244
245#endif// NO_OS_DEPENDENCE
246
247#endif

Archive Download this file

Branches

Tags

Quick Links:     www.monotone.ca    -     Downloads    -     Documentation    -     Wiki    -     Code Forge    -     Build Status