config.h

00001 #define CRYPTOPP_DISABLE_SSE2
00002 #ifndef CRYPTOPP_CONFIG_H
00003 #define CRYPTOPP_CONFIG_H
00004 
00005 // ***************** Important Settings ********************
00006 
00007 // define this if running on a big-endian CPU
00008 #if !defined(IS_LITTLE_ENDIAN) && (defined(__BIG_ENDIAN__) || defined(__sparc) || defined(__sparc__) || defined(__hppa__) || defined(__mips__) || (defined(__MWERKS__) && !defined(__INTEL__)))
00009 #       define IS_BIG_ENDIAN
00010 #endif
00011 
00012 // define this if running on a little-endian CPU
00013 // big endian will be assumed if IS_LITTLE_ENDIAN is not defined
00014 #ifndef IS_BIG_ENDIAN
00015 #       define IS_LITTLE_ENDIAN
00016 #endif
00017 
00018 // define this if you want to disable all OS-dependent features,
00019 // such as sockets and OS-provided random number generators
00020 // #define NO_OS_DEPENDENCE
00021 
00022 // Define this to use features provided by Microsoft's CryptoAPI.
00023 // Currently the only feature used is random number generation.
00024 // This macro will be ignored if NO_OS_DEPENDENCE is defined.
00025 #define USE_MS_CRYPTOAPI
00026 
00027 // Define this to 1 to enforce the requirement in FIPS 186-2 Change Notice 1 that only 1024 bit moduli be used
00028 #ifndef DSA_1024_BIT_MODULUS_ONLY
00029 #       define DSA_1024_BIT_MODULUS_ONLY 1
00030 #endif
00031 
00032 // ***************** Less Important Settings ***************
00033 
00034 // define this to retain (as much as possible) old deprecated function and class names
00035 // #define CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY
00036 
00037 #define GZIP_OS_CODE 0
00038 
00039 // Try this if your CPU has 256K internal cache or a slow multiply instruction
00040 // and you want a (possibly) faster IDEA implementation using log tables
00041 // #define IDEA_LARGECACHE
00042 
00043 // Define this if, for the linear congruential RNG, you want to use
00044 // the original constants as specified in S.K. Park and K.W. Miller's
00045 // CACM paper.
00046 // #define LCRNG_ORIGINAL_NUMBERS
00047 
00048 // choose which style of sockets to wrap (mostly useful for cygwin which has both)
00049 #define PREFER_BERKELEY_STYLE_SOCKETS
00050 // #define PREFER_WINDOWS_STYLE_SOCKETS
00051 
00052 // set the name of Rijndael cipher, was "Rijndael" before version 5.3
00053 #define CRYPTOPP_RIJNDAEL_NAME "AES"
00054 
00055 // ***************** Important Settings Again ********************
00056 // But the defaults should be ok.
00057 
00058 // namespace support is now required
00059 #ifdef NO_NAMESPACE
00060 #       error namespace support is now required
00061 #endif
00062 
00063 // Define this to workaround a Microsoft CryptoAPI bug where
00064 // each call to CryptAcquireContext causes a 100 KB memory leak.
00065 // Defining this will cause Crypto++ to make only one call to CryptAcquireContext.
00066 #define WORKAROUND_MS_BUG_Q258000
00067 
00068 #ifdef CRYPTOPP_DOXYGEN_PROCESSING
00069 // Avoid putting "CryptoPP::" in front of everything in Doxygen output
00070 #       define CryptoPP
00071 #       define NAMESPACE_BEGIN(x)
00072 #       define NAMESPACE_END
00073 // Get Doxygen to generate better documentation for these typedefs
00074 #       define DOCUMENTED_TYPEDEF(x, y) class y : public x {};
00075 #else
00076 #       define NAMESPACE_BEGIN(x) namespace x {
00077 #       define NAMESPACE_END }
00078 #       define DOCUMENTED_TYPEDEF(x, y) typedef x y;
00079 #endif
00080 #define ANONYMOUS_NAMESPACE_BEGIN namespace {
00081 #define USING_NAMESPACE(x) using namespace x;
00082 #define DOCUMENTED_NAMESPACE_BEGIN(x) namespace x {
00083 #define DOCUMENTED_NAMESPACE_END }
00084 
00085 // What is the type of the third parameter to bind?
00086 // For Unix, the new standard is ::socklen_t (typically unsigned int), and the old standard is int.
00087 // Unfortunately there is no way to tell whether or not socklen_t is defined.
00088 // To work around this, TYPE_OF_SOCKLEN_T is a macro so that you can change it from the makefile.
00089 #ifndef TYPE_OF_SOCKLEN_T
00090 #       if defined(_WIN32) || defined(__CYGWIN__)
00091 #               define TYPE_OF_SOCKLEN_T int
00092 #       else
00093 #               define TYPE_OF_SOCKLEN_T ::socklen_t
00094 #       endif
00095 #endif
00096 
00097 #if defined(__CYGWIN__) && defined(PREFER_WINDOWS_STYLE_SOCKETS)
00098 #       define __USE_W32_SOCKETS
00099 #endif
00100 
00101 typedef unsigned char byte;             // put in global namespace to avoid ambiguity with other byte typedefs
00102 
00103 NAMESPACE_BEGIN(CryptoPP)
00104 
00105 typedef unsigned short word16;
00106 typedef unsigned int word32;
00107 
00108 #if defined(__GNUC__) || defined(__MWERKS__) || defined(__SUNPRO_CC)
00109         #define WORD64_AVAILABLE
00110         typedef unsigned long long word64;
00111         #define W64LIT(x) x##LL
00112 #elif defined(_MSC_VER) || defined(__BORLANDC__)
00113         #define WORD64_AVAILABLE
00114         typedef unsigned __int64 word64;
00115         #define W64LIT(x) x##ui64
00116 #endif
00117 
00118 // define large word type, used for file offsets and such
00119 #ifdef WORD64_AVAILABLE
00120         typedef word64 lword;
00121         const lword LWORD_MAX = W64LIT(0xffffffffffffffff);
00122 #else
00123         typedef word32 lword;
00124         const lword LWORD_MAX = 0xffffffffUL;
00125 #endif
00126 
00127 // define hword, word, and dword. these are used for multiprecision integer arithmetic
00128 // Intel compiler won't have _umul128 until version 10.0. See http://softwarecommunity.intel.com/isn/Community/en-US/forums/thread/30231625.aspx
00129 #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__))
00130         typedef word32 hword;
00131         typedef word64 word;
00132 #else
00133         #define CRYPTOPP_NATIVE_DWORD_AVAILABLE
00134         #if defined(__alpha__) || defined(__ia64__) || defined(_ARCH_PPC64) || defined(__x86_64__) || defined(__mips64) || defined(__sparc64__)
00135                 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
00136                         typedef word32 hword;
00137                         typedef word64 word;
00138                         typedef __uint128_t dword;
00139                         typedef __uint128_t word128;
00140                         #define CRYPTOPP_WORD128_AVAILABLE
00141                 #else
00142                         // 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
00143                         typedef word16 hword;
00144                         typedef word32 word;
00145                         typedef word64 dword;
00146                 #endif
00147         #elif defined(WORD64_AVAILABLE)
00148                 #define CRYPTOPP_SLOW_WORD64 // use alternative code that avoids word64
00149                 typedef word16 hword;
00150                 typedef word32 word;
00151                 typedef word64 dword;
00152         #else
00153                 typedef byte hword;
00154                 typedef word16 word;
00155                 typedef word32 dword;
00156         #endif
00157 #endif
00158 
00159 const unsigned int WORD_SIZE = sizeof(word);
00160 const unsigned int WORD_BITS = WORD_SIZE * 8;
00161 
00162 NAMESPACE_END
00163 
00164 #ifndef CRYPTOPP_L1_CACHE_LINE_SIZE
00165         // This should be a lower bound on the L1 cache line size. It's used for defense against timing attacks.
00166         #if defined(_M_X64) || defined(__x86_64__)
00167                 #define CRYPTOPP_L1_CACHE_LINE_SIZE 64
00168         #else
00169                 // L1 cache line size is 32 on Pentium III and earlier
00170                 #define CRYPTOPP_L1_CACHE_LINE_SIZE 32
00171         #endif
00172 #endif
00173 
00174 #if defined(_MSC_VER)
00175         #if _MSC_VER == 1200
00176                 #include <malloc.h>
00177         #endif
00178         #if _MSC_VER > 1200 || defined(_mm_free)
00179                 #define CRYPTOPP_MSVC6PP_OR_LATER               // VC 6 processor pack or later
00180         #else
00181                 #define CRYPTOPP_MSVC6_NO_PP                    // VC 6 without processor pack
00182         #endif
00183 #endif
00184 
00185 #ifdef __GNUC__
00186         #define CRYPTOPP_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
00187 #endif
00188 
00189 #ifndef CRYPTOPP_ALIGN_DATA
00190         #if defined(CRYPTOPP_MSVC6PP_OR_LATER)
00191                 #define CRYPTOPP_ALIGN_DATA(x) __declspec(align(x))
00192         #elif defined(__GNUC__) || __SUNPRO_CC > 0x580
00193                 #define CRYPTOPP_ALIGN_DATA(x) __attribute__((aligned(x)))
00194         #else
00195                 #define CRYPTOPP_ALIGN_DATA(x)
00196         #endif
00197 #endif
00198 
00199 #ifndef CRYPTOPP_SECTION_ALIGN16
00200         #if defined(__GNUC__) && !defined(__APPLE__)
00201                 // the alignment attribute doesn't seem to work without this section attribute when -fdata-sections is turned on
00202                 #define CRYPTOPP_SECTION_ALIGN16 __attribute__((section ("CryptoPP_Align16")))
00203         #else
00204                 #define CRYPTOPP_SECTION_ALIGN16
00205         #endif
00206 #endif
00207 
00208 #if defined(_MSC_VER) || defined(__fastcall)
00209         #define CRYPTOPP_FASTCALL __fastcall
00210 #else
00211         #define CRYPTOPP_FASTCALL
00212 #endif
00213 
00214 // VC60 workaround: it doesn't allow typename in some places
00215 #if defined(_MSC_VER) && (_MSC_VER < 1300)
00216 #define CPP_TYPENAME
00217 #else
00218 #define CPP_TYPENAME typename
00219 #endif
00220 
00221 // VC60 workaround: can't cast unsigned __int64 to float or double
00222 #if defined(_MSC_VER) && !defined(CRYPTOPP_MSVC6PP_OR_LATER)
00223 #define CRYPTOPP_VC6_INT64 (__int64)
00224 #else
00225 #define CRYPTOPP_VC6_INT64
00226 #endif
00227 
00228 #ifdef _MSC_VER
00229 #define CRYPTOPP_NO_VTABLE __declspec(novtable)
00230 #else
00231 #define CRYPTOPP_NO_VTABLE
00232 #endif
00233 
00234 #ifdef _MSC_VER
00235         // 4231: nonstandard extension used : 'extern' before template explicit instantiation
00236         // 4250: dominance
00237         // 4251: member needs to have dll-interface
00238         // 4275: base needs to have dll-interface
00239         // 4660: explicitly instantiating a class that's already implicitly instantiated
00240         // 4661: no suitable definition provided for explicit template instantiation request
00241         // 4786: identifer was truncated in debug information
00242         // 4355: 'this' : used in base member initializer list
00243         // 4910: '__declspec(dllexport)' and 'extern' are incompatible on an explicit instantiation
00244 #       pragma warning(disable: 4231 4250 4251 4275 4660 4661 4786 4355 4910)
00245 #endif
00246 
00247 #ifdef __BORLANDC__
00248 // 8037: non-const function called for const object. needed to work around BCB2006 bug
00249 #       pragma warn -8037
00250 #endif
00251 
00252 #if (defined(_MSC_VER) && _MSC_VER <= 1300) || defined(__MWERKS__) || defined(_STLPORT_VERSION)
00253 #define CRYPTOPP_DISABLE_UNCAUGHT_EXCEPTION
00254 #endif
00255 
00256 #ifndef CRYPTOPP_DISABLE_UNCAUGHT_EXCEPTION
00257 #define CRYPTOPP_UNCAUGHT_EXCEPTION_AVAILABLE
00258 #endif
00259 
00260 #ifdef CRYPTOPP_DISABLE_X86ASM          // for backwards compatibility: this macro had both meanings
00261 #define CRYPTOPP_DISABLE_ASM
00262 #define CRYPTOPP_DISABLE_SSE2
00263 #endif
00264 
00265 #if !defined(CRYPTOPP_DISABLE_ASM) && ((defined(_MSC_VER) && defined(_M_IX86)) || (defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))))
00266         #define CRYPTOPP_X86_ASM_AVAILABLE
00267 
00268         #if !defined(CRYPTOPP_DISABLE_SSE2) && (defined(CRYPTOPP_MSVC6PP_OR_LATER) || CRYPTOPP_GCC_VERSION >= 30300)
00269                 #define CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE 1
00270         #else
00271                 #define CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE 0
00272         #endif
00273 
00274         // 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.
00275         // GCC 4.1.2 was released on 2/13/2007, so we'll use that as a proxy for the binutils version.
00276         #if !defined(CRYPTOPP_DISABLE_SSSE3) && (_MSC_VER >= 1400 || CRYPTOPP_GCC_VERSION >= 40102)
00277                 #define CRYPTOPP_BOOL_SSSE3_ASM_AVAILABLE 1
00278         #else
00279                 #define CRYPTOPP_BOOL_SSSE3_ASM_AVAILABLE 0
00280         #endif
00281 #endif
00282 
00283 #if !defined(CRYPTOPP_DISABLE_ASM) && defined(_MSC_VER) && defined(_M_X64)
00284         #define CRYPTOPP_X64_MASM_AVAILABLE
00285 #endif
00286 
00287 #if !defined(CRYPTOPP_DISABLE_ASM) && defined(__GNUC__) && defined(__x86_64__)
00288         #define CRYPTOPP_X64_ASM_AVAILABLE
00289 #endif
00290 
00291 #if !defined(CRYPTOPP_DISABLE_SSE2) && (defined(CRYPTOPP_MSVC6PP_OR_LATER) || defined(__SSE2__))
00292         #define CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE 1
00293 #else
00294         #define CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE 0
00295 #endif
00296 
00297 // how to allocate 16-byte aligned memory (for SSE2)
00298 #if defined(CRYPTOPP_MSVC6PP_OR_LATER)
00299         #define CRYPTOPP_MM_MALLOC_AVAILABLE
00300 #elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
00301         #define CRYPTOPP_MALLOC_ALIGNMENT_IS_16
00302 #elif defined(__linux__) || defined(__sun__) || defined(__CYGWIN__)
00303         #define CRYPTOPP_MEMALIGN_AVAILABLE
00304 #else
00305         #define CRYPTOPP_NO_ALIGNED_ALLOC
00306 #endif
00307 
00308 // how to disable inlining
00309 #if defined(_MSC_VER) && _MSC_VER >= 1300
00310 #       define CRYPTOPP_NOINLINE_DOTDOTDOT
00311 #       define CRYPTOPP_NOINLINE __declspec(noinline)
00312 #elif defined(__GNUC__)
00313 #       define CRYPTOPP_NOINLINE_DOTDOTDOT
00314 #       define CRYPTOPP_NOINLINE __attribute__((noinline))
00315 #else
00316 #       define CRYPTOPP_NOINLINE_DOTDOTDOT ...
00317 #       define CRYPTOPP_NOINLINE 
00318 #endif
00319 
00320 // how to declare class constants
00321 #if defined(_MSC_VER) && _MSC_VER <= 1300
00322 #       define CRYPTOPP_CONSTANT(x) enum {x};
00323 #else
00324 #       define CRYPTOPP_CONSTANT(x) static const int x;
00325 #endif
00326 
00327 #if defined(_M_X64) || defined(__x86_64__)
00328         #define CRYPTOPP_BOOL_X64 1
00329 #else
00330         #define CRYPTOPP_BOOL_X64 0
00331 #endif
00332 
00333 // see http://predef.sourceforge.net/prearch.html
00334 #if defined(_M_IX86) || defined(__i386__) || defined(__i386) || defined(_X86_) || defined(__I86__) || defined(__INTEL__)
00335         #define CRYPTOPP_BOOL_X86 1
00336 #else
00337         #define CRYPTOPP_BOOL_X86 0
00338 #endif
00339 
00340 #if CRYPTOPP_BOOL_X64 || CRYPTOPP_BOOL_X86
00341         #define CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS
00342 #endif
00343 
00344 #define CRYPTOPP_VERSION 552
00345 
00346 // ***************** determine availability of OS features ********************
00347 
00348 #ifndef NO_OS_DEPENDENCE
00349 
00350 #if defined(_WIN32) || defined(__CYGWIN__)
00351 #define CRYPTOPP_WIN32_AVAILABLE
00352 #endif
00353 
00354 #if defined(__unix__) || defined(__MACH__) || defined(__NetBSD__) || defined(__sun)
00355 #define CRYPTOPP_UNIX_AVAILABLE
00356 #endif
00357 
00358 #if defined(WORD64_AVAILABLE) && (defined(CRYPTOPP_WIN32_AVAILABLE) || defined(CRYPTOPP_UNIX_AVAILABLE))
00359 #       define HIGHRES_TIMER_AVAILABLE
00360 #endif
00361 
00362 #ifdef CRYPTOPP_UNIX_AVAILABLE
00363 #       define HAS_BERKELEY_STYLE_SOCKETS
00364 #endif
00365 
00366 #ifdef CRYPTOPP_WIN32_AVAILABLE
00367 #       define HAS_WINDOWS_STYLE_SOCKETS
00368 #endif
00369 
00370 #if defined(HIGHRES_TIMER_AVAILABLE) && (defined(HAS_BERKELEY_STYLE_SOCKETS) || defined(HAS_WINDOWS_STYLE_SOCKETS))
00371 #       define SOCKETS_AVAILABLE
00372 #endif
00373 
00374 #if defined(HAS_WINDOWS_STYLE_SOCKETS) && (!defined(HAS_BERKELEY_STYLE_SOCKETS) || defined(PREFER_WINDOWS_STYLE_SOCKETS))
00375 #       define USE_WINDOWS_STYLE_SOCKETS
00376 #else
00377 #       define USE_BERKELEY_STYLE_SOCKETS
00378 #endif
00379 
00380 #if defined(HIGHRES_TIMER_AVAILABLE) && defined(CRYPTOPP_WIN32_AVAILABLE) && !defined(USE_BERKELEY_STYLE_SOCKETS)
00381 #       define WINDOWS_PIPES_AVAILABLE
00382 #endif
00383 
00384 #if defined(CRYPTOPP_WIN32_AVAILABLE) && defined(USE_MS_CRYPTOAPI)
00385 #       define NONBLOCKING_RNG_AVAILABLE
00386 #       define OS_RNG_AVAILABLE
00387 #endif
00388 
00389 #if defined(CRYPTOPP_UNIX_AVAILABLE) || defined(CRYPTOPP_DOXYGEN_PROCESSING)
00390 #       define NONBLOCKING_RNG_AVAILABLE
00391 #       define BLOCKING_RNG_AVAILABLE
00392 #       define OS_RNG_AVAILABLE
00393 #       define HAS_PTHREADS
00394 #       define THREADS_AVAILABLE
00395 #endif
00396 
00397 #ifdef CRYPTOPP_WIN32_AVAILABLE
00398 #       define HAS_WINTHREADS
00399 #       define THREADS_AVAILABLE
00400 #endif
00401 
00402 #endif  // NO_OS_DEPENDENCE
00403 
00404 // ***************** DLL related ********************
00405 
00406 #ifdef CRYPTOPP_WIN32_AVAILABLE
00407 
00408 #ifdef CRYPTOPP_EXPORTS
00409 #define CRYPTOPP_IS_DLL
00410 #define CRYPTOPP_DLL __declspec(dllexport)
00411 #elif defined(CRYPTOPP_IMPORTS)
00412 #define CRYPTOPP_IS_DLL
00413 #define CRYPTOPP_DLL __declspec(dllimport)
00414 #else
00415 #define CRYPTOPP_DLL
00416 #endif
00417 
00418 #define CRYPTOPP_API __cdecl
00419 
00420 #else   // CRYPTOPP_WIN32_AVAILABLE
00421 
00422 #define CRYPTOPP_DLL
00423 #define CRYPTOPP_API
00424 
00425 #endif  // CRYPTOPP_WIN32_AVAILABLE
00426 
00427 #if defined(__MWERKS__)
00428 #define CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS extern class CRYPTOPP_DLL
00429 #elif defined(__BORLANDC__) || defined(__SUNPRO_CC)
00430 #define CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS template class CRYPTOPP_DLL
00431 #else
00432 #define CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS extern template class CRYPTOPP_DLL
00433 #endif
00434 
00435 #if defined(CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES) && !defined(CRYPTOPP_IMPORTS)
00436 #define CRYPTOPP_DLL_TEMPLATE_CLASS template class CRYPTOPP_DLL
00437 #else
00438 #define CRYPTOPP_DLL_TEMPLATE_CLASS CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS
00439 #endif
00440 
00441 #if defined(__MWERKS__)
00442 #define CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS extern class
00443 #elif defined(__BORLANDC__) || defined(__SUNPRO_CC)
00444 #define CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS template class
00445 #else
00446 #define CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS extern template class
00447 #endif
00448 
00449 #if defined(CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES) && !defined(CRYPTOPP_EXPORTS)
00450 #define CRYPTOPP_STATIC_TEMPLATE_CLASS template class
00451 #else
00452 #define CRYPTOPP_STATIC_TEMPLATE_CLASS CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS
00453 #endif
00454 
00455 #endif

Generated on Fri Feb 6 00:56:23 2009 for Crypto++ by  doxygen 1.4.7