00001 #ifndef CRYPTOPP_CONFIG_H
00002 #define CRYPTOPP_CONFIG_H
00003
00004
00005
00006
00007 #if !defined(IS_LITTLE_ENDIAN) && (defined(__BIG_ENDIAN__) || defined(__sparc) || defined(__sparc__) || defined(__hppa__) || defined(__MIPSEB__) || defined(__ARMEB__) || (defined(__MWERKS__) && !defined(__INTEL__)))
00008 # define IS_BIG_ENDIAN
00009 #endif
00010
00011
00012
00013 #ifndef IS_BIG_ENDIAN
00014 # define IS_LITTLE_ENDIAN
00015 #endif
00016
00017
00018
00019
00020
00021
00022
00023
00024 #define USE_MS_CRYPTOAPI
00025
00026
00027 #ifndef DSA_1024_BIT_MODULUS_ONLY
00028 # define DSA_1024_BIT_MODULUS_ONLY 1
00029 #endif
00030
00031
00032
00033
00034
00035
00036 #define GZIP_OS_CODE 0
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048 #define PREFER_BERKELEY_STYLE_SOCKETS
00049
00050
00051
00052 #define CRYPTOPP_RIJNDAEL_NAME "AES"
00053
00054
00055
00056
00057
00058 #ifdef NO_NAMESPACE
00059 # error namespace support is now required
00060 #endif
00061
00062
00063
00064
00065 #define WORKAROUND_MS_BUG_Q258000
00066
00067 #ifdef CRYPTOPP_DOXYGEN_PROCESSING
00068
00069 # define CryptoPP
00070 # define NAMESPACE_BEGIN(x)
00071 # define NAMESPACE_END
00072
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
00085
00086
00087
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;
00101
00102 NAMESPACE_BEGIN(CryptoPP)
00103
00104 typedef unsigned short word16;
00105 typedef unsigned int word32;
00106
00107 #if defined(_MSC_VER) || defined(__BORLANDC__)
00108 typedef unsigned __int64 word64;
00109 #define W64LIT(x) x##ui64
00110 #else
00111 typedef unsigned long long word64;
00112 #define W64LIT(x) x##ULL
00113 #endif
00114
00115
00116 typedef word64 lword;
00117 const lword LWORD_MAX = W64LIT(0xffffffffffffffff);
00118
00119 #ifdef __GNUC__
00120 #define CRYPTOPP_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
00121 #endif
00122
00123
00124
00125 #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__)) || (defined(__SUNPRO_CC) && defined(__x86_64__))
00126 typedef word32 hword;
00127 typedef word64 word;
00128 #else
00129 #define CRYPTOPP_NATIVE_DWORD_AVAILABLE
00130 #if defined(__alpha__) || defined(__ia64__) || defined(_ARCH_PPC64) || defined(__x86_64__) || defined(__mips64) || defined(__sparc64__)
00131 #if defined(__GNUC__) && !defined(__INTEL_COMPILER) && !(CRYPTOPP_GCC_VERSION == 40001 && defined(__APPLE__)) && CRYPTOPP_GCC_VERSION >= 30400
00132
00133
00134 typedef word32 hword;
00135 typedef word64 word;
00136 typedef __uint128_t dword;
00137 typedef __uint128_t word128;
00138 #define CRYPTOPP_WORD128_AVAILABLE
00139 #else
00140
00141 typedef word16 hword;
00142 typedef word32 word;
00143 typedef word64 dword;
00144 #endif
00145 #else
00146
00147 #define CRYPTOPP_BOOL_SLOW_WORD64 1
00148 typedef word16 hword;
00149 typedef word32 word;
00150 typedef word64 dword;
00151 #endif
00152 #endif
00153 #ifndef CRYPTOPP_BOOL_SLOW_WORD64
00154 #define CRYPTOPP_BOOL_SLOW_WORD64 0
00155 #endif
00156
00157 const unsigned int WORD_SIZE = sizeof(word);
00158 const unsigned int WORD_BITS = WORD_SIZE * 8;
00159
00160 NAMESPACE_END
00161
00162 #ifndef CRYPTOPP_L1_CACHE_LINE_SIZE
00163
00164 #if defined(_M_X64) || defined(__x86_64__)
00165 #define CRYPTOPP_L1_CACHE_LINE_SIZE 64
00166 #else
00167
00168 #define CRYPTOPP_L1_CACHE_LINE_SIZE 32
00169 #endif
00170 #endif
00171
00172 #if defined(_MSC_VER)
00173 #if _MSC_VER == 1200
00174 #include <malloc.h>
00175 #endif
00176 #if _MSC_VER > 1200 || defined(_mm_free)
00177 #define CRYPTOPP_MSVC6PP_OR_LATER // VC 6 processor pack or later
00178 #else
00179 #define CRYPTOPP_MSVC6_NO_PP // VC 6 without processor pack
00180 #endif
00181 #endif
00182
00183 #ifndef CRYPTOPP_ALIGN_DATA
00184 #if defined(CRYPTOPP_MSVC6PP_OR_LATER)
00185 #define CRYPTOPP_ALIGN_DATA(x) __declspec(align(x))
00186 #elif defined(__GNUC__)
00187 #define CRYPTOPP_ALIGN_DATA(x) __attribute__((aligned(x)))
00188 #else
00189 #define CRYPTOPP_ALIGN_DATA(x)
00190 #endif
00191 #endif
00192
00193 #ifndef CRYPTOPP_SECTION_ALIGN16
00194 #if defined(__GNUC__) && !defined(__APPLE__)
00195
00196 #define CRYPTOPP_SECTION_ALIGN16 __attribute__((section ("CryptoPP_Align16")))
00197 #else
00198 #define CRYPTOPP_SECTION_ALIGN16
00199 #endif
00200 #endif
00201
00202 #if defined(_MSC_VER) || defined(__fastcall)
00203 #define CRYPTOPP_FASTCALL __fastcall
00204 #else
00205 #define CRYPTOPP_FASTCALL
00206 #endif
00207
00208
00209 #if defined(_MSC_VER) && (_MSC_VER < 1300)
00210 #define CPP_TYPENAME
00211 #else
00212 #define CPP_TYPENAME typename
00213 #endif
00214
00215
00216 #if defined(_MSC_VER) && !defined(CRYPTOPP_MSVC6PP_OR_LATER)
00217 #define CRYPTOPP_VC6_INT64 (__int64)
00218 #else
00219 #define CRYPTOPP_VC6_INT64
00220 #endif
00221
00222 #ifdef _MSC_VER
00223 #define CRYPTOPP_NO_VTABLE __declspec(novtable)
00224 #else
00225 #define CRYPTOPP_NO_VTABLE
00226 #endif
00227
00228 #ifdef _MSC_VER
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238 # pragma warning(disable: 4231 4250 4251 4275 4660 4661 4786 4355 4910)
00239 #endif
00240
00241 #ifdef __BORLANDC__
00242
00243 # pragma warn -8037
00244 #endif
00245
00246 #if (defined(_MSC_VER) && _MSC_VER <= 1300) || defined(__MWERKS__) || defined(_STLPORT_VERSION)
00247 #define CRYPTOPP_DISABLE_UNCAUGHT_EXCEPTION
00248 #endif
00249
00250 #ifndef CRYPTOPP_DISABLE_UNCAUGHT_EXCEPTION
00251 #define CRYPTOPP_UNCAUGHT_EXCEPTION_AVAILABLE
00252 #endif
00253
00254 #ifdef CRYPTOPP_DISABLE_X86ASM // for backwards compatibility: this macro had both meanings
00255 #define CRYPTOPP_DISABLE_ASM
00256 #define CRYPTOPP_DISABLE_SSE2
00257 #endif
00258
00259 #if !defined(CRYPTOPP_DISABLE_ASM) && ((defined(_MSC_VER) && defined(_M_IX86)) || (defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))))
00260
00261 #define CRYPTOPP_X86_ASM_AVAILABLE
00262
00263 #if !defined(CRYPTOPP_DISABLE_SSE2) && (defined(CRYPTOPP_MSVC6PP_OR_LATER) || CRYPTOPP_GCC_VERSION >= 30300)
00264 #define CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE 1
00265 #else
00266 #define CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE 0
00267 #endif
00268
00269
00270
00271 #if !defined(CRYPTOPP_DISABLE_SSSE3) && (_MSC_VER >= 1400 || CRYPTOPP_GCC_VERSION >= 40102)
00272 #define CRYPTOPP_BOOL_SSSE3_ASM_AVAILABLE 1
00273 #else
00274 #define CRYPTOPP_BOOL_SSSE3_ASM_AVAILABLE 0
00275 #endif
00276 #endif
00277
00278 #if !defined(CRYPTOPP_DISABLE_ASM) && defined(_MSC_VER) && defined(_M_X64)
00279 #define CRYPTOPP_X64_MASM_AVAILABLE
00280 #endif
00281
00282 #if !defined(CRYPTOPP_DISABLE_ASM) && defined(__GNUC__) && defined(__x86_64__)
00283 #define CRYPTOPP_X64_ASM_AVAILABLE
00284 #endif
00285
00286 #if !defined(CRYPTOPP_DISABLE_SSE2) && (defined(CRYPTOPP_MSVC6PP_OR_LATER) || defined(__SSE2__))
00287 #define CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE 1
00288 #else
00289 #define CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE 0
00290 #endif
00291
00292 #if !defined(CRYPTOPP_DISABLE_SSSE3) && !defined(CRYPTOPP_DISABLE_AESNI) && CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE && (CRYPTOPP_GCC_VERSION >= 40400 || _MSC_FULL_VER >= 150030729 || __INTEL_COMPILER >= 1110)
00293 #define CRYPTOPP_BOOL_AESNI_INTRINSICS_AVAILABLE 1
00294 #else
00295 #define CRYPTOPP_BOOL_AESNI_INTRINSICS_AVAILABLE 0
00296 #endif
00297
00298 #if CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE || CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE || defined(CRYPTOPP_X64_MASM_AVAILABLE)
00299 #define CRYPTOPP_BOOL_ALIGN16_ENABLED 1
00300 #else
00301 #define CRYPTOPP_BOOL_ALIGN16_ENABLED 0
00302 #endif
00303
00304
00305 #if defined(CRYPTOPP_MSVC6PP_OR_LATER)
00306 #define CRYPTOPP_MM_MALLOC_AVAILABLE
00307 #elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
00308 #define CRYPTOPP_MALLOC_ALIGNMENT_IS_16
00309 #elif defined(__linux__) || defined(__sun__) || defined(__CYGWIN__)
00310 #define CRYPTOPP_MEMALIGN_AVAILABLE
00311 #else
00312 #define CRYPTOPP_NO_ALIGNED_ALLOC
00313 #endif
00314
00315
00316 #if defined(_MSC_VER) && _MSC_VER >= 1300
00317 # define CRYPTOPP_NOINLINE_DOTDOTDOT
00318 # define CRYPTOPP_NOINLINE __declspec(noinline)
00319 #elif defined(__GNUC__)
00320 # define CRYPTOPP_NOINLINE_DOTDOTDOT
00321 # define CRYPTOPP_NOINLINE __attribute__((noinline))
00322 #else
00323 # define CRYPTOPP_NOINLINE_DOTDOTDOT ...
00324 # define CRYPTOPP_NOINLINE
00325 #endif
00326
00327
00328 #if (defined(_MSC_VER) && _MSC_VER <= 1300) || defined(__INTEL_COMPILER)
00329 # define CRYPTOPP_CONSTANT(x) enum {x};
00330 #else
00331 # define CRYPTOPP_CONSTANT(x) static const int x;
00332 #endif
00333
00334 #if defined(_M_X64) || defined(__x86_64__)
00335 #define CRYPTOPP_BOOL_X64 1
00336 #else
00337 #define CRYPTOPP_BOOL_X64 0
00338 #endif
00339
00340
00341 #if defined(_M_IX86) || defined(__i386__) || defined(__i386) || defined(_X86_) || defined(__I86__) || defined(__INTEL__)
00342 #define CRYPTOPP_BOOL_X86 1
00343 #else
00344 #define CRYPTOPP_BOOL_X86 0
00345 #endif
00346
00347 #if CRYPTOPP_BOOL_X64 || CRYPTOPP_BOOL_X86 || defined(__powerpc__)
00348 #define CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS
00349 #endif
00350
00351 #define CRYPTOPP_VERSION 561
00352
00353
00354
00355 #ifndef NO_OS_DEPENDENCE
00356
00357 #if defined(_WIN32) || defined(__CYGWIN__)
00358 #define CRYPTOPP_WIN32_AVAILABLE
00359 #endif
00360
00361 #if defined(__unix__) || defined(__MACH__) || defined(__NetBSD__) || defined(__sun)
00362 #define CRYPTOPP_UNIX_AVAILABLE
00363 #endif
00364
00365 #if defined(CRYPTOPP_WIN32_AVAILABLE) || defined(CRYPTOPP_UNIX_AVAILABLE)
00366 # define HIGHRES_TIMER_AVAILABLE
00367 #endif
00368
00369 #ifdef CRYPTOPP_UNIX_AVAILABLE
00370 # define HAS_BERKELEY_STYLE_SOCKETS
00371 #endif
00372
00373 #ifdef CRYPTOPP_WIN32_AVAILABLE
00374 # define HAS_WINDOWS_STYLE_SOCKETS
00375 #endif
00376
00377 #if defined(HIGHRES_TIMER_AVAILABLE) && (defined(HAS_BERKELEY_STYLE_SOCKETS) || defined(HAS_WINDOWS_STYLE_SOCKETS))
00378 # define SOCKETS_AVAILABLE
00379 #endif
00380
00381 #if defined(HAS_WINDOWS_STYLE_SOCKETS) && (!defined(HAS_BERKELEY_STYLE_SOCKETS) || defined(PREFER_WINDOWS_STYLE_SOCKETS))
00382 # define USE_WINDOWS_STYLE_SOCKETS
00383 #else
00384 # define USE_BERKELEY_STYLE_SOCKETS
00385 #endif
00386
00387 #if defined(HIGHRES_TIMER_AVAILABLE) && defined(CRYPTOPP_WIN32_AVAILABLE) && !defined(USE_BERKELEY_STYLE_SOCKETS)
00388 # define WINDOWS_PIPES_AVAILABLE
00389 #endif
00390
00391 #if defined(CRYPTOPP_WIN32_AVAILABLE) && defined(USE_MS_CRYPTOAPI)
00392 # define NONBLOCKING_RNG_AVAILABLE
00393 # define OS_RNG_AVAILABLE
00394 #endif
00395
00396 #if defined(CRYPTOPP_UNIX_AVAILABLE) || defined(CRYPTOPP_DOXYGEN_PROCESSING)
00397 # define NONBLOCKING_RNG_AVAILABLE
00398 # define BLOCKING_RNG_AVAILABLE
00399 # define OS_RNG_AVAILABLE
00400 # define HAS_PTHREADS
00401 # define THREADS_AVAILABLE
00402 #endif
00403
00404 #ifdef CRYPTOPP_WIN32_AVAILABLE
00405 # define HAS_WINTHREADS
00406 # define THREADS_AVAILABLE
00407 #endif
00408
00409 #endif // NO_OS_DEPENDENCE
00410
00411
00412
00413 #if defined(CRYPTOPP_WIN32_AVAILABLE) && !defined(CRYPTOPP_DOXYGEN_PROCESSING)
00414
00415 #ifdef CRYPTOPP_EXPORTS
00416 #define CRYPTOPP_IS_DLL
00417 #define CRYPTOPP_DLL __declspec(dllexport)
00418 #elif defined(CRYPTOPP_IMPORTS)
00419 #define CRYPTOPP_IS_DLL
00420 #define CRYPTOPP_DLL __declspec(dllimport)
00421 #else
00422 #define CRYPTOPP_DLL
00423 #endif
00424
00425 #define CRYPTOPP_API __cdecl
00426
00427 #else // CRYPTOPP_WIN32_AVAILABLE
00428
00429 #define CRYPTOPP_DLL
00430 #define CRYPTOPP_API
00431
00432 #endif // CRYPTOPP_WIN32_AVAILABLE
00433
00434 #if defined(__MWERKS__)
00435 #define CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS extern class CRYPTOPP_DLL
00436 #elif defined(__BORLANDC__) || defined(__SUNPRO_CC)
00437 #define CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS template class CRYPTOPP_DLL
00438 #else
00439 #define CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS extern template class CRYPTOPP_DLL
00440 #endif
00441
00442 #if defined(CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES) && !defined(CRYPTOPP_IMPORTS)
00443 #define CRYPTOPP_DLL_TEMPLATE_CLASS template class CRYPTOPP_DLL
00444 #else
00445 #define CRYPTOPP_DLL_TEMPLATE_CLASS CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS
00446 #endif
00447
00448 #if defined(__MWERKS__)
00449 #define CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS extern class
00450 #elif defined(__BORLANDC__) || defined(__SUNPRO_CC)
00451 #define CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS template class
00452 #else
00453 #define CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS extern template class
00454 #endif
00455
00456 #if defined(CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES) && !defined(CRYPTOPP_EXPORTS)
00457 #define CRYPTOPP_STATIC_TEMPLATE_CLASS template class
00458 #else
00459 #define CRYPTOPP_STATIC_TEMPLATE_CLASS CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS
00460 #endif
00461
00462 #endif