6 #ifndef CRYPTOPP_CONFIG_H 7 #define CRYPTOPP_CONFIG_H 13 #define IS_LITTLE_ENDIAN 22 #define USE_MS_CRYPTOAPI 25 #ifndef DSA_1024_BIT_MODULUS_ONLY 26 # define DSA_1024_BIT_MODULUS_ONLY 1 34 #define GZIP_OS_CODE 0 46 #define PREFER_BERKELEY_STYLE_SOCKETS 50 #define CRYPTOPP_RIJNDAEL_NAME "AES" 57 # error namespace support is now required 63 #define WORKAROUND_MS_BUG_Q258000 65 #ifdef CRYPTOPP_DOXYGEN_PROCESSING 68 # define NAMESPACE_BEGIN(x) 69 # define NAMESPACE_END 71 # define DOCUMENTED_TYPEDEF(x, y) class y : public x {}; 73 # define NAMESPACE_BEGIN(x) namespace x { 74 # define NAMESPACE_END } 75 # define DOCUMENTED_TYPEDEF(x, y) typedef x y; 77 #define ANONYMOUS_NAMESPACE_BEGIN namespace { 78 #define USING_NAMESPACE(x) using namespace x; 79 #define DOCUMENTED_NAMESPACE_BEGIN(x) namespace x { 80 #define DOCUMENTED_NAMESPACE_END } 86 #ifndef TYPE_OF_SOCKLEN_T 87 # if defined(_WIN32) || defined(__CYGWIN__) 88 # define TYPE_OF_SOCKLEN_T int 90 # define TYPE_OF_SOCKLEN_T ::socklen_t 94 #if defined(__CYGWIN__) && defined(PREFER_WINDOWS_STYLE_SOCKETS) 95 # define __USE_W32_SOCKETS 98 typedef unsigned char byte;
100 NAMESPACE_BEGIN(CryptoPP)
102 typedef
unsigned short word16;
103 typedef
unsigned int word32;
105 #if defined(_MSC_VER) || defined(__BORLANDC__) 106 typedef unsigned __int64 word64;
107 #define W64LIT(x) x##ui64 109 typedef unsigned long long word64;
110 #define W64LIT(x) x##ULL 114 typedef word64 lword;
115 const lword LWORD_MAX = W64LIT(0xffffffffffffffff);
118 #define CRYPTOPP_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) 123 #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__)) 124 typedef word32 hword;
127 #define CRYPTOPP_NATIVE_DWORD_AVAILABLE 128 #if defined(__alpha__) || defined(__ia64__) || defined(_ARCH_PPC64) || defined(__x86_64__) || defined(__mips64) || defined(__sparc64__) 129 #if defined(__GNUC__) && !defined(__INTEL_COMPILER) && !(CRYPTOPP_GCC_VERSION == 40001 && defined(__APPLE__)) && CRYPTOPP_GCC_VERSION >= 30400 132 typedef word32 hword;
134 typedef __uint128_t dword;
135 typedef __uint128_t word128;
136 #define CRYPTOPP_WORD128_AVAILABLE 139 typedef word16 hword;
141 typedef word64 dword;
145 #define CRYPTOPP_BOOL_SLOW_WORD64 1 146 typedef word16 hword;
148 typedef word64 dword;
151 #ifndef CRYPTOPP_BOOL_SLOW_WORD64 152 #define CRYPTOPP_BOOL_SLOW_WORD64 0 155 const unsigned int WORD_SIZE =
sizeof(word);
156 const unsigned int WORD_BITS = WORD_SIZE * 8;
160 #ifndef CRYPTOPP_L1_CACHE_LINE_SIZE 162 #if defined(_M_X64) || defined(__x86_64__) 163 #define CRYPTOPP_L1_CACHE_LINE_SIZE 64 166 #define CRYPTOPP_L1_CACHE_LINE_SIZE 32 170 #if defined(_MSC_VER) 174 #if _MSC_VER > 1200 || defined(_mm_free) 175 #define CRYPTOPP_MSVC6PP_OR_LATER // VC 6 processor pack or later 177 #define CRYPTOPP_MSVC6_NO_PP // VC 6 without processor pack 181 #ifndef CRYPTOPP_ALIGN_DATA 182 #if defined(CRYPTOPP_MSVC6PP_OR_LATER) 183 #define CRYPTOPP_ALIGN_DATA(x) __declspec(align(x)) 184 #elif defined(__GNUC__) 185 #define CRYPTOPP_ALIGN_DATA(x) __attribute__((aligned(x))) 187 #define CRYPTOPP_ALIGN_DATA(x) 191 #ifndef CRYPTOPP_SECTION_ALIGN16 192 #if defined(__GNUC__) && !defined(__APPLE__) 194 #define CRYPTOPP_SECTION_ALIGN16 __attribute__((section ("CryptoPP_Align16"))) 196 #define CRYPTOPP_SECTION_ALIGN16 200 #if defined(_MSC_VER) || defined(__fastcall) 201 #define CRYPTOPP_FASTCALL __fastcall 203 #define CRYPTOPP_FASTCALL 207 #if defined(_MSC_VER) && (_MSC_VER < 1300) 210 #define CPP_TYPENAME typename 214 #if defined(_MSC_VER) && !defined(CRYPTOPP_MSVC6PP_OR_LATER) 215 #define CRYPTOPP_VC6_INT64 (__int64) 217 #define CRYPTOPP_VC6_INT64 221 #define CRYPTOPP_NO_VTABLE __declspec(novtable) 223 #define CRYPTOPP_NO_VTABLE 236 # pragma warning(disable: 4231 4250 4251 4275 4660 4661 4786 4355 4910) 244 #if (defined(_MSC_VER) && _MSC_VER <= 1300) || defined(__MWERKS__) || defined(_STLPORT_VERSION) 245 #define CRYPTOPP_DISABLE_UNCAUGHT_EXCEPTION 248 #ifndef CRYPTOPP_DISABLE_UNCAUGHT_EXCEPTION 249 #define CRYPTOPP_UNCAUGHT_EXCEPTION_AVAILABLE 252 #ifdef CRYPTOPP_DISABLE_X86ASM // for backwards compatibility: this macro had both meanings 253 #define CRYPTOPP_DISABLE_ASM 254 #define CRYPTOPP_DISABLE_SSE2 257 #if !defined(CRYPTOPP_DISABLE_ASM) && ((defined(_MSC_VER) && defined(_M_IX86)) || (defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)))) 259 #define CRYPTOPP_X86_ASM_AVAILABLE 261 #if !defined(CRYPTOPP_DISABLE_SSE2) && (defined(CRYPTOPP_MSVC6PP_OR_LATER) || CRYPTOPP_GCC_VERSION >= 30300) 262 #define CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE 1 264 #define CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE 0 269 #if !defined(CRYPTOPP_DISABLE_SSSE3) && (_MSC_VER >= 1400 || CRYPTOPP_GCC_VERSION >= 40102) 270 #define CRYPTOPP_BOOL_SSSE3_ASM_AVAILABLE 1 272 #define CRYPTOPP_BOOL_SSSE3_ASM_AVAILABLE 0 276 #if !defined(CRYPTOPP_DISABLE_ASM) && defined(_MSC_VER) && defined(_M_X64) 277 #define CRYPTOPP_X64_MASM_AVAILABLE 280 #if !defined(CRYPTOPP_DISABLE_ASM) && defined(__GNUC__) && defined(__x86_64__) 281 #define CRYPTOPP_X64_ASM_AVAILABLE 284 #if !defined(CRYPTOPP_DISABLE_SSE2) && (defined(CRYPTOPP_MSVC6PP_OR_LATER) || defined(__SSE2__)) 285 #define CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE 1 287 #define CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE 0 290 #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) 291 #define CRYPTOPP_BOOL_AESNI_INTRINSICS_AVAILABLE 1 293 #define CRYPTOPP_BOOL_AESNI_INTRINSICS_AVAILABLE 0 296 #if CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE || CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE || defined(CRYPTOPP_X64_MASM_AVAILABLE) 297 #define CRYPTOPP_BOOL_ALIGN16_ENABLED 1 299 #define CRYPTOPP_BOOL_ALIGN16_ENABLED 0 303 #if defined(CRYPTOPP_MSVC6PP_OR_LATER) 304 #define CRYPTOPP_MM_MALLOC_AVAILABLE 305 #elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) 306 #define CRYPTOPP_MALLOC_ALIGNMENT_IS_16 307 #elif defined(__linux__) || defined(__sun__) || defined(__CYGWIN__) 308 #define CRYPTOPP_MEMALIGN_AVAILABLE 310 #define CRYPTOPP_NO_ALIGNED_ALLOC 314 #if defined(_MSC_VER) && _MSC_VER >= 1300 315 # define CRYPTOPP_NOINLINE_DOTDOTDOT 316 # define CRYPTOPP_NOINLINE __declspec(noinline) 317 #elif defined(__GNUC__) 318 # define CRYPTOPP_NOINLINE_DOTDOTDOT 319 # define CRYPTOPP_NOINLINE __attribute__((noinline)) 321 # define CRYPTOPP_NOINLINE_DOTDOTDOT ... 322 # define CRYPTOPP_NOINLINE 326 #if (defined(_MSC_VER) && _MSC_VER <= 1300) || defined(__INTEL_COMPILER) 327 # define CRYPTOPP_CONSTANT(x) enum {x}; 329 # define CRYPTOPP_CONSTANT(x) static const int x; 332 #if defined(_M_X64) || defined(__x86_64__) 333 #define CRYPTOPP_BOOL_X64 1 335 #define CRYPTOPP_BOOL_X64 0 339 #if defined(_M_IX86) || defined(__i386__) || defined(__i386) || defined(_X86_) || defined(__I86__) || defined(__INTEL__) 340 #define CRYPTOPP_BOOL_X86 1 342 #define CRYPTOPP_BOOL_X86 0 345 #if CRYPTOPP_BOOL_X64 || CRYPTOPP_BOOL_X86 || defined(__powerpc__) 346 #define CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS 349 #define CRYPTOPP_VERSION 561 353 #ifndef NO_OS_DEPENDENCE 355 #if defined(_WIN32) || defined(__CYGWIN__) 356 #define CRYPTOPP_WIN32_AVAILABLE 359 #if defined(__unix__) || defined(__MACH__) || defined(__NetBSD__) || defined(__sun) 360 #define CRYPTOPP_UNIX_AVAILABLE 363 #if defined(CRYPTOPP_WIN32_AVAILABLE) || defined(CRYPTOPP_UNIX_AVAILABLE) 364 # define HIGHRES_TIMER_AVAILABLE 367 #ifdef CRYPTOPP_UNIX_AVAILABLE 368 # define HAS_BERKELEY_STYLE_SOCKETS 371 #ifdef CRYPTOPP_WIN32_AVAILABLE 372 # define HAS_WINDOWS_STYLE_SOCKETS 375 #if defined(HIGHRES_TIMER_AVAILABLE) && (defined(HAS_BERKELEY_STYLE_SOCKETS) || defined(HAS_WINDOWS_STYLE_SOCKETS)) 376 # define SOCKETS_AVAILABLE 379 #if defined(HAS_WINDOWS_STYLE_SOCKETS) && (!defined(HAS_BERKELEY_STYLE_SOCKETS) || defined(PREFER_WINDOWS_STYLE_SOCKETS)) 380 # define USE_WINDOWS_STYLE_SOCKETS 382 # define USE_BERKELEY_STYLE_SOCKETS 385 #if defined(HIGHRES_TIMER_AVAILABLE) && defined(CRYPTOPP_WIN32_AVAILABLE) && !defined(USE_BERKELEY_STYLE_SOCKETS) 386 # define WINDOWS_PIPES_AVAILABLE 389 #if defined(CRYPTOPP_WIN32_AVAILABLE) && defined(USE_MS_CRYPTOAPI) 390 # define NONBLOCKING_RNG_AVAILABLE 391 # define OS_RNG_AVAILABLE 394 #if defined(CRYPTOPP_UNIX_AVAILABLE) || defined(CRYPTOPP_DOXYGEN_PROCESSING) 395 # define NONBLOCKING_RNG_AVAILABLE 396 # define BLOCKING_RNG_AVAILABLE 397 # define OS_RNG_AVAILABLE 398 # define HAS_PTHREADS 399 # define THREADS_AVAILABLE 402 #ifdef CRYPTOPP_WIN32_AVAILABLE 403 # define HAS_WINTHREADS 404 # define THREADS_AVAILABLE 407 #endif // NO_OS_DEPENDENCE 411 #if defined(CRYPTOPP_WIN32_AVAILABLE) && !defined(CRYPTOPP_DOXYGEN_PROCESSING) 413 #ifdef CRYPTOPP_EXPORTS 414 #define CRYPTOPP_IS_DLL 415 #define CRYPTOPP_DLL __declspec(dllexport) 416 #elif defined(CRYPTOPP_IMPORTS) 417 #define CRYPTOPP_IS_DLL 418 #define CRYPTOPP_DLL __declspec(dllimport) 423 #define CRYPTOPP_API __cdecl 425 #else // CRYPTOPP_WIN32_AVAILABLE 430 #endif // CRYPTOPP_WIN32_AVAILABLE 432 #if defined(__MWERKS__) 433 #define CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS extern class CRYPTOPP_DLL 434 #elif defined(__BORLANDC__) || defined(__SUNPRO_CC) 435 #define CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS template class CRYPTOPP_DLL 437 #define CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS extern template class CRYPTOPP_DLL 440 #if defined(CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES) && !defined(CRYPTOPP_IMPORTS) 441 #define CRYPTOPP_DLL_TEMPLATE_CLASS template class CRYPTOPP_DLL 443 #define CRYPTOPP_DLL_TEMPLATE_CLASS CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS 446 #if defined(__MWERKS__) 447 #define CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS extern class 448 #elif defined(__BORLANDC__) || defined(__SUNPRO_CC) 449 #define CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS template class 451 #define CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS extern template class 454 #if defined(CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES) && !defined(CRYPTOPP_EXPORTS) 455 #define CRYPTOPP_STATIC_TEMPLATE_CLASS template class 457 #define CRYPTOPP_STATIC_TEMPLATE_CLASS CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS