config.h

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

Generated on Thu Jul 5 22:21:36 2007 for Crypto++ by  doxygen 1.5.2