config.h

00001 #ifndef CRYPTOPP_CONFIG_H
00002 #define CRYPTOPP_CONFIG_H
00003 
00004 // ***************** Important Settings ********************
00005 
00006 // define this if running on a big-endian CPU
00007 #if !defined(IS_LITTLE_ENDIAN) && (defined(__BIG_ENDIAN__) || defined(__sparc) || defined(__sparc__) || defined(__hppa__) || defined(__mips__) || (defined(__MWERKS__) && !defined(__INTEL__)))
00008 #       define IS_BIG_ENDIAN
00009 #endif
00010 
00011 // define this if running on a little-endian CPU
00012 // big endian will be assumed if IS_LITTLE_ENDIAN is not defined
00013 #ifndef IS_BIG_ENDIAN
00014 #       define IS_LITTLE_ENDIAN
00015 #endif
00016 
00017 // define this if you want to disable all OS-dependent features,
00018 // such as sockets and OS-provided random number generators
00019 // #define NO_OS_DEPENDENCE
00020 
00021 // Define this to use features provided by Microsoft's CryptoAPI.
00022 // Currently the only feature used is random number generation.
00023 // This macro will be ignored if NO_OS_DEPENDENCE is defined.
00024 #define USE_MS_CRYPTOAPI
00025 
00026 // Define this to 1 to enforce the requirement in FIPS 186-2 Change Notice 1 that only 1024 bit moduli be used
00027 #ifndef DSA_1024_BIT_MODULUS_ONLY
00028 #       define DSA_1024_BIT_MODULUS_ONLY 1
00029 #endif
00030 
00031 // ***************** Less Important Settings ***************
00032 
00033 // define this to retain (as much as possible) old deprecated function and class names
00034 // #define CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY
00035 
00036 #define GZIP_OS_CODE 0
00037 
00038 // Try this if your CPU has 256K internal cache or a slow multiply instruction
00039 // and you want a (possibly) faster IDEA implementation using log tables
00040 // #define IDEA_LARGECACHE
00041 
00042 // Define this if, for the linear congruential RNG, you want to use
00043 // the original constants as specified in S.K. Park and K.W. Miller's
00044 // CACM paper.
00045 // #define LCRNG_ORIGINAL_NUMBERS
00046 
00047 // choose which style of sockets to wrap (mostly useful for cygwin which has both)
00048 #define PREFER_BERKELEY_STYLE_SOCKETS
00049 // #define PREFER_WINDOWS_STYLE_SOCKETS
00050 
00051 // set the name of Rijndael cipher, was "Rijndael" before version 5.3
00052 #define CRYPTOPP_RIJNDAEL_NAME "AES"
00053 
00054 // ***************** Important Settings Again ********************
00055 // But the defaults should be ok.
00056 
00057 // namespace support is now required
00058 #ifdef NO_NAMESPACE
00059 #       error namespace support is now required
00060 #endif
00061 
00062 // Define this to workaround a Microsoft CryptoAPI bug where
00063 // each call to CryptAcquireContext causes a 100 KB memory leak.
00064 // Defining this will cause Crypto++ to make only one call to CryptAcquireContext.
00065 #define WORKAROUND_MS_BUG_Q258000
00066 
00067 #ifdef CRYPTOPP_DOXYGEN_PROCESSING
00068 // Avoid putting "CryptoPP::" in front of everything in Doxygen output
00069 #       define CryptoPP
00070 #       define NAMESPACE_BEGIN(x)
00071 #       define NAMESPACE_END
00072 // Get Doxygen to generate better documentation for these typedefs
00073 #       define DOCUMENTED_TYPEDEF(x, y) class y : public x {};
00074 #else
00075 #       define NAMESPACE_BEGIN(x) namespace x {
00076 #       define NAMESPACE_END }
00077 #       define DOCUMENTED_TYPEDEF(x, y) typedef x y;
00078 #endif
00079 #define ANONYMOUS_NAMESPACE_BEGIN namespace {
00080 #define USING_NAMESPACE(x) using namespace x;
00081 #define DOCUMENTED_NAMESPACE_BEGIN(x) namespace x {
00082 #define DOCUMENTED_NAMESPACE_END }
00083 
00084 // What is the type of the third parameter to bind?
00085 // For Unix, the new standard is ::socklen_t (typically unsigned int), and the old standard is int.
00086 // Unfortunately there is no way to tell whether or not socklen_t is defined.
00087 // To work around this, TYPE_OF_SOCKLEN_T is a macro so that you can change it from the makefile.
00088 #ifndef TYPE_OF_SOCKLEN_T
00089 #       if defined(_WIN32) || defined(__CYGWIN__)
00090 #               define TYPE_OF_SOCKLEN_T int
00091 #       else
00092 #               define TYPE_OF_SOCKLEN_T ::socklen_t
00093 #       endif
00094 #endif
00095 
00096 #if defined(__CYGWIN__) && defined(PREFER_WINDOWS_STYLE_SOCKETS)
00097 #       define __USE_W32_SOCKETS
00098 #endif
00099 
00100 typedef unsigned char byte;             // put in global namespace to avoid ambiguity with other byte typedefs
00101 
00102 NAMESPACE_BEGIN(CryptoPP)
00103 
00104 typedef unsigned short word16;
00105 typedef unsigned int word32;
00106 
00107 #if defined(__GNUC__) || defined(__MWERKS__) || defined(__SUNPRO_CC)
00108         #define WORD64_AVAILABLE
00109         typedef unsigned long long word64;
00110         #define W64LIT(x) x##LL
00111 #elif defined(_MSC_VER) || defined(__BORLANDC__)
00112         #define WORD64_AVAILABLE
00113         typedef unsigned __int64 word64;
00114         #define W64LIT(x) x##ui64
00115 #endif
00116 
00117 // define largest word type
00118 #ifdef WORD64_AVAILABLE
00119         typedef word64 lword;
00120         const lword LWORD_MAX = W64LIT(0)-1;
00121 #else
00122         typedef word32 lword;
00123         const lword LWORD_MAX = lword(0)-1;
00124 #endif
00125 
00126 #if defined(__alpha__) || defined(__ia64__) || defined(_ARCH_PPC64) || defined(__x86_64__) || defined(__mips64) || defined(_M_X64)
00127         // These platforms have 64-bit CPU registers. Unfortunately most C++ compilers doesn't
00128         // allow any way to access the 64-bit by 64-bit multiply instruction without using
00129         // assembly, so in order to use word64 as word, the assembly instruction must be defined
00130         // in Dword::Multiply().
00131         #if defined(__SUNPRO_CC)        // no Dword::Multiply() for these compilers yet
00132                 #define CRYPTOPP_NATIVE_DWORD_AVAILABLE
00133                 typedef word16 hword;
00134                 typedef word32 word;
00135                 typedef word64 dword;
00136         #else
00137                 typedef word32 hword;
00138                 typedef word64 word;
00139         #endif
00140 #else
00141         #define CRYPTOPP_NATIVE_DWORD_AVAILABLE
00142         #ifdef WORD64_AVAILABLE
00143                 #define CRYPTOPP_SLOW_WORD64 // defined this if your CPU is not 64-bit to use alternative code that avoids word64
00144                 typedef word16 hword;
00145                 typedef word32 word;
00146                 typedef word64 dword;
00147         #else
00148                 typedef byte hword;
00149                 typedef word16 word;
00150                 typedef word32 dword;
00151         #endif
00152 #endif
00153 
00154 const unsigned int WORD_SIZE = sizeof(word);
00155 const unsigned int WORD_BITS = WORD_SIZE * 8;
00156 
00157 #if defined(_MSC_VER) // || defined(__BORLANDC__) intrinsics don't work on BCB 2006
00158         #define INTEL_INTRINSICS
00159         #define FAST_ROTATE
00160 #elif defined(__MWERKS__) && TARGET_CPU_PPC
00161         #define PPC_INTRINSICS
00162         #define FAST_ROTATE
00163 #elif defined(__GNUC__) && defined(__i386__)
00164         // GCC does peephole optimizations which should result in using rotate instructions
00165         #define FAST_ROTATE
00166 #endif
00167 
00168 #ifndef CRYPTOPP_L1_CACHE_LINE_SIZE
00169         // This should be a lower bound on the L1 cache line size. It's used for defense against timing attacks.
00170         // L1 cache line size is 32 on Pentium III and earlier
00171         #define CRYPTOPP_L1_CACHE_LINE_SIZE 32
00172 #endif
00173 
00174 #ifndef CRYPTOPP_L1_CACHE_ALIGN
00175         #if defined(_MSC_VER)
00176                 #define CRYPTOPP_L1_CACHE_ALIGN(x) __declspec(align(CRYPTOPP_L1_CACHE_LINE_SIZE)) x
00177         #elif defined(__GNUC__)
00178                 #define CRYPTOPP_L1_CACHE_ALIGN(x) x __attribute__((aligned(CRYPTOPP_L1_CACHE_LINE_SIZE)))
00179         #else
00180                 #define CRYPTOPP_L1_CACHE_ALIGN(x) x
00181         #endif
00182 #endif
00183 
00184 NAMESPACE_END
00185 
00186 // VC60 workaround: it doesn't allow typename in some places
00187 #if defined(_MSC_VER) && (_MSC_VER < 1300)
00188 #define CPP_TYPENAME
00189 #else
00190 #define CPP_TYPENAME typename
00191 #endif
00192 
00193 #ifdef _MSC_VER
00194 #define CRYPTOPP_NO_VTABLE __declspec(novtable)
00195 #else
00196 #define CRYPTOPP_NO_VTABLE
00197 #endif
00198 
00199 #ifdef _MSC_VER
00200         // 4231: nonstandard extension used : 'extern' before template explicit instantiation
00201         // 4250: dominance
00202         // 4251: member needs to have dll-interface
00203         // 4275: base needs to have dll-interface
00204         // 4660: explicitly instantiating a class that's already implicitly instantiated
00205         // 4661: no suitable definition provided for explicit template instantiation request
00206         // 4786: identifer was truncated in debug information
00207         // 4355: 'this' : used in base member initializer list
00208 #       pragma warning(disable: 4231 4250 4251 4275 4660 4661 4786 4355)
00209 #endif
00210 
00211 #ifdef __BORLANDC__
00212 // 8037: non-const function called for const object. needed to work around BCB2006 bug
00213 #       pragma warn -8037
00214 #endif
00215 
00216 #if (defined(_MSC_VER) && _MSC_VER <= 1300) || defined(__MWERKS__) || defined(_STLPORT_VERSION)
00217 #define CRYPTOPP_DISABLE_UNCAUGHT_EXCEPTION
00218 #endif
00219 
00220 #ifndef CRYPTOPP_DISABLE_UNCAUGHT_EXCEPTION
00221 #define CRYPTOPP_UNCAUGHT_EXCEPTION_AVAILABLE
00222 #endif
00223 
00224 // CodeWarrior defines _MSC_VER
00225 #if !defined(CRYPTOPP_DISABLE_X86ASM) && ((defined(_MSC_VER) && !defined(__MWERKS__) && defined(_M_IX86)) || (defined(__GNUC__) && defined(__i386__)))
00226 #define CRYPTOPP_X86ASM_AVAILABLE
00227 #endif
00228 
00229 // how to disable inlining
00230 #if defined(_MSC_VER) && _MSC_VER >= 1300
00231 #       define CRYPTOPP_NOINLINE_DOTDOTDOT
00232 #       define CRYPTOPP_NOINLINE __declspec(noinline)
00233 #elif defined(__GNUC__)
00234 #       define CRYPTOPP_NOINLINE_DOTDOTDOT
00235 #       define CRYPTOPP_NOINLINE __attribute__((noinline))
00236 #else
00237 #       define CRYPTOPP_NOINLINE_DOTDOTDOT ...
00238 #       define CRYPTOPP_NOINLINE 
00239 #endif
00240 
00241 // how to declare class constants
00242 #if defined(_MSC_VER) && _MSC_VER < 1300
00243 #       define CRYPTOPP_CONSTANT(x) enum {x};
00244 #else
00245 #       define CRYPTOPP_CONSTANT(x) static const int x;
00246 #endif
00247 
00248 // how to allocate 16-byte aligned memory (for SSE2)
00249 #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
00250 #       define CRYPTOPP_MALLOC_ALIGNMENT_IS_16
00251 #elif defined(__linux__) || defined(__sun__) || defined(__CYGWIN__)
00252 #       define CRYPTOPP_MEMALIGN_AVAILABLE
00253 #endif
00254 
00255 // ***************** determine availability of OS features ********************
00256 
00257 #ifndef NO_OS_DEPENDENCE
00258 
00259 #if defined(_WIN32) || defined(__CYGWIN__)
00260 #define CRYPTOPP_WIN32_AVAILABLE
00261 #endif
00262 
00263 #if defined(__unix__) || defined(__MACH__) || defined(__NetBSD__)
00264 #define CRYPTOPP_UNIX_AVAILABLE
00265 #endif
00266 
00267 #if defined(WORD64_AVAILABLE) && (defined(CRYPTOPP_WIN32_AVAILABLE) || defined(CRYPTOPP_UNIX_AVAILABLE))
00268 #       define HIGHRES_TIMER_AVAILABLE
00269 #endif
00270 
00271 #ifdef CRYPTOPP_UNIX_AVAILABLE
00272 #       define HAS_BERKELEY_STYLE_SOCKETS
00273 #endif
00274 
00275 #ifdef CRYPTOPP_WIN32_AVAILABLE
00276 #       define HAS_WINDOWS_STYLE_SOCKETS
00277 #endif
00278 
00279 #if defined(HIGHRES_TIMER_AVAILABLE) && (defined(HAS_BERKELEY_STYLE_SOCKETS) || defined(HAS_WINDOWS_STYLE_SOCKETS))
00280 #       define SOCKETS_AVAILABLE
00281 #endif
00282 
00283 #if defined(HAS_WINDOWS_STYLE_SOCKETS) && (!defined(HAS_BERKELEY_STYLE_SOCKETS) || defined(PREFER_WINDOWS_STYLE_SOCKETS))
00284 #       define USE_WINDOWS_STYLE_SOCKETS
00285 #else
00286 #       define USE_BERKELEY_STYLE_SOCKETS
00287 #endif
00288 
00289 #if defined(HIGHRES_TIMER_AVAILABLE) && defined(CRYPTOPP_WIN32_AVAILABLE) && !defined(USE_BERKELEY_STYLE_SOCKETS)
00290 #       define WINDOWS_PIPES_AVAILABLE
00291 #endif
00292 
00293 #if defined(CRYPTOPP_WIN32_AVAILABLE) && defined(USE_MS_CRYPTOAPI)
00294 #       define NONBLOCKING_RNG_AVAILABLE
00295 #       define OS_RNG_AVAILABLE
00296 #endif
00297 
00298 #if defined(CRYPTOPP_UNIX_AVAILABLE) || defined(CRYPTOPP_DOXYGEN_PROCESSING)
00299 #       define NONBLOCKING_RNG_AVAILABLE
00300 #       define BLOCKING_RNG_AVAILABLE
00301 #       define OS_RNG_AVAILABLE
00302 #       define HAS_PTHREADS
00303 #       define THREADS_AVAILABLE
00304 #endif
00305 
00306 #ifdef CRYPTOPP_WIN32_AVAILABLE
00307 #       define HAS_WINTHREADS
00308 #       define THREADS_AVAILABLE
00309 #endif
00310 
00311 #endif  // NO_OS_DEPENDENCE
00312 
00313 // ***************** DLL related ********************
00314 
00315 #ifdef CRYPTOPP_WIN32_AVAILABLE
00316 
00317 #ifdef CRYPTOPP_EXPORTS
00318 #define CRYPTOPP_IS_DLL
00319 #define CRYPTOPP_DLL __declspec(dllexport)
00320 #elif defined(CRYPTOPP_IMPORTS)
00321 #define CRYPTOPP_IS_DLL
00322 #define CRYPTOPP_DLL __declspec(dllimport)
00323 #else
00324 #define CRYPTOPP_DLL
00325 #endif
00326 
00327 #define CRYPTOPP_API __cdecl
00328 
00329 #else   // CRYPTOPP_WIN32_AVAILABLE
00330 
00331 #define CRYPTOPP_DLL
00332 #define CRYPTOPP_API
00333 
00334 #endif  // CRYPTOPP_WIN32_AVAILABLE
00335 
00336 #if defined(__MWERKS__)
00337 #define CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS extern class CRYPTOPP_DLL
00338 #elif defined(__BORLANDC__) || defined(__SUNPRO_CC)
00339 #define CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS template class CRYPTOPP_DLL
00340 #else
00341 #define CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS extern template class CRYPTOPP_DLL
00342 #endif
00343 
00344 #if defined(CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES) && !defined(CRYPTOPP_IMPORTS)
00345 #define CRYPTOPP_DLL_TEMPLATE_CLASS template class CRYPTOPP_DLL
00346 #else
00347 #define CRYPTOPP_DLL_TEMPLATE_CLASS CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS
00348 #endif
00349 
00350 #if defined(__MWERKS__)
00351 #define CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS extern class
00352 #elif defined(__BORLANDC__) || defined(__SUNPRO_CC)
00353 #define CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS template class
00354 #else
00355 #define CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS extern template class
00356 #endif
00357 
00358 #if defined(CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES) && !defined(CRYPTOPP_EXPORTS)
00359 #define CRYPTOPP_STATIC_TEMPLATE_CLASS template class
00360 #else
00361 #define CRYPTOPP_STATIC_TEMPLATE_CLASS CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS
00362 #endif
00363 
00364 #endif

Generated on Sat Dec 23 02:07:06 2006 for Crypto++ by  doxygen 1.5.1-p1