Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

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(__sparc__) || defined(__hppa__) || defined(__ppc__) || 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 if your compiler does not support namespaces
00027 // #define NO_NAMESPACE
00028 #ifdef NO_NAMESPACE
00029 #define std
00030 #define CryptoPP
00031 #define USING_NAMESPACE(x)
00032 #define NAMESPACE_BEGIN(x)
00033 #define NAMESPACE_END
00034 #define ANONYMOUS_NAMESPACE_BEGIN
00035 #else
00036 #define USING_NAMESPACE(x) using namespace x;
00037 #define NAMESPACE_BEGIN(x) namespace x {
00038 #define ANONYMOUS_NAMESPACE_BEGIN namespace {
00039 #define NAMESPACE_END }
00040 #endif
00041 
00042 // ***************** Less Important Settings ***************
00043 
00044 // switch between different secure memory allocation mechnisms, this is the only
00045 // one available right now
00046 #define SECALLOC_DEFAULT
00047 
00048 #define GZIP_OS_CODE 0
00049 
00050 // Try this if your CPU has 256K internal cache or a slow multiply instruction
00051 // and you want a (possibly) faster IDEA implementation using log tables
00052 // #define IDEA_LARGECACHE
00053 
00054 // Try this if you have a large cache or your CPU is slow manipulating
00055 // individual bytes.
00056 // #define DIAMOND_USE_PERMTABLE
00057 
00058 // Define this if, for the linear congruential RNG, you want to use
00059 // the original constants as specified in S.K. Park and K.W. Miller's
00060 // CACM paper.
00061 // #define LCRNG_ORIGINAL_NUMBERS
00062 
00063 // choose which style of sockets to wrap (mostly useful for cygwin which has both)
00064 #define PREFER_BERKELEY_STYLE_SOCKETS
00065 // #define PREFER_WINDOWS_STYLE_SOCKETS
00066 
00067 // ***************** Important Settings Again ********************
00068 // But the defaults should be ok.
00069 
00070 typedef unsigned char byte;     // moved outside namespace for Borland C++Builder 5
00071 
00072 NAMESPACE_BEGIN(CryptoPP)
00073 
00074 typedef unsigned short word16;
00075 #if defined(__alpha) && !defined(_MSC_VER)
00076 typedef unsigned int word32;
00077 #else
00078 typedef unsigned long word32;
00079 #endif
00080 
00081 #if defined(__GNUC__) || defined(__MWERKS__)
00082 #define WORD64_AVAILABLE
00083 typedef unsigned long long word64;
00084 #define W64LIT(x) x##LL
00085 #elif defined(_MSC_VER) || defined(__BCPLUSPLUS__)
00086 #define WORD64_AVAILABLE
00087 typedef unsigned __int64 word64;
00088 #define W64LIT(x) x##ui64
00089 #endif
00090 
00091 // defined this if your CPU is not 64-bit
00092 #if defined(WORD64_AVAILABLE) && !defined(__alpha)
00093 #define SLOW_WORD64
00094 #endif
00095 
00096 // word should have the same size as your CPU registers
00097 // dword should be twice as big as word
00098 
00099 #if (defined(__GNUC__) && !defined(__alpha)) || defined(__MWERKS__)
00100 typedef unsigned long word;
00101 typedef unsigned long long dword;
00102 #elif defined(_MSC_VER) || defined(__BCPLUSPLUS__)
00103 typedef unsigned __int32 word;
00104 typedef unsigned __int64 dword;
00105 #else
00106 typedef unsigned int word;
00107 typedef unsigned long dword;
00108 #endif
00109 
00110 const unsigned int WORD_SIZE = sizeof(word);
00111 const unsigned int WORD_BITS = WORD_SIZE * 8;
00112 
00113 #define LOW_WORD(x) (word)(x)
00114 
00115 union dword_union
00116 {
00117         dword_union (const dword &dw) : dw(dw) {}
00118         dword dw;
00119         word w[2];
00120 };
00121 
00122 #ifdef IS_LITTLE_ENDIAN
00123 #define HIGH_WORD(x) (dword_union(x).w[1])
00124 #else
00125 #define HIGH_WORD(x) (dword_union(x).w[0])
00126 #endif
00127 
00128 // if the above HIGH_WORD macro doesn't work (if you are not sure, compile it
00129 // and run the validation tests), try this:
00130 // #define HIGH_WORD(x) (word)((x)>>WORD_BITS)
00131 
00132 #if defined(_MSC_VER) || defined(__BCPLUSPLUS__)
00133 #define INTEL_INTRINSICS
00134 #define FAST_ROTATE
00135 #elif defined(__MWERKS__) && TARGET_CPU_PPC
00136 #define PPC_INTRINSICS
00137 #define FAST_ROTATE
00138 #elif defined(__GNUC__) && defined(__i386__)
00139 // GCC does peephole optimizations which should result in using rotate instructions
00140 #define FAST_ROTATE
00141 #endif
00142 
00143 // can't use std::min or std::max in MSVC60 or Cygwin 1.1.0
00144 template <class _Tp>
00145 inline const _Tp& STDMIN(const _Tp& __a, const _Tp& __b) {
00146   return __b < __a ? __b : __a;
00147 }
00148 
00149 template <class _Tp>
00150 inline const _Tp& STDMAX(const _Tp& __a, const _Tp& __b) {
00151   return  __a < __b ? __b : __a;
00152 }
00153 
00154 #ifdef _MSC_VER
00155 // 4250: dominance
00156 // 4660: explicitly instantiating a class that's already implicitly instantiated
00157 // 4786: identifer was truncated in debug information
00158 // 4355: 'this' : used in base member initializer list
00159 // 4800: converting int to bool
00160 #pragma warning(disable: 4250 4660 4786 4355 4800)
00161 #endif
00162 
00163 NAMESPACE_END
00164 
00165 #endif

Generated at Mon Jan 15 01:16:30 2001 for Crypto++ by doxygen1.2.4 written by Dimitri van Heesch, © 1997-2000