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__)
00108         #define WORD64_AVAILABLE
00109         typedef unsigned long long word64;
00110         #define W64LIT(x) x##LL
00111 #elif defined(_MSC_VER) || defined(__BCPLUSPLUS__)
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         typedef word32 hword;
00132         typedef word64 word;
00133 #else
00134         #define CRYPTOPP_NATIVE_DWORD_AVAILABLE
00135         #ifdef WORD64_AVAILABLE
00136                 #define CRYPTOPP_SLOW_WORD64 // defined this if your CPU is not 64-bit to use alternative code that avoids word64
00137                 typedef word16 hword;
00138                 typedef word32 word;
00139                 typedef word64 dword;
00140         #else
00141                 typedef word8 hword;
00142                 typedef word16 word;
00143                 typedef word32 dword;
00144         #endif
00145 #endif
00146 
00147 const unsigned int WORD_SIZE = sizeof(word);
00148 const unsigned int WORD_BITS = WORD_SIZE * 8;
00149 
00150 #if defined(_MSC_VER) || defined(__BCPLUSPLUS__)
00151         #define INTEL_INTRINSICS
00152         #define FAST_ROTATE
00153 #elif defined(__MWERKS__) && TARGET_CPU_PPC
00154         #define PPC_INTRINSICS
00155         #define FAST_ROTATE
00156 #elif defined(__GNUC__) && defined(__i386__)
00157         // GCC does peephole optimizations which should result in using rotate instructions
00158         #define FAST_ROTATE
00159 #endif
00160 
00161 #ifndef CRYPTOPP_L1_CACHE_LINE_SIZE
00162         // This should be a lower bound on the L1 cache line size. It's used for defense against timing attacks.
00163         // L1 cache line size is 32 on Pentium III and earlier
00164         #define CRYPTOPP_L1_CACHE_LINE_SIZE 32
00165 #endif
00166 
00167 #ifndef CRYPTOPP_L1_CACHE_ALIGN
00168         #ifdef _MSC_VER
00169                 #define CRYPTOPP_L1_CACHE_ALIGN(x) __declspec(align(CRYPTOPP_L1_CACHE_LINE_SIZE)) x
00170         #elif defined(__GNUC__)
00171                 #define CRYPTOPP_L1_CACHE_ALIGN(x) x __attribute__((aligned(CRYPTOPP_L1_CACHE_LINE_SIZE)))
00172         #endif
00173 #endif
00174 
00175 NAMESPACE_END
00176 
00177 // VC60 workaround: it doesn't allow typename in some places
00178 #if defined(_MSC_VER) && (_MSC_VER < 1300)
00179 #define CPP_TYPENAME
00180 #else
00181 #define CPP_TYPENAME typename
00182 #endif
00183 
00184 #ifdef _MSC_VER
00185 #define CRYPTOPP_NO_VTABLE __declspec(novtable)
00186 #else
00187 #define CRYPTOPP_NO_VTABLE
00188 #endif
00189 
00190 #ifdef _MSC_VER
00191         // 4231: nonstandard extension used : 'extern' before template explicit instantiation
00192         // 4250: dominance
00193         // 4251: member needs to have dll-interface
00194         // 4275: base needs to have dll-interface
00195         // 4660: explicitly instantiating a class that's already implicitly instantiated
00196         // 4661: no suitable definition provided for explicit template instantiation request
00197         // 4786: identifer was truncated in debug information
00198         // 4355: 'this' : used in base member initializer list
00199 #       pragma warning(disable: 4231 4250 4251 4275 4660 4661 4786 4355)
00200 #endif
00201 
00202 #if (defined(_MSC_VER) && _MSC_VER <= 1300) || defined(__MWERKS__) || defined(_STLPORT_VERSION)
00203 #define CRYPTOPP_DISABLE_UNCAUGHT_EXCEPTION
00204 #endif
00205 
00206 #ifndef CRYPTOPP_DISABLE_UNCAUGHT_EXCEPTION
00207 #define CRYPTOPP_UNCAUGHT_EXCEPTION_AVAILABLE
00208 #endif
00209 
00210 // CodeWarrior defines _MSC_VER
00211 #if !defined(CRYPTOPP_DISABLE_X86ASM) && ((defined(_MSC_VER) && !defined(__MWERKS__) && defined(_M_IX86)) || (defined(__GNUC__) && defined(__i386__)))
00212 #define CRYPTOPP_X86ASM_AVAILABLE
00213 #endif
00214 
00215 // ***************** determine availability of OS features ********************
00216 
00217 #ifndef NO_OS_DEPENDENCE
00218 
00219 #if defined(_WIN32) || defined(__CYGWIN__)
00220 #define CRYPTOPP_WIN32_AVAILABLE
00221 #endif
00222 
00223 #if defined(__unix__) || defined(__MACH__)
00224 #define CRYPTOPP_UNIX_AVAILABLE
00225 #endif
00226 
00227 #if defined(WORD64_AVAILABLE) && (defined(CRYPTOPP_WIN32_AVAILABLE) || defined(CRYPTOPP_UNIX_AVAILABLE))
00228 #       define HIGHRES_TIMER_AVAILABLE
00229 #endif
00230 
00231 #ifdef CRYPTOPP_UNIX_AVAILABLE
00232 #       define HAS_BERKELEY_STYLE_SOCKETS
00233 #endif
00234 
00235 #ifdef CRYPTOPP_WIN32_AVAILABLE
00236 #       define HAS_WINDOWS_STYLE_SOCKETS
00237 #endif
00238 
00239 #if defined(HIGHRES_TIMER_AVAILABLE) && (defined(HAS_BERKELEY_STYLE_SOCKETS) || defined(HAS_WINDOWS_STYLE_SOCKETS))
00240 #       define SOCKETS_AVAILABLE
00241 #endif
00242 
00243 #if defined(HAS_WINDOWS_STYLE_SOCKETS) && (!defined(HAS_BERKELEY_STYLE_SOCKETS) || defined(PREFER_WINDOWS_STYLE_SOCKETS))
00244 #       define USE_WINDOWS_STYLE_SOCKETS
00245 #else
00246 #       define USE_BERKELEY_STYLE_SOCKETS
00247 #endif
00248 
00249 #if defined(CRYPTOPP_WIN32_AVAILABLE) && !defined(USE_BERKELEY_STYLE_SOCKETS)
00250 #       define WINDOWS_PIPES_AVAILABLE
00251 #endif
00252 
00253 #if defined(CRYPTOPP_WIN32_AVAILABLE) && defined(USE_MS_CRYPTOAPI)
00254 #       define NONBLOCKING_RNG_AVAILABLE
00255 #       define OS_RNG_AVAILABLE
00256 #endif
00257 
00258 #if defined(CRYPTOPP_UNIX_AVAILABLE) || defined(CRYPTOPP_DOXYGEN_PROCESSING)
00259 #       define NONBLOCKING_RNG_AVAILABLE
00260 #       define BLOCKING_RNG_AVAILABLE
00261 #       define OS_RNG_AVAILABLE
00262 #       define HAS_PTHREADS
00263 #       define THREADS_AVAILABLE
00264 #endif
00265 
00266 #ifdef CRYPTOPP_WIN32_AVAILABLE
00267 #       define HAS_WINTHREADS
00268 #       define THREADS_AVAILABLE
00269 #endif
00270 
00271 #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
00272 #       define CRYPTOPP_MALLOC_ALIGNMENT_IS_16
00273 #endif
00274 
00275 #if defined(__linux__) || defined(__sun__) || defined(__CYGWIN__)
00276 #       define CRYPTOPP_MEMALIGN_AVAILABLE
00277 #endif
00278 
00279 #endif  // NO_OS_DEPENDENCE
00280 
00281 // ***************** DLL related ********************
00282 
00283 #ifdef CRYPTOPP_WIN32_AVAILABLE
00284 
00285 #ifdef CRYPTOPP_EXPORTS
00286 #define CRYPTOPP_IS_DLL
00287 #define CRYPTOPP_DLL __declspec(dllexport)
00288 #elif defined(CRYPTOPP_IMPORTS)
00289 #define CRYPTOPP_IS_DLL
00290 #define CRYPTOPP_DLL __declspec(dllimport)
00291 #else
00292 #define CRYPTOPP_DLL
00293 #endif
00294 
00295 #define CRYPTOPP_API __cdecl
00296 
00297 #else   // CRYPTOPP_WIN32_AVAILABLE
00298 
00299 #define CRYPTOPP_DLL
00300 #define CRYPTOPP_API
00301 
00302 #endif  // CRYPTOPP_WIN32_AVAILABLE
00303 
00304 #if defined(__MWERKS__)
00305 #define CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS extern class CRYPTOPP_DLL
00306 #else
00307 #define CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS extern template class CRYPTOPP_DLL
00308 #endif
00309 
00310 #if defined(CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES) && !defined(CRYPTOPP_IMPORTS)
00311 #define CRYPTOPP_DLL_TEMPLATE_CLASS template class CRYPTOPP_DLL
00312 #else
00313 #define CRYPTOPP_DLL_TEMPLATE_CLASS CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS
00314 #endif
00315 
00316 #if defined(__MWERKS__)
00317 #define CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS extern class
00318 #else
00319 #define CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS extern template class
00320 #endif
00321 
00322 #if defined(CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES) && !defined(CRYPTOPP_EXPORTS)
00323 #define CRYPTOPP_STATIC_TEMPLATE_CLASS template class
00324 #else
00325 #define CRYPTOPP_STATIC_TEMPLATE_CLASS CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS
00326 #endif
00327 
00328 #endif

Generated on Thu Nov 23 15:57:38 2006 for Crypto++ by  doxygen 1.5.1-p1