mirror of
https://github.com/shadps4-emu/ext-cryptopp.git
synced 2024-11-23 01:49:41 +00:00
Attempt to keep Clang out of other compiler paths (GH #147)
This commit is contained in:
parent
0d9cd947a0
commit
a89a27b72c
@ -393,7 +393,7 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(DEBUG_NEW) && (_MSC_VER >= 1300)
|
#if defined(DEBUG_NEW) && (CRYPTOPP_MSC_VERSION >= 1300)
|
||||||
# pragma push_macro("new")
|
# pragma push_macro("new")
|
||||||
# undef new
|
# undef new
|
||||||
#endif
|
#endif
|
||||||
@ -404,7 +404,7 @@ public:
|
|||||||
CRYPTOPP_UNUSED(p); // silence warning
|
CRYPTOPP_UNUSED(p); // silence warning
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(DEBUG_NEW) && (_MSC_VER >= 1300)
|
#if defined(DEBUG_NEW) && (CRYPTOPP_MSC_VERSION >= 1300)
|
||||||
# pragma pop_macro("new")
|
# pragma pop_macro("new")
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
34
arm_simd.h
34
arm_simd.h
@ -29,7 +29,7 @@
|
|||||||
/// \since Crypto++ 8.6
|
/// \since Crypto++ 8.6
|
||||||
inline uint32_t CRC32B (uint32_t crc, uint8_t val)
|
inline uint32_t CRC32B (uint32_t crc, uint8_t val)
|
||||||
{
|
{
|
||||||
#if defined(_MSC_VER)
|
#if defined(CRYPTOPP_MSC_VERSION)
|
||||||
return __crc32b(crc, val);
|
return __crc32b(crc, val);
|
||||||
#else
|
#else
|
||||||
__asm__ ("crc32b %w0, %w0, %w1 \n\t"
|
__asm__ ("crc32b %w0, %w0, %w1 \n\t"
|
||||||
@ -45,7 +45,7 @@ inline uint32_t CRC32B (uint32_t crc, uint8_t val)
|
|||||||
/// \since Crypto++ 8.6
|
/// \since Crypto++ 8.6
|
||||||
inline uint32_t CRC32W (uint32_t crc, uint32_t val)
|
inline uint32_t CRC32W (uint32_t crc, uint32_t val)
|
||||||
{
|
{
|
||||||
#if defined(_MSC_VER)
|
#if defined(CRYPTOPP_MSC_VERSION)
|
||||||
return __crc32w(crc, val);
|
return __crc32w(crc, val);
|
||||||
#else
|
#else
|
||||||
__asm__ ("crc32w %w0, %w0, %w1 \n\t"
|
__asm__ ("crc32w %w0, %w0, %w1 \n\t"
|
||||||
@ -61,7 +61,7 @@ inline uint32_t CRC32W (uint32_t crc, uint32_t val)
|
|||||||
/// \since Crypto++ 8.6
|
/// \since Crypto++ 8.6
|
||||||
inline uint32_t CRC32Wx4 (uint32_t crc, const uint32_t vals[4])
|
inline uint32_t CRC32Wx4 (uint32_t crc, const uint32_t vals[4])
|
||||||
{
|
{
|
||||||
#if defined(_MSC_VER)
|
#if defined(CRYPTOPP_MSC_VERSION)
|
||||||
return __crc32w(__crc32w(__crc32w(__crc32w(
|
return __crc32w(__crc32w(__crc32w(__crc32w(
|
||||||
crc, vals[0]), vals[1]), vals[2]), vals[3]);
|
crc, vals[0]), vals[1]), vals[2]), vals[3]);
|
||||||
#else
|
#else
|
||||||
@ -85,7 +85,7 @@ inline uint32_t CRC32Wx4 (uint32_t crc, const uint32_t vals[4])
|
|||||||
/// \since Crypto++ 8.6
|
/// \since Crypto++ 8.6
|
||||||
inline uint32_t CRC32CB (uint32_t crc, uint8_t val)
|
inline uint32_t CRC32CB (uint32_t crc, uint8_t val)
|
||||||
{
|
{
|
||||||
#if defined(_MSC_VER)
|
#if defined(CRYPTOPP_MSC_VERSION)
|
||||||
return __crc32cb(crc, val);
|
return __crc32cb(crc, val);
|
||||||
#else
|
#else
|
||||||
__asm__ ("crc32cb %w0, %w0, %w1 \n\t"
|
__asm__ ("crc32cb %w0, %w0, %w1 \n\t"
|
||||||
@ -101,7 +101,7 @@ inline uint32_t CRC32CB (uint32_t crc, uint8_t val)
|
|||||||
/// \since Crypto++ 8.6
|
/// \since Crypto++ 8.6
|
||||||
inline uint32_t CRC32CW (uint32_t crc, uint32_t val)
|
inline uint32_t CRC32CW (uint32_t crc, uint32_t val)
|
||||||
{
|
{
|
||||||
#if defined(_MSC_VER)
|
#if defined(CRYPTOPP_MSC_VERSION)
|
||||||
return __crc32cw(crc, val);
|
return __crc32cw(crc, val);
|
||||||
#else
|
#else
|
||||||
__asm__ ("crc32cw %w0, %w0, %w1 \n\t"
|
__asm__ ("crc32cw %w0, %w0, %w1 \n\t"
|
||||||
@ -117,7 +117,7 @@ inline uint32_t CRC32CW (uint32_t crc, uint32_t val)
|
|||||||
/// \since Crypto++ 8.6
|
/// \since Crypto++ 8.6
|
||||||
inline uint32_t CRC32CWx4 (uint32_t crc, const uint32_t vals[4])
|
inline uint32_t CRC32CWx4 (uint32_t crc, const uint32_t vals[4])
|
||||||
{
|
{
|
||||||
#if defined(_MSC_VER)
|
#if defined(CRYPTOPP_MSC_VERSION)
|
||||||
return __crc32cw(__crc32cw(__crc32cw(__crc32cw(
|
return __crc32cw(__crc32cw(__crc32cw(__crc32cw(
|
||||||
crc, vals[0]), vals[1]), vals[2]), vals[3]);
|
crc, vals[0]), vals[1]), vals[2]), vals[3]);
|
||||||
#else
|
#else
|
||||||
@ -151,7 +151,7 @@ inline uint32_t CRC32CWx4 (uint32_t crc, const uint32_t vals[4])
|
|||||||
/// \since Crypto++ 8.0
|
/// \since Crypto++ 8.0
|
||||||
inline uint64x2_t PMULL_00(const uint64x2_t a, const uint64x2_t b)
|
inline uint64x2_t PMULL_00(const uint64x2_t a, const uint64x2_t b)
|
||||||
{
|
{
|
||||||
#if defined(_MSC_VER)
|
#if defined(CRYPTOPP_MSC_VERSION)
|
||||||
const __n64 x = { vgetq_lane_u64(a, 0) };
|
const __n64 x = { vgetq_lane_u64(a, 0) };
|
||||||
const __n64 y = { vgetq_lane_u64(b, 0) };
|
const __n64 y = { vgetq_lane_u64(b, 0) };
|
||||||
return vmull_p64(x, y);
|
return vmull_p64(x, y);
|
||||||
@ -181,7 +181,7 @@ inline uint64x2_t PMULL_00(const uint64x2_t a, const uint64x2_t b)
|
|||||||
/// \since Crypto++ 8.0
|
/// \since Crypto++ 8.0
|
||||||
inline uint64x2_t PMULL_01(const uint64x2_t a, const uint64x2_t b)
|
inline uint64x2_t PMULL_01(const uint64x2_t a, const uint64x2_t b)
|
||||||
{
|
{
|
||||||
#if defined(_MSC_VER)
|
#if defined(CRYPTOPP_MSC_VERSION)
|
||||||
const __n64 x = { vgetq_lane_u64(a, 0) };
|
const __n64 x = { vgetq_lane_u64(a, 0) };
|
||||||
const __n64 y = { vgetq_lane_u64(b, 1) };
|
const __n64 y = { vgetq_lane_u64(b, 1) };
|
||||||
return vmull_p64(x, y);
|
return vmull_p64(x, y);
|
||||||
@ -211,7 +211,7 @@ inline uint64x2_t PMULL_01(const uint64x2_t a, const uint64x2_t b)
|
|||||||
/// \since Crypto++ 8.0
|
/// \since Crypto++ 8.0
|
||||||
inline uint64x2_t PMULL_10(const uint64x2_t a, const uint64x2_t b)
|
inline uint64x2_t PMULL_10(const uint64x2_t a, const uint64x2_t b)
|
||||||
{
|
{
|
||||||
#if defined(_MSC_VER)
|
#if defined(CRYPTOPP_MSC_VERSION)
|
||||||
const __n64 x = { vgetq_lane_u64(a, 1) };
|
const __n64 x = { vgetq_lane_u64(a, 1) };
|
||||||
const __n64 y = { vgetq_lane_u64(b, 0) };
|
const __n64 y = { vgetq_lane_u64(b, 0) };
|
||||||
return vmull_p64(x, y);
|
return vmull_p64(x, y);
|
||||||
@ -241,7 +241,7 @@ inline uint64x2_t PMULL_10(const uint64x2_t a, const uint64x2_t b)
|
|||||||
/// \since Crypto++ 8.0
|
/// \since Crypto++ 8.0
|
||||||
inline uint64x2_t PMULL_11(const uint64x2_t a, const uint64x2_t b)
|
inline uint64x2_t PMULL_11(const uint64x2_t a, const uint64x2_t b)
|
||||||
{
|
{
|
||||||
#if defined(_MSC_VER)
|
#if defined(CRYPTOPP_MSC_VERSION)
|
||||||
const __n64 x = { vgetq_lane_u64(a, 1) };
|
const __n64 x = { vgetq_lane_u64(a, 1) };
|
||||||
const __n64 y = { vgetq_lane_u64(b, 1) };
|
const __n64 y = { vgetq_lane_u64(b, 1) };
|
||||||
return vmull_p64(x, y);
|
return vmull_p64(x, y);
|
||||||
@ -266,7 +266,7 @@ inline uint64x2_t PMULL_11(const uint64x2_t a, const uint64x2_t b)
|
|||||||
/// \since Crypto++ 8.0
|
/// \since Crypto++ 8.0
|
||||||
inline uint64x2_t PMULL(const uint64x2_t a, const uint64x2_t b)
|
inline uint64x2_t PMULL(const uint64x2_t a, const uint64x2_t b)
|
||||||
{
|
{
|
||||||
#if defined(_MSC_VER)
|
#if defined(CRYPTOPP_MSC_VERSION)
|
||||||
const __n64 x = { vgetq_lane_u64(a, 0) };
|
const __n64 x = { vgetq_lane_u64(a, 0) };
|
||||||
const __n64 y = { vgetq_lane_u64(b, 0) };
|
const __n64 y = { vgetq_lane_u64(b, 0) };
|
||||||
return vmull_p64(x, y);
|
return vmull_p64(x, y);
|
||||||
@ -291,7 +291,7 @@ inline uint64x2_t PMULL(const uint64x2_t a, const uint64x2_t b)
|
|||||||
/// \since Crypto++ 8.0
|
/// \since Crypto++ 8.0
|
||||||
inline uint64x2_t PMULL_HIGH(const uint64x2_t a, const uint64x2_t b)
|
inline uint64x2_t PMULL_HIGH(const uint64x2_t a, const uint64x2_t b)
|
||||||
{
|
{
|
||||||
#if defined(_MSC_VER)
|
#if defined(CRYPTOPP_MSC_VERSION)
|
||||||
const __n64 x = { vgetq_lane_u64(a, 1) };
|
const __n64 x = { vgetq_lane_u64(a, 1) };
|
||||||
const __n64 y = { vgetq_lane_u64(b, 1) };
|
const __n64 y = { vgetq_lane_u64(b, 1) };
|
||||||
return vmull_p64(x, y);
|
return vmull_p64(x, y);
|
||||||
@ -320,7 +320,7 @@ template <unsigned int C>
|
|||||||
inline uint64x2_t VEXT_U8(uint64x2_t a, uint64x2_t b)
|
inline uint64x2_t VEXT_U8(uint64x2_t a, uint64x2_t b)
|
||||||
{
|
{
|
||||||
// https://github.com/weidai11/cryptopp/issues/366
|
// https://github.com/weidai11/cryptopp/issues/366
|
||||||
#if defined(_MSC_VER)
|
#if defined(CRYPTOPP_MSC_VERSION)
|
||||||
return vreinterpretq_u64_u8(vextq_u8(
|
return vreinterpretq_u64_u8(vextq_u8(
|
||||||
vreinterpretq_u8_u64(a), vreinterpretq_u8_u64(b), C));
|
vreinterpretq_u8_u64(a), vreinterpretq_u8_u64(b), C));
|
||||||
#else
|
#else
|
||||||
@ -349,7 +349,7 @@ inline uint64x2_t VEXT_U8(uint64x2_t a, uint64x2_t b)
|
|||||||
/// \since Crypto++ 8.6
|
/// \since Crypto++ 8.6
|
||||||
inline uint64x2_t VEOR3(uint64x2_t a, uint64x2_t b, uint64x2_t c)
|
inline uint64x2_t VEOR3(uint64x2_t a, uint64x2_t b, uint64x2_t c)
|
||||||
{
|
{
|
||||||
#if defined(_MSC_VER)
|
#if defined(CRYPTOPP_MSC_VERSION)
|
||||||
return veor3q_u64(a, b, c);
|
return veor3q_u64(a, b, c);
|
||||||
#else
|
#else
|
||||||
uint64x2_t r;
|
uint64x2_t r;
|
||||||
@ -370,7 +370,7 @@ inline uint64x2_t VEOR3(uint64x2_t a, uint64x2_t b, uint64x2_t c)
|
|||||||
/// \since Crypto++ 8.6
|
/// \since Crypto++ 8.6
|
||||||
inline uint64x2_t VXAR(uint64x2_t a, uint64x2_t b, const int c)
|
inline uint64x2_t VXAR(uint64x2_t a, uint64x2_t b, const int c)
|
||||||
{
|
{
|
||||||
#if defined(_MSC_VER)
|
#if defined(CRYPTOPP_MSC_VERSION)
|
||||||
return vxarq_u64(a, b, c);
|
return vxarq_u64(a, b, c);
|
||||||
#else
|
#else
|
||||||
uint64x2_t r;
|
uint64x2_t r;
|
||||||
@ -392,7 +392,7 @@ inline uint64x2_t VXAR(uint64x2_t a, uint64x2_t b, const int c)
|
|||||||
template <unsigned int C>
|
template <unsigned int C>
|
||||||
inline uint64x2_t VXAR(uint64x2_t a, uint64x2_t b)
|
inline uint64x2_t VXAR(uint64x2_t a, uint64x2_t b)
|
||||||
{
|
{
|
||||||
#if defined(_MSC_VER)
|
#if defined(CRYPTOPP_MSC_VERSION)
|
||||||
return vxarq_u64(a, b, C);
|
return vxarq_u64(a, b, C);
|
||||||
#else
|
#else
|
||||||
uint64x2_t r;
|
uint64x2_t r;
|
||||||
@ -412,7 +412,7 @@ inline uint64x2_t VXAR(uint64x2_t a, uint64x2_t b)
|
|||||||
/// \since Crypto++ 8.6
|
/// \since Crypto++ 8.6
|
||||||
inline uint64x2_t VRAX1(uint64x2_t a, uint64x2_t b)
|
inline uint64x2_t VRAX1(uint64x2_t a, uint64x2_t b)
|
||||||
{
|
{
|
||||||
#if defined(_MSC_VER)
|
#if defined(CRYPTOPP_MSC_VERSION)
|
||||||
return vrax1q_u64(a, b);
|
return vrax1q_u64(a, b);
|
||||||
#else
|
#else
|
||||||
uint64x2_t r;
|
uint64x2_t r;
|
||||||
|
@ -41,7 +41,7 @@ extern const char CHACHA_AVX_FNAME[] = __FILE__;
|
|||||||
// https://github.com/weidai11/cryptopp/issues/735. The
|
// https://github.com/weidai11/cryptopp/issues/735. The
|
||||||
// 649 issue affects AES but it is the same here. The 735
|
// 649 issue affects AES but it is the same here. The 735
|
||||||
// issue is ChaCha AVX2 cut-in where it surfaced again.
|
// issue is ChaCha AVX2 cut-in where it surfaced again.
|
||||||
#if (_MSC_VER >= 1910) && (_MSC_VER <= 1916)
|
#if (CRYPTOPP_MSC_VERSION >= 1910) && (CRYPTOPP_MSC_VERSION <= 1916)
|
||||||
# ifndef CRYPTOPP_DEBUG
|
# ifndef CRYPTOPP_DEBUG
|
||||||
# pragma optimize("", off)
|
# pragma optimize("", off)
|
||||||
# pragma optimize("ts", on)
|
# pragma optimize("ts", on)
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
|
|
||||||
// How to allocate 16-byte aligned memory (for SSE2)
|
// How to allocate 16-byte aligned memory (for SSE2)
|
||||||
// posix_memalign see https://forum.kde.org/viewtopic.php?p=66274
|
// posix_memalign see https://forum.kde.org/viewtopic.php?p=66274
|
||||||
#if defined(_MSC_VER)
|
#if defined(CRYPTOPP_MSC_VERSION)
|
||||||
#define CRYPTOPP_MM_MALLOC_AVAILABLE
|
#define CRYPTOPP_MM_MALLOC_AVAILABLE
|
||||||
#elif defined(__linux__) || defined(__sun__) || defined(__CYGWIN__)
|
#elif defined(__linux__) || defined(__sun__) || defined(__CYGWIN__)
|
||||||
#define CRYPTOPP_MEMALIGN_AVAILABLE
|
#define CRYPTOPP_MEMALIGN_AVAILABLE
|
||||||
@ -59,7 +59,7 @@
|
|||||||
// CRYPTOPP_ALIGN_DATA may not be reliable on AIX.
|
// CRYPTOPP_ALIGN_DATA may not be reliable on AIX.
|
||||||
#if defined(CRYPTOPP_CXX11_ALIGNAS)
|
#if defined(CRYPTOPP_CXX11_ALIGNAS)
|
||||||
#define CRYPTOPP_ALIGN_DATA(x) alignas(x)
|
#define CRYPTOPP_ALIGN_DATA(x) alignas(x)
|
||||||
#elif defined(_MSC_VER)
|
#elif defined(CRYPTOPP_MSC_VERSION)
|
||||||
#define CRYPTOPP_ALIGN_DATA(x) __declspec(align(x))
|
#define CRYPTOPP_ALIGN_DATA(x) __declspec(align(x))
|
||||||
#elif defined(__GNUC__) || defined(__clang__) || (__SUNPRO_CC >= 0x5100)
|
#elif defined(__GNUC__) || defined(__clang__) || (__SUNPRO_CC >= 0x5100)
|
||||||
#define CRYPTOPP_ALIGN_DATA(x) __attribute__((aligned(x)))
|
#define CRYPTOPP_ALIGN_DATA(x) __attribute__((aligned(x)))
|
||||||
|
@ -100,12 +100,12 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// 32-bit SunCC does not enable SSE2 by default.
|
// 32-bit SunCC does not enable SSE2 by default.
|
||||||
#if !defined(CRYPTOPP_DISABLE_SSE2) && (defined(_MSC_VER) || CRYPTOPP_GCC_VERSION >= 30300 || defined(__SSE2__) || (__SUNPRO_CC >= 0x5100))
|
#if !defined(CRYPTOPP_DISABLE_SSE2) && (defined(CRYPTOPP_MSC_VERSION) || CRYPTOPP_GCC_VERSION >= 30300 || defined(__SSE2__) || (__SUNPRO_CC >= 0x5100))
|
||||||
#define CRYPTOPP_SSE2_INTRIN_AVAILABLE 1
|
#define CRYPTOPP_SSE2_INTRIN_AVAILABLE 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(CRYPTOPP_DISABLE_SSSE3)
|
#if !defined(CRYPTOPP_DISABLE_SSSE3)
|
||||||
# if defined(__SSSE3__) || (_MSC_VER >= 1500) || \
|
# if defined(__SSSE3__) || (CRYPTOPP_MSC_VERSION >= 1500) || \
|
||||||
(CRYPTOPP_GCC_VERSION >= 40300) || (__INTEL_COMPILER >= 1000) || (__SUNPRO_CC >= 0x5110) || \
|
(CRYPTOPP_GCC_VERSION >= 40300) || (__INTEL_COMPILER >= 1000) || (__SUNPRO_CC >= 0x5110) || \
|
||||||
(CRYPTOPP_LLVM_CLANG_VERSION >= 20300) || (CRYPTOPP_APPLE_CLANG_VERSION >= 40000)
|
(CRYPTOPP_LLVM_CLANG_VERSION >= 20300) || (CRYPTOPP_APPLE_CLANG_VERSION >= 40000)
|
||||||
#define CRYPTOPP_SSSE3_AVAILABLE 1
|
#define CRYPTOPP_SSSE3_AVAILABLE 1
|
||||||
@ -312,7 +312,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Buggy Microsoft compiler, https://github.com/weidai11/cryptopp/issues/1096
|
// Buggy Microsoft compiler, https://github.com/weidai11/cryptopp/issues/1096
|
||||||
#if defined(_MSC_VER)
|
#if defined(CRYPTOPP_MSC_VERSION)
|
||||||
# undef CRYPTOPP_ARM_SHA1_AVAILABLE
|
# undef CRYPTOPP_ARM_SHA1_AVAILABLE
|
||||||
# undef CRYPTOPP_ARM_SHA2_AVAILABLE
|
# undef CRYPTOPP_ARM_SHA2_AVAILABLE
|
||||||
#endif
|
#endif
|
||||||
|
@ -202,7 +202,7 @@
|
|||||||
/// \details CRYPTOPP_GNU_STYLE_INLINE_ASSEMBLY is defined when neither
|
/// \details CRYPTOPP_GNU_STYLE_INLINE_ASSEMBLY is defined when neither
|
||||||
/// <tt>_MSC_VER</tt> nor <tt>__BORLANDC__</tt> are defined.
|
/// <tt>_MSC_VER</tt> nor <tt>__BORLANDC__</tt> are defined.
|
||||||
#define CRYPTOPP_GNU_STYLE_INLINE_ASSEMBLY ...
|
#define CRYPTOPP_GNU_STYLE_INLINE_ASSEMBLY ...
|
||||||
#elif defined(_MSC_VER) || defined(__BORLANDC__)
|
#elif defined(CRYPTOPP_MSC_VERSION) || defined(__BORLANDC__)
|
||||||
#define CRYPTOPP_MS_STYLE_INLINE_ASSEMBLY 1
|
#define CRYPTOPP_MS_STYLE_INLINE_ASSEMBLY 1
|
||||||
#else
|
#else
|
||||||
#define CRYPTOPP_GNU_STYLE_INLINE_ASSEMBLY 1
|
#define CRYPTOPP_GNU_STYLE_INLINE_ASSEMBLY 1
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
|
|
||||||
// You may need to force include a C++ header on Android when using STLPort
|
// You may need to force include a C++ header on Android when using STLPort
|
||||||
// to ensure _STLPORT_VERSION is defined
|
// to ensure _STLPORT_VERSION is defined
|
||||||
#if (defined(_MSC_VER) && _MSC_VER <= 1300) || \
|
#if (defined(CRYPTOPP_MSC_VERSION) && CRYPTOPP_MSC_VERSION <= 1300) || \
|
||||||
defined(__MWERKS__) || \
|
defined(__MWERKS__) || \
|
||||||
(defined(_STLPORT_VERSION) && ((_STLPORT_VERSION < 0x450) || defined(_STLP_NO_UNCAUGHT_EXCEPT_SUPPORT)) || \
|
(defined(_STLPORT_VERSION) && ((_STLPORT_VERSION < 0x450) || defined(_STLP_NO_UNCAUGHT_EXCEPT_SUPPORT)) || \
|
||||||
(__cplusplus >= 202002L))
|
(__cplusplus >= 202002L))
|
||||||
@ -58,7 +58,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// C++11 macro version, https://stackoverflow.com/q/7223991/608639
|
// C++11 macro version, https://stackoverflow.com/q/7223991/608639
|
||||||
#if ((_MSC_VER >= 1600) || (__cplusplus >= 201103L)) && !defined(_STLPORT_VERSION)
|
#if ((CRYPTOPP_MSC_VERSION >= 1600) || (__cplusplus >= 201103L)) && !defined(_STLPORT_VERSION)
|
||||||
# define CRYPTOPP_CXX11 1
|
# define CRYPTOPP_CXX11 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -76,14 +76,14 @@
|
|||||||
|
|
||||||
// C++14 macro version, https://stackoverflow.com/q/26089319/608639
|
// C++14 macro version, https://stackoverflow.com/q/26089319/608639
|
||||||
#if defined(CRYPTOPP_CXX11) && !defined(CRYPTOPP_NO_CXX14)
|
#if defined(CRYPTOPP_CXX11) && !defined(CRYPTOPP_NO_CXX14)
|
||||||
# if ((_MSC_VER >= 1900) || (__cplusplus >= 201402L)) && !defined(_STLPORT_VERSION)
|
# if ((CRYPTOPP_MSC_VERSION >= 1900) || (__cplusplus >= 201402L)) && !defined(_STLPORT_VERSION)
|
||||||
# define CRYPTOPP_CXX14 1
|
# define CRYPTOPP_CXX14 1
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// C++17 macro version, https://stackoverflow.com/q/38456127/608639
|
// C++17 macro version, https://stackoverflow.com/q/38456127/608639
|
||||||
#if defined(CRYPTOPP_CXX14) && !defined(CRYPTOPP_NO_CXX17)
|
#if defined(CRYPTOPP_CXX14) && !defined(CRYPTOPP_NO_CXX17)
|
||||||
# if ((_MSC_VER >= 1900) || (__cplusplus >= 201703L)) && !defined(_STLPORT_VERSION)
|
# if ((CRYPTOPP_MSC_VERSION >= 1900) || (__cplusplus >= 201703L)) && !defined(_STLPORT_VERSION)
|
||||||
# define CRYPTOPP_CXX17 1
|
# define CRYPTOPP_CXX17 1
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
@ -145,7 +145,7 @@ typedef signed int sword32;
|
|||||||
/// where the cpu is slow even with a 64-bit cpu.
|
/// where the cpu is slow even with a 64-bit cpu.
|
||||||
#define CRYPTOPP_BOOL_SLOW_WORD64 ...
|
#define CRYPTOPP_BOOL_SLOW_WORD64 ...
|
||||||
|
|
||||||
#elif defined(_MSC_VER) || defined(__BORLANDC__)
|
#elif defined(CRYPTOPP_MSC_VERSION) || defined(__BORLANDC__)
|
||||||
typedef signed __int64 sword64;
|
typedef signed __int64 sword64;
|
||||||
typedef unsigned __int64 word64;
|
typedef unsigned __int64 word64;
|
||||||
#define SW64LIT(x) x##i64
|
#define SW64LIT(x) x##i64
|
||||||
@ -215,7 +215,7 @@ CRYPTOPP_CONST_OR_CONSTEXPR lword LWORD_MAX = W64LIT(0xffffffffffffffff);
|
|||||||
#else
|
#else
|
||||||
// define hword, word, and dword. these are used for multiprecision integer arithmetic
|
// define hword, word, and dword. these are used for multiprecision integer arithmetic
|
||||||
// Intel compiler won't have _umul128 until version 10.0. See http://softwarecommunity.intel.com/isn/Community/en-US/forums/thread/30231625.aspx
|
// Intel compiler won't have _umul128 until version 10.0. See http://softwarecommunity.intel.com/isn/Community/en-US/forums/thread/30231625.aspx
|
||||||
#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__))
|
#if (defined(CRYPTOPP_MSC_VERSION) && (!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__))
|
||||||
typedef word32 hword;
|
typedef word32 hword;
|
||||||
typedef word64 word;
|
typedef word64 word;
|
||||||
#else
|
#else
|
||||||
|
@ -130,7 +130,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// how to disable inlining
|
// how to disable inlining
|
||||||
#if defined(_MSC_VER)
|
#if defined(CRYPTOPP_MSC_VERSION)
|
||||||
# define CRYPTOPP_NOINLINE_DOTDOTDOT
|
# define CRYPTOPP_NOINLINE_DOTDOTDOT
|
||||||
# define CRYPTOPP_NOINLINE __declspec(noinline)
|
# define CRYPTOPP_NOINLINE __declspec(noinline)
|
||||||
#elif defined(__xlc__) || defined(__xlC__) || defined(__ibmxl__)
|
#elif defined(__xlc__) || defined(__xlC__) || defined(__ibmxl__)
|
||||||
@ -169,14 +169,14 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Warnings
|
// Warnings
|
||||||
#ifdef _MSC_VER
|
#ifdef CRYPTOPP_MSC_VERSION
|
||||||
// 4127: conditional expression is constant
|
// 4127: conditional expression is constant
|
||||||
// 4512: assignment operator not generated
|
// 4512: assignment operator not generated
|
||||||
// 4661: no suitable definition provided for explicit template instantiation request
|
// 4661: no suitable definition provided for explicit template instantiation request
|
||||||
// 4910: '__declspec(dllexport)' and 'extern' are incompatible on an explicit instantiation
|
// 4910: '__declspec(dllexport)' and 'extern' are incompatible on an explicit instantiation
|
||||||
# pragma warning(disable: 4127 4512 4661 4910)
|
# pragma warning(disable: 4127 4512 4661 4910)
|
||||||
// _MSC_VER 1920 is VS2019
|
// CRYPTOPP_MSC_VERSION 1920 is VS2019
|
||||||
# if _MSC_VER >= 1920
|
# if CRYPTOPP_MSC_VERSION >= 1920
|
||||||
// 5054: operator '|': deprecated between enumerations of different types
|
// 5054: operator '|': deprecated between enumerations of different types
|
||||||
# pragma warning(disable: 5054)
|
# pragma warning(disable: 5054)
|
||||||
# endif
|
# endif
|
||||||
|
@ -29,8 +29,7 @@
|
|||||||
// https://www.cryptopp.com/wiki/Release_Process#Self_Tests
|
// https://www.cryptopp.com/wiki/Release_Process#Self_Tests
|
||||||
// The problems with Clang pretending to be other compilers is
|
// The problems with Clang pretending to be other compilers is
|
||||||
// discussed at http://github.com/weidai11/cryptopp/issues/147.
|
// discussed at http://github.com/weidai11/cryptopp/issues/147.
|
||||||
#if (defined(_MSC_VER) && defined(__clang__) && \
|
#if (defined(_MSC_VER) && defined(__clang__))
|
||||||
!(defined( __clang_analyzer__)) && !defined(__INTEL_LLVM_COMPILER))
|
|
||||||
# error: "Unsupported configuration"
|
# error: "Unsupported configuration"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -50,14 +49,14 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Microsoft compilers
|
// Microsoft compilers
|
||||||
#if defined(_MSC_VER) || defined(__fastcall)
|
#if defined(CRYPTOPP_MSC_VERSION) || defined(__fastcall)
|
||||||
#define CRYPTOPP_FASTCALL __fastcall
|
#define CRYPTOPP_FASTCALL __fastcall
|
||||||
#else
|
#else
|
||||||
#define CRYPTOPP_FASTCALL
|
#define CRYPTOPP_FASTCALL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Microsoft compilers
|
// Microsoft compilers
|
||||||
#if defined(_MSC_VER)
|
#if defined(CRYPTOPP_MSC_VERSION)
|
||||||
#define CRYPTOPP_NO_VTABLE __declspec(novtable)
|
#define CRYPTOPP_NO_VTABLE __declspec(novtable)
|
||||||
#else
|
#else
|
||||||
#define CRYPTOPP_NO_VTABLE
|
#define CRYPTOPP_NO_VTABLE
|
||||||
|
@ -66,23 +66,23 @@
|
|||||||
// code paths that it cannot compile. Unset Clang to save the grief.
|
// code paths that it cannot compile. Unset Clang to save the grief.
|
||||||
// Also see http://github.com/weidai11/cryptopp/issues/147.
|
// Also see http://github.com/weidai11/cryptopp/issues/147.
|
||||||
|
|
||||||
#if defined(__GNUC__)
|
#if defined(__GNUC__) && !defined(__clang__)
|
||||||
# undef CRYPTOPP_APPLE_CLANG_VERSION
|
# undef CRYPTOPP_APPLE_CLANG_VERSION
|
||||||
# undef CRYPTOPP_LLVM_CLANG_VERSION
|
# undef CRYPTOPP_LLVM_CLANG_VERSION
|
||||||
# define CRYPTOPP_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
|
# define CRYPTOPP_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__xlc__) || defined(__xlC__)
|
#if defined(__xlc__) || defined(__xlC__) && !defined(__clang__)
|
||||||
# undef CRYPTOPP_LLVM_CLANG_VERSION
|
# undef CRYPTOPP_LLVM_CLANG_VERSION
|
||||||
# define CRYPTOPP_XLC_VERSION ((__xlC__ / 256) * 10000 + (__xlC__ % 256) * 100)
|
# define CRYPTOPP_XLC_VERSION ((__xlC__ / 256) * 10000 + (__xlC__ % 256) * 100)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __INTEL_COMPILER
|
#if defined(__INTEL_COMPILER) && !defined(__clang__)
|
||||||
# undef CRYPTOPP_LLVM_CLANG_VERSION
|
# undef CRYPTOPP_LLVM_CLANG_VERSION
|
||||||
# define CRYPTOPP_INTEL_VERSION (__INTEL_COMPILER)
|
# define CRYPTOPP_INTEL_VERSION (__INTEL_COMPILER)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#if defined(_MSC_VER) && !defined(__clang__)
|
||||||
# undef CRYPTOPP_LLVM_CLANG_VERSION
|
# undef CRYPTOPP_LLVM_CLANG_VERSION
|
||||||
# define CRYPTOPP_MSC_VERSION (_MSC_VER)
|
# define CRYPTOPP_MSC_VERSION (_MSC_VER)
|
||||||
#endif
|
#endif
|
||||||
|
16
cpu.cpp
16
cpu.cpp
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
// For _xgetbv on Microsoft 32-bit and 64-bit Intel platforms
|
// For _xgetbv on Microsoft 32-bit and 64-bit Intel platforms
|
||||||
// https://github.com/weidai11/cryptopp/issues/972
|
// https://github.com/weidai11/cryptopp/issues/972
|
||||||
#if _MSC_VER >= 1600 && (defined(_M_IX86) || defined(_M_X64))
|
#if (CRYPTOPP_MSC_VERSION >= 1600) && (defined(_M_IX86) || defined(_M_X64))
|
||||||
# include <immintrin.h>
|
# include <immintrin.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -80,7 +80,7 @@ unsigned long int getauxval(unsigned long int) { return 0; }
|
|||||||
|
|
||||||
// Visual Studio 2008 and below are missing _xgetbv and _cpuidex.
|
// Visual Studio 2008 and below are missing _xgetbv and _cpuidex.
|
||||||
// The 32-bit versions use inline ASM below. The 64-bit versions are in x64dll.asm.
|
// The 32-bit versions use inline ASM below. The 64-bit versions are in x64dll.asm.
|
||||||
#if defined(_MSC_VER) && defined(_M_X64)
|
#if defined(CRYPTOPP_MSC_VERSION) && defined(_M_X64)
|
||||||
extern "C" unsigned long long __fastcall XGETBV64(unsigned int);
|
extern "C" unsigned long long __fastcall XGETBV64(unsigned int);
|
||||||
extern "C" unsigned long long __fastcall CPUID64(unsigned int, unsigned int, unsigned int*);
|
extern "C" unsigned long long __fastcall CPUID64(unsigned int, unsigned int, unsigned int*);
|
||||||
#endif
|
#endif
|
||||||
@ -389,17 +389,17 @@ word64 XGetBV(word32 num)
|
|||||||
{
|
{
|
||||||
// Visual Studio 2010 SP1 and above, 32 and 64-bit
|
// Visual Studio 2010 SP1 and above, 32 and 64-bit
|
||||||
// https://github.com/weidai11/cryptopp/issues/972
|
// https://github.com/weidai11/cryptopp/issues/972
|
||||||
#if defined(_MSC_VER) && (_MSC_FULL_VER >= 160040219)
|
#if defined(CRYPTOPP_MSC_VERSION) && (_MSC_FULL_VER >= 160040219)
|
||||||
|
|
||||||
return _xgetbv(num);
|
return _xgetbv(num);
|
||||||
|
|
||||||
// Visual Studio 2008 and below, 64-bit
|
// Visual Studio 2008 and below, 64-bit
|
||||||
#elif defined(_MSC_VER) && defined(_M_X64)
|
#elif defined(CRYPTOPP_MSC_VERSION) && defined(_M_X64)
|
||||||
|
|
||||||
return XGETBV64(num);
|
return XGETBV64(num);
|
||||||
|
|
||||||
// Visual Studio 2008 and below, 32-bit
|
// Visual Studio 2008 and below, 32-bit
|
||||||
#elif defined(_MSC_VER) && defined(_M_IX86)
|
#elif defined(CRYPTOPP_MSC_VERSION) && defined(_M_IX86)
|
||||||
|
|
||||||
word32 a=0, d=0;
|
word32 a=0, d=0;
|
||||||
__asm {
|
__asm {
|
||||||
@ -450,19 +450,19 @@ word64 XGetBV(word32 num)
|
|||||||
bool CpuId(word32 func, word32 subfunc, word32 output[4])
|
bool CpuId(word32 func, word32 subfunc, word32 output[4])
|
||||||
{
|
{
|
||||||
// Visual Studio 2010 and above, 32 and 64-bit
|
// Visual Studio 2010 and above, 32 and 64-bit
|
||||||
#if defined(_MSC_VER) && (_MSC_VER >= 1600)
|
#if defined(CRYPTOPP_MSC_VERSION) && ((CRYPTOPP_MSC_VERSION >= 1600))
|
||||||
|
|
||||||
__cpuidex((int *)output, func, subfunc);
|
__cpuidex((int *)output, func, subfunc);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// Visual Studio 2008 and below, 64-bit
|
// Visual Studio 2008 and below, 64-bit
|
||||||
#elif defined(_MSC_VER) && defined(_M_X64)
|
#elif defined(CRYPTOPP_MSC_VERSION) && defined(_M_X64)
|
||||||
|
|
||||||
CPUID64(func, subfunc, output);
|
CPUID64(func, subfunc, output);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// Visual Studio 2008 and below, 32-bit
|
// Visual Studio 2008 and below, 32-bit
|
||||||
#elif (defined(_MSC_VER) && defined(_M_IX86)) || defined(__BORLANDC__)
|
#elif (defined(CRYPTOPP_MSC_VERSION) && defined(_M_IX86)) || defined(__BORLANDC__)
|
||||||
|
|
||||||
__try
|
__try
|
||||||
{
|
{
|
||||||
|
4
cpu.h
4
cpu.h
@ -46,7 +46,7 @@
|
|||||||
#define INTEL_NOPREFIX ".intel_syntax;"
|
#define INTEL_NOPREFIX ".intel_syntax;"
|
||||||
#define ATT_PREFIX ".att_syntax;"
|
#define ATT_PREFIX ".att_syntax;"
|
||||||
#define ATT_NOPREFIX ".att_syntax;"
|
#define ATT_NOPREFIX ".att_syntax;"
|
||||||
#elif defined(__GNUC__)
|
#elif defined(CRYPTOPP_GCC_VERSION)
|
||||||
#define NEW_LINE
|
#define NEW_LINE
|
||||||
#define INTEL_PREFIX ".intel_syntax prefix;"
|
#define INTEL_PREFIX ".intel_syntax prefix;"
|
||||||
#define INTEL_NOPREFIX ".intel_syntax noprefix;"
|
#define INTEL_NOPREFIX ".intel_syntax noprefix;"
|
||||||
@ -909,7 +909,7 @@ inline int GetCacheLineSize()
|
|||||||
#define ASJ(x, y, z) x label##y*newline*
|
#define ASJ(x, y, z) x label##y*newline*
|
||||||
#define ASC(x, y) x label##y*newline*
|
#define ASC(x, y) x label##y*newline*
|
||||||
#define AS_HEX(y) 0##y##h
|
#define AS_HEX(y) 0##y##h
|
||||||
#elif defined(_MSC_VER) || defined(__BORLANDC__)
|
#elif defined(CRYPTOPP_MSC_VERSION) || defined(__BORLANDC__)
|
||||||
#define AS1(x) __asm {x}
|
#define AS1(x) __asm {x}
|
||||||
#define AS2(x, y) __asm {x, y}
|
#define AS2(x, y) __asm {x, y}
|
||||||
#define AS3(x, y, z) __asm {x, y, z}
|
#define AS3(x, y, z) __asm {x, y, z}
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
# pragma warning(disable: 4505 4355)
|
# pragma warning(disable: 4505 4355)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef CRYPTOPP_MSC_VERSION
|
||||||
# define STRTOUL64 _strtoui64
|
# define STRTOUL64 _strtoui64
|
||||||
#else
|
#else
|
||||||
# define STRTOUL64 strtoull
|
# define STRTOUL64 strtoull
|
||||||
|
2
des.cpp
2
des.cpp
@ -283,7 +283,7 @@ namespace {
|
|||||||
/* Set key (initialize key schedule array) */
|
/* Set key (initialize key schedule array) */
|
||||||
void RawDES::RawSetKey(CipherDir dir, const byte *key)
|
void RawDES::RawSetKey(CipherDir dir, const byte *key)
|
||||||
{
|
{
|
||||||
#if (_MSC_VER >= 1600) || (__cplusplus >= 201103L)
|
#if (CRYPTOPP_MSC_VERSION >= 1600) || (__cplusplus >= 201103L)
|
||||||
# define REGISTER /* Define to nothing for C++11 and above */
|
# define REGISTER /* Define to nothing for C++11 and above */
|
||||||
#else
|
#else
|
||||||
# define REGISTER register
|
# define REGISTER register
|
||||||
|
5
donna.h
5
donna.h
@ -26,6 +26,7 @@
|
|||||||
#ifndef CRYPTOPP_DONNA_H
|
#ifndef CRYPTOPP_DONNA_H
|
||||||
#define CRYPTOPP_DONNA_H
|
#define CRYPTOPP_DONNA_H
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
#include "cryptlib.h"
|
#include "cryptlib.h"
|
||||||
#include "stdcpp.h"
|
#include "stdcpp.h"
|
||||||
|
|
||||||
@ -140,7 +141,7 @@ ed25519_sign_open(std::istream& stream, const byte publicKey[32], const byte sig
|
|||||||
// error "The operand ___LCM cannot be assigned to".
|
// error "The operand ___LCM cannot be assigned to".
|
||||||
|
|
||||||
#if defined(CRYPTOPP_WORD128_AVAILABLE) || \
|
#if defined(CRYPTOPP_WORD128_AVAILABLE) || \
|
||||||
(defined(_MSC_VER) && defined(_M_X64))
|
(defined(CRYPTOPP_MSC_VERSION) && defined(_M_X64))
|
||||||
# define CRYPTOPP_CURVE25519_64BIT 1
|
# define CRYPTOPP_CURVE25519_64BIT 1
|
||||||
#else
|
#else
|
||||||
# define CRYPTOPP_CURVE25519_32BIT 1
|
# define CRYPTOPP_CURVE25519_32BIT 1
|
||||||
@ -162,7 +163,7 @@ ed25519_sign_open(std::istream& stream, const byte publicKey[32], const byte sig
|
|||||||
// * x64, no SSE2, 0.081
|
// * x64, no SSE2, 0.081
|
||||||
// * x64, SSE2, 0.071
|
// * x64, SSE2, 0.071
|
||||||
|
|
||||||
#if (CRYPTOPP_SSE2_INTRIN_AVAILABLE) && defined(_MSC_VER)
|
#if defined(CRYPTOPP_MSC_VERSION) && (CRYPTOPP_SSE2_INTRIN_AVAILABLE)
|
||||||
# define CRYPTOPP_CURVE25519_SSE2 1
|
# define CRYPTOPP_CURVE25519_SSE2 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
#if defined(CRYPTOPP_MSC_VERSION)
|
||||||
# include <intrin.h>
|
# include <intrin.h>
|
||||||
# pragma intrinsic(_umul128)
|
# pragma intrinsic(_umul128)
|
||||||
# pragma intrinsic(__shiftright128)
|
# pragma intrinsic(__shiftright128)
|
||||||
@ -52,7 +52,7 @@ using CryptoPP::word128;
|
|||||||
# define shr128(out,in,shift) out = (word64)(in >> (shift));
|
# define shr128(out,in,shift) out = (word64)(in >> (shift));
|
||||||
# define shl128(out,in,shift) out = (word64)((in << shift) >> 64);
|
# define shl128(out,in,shift) out = (word64)((in << shift) >> 64);
|
||||||
|
|
||||||
#elif defined(_MSC_VER)
|
#elif defined(CRYPTOPP_MSC_VERSION)
|
||||||
struct word128 { word64 lo, hi; };
|
struct word128 { word64 lo, hi; };
|
||||||
# define mul64x64_128(out,a,b) out.lo = _umul128(a,b,&out.hi);
|
# define mul64x64_128(out,a,b) out.lo = _umul128(a,b,&out.hi);
|
||||||
# define shr128_pair(out,hi,lo,shift) out = __shiftright128(lo, hi, shift);
|
# define shr128_pair(out,hi,lo,shift) out = __shiftright128(lo, hi, shift);
|
||||||
|
@ -57,7 +57,7 @@ void FileStore::StoreInitialize(const NameValuePairs ¶meters)
|
|||||||
m_file.release();
|
m_file.release();
|
||||||
|
|
||||||
const char *fileName = NULLPTR;
|
const char *fileName = NULLPTR;
|
||||||
#if defined(CRYPTOPP_UNIX_AVAILABLE) || _MSC_VER >= 1400
|
#if defined(CRYPTOPP_UNIX_AVAILABLE) || CRYPTOPP_MSC_VERSION >= 1400
|
||||||
const wchar_t *fileNameWide = NULLPTR;
|
const wchar_t *fileNameWide = NULLPTR;
|
||||||
if (!parameters.GetValue(Name::InputFileNameWide(), fileNameWide))
|
if (!parameters.GetValue(Name::InputFileNameWide(), fileNameWide))
|
||||||
#endif
|
#endif
|
||||||
@ -74,7 +74,7 @@ void FileStore::StoreInitialize(const NameValuePairs ¶meters)
|
|||||||
if (fileNameWide)
|
if (fileNameWide)
|
||||||
fileName = (narrowed = StringNarrow(fileNameWide)).c_str();
|
fileName = (narrowed = StringNarrow(fileNameWide)).c_str();
|
||||||
#endif
|
#endif
|
||||||
#if _MSC_VER >= 1400
|
#if CRYPTOPP_MSC_VERSION >= 1400
|
||||||
if (fileNameWide)
|
if (fileNameWide)
|
||||||
{
|
{
|
||||||
m_file->open(fileNameWide, std::ios::in | binary);
|
m_file->open(fileNameWide, std::ios::in | binary);
|
||||||
@ -224,7 +224,7 @@ void FileSink::IsolatedInitialize(const NameValuePairs ¶meters)
|
|||||||
m_file.release();
|
m_file.release();
|
||||||
|
|
||||||
const char *fileName = NULLPTR;
|
const char *fileName = NULLPTR;
|
||||||
#if defined(CRYPTOPP_UNIX_AVAILABLE) || _MSC_VER >= 1400
|
#if defined(CRYPTOPP_UNIX_AVAILABLE) || CRYPTOPP_MSC_VERSION >= 1400
|
||||||
const wchar_t *fileNameWide = NULLPTR;
|
const wchar_t *fileNameWide = NULLPTR;
|
||||||
if (!parameters.GetValue(Name::OutputFileNameWide(), fileNameWide))
|
if (!parameters.GetValue(Name::OutputFileNameWide(), fileNameWide))
|
||||||
#endif
|
#endif
|
||||||
|
6
files.h
6
files.h
@ -46,7 +46,7 @@ public:
|
|||||||
FileStore(const char *filename) : m_stream(NULLPTR), m_space(NULLPTR), m_len(0), m_waiting(0)
|
FileStore(const char *filename) : m_stream(NULLPTR), m_space(NULLPTR), m_len(0), m_waiting(0)
|
||||||
{StoreInitialize(MakeParameters(Name::InputFileName(), filename ? filename : ""));}
|
{StoreInitialize(MakeParameters(Name::InputFileName(), filename ? filename : ""));}
|
||||||
|
|
||||||
#if defined(CRYPTOPP_UNIX_AVAILABLE) || defined(CRYPTOPP_DOXYGEN_PROCESSING) || _MSC_VER >= 1400
|
#if defined(CRYPTOPP_UNIX_AVAILABLE) || defined(CRYPTOPP_DOXYGEN_PROCESSING) || (CRYPTOPP_MSC_VERSION >= 1400)
|
||||||
/// \brief Construct a FileStore
|
/// \brief Construct a FileStore
|
||||||
/// \param filename the Unicode name of the file to open
|
/// \param filename the Unicode name of the file to open
|
||||||
/// \details On non-Windows OS, this function assumes that setlocale() has been called.
|
/// \details On non-Windows OS, this function assumes that setlocale() has been called.
|
||||||
@ -109,7 +109,7 @@ public:
|
|||||||
FileSource(const char *filename, bool pumpAll, BufferedTransformation *attachment = NULLPTR, bool binary=true)
|
FileSource(const char *filename, bool pumpAll, BufferedTransformation *attachment = NULLPTR, bool binary=true)
|
||||||
: SourceTemplate<FileStore>(attachment) {SourceInitialize(pumpAll, MakeParameters(Name::InputFileName(), filename)(Name::InputBinaryMode(), binary));}
|
: SourceTemplate<FileStore>(attachment) {SourceInitialize(pumpAll, MakeParameters(Name::InputFileName(), filename)(Name::InputBinaryMode(), binary));}
|
||||||
|
|
||||||
#if defined(CRYPTOPP_UNIX_AVAILABLE) || defined(CRYPTOPP_DOXYGEN_PROCESSING) || _MSC_VER >= 1400
|
#if defined(CRYPTOPP_UNIX_AVAILABLE) || defined(CRYPTOPP_DOXYGEN_PROCESSING) || (CRYPTOPP_MSC_VERSION >= 1400)
|
||||||
/// \brief Construct a FileSource
|
/// \brief Construct a FileSource
|
||||||
/// \param filename the Unicode name of the file to open
|
/// \param filename the Unicode name of the file to open
|
||||||
/// \param pumpAll flag indicating if source data should be pumped to its attached transformation
|
/// \param pumpAll flag indicating if source data should be pumped to its attached transformation
|
||||||
@ -155,7 +155,7 @@ public:
|
|||||||
FileSink(const char *filename, bool binary=true)
|
FileSink(const char *filename, bool binary=true)
|
||||||
{IsolatedInitialize(MakeParameters(Name::OutputFileName(), filename)(Name::OutputBinaryMode(), binary));}
|
{IsolatedInitialize(MakeParameters(Name::OutputFileName(), filename)(Name::OutputBinaryMode(), binary));}
|
||||||
|
|
||||||
#if defined(CRYPTOPP_UNIX_AVAILABLE) || _MSC_VER >= 1400
|
#if defined(CRYPTOPP_UNIX_AVAILABLE) || (CRYPTOPP_MSC_VERSION >= 1400)
|
||||||
/// \brief Construct a FileSink
|
/// \brief Construct a FileSink
|
||||||
/// \param filename the Unicode name of the file to open
|
/// \param filename the Unicode name of the file to open
|
||||||
/// \details On non-Windows OS, this function assumes that setlocale() has been called.
|
/// \details On non-Windows OS, this function assumes that setlocale() has been called.
|
||||||
|
@ -29,13 +29,13 @@
|
|||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
#if defined(_MSC_VER) && _MSC_VER >= 1400
|
#if defined(CRYPTOPP_MSC_VERSION) && CRYPTOPP_MSC_VERSION >= 1400
|
||||||
# ifdef _M_IX86
|
# ifdef _M_IX86
|
||||||
# define _CRT_DEBUGGER_HOOK _crt_debugger_hook
|
# define _CRT_DEBUGGER_HOOK _crt_debugger_hook
|
||||||
# else
|
# else
|
||||||
# define _CRT_DEBUGGER_HOOK __crt_debugger_hook
|
# define _CRT_DEBUGGER_HOOK __crt_debugger_hook
|
||||||
# endif
|
# endif
|
||||||
# if _MSC_VER < 1900
|
# if CRYPTOPP_MSC_VERSION < 1900
|
||||||
extern "C" {_CRTIMP void __cdecl _CRT_DEBUGGER_HOOK(int);}
|
extern "C" {_CRTIMP void __cdecl _CRT_DEBUGGER_HOOK(int);}
|
||||||
# else
|
# else
|
||||||
extern "C" {void __cdecl _CRT_DEBUGGER_HOOK(int); }
|
extern "C" {void __cdecl _CRT_DEBUGGER_HOOK(int); }
|
||||||
@ -299,7 +299,7 @@ bool IntegrityCheckModule(const char *moduleFilename, const byte *expectedModule
|
|||||||
char moduleFilenameBuf[FIPS_MODULE_MAX_PATH] = "";
|
char moduleFilenameBuf[FIPS_MODULE_MAX_PATH] = "";
|
||||||
if (moduleFilename == NULLPTR)
|
if (moduleFilename == NULLPTR)
|
||||||
{
|
{
|
||||||
#if (_MSC_VER >= 1400 && !defined(_STLPORT_VERSION)) // ifstream doesn't support wide filename on other compilers
|
#if (CRYPTOPP_MSC_VERSION >= 1400 && !defined(_STLPORT_VERSION)) // ifstream doesn't support wide filename on other compilers
|
||||||
wchar_t wideModuleFilename[FIPS_MODULE_MAX_PATH];
|
wchar_t wideModuleFilename[FIPS_MODULE_MAX_PATH];
|
||||||
if (GetModuleFileNameW(s_hModule, wideModuleFilename, FIPS_MODULE_MAX_PATH) > 0)
|
if (GetModuleFileNameW(s_hModule, wideModuleFilename, FIPS_MODULE_MAX_PATH) > 0)
|
||||||
{
|
{
|
||||||
@ -403,7 +403,7 @@ bool IntegrityCheckModule(const char *moduleFilename, const byte *expectedModule
|
|||||||
|
|
||||||
// Visual Studio 2019 is MSC_VER == 1920
|
// Visual Studio 2019 is MSC_VER == 1920
|
||||||
// https://dev.to/yumetodo/list-of-mscver-and-mscfullver-8nds
|
// https://dev.to/yumetodo/list-of-mscver-and-mscfullver-8nds
|
||||||
#if (_MSC_VER >= 1400 && _MSC_VER < 1920) && (defined(_M_IX86) || defined(_M_X64))
|
#if (CRYPTOPP_MSC_VERSION >= 1400 && CRYPTOPP_MSC_VERSION < 1920) && (defined(_M_IX86) || defined(_M_X64))
|
||||||
// first byte of _CRT_DEBUGGER_HOOK gets modified in memory by the debugger invisibly, so read it from file
|
// first byte of _CRT_DEBUGGER_HOOK gets modified in memory by the debugger invisibly, so read it from file
|
||||||
if (IsDebuggerPresent())
|
if (IsDebuggerPresent())
|
||||||
{
|
{
|
||||||
|
6
gcm.cpp
6
gcm.cpp
@ -13,7 +13,7 @@
|
|||||||
#ifndef CRYPTOPP_GENERATE_X64_MASM
|
#ifndef CRYPTOPP_GENERATE_X64_MASM
|
||||||
|
|
||||||
// Visual Studio .Net 2003 compiler crash
|
// Visual Studio .Net 2003 compiler crash
|
||||||
#if defined(_MSC_VER) && (_MSC_VER < 1400)
|
#if defined(CRYPTOPP_MSC_VERSION) && (CRYPTOPP_MSC_VERSION < 1400)
|
||||||
# pragma optimize("", off)
|
# pragma optimize("", off)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ NAMESPACE_BEGIN(CryptoPP)
|
|||||||
#if defined(CRYPTOPP_DISABLE_MIXED_ASM)
|
#if defined(CRYPTOPP_DISABLE_MIXED_ASM)
|
||||||
// 'movd eax, xmm0' only. REG_WORD() macro not used. Clang path.
|
// 'movd eax, xmm0' only. REG_WORD() macro not used. Clang path.
|
||||||
# define USE_MOVD_REG32 1
|
# define USE_MOVD_REG32 1
|
||||||
#elif defined(__GNUC__) || defined(_MSC_VER)
|
#elif defined(__GNUC__) || defined(CRYPTOPP_MSC_VERSION)
|
||||||
// 'movd eax, xmm0' or 'movd rax, xmm0'. REG_WORD() macro supplies REG32 or REG64.
|
// 'movd eax, xmm0' or 'movd rax, xmm0'. REG_WORD() macro supplies REG32 or REG64.
|
||||||
# define USE_MOVD_REG32_OR_REG64 1
|
# define USE_MOVD_REG32_OR_REG64 1
|
||||||
#else
|
#else
|
||||||
@ -146,7 +146,7 @@ void GCM_Base::SetKeyWithoutResync(const byte *userKey, size_t keylength, const
|
|||||||
else
|
else
|
||||||
tableSize = (GetTablesOption() == GCM_64K_Tables) ? 64*1024 : 2*1024;
|
tableSize = (GetTablesOption() == GCM_64K_Tables) ? 64*1024 : 2*1024;
|
||||||
|
|
||||||
//#if defined(_MSC_VER) && (_MSC_VER < 1400)
|
//#if defined(CRYPTOPP_MSC_VERSION) && (CRYPTOPP_MSC_VERSION < 1400)
|
||||||
// VC 2003 workaround: compiler generates bad code for 64K tables
|
// VC 2003 workaround: compiler generates bad code for 64K tables
|
||||||
//tableSize = 2*1024;
|
//tableSize = 2*1024;
|
||||||
//#endif
|
//#endif
|
||||||
|
2
ida.cpp
2
ida.cpp
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
NAMESPACE_BEGIN(CryptoPP)
|
NAMESPACE_BEGIN(CryptoPP)
|
||||||
|
|
||||||
#if (defined(_MSC_VER) && (_MSC_VER < 1400)) && !defined(__MWERKS__)
|
#if (defined(CRYPTOPP_MSC_VERSION) && (CRYPTOPP_MSC_VERSION < 1400)) && !defined(__MWERKS__)
|
||||||
// VC60 and VC7 workaround: built-in reverse_iterator has two template parameters, Dinkumware only has one
|
// VC60 and VC7 workaround: built-in reverse_iterator has two template parameters, Dinkumware only has one
|
||||||
typedef std::reverse_bidirectional_iterator<const byte *, const byte> RevIt;
|
typedef std::reverse_bidirectional_iterator<const byte *, const byte> RevIt;
|
||||||
#elif defined(_RWSTD_NO_CLASS_PARTIAL_SPEC)
|
#elif defined(_RWSTD_NO_CLASS_PARTIAL_SPEC)
|
||||||
|
@ -75,7 +75,7 @@
|
|||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#if (_MSC_VER >= 1400) && !defined(_M_ARM)
|
#if (CRYPTOPP_MSC_VERSION >= 1400) && !defined(_M_ARM)
|
||||||
#include <intrin.h>
|
#include <intrin.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -207,7 +207,7 @@ static word AtomicInverseModPower2(word A)
|
|||||||
#define Add2WordsBy1(a, b, c) a##0 = b##0 + c; a##1 = b##1 + (a##0 < c);
|
#define Add2WordsBy1(a, b, c) a##0 = b##0 + c; a##1 = b##1 + (a##0 < c);
|
||||||
#define LowWord(a) a##0
|
#define LowWord(a) a##0
|
||||||
#define HighWord(a) a##1
|
#define HighWord(a) a##1
|
||||||
#ifdef _MSC_VER
|
#ifdef CRYPTOPP_MSC_VERSION
|
||||||
#define MultiplyWordsLoHi(p0, p1, a, b) p0 = _umul128(a, b, &p1);
|
#define MultiplyWordsLoHi(p0, p1, a, b) p0 = _umul128(a, b, &p1);
|
||||||
#ifndef __INTEL_COMPILER
|
#ifndef __INTEL_COMPILER
|
||||||
#define Double3Words(c, d) d##1 = __shiftleft128(d##0, d##1, 1); d##0 = __shiftleft128(c, d##0, 1); c *= 2;
|
#define Double3Words(c, d) d##1 = __shiftleft128(d##0, d##1, 1); d##0 = __shiftleft128(c, d##0, 1); c *= 2;
|
||||||
@ -249,7 +249,7 @@ static word AtomicInverseModPower2(word A)
|
|||||||
#define GetBorrow(u) u##1
|
#define GetBorrow(u) u##1
|
||||||
#else
|
#else
|
||||||
#define Declare2Words(x) dword x;
|
#define Declare2Words(x) dword x;
|
||||||
#if _MSC_VER >= 1400 && !defined(__INTEL_COMPILER) && (defined(_M_IX86) || defined(_M_X64) || defined(_M_IA64))
|
#if CRYPTOPP_MSC_VERSION >= 1400 && !defined(__INTEL_COMPILER) && (defined(_M_IX86) || defined(_M_X64) || defined(_M_IA64))
|
||||||
#define MultiplyWords(p, a, b) p = __emulu(a, b);
|
#define MultiplyWords(p, a, b) p = __emulu(a, b);
|
||||||
#else
|
#else
|
||||||
#define MultiplyWords(p, a, b) p = (dword)a*b;
|
#define MultiplyWords(p, a, b) p = (dword)a*b;
|
||||||
@ -3056,7 +3056,7 @@ Integer::Integer(const byte *encodedInteger, size_t byteCount, Signedness s, Byt
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
SecByteBlock block(byteCount);
|
SecByteBlock block(byteCount);
|
||||||
#if (_MSC_VER >= 1500)
|
#if (CRYPTOPP_MSC_VERSION >= 1500)
|
||||||
std::reverse_copy(encodedInteger, encodedInteger+byteCount,
|
std::reverse_copy(encodedInteger, encodedInteger+byteCount,
|
||||||
stdext::make_checked_array_iterator(block.begin(), block.size()));
|
stdext::make_checked_array_iterator(block.begin(), block.size()));
|
||||||
#else
|
#else
|
||||||
|
@ -67,7 +67,7 @@ rho56[2] = {W64LIT(0x0007060504030201), W64LIT(0x080F0E0D0C0B0A09)};
|
|||||||
// Damn Visual Studio is missing too many intrinsics...
|
// Damn Visual Studio is missing too many intrinsics...
|
||||||
inline __m128i SPLAT64(const word64 a)
|
inline __m128i SPLAT64(const word64 a)
|
||||||
{
|
{
|
||||||
#if defined(_MSC_VER)
|
#if defined(CRYPTOPP_MSC_VERSION)
|
||||||
double x; std::memcpy(&x, &a, 8);
|
double x; std::memcpy(&x, &a, 8);
|
||||||
return _mm_castpd_si128(_mm_loaddup_pd(&x));
|
return _mm_castpd_si128(_mm_loaddup_pd(&x));
|
||||||
#else
|
#else
|
||||||
|
38
misc.h
38
misc.h
@ -32,8 +32,8 @@
|
|||||||
# pragma GCC diagnostic ignored "-Wunused-function"
|
# pragma GCC diagnostic ignored "-Wunused-function"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef CRYPTOPP_MSC_VERSION
|
||||||
#if _MSC_VER >= 1400
|
#if CRYPTOPP_MSC_VERSION >= 1400
|
||||||
// VC2005 workaround: disable declarations that conflict with winnt.h
|
// VC2005 workaround: disable declarations that conflict with winnt.h
|
||||||
#define _interlockedbittestandset CRYPTOPP_DISABLED_INTRINSIC_1
|
#define _interlockedbittestandset CRYPTOPP_DISABLED_INTRINSIC_1
|
||||||
#define _interlockedbittestandreset CRYPTOPP_DISABLED_INTRINSIC_2
|
#define _interlockedbittestandreset CRYPTOPP_DISABLED_INTRINSIC_2
|
||||||
@ -45,7 +45,7 @@
|
|||||||
#undef _interlockedbittestandset64
|
#undef _interlockedbittestandset64
|
||||||
#undef _interlockedbittestandreset64
|
#undef _interlockedbittestandreset64
|
||||||
#define CRYPTOPP_FAST_ROTATE(x) 1
|
#define CRYPTOPP_FAST_ROTATE(x) 1
|
||||||
#elif _MSC_VER >= 1300
|
#elif CRYPTOPP_MSC_VERSION >= 1300
|
||||||
#define CRYPTOPP_FAST_ROTATE(x) ((x) == 32 | (x) == 64)
|
#define CRYPTOPP_FAST_ROTATE(x) ((x) == 32 | (x) == 64)
|
||||||
#else
|
#else
|
||||||
#define CRYPTOPP_FAST_ROTATE(x) ((x) == 32)
|
#define CRYPTOPP_FAST_ROTATE(x) ((x) == 32)
|
||||||
@ -194,7 +194,7 @@ struct CompileAssert
|
|||||||
#else
|
#else
|
||||||
// VS2005 added _countof
|
// VS2005 added _countof
|
||||||
#ifndef COUNTOF
|
#ifndef COUNTOF
|
||||||
# if defined(_MSC_VER) && (_MSC_VER >= 1400)
|
# if defined(CRYPTOPP_MSC_VERSION) && (CRYPTOPP_MSC_VERSION >= 1400)
|
||||||
# define COUNTOF(x) _countof(x)
|
# define COUNTOF(x) _countof(x)
|
||||||
# else
|
# else
|
||||||
# define COUNTOF(x) (sizeof(x)/sizeof(x[0]))
|
# define COUNTOF(x) (sizeof(x)/sizeof(x[0]))
|
||||||
@ -273,7 +273,7 @@ struct NewObject
|
|||||||
#else
|
#else
|
||||||
#if defined(CRYPTOPP_CXX11_ATOMIC)
|
#if defined(CRYPTOPP_CXX11_ATOMIC)
|
||||||
# define MEMORY_BARRIER() std::atomic_thread_fence(std::memory_order_acq_rel)
|
# define MEMORY_BARRIER() std::atomic_thread_fence(std::memory_order_acq_rel)
|
||||||
#elif (_MSC_VER >= 1400)
|
#elif (CRYPTOPP_MSC_VERSION >= 1400)
|
||||||
# pragma intrinsic(_ReadWriteBarrier)
|
# pragma intrinsic(_ReadWriteBarrier)
|
||||||
# define MEMORY_BARRIER() _ReadWriteBarrier()
|
# define MEMORY_BARRIER() _ReadWriteBarrier()
|
||||||
#elif defined(__INTEL_COMPILER)
|
#elif defined(__INTEL_COMPILER)
|
||||||
@ -1079,7 +1079,7 @@ inline unsigned int TrailingZeros(word32 v)
|
|||||||
return (unsigned int)_tzcnt_u32(v);
|
return (unsigned int)_tzcnt_u32(v);
|
||||||
#elif defined(__GNUC__) && (CRYPTOPP_GCC_VERSION >= 30400)
|
#elif defined(__GNUC__) && (CRYPTOPP_GCC_VERSION >= 30400)
|
||||||
return (unsigned int)__builtin_ctz(v);
|
return (unsigned int)__builtin_ctz(v);
|
||||||
#elif defined(_MSC_VER) && (_MSC_VER >= 1400)
|
#elif defined(CRYPTOPP_MSC_VERSION) && (CRYPTOPP_MSC_VERSION >= 1400)
|
||||||
unsigned long result;
|
unsigned long result;
|
||||||
_BitScanForward(&result, v);
|
_BitScanForward(&result, v);
|
||||||
return static_cast<unsigned int>(result);
|
return static_cast<unsigned int>(result);
|
||||||
@ -1110,7 +1110,7 @@ inline unsigned int TrailingZeros(word64 v)
|
|||||||
return (unsigned int)_tzcnt_u64(v);
|
return (unsigned int)_tzcnt_u64(v);
|
||||||
#elif defined(__GNUC__) && (CRYPTOPP_GCC_VERSION >= 30400)
|
#elif defined(__GNUC__) && (CRYPTOPP_GCC_VERSION >= 30400)
|
||||||
return (unsigned int)__builtin_ctzll(v);
|
return (unsigned int)__builtin_ctzll(v);
|
||||||
#elif defined(_MSC_VER) && (_MSC_VER >= 1400) && (defined(_M_X64) || defined(_M_IA64))
|
#elif defined(CRYPTOPP_MSC_VERSION) && (CRYPTOPP_MSC_VERSION >= 1400) && (defined(_M_X64) || defined(_M_IA64))
|
||||||
unsigned long result;
|
unsigned long result;
|
||||||
_BitScanForward64(&result, v);
|
_BitScanForward64(&result, v);
|
||||||
return static_cast<unsigned int>(result);
|
return static_cast<unsigned int>(result);
|
||||||
@ -1410,7 +1410,7 @@ inline unsigned int GetAlignmentOf()
|
|||||||
{
|
{
|
||||||
#if defined(CRYPTOPP_CXX11_ALIGNOF)
|
#if defined(CRYPTOPP_CXX11_ALIGNOF)
|
||||||
return alignof(T);
|
return alignof(T);
|
||||||
#elif (_MSC_VER >= 1300)
|
#elif (CRYPTOPP_MSC_VERSION >= 1300)
|
||||||
return __alignof(T);
|
return __alignof(T);
|
||||||
#elif defined(__GNUC__)
|
#elif defined(__GNUC__)
|
||||||
return __alignof__(T);
|
return __alignof__(T);
|
||||||
@ -1591,7 +1591,7 @@ void SecureWipeBuffer(T *buf, size_t n)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(CRYPTOPP_DISABLE_ASM) && \
|
#if !defined(CRYPTOPP_DISABLE_ASM) && \
|
||||||
(_MSC_VER >= 1400 || defined(__GNUC__)) && \
|
(CRYPTOPP_MSC_VERSION >= 1400 || defined(__GNUC__)) && \
|
||||||
(CRYPTOPP_BOOL_X64 || CRYPTOPP_BOOL_X86)
|
(CRYPTOPP_BOOL_X64 || CRYPTOPP_BOOL_X86)
|
||||||
|
|
||||||
/// \brief Sets each byte of an array to 0
|
/// \brief Sets each byte of an array to 0
|
||||||
@ -1660,7 +1660,7 @@ template<> inline void SecureWipeBuffer(word64 *buf, size_t n)
|
|||||||
|
|
||||||
#endif // CRYPTOPP_BOOL_X64 || CRYPTOPP_BOOL_X86
|
#endif // CRYPTOPP_BOOL_X64 || CRYPTOPP_BOOL_X86
|
||||||
|
|
||||||
#if !defined(CRYPTOPP_DISABLE_ASM) && (_MSC_VER >= 1700) && defined(_M_ARM)
|
#if !defined(CRYPTOPP_DISABLE_ASM) && (CRYPTOPP_MSC_VERSION >= 1700) && defined(_M_ARM)
|
||||||
template<> inline void SecureWipeBuffer(byte *buf, size_t n)
|
template<> inline void SecureWipeBuffer(byte *buf, size_t n)
|
||||||
{
|
{
|
||||||
char *p = reinterpret_cast<char*>(buf+n);
|
char *p = reinterpret_cast<char*>(buf+n);
|
||||||
@ -1914,7 +1914,7 @@ template <class T> inline T rotrMod(T x, unsigned int y)
|
|||||||
return T((x>>(y&MASK))|(x<<(-y&MASK)));
|
return T((x>>(y&MASK))|(x<<(-y&MASK)));
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef CRYPTOPP_MSC_VERSION
|
||||||
|
|
||||||
/// \brief Performs a left rotate
|
/// \brief Performs a left rotate
|
||||||
/// \tparam T the word type
|
/// \tparam T the word type
|
||||||
@ -2006,9 +2006,9 @@ template<> inline word32 rotrMod<word32>(word32 x, unsigned int y)
|
|||||||
return _lrotr(x, static_cast<byte>(y));
|
return _lrotr(x, static_cast<byte>(y));
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // #ifdef _MSC_VER
|
#endif // #ifdef CRYPTOPP_MSC_VERSION
|
||||||
|
|
||||||
#if (_MSC_VER >= 1400) || (defined(_MSC_VER) && !defined(_DLL))
|
#if (CRYPTOPP_MSC_VERSION >= 1400) || (defined(CRYPTOPP_MSC_VERSION) && !defined(_DLL))
|
||||||
// Intel C++ Compiler 10.0 calls a function instead of using the rotate instruction when using these instructions
|
// Intel C++ Compiler 10.0 calls a function instead of using the rotate instruction when using these instructions
|
||||||
|
|
||||||
/// \brief Performs a left rotate
|
/// \brief Performs a left rotate
|
||||||
@ -2101,9 +2101,9 @@ template<> inline word64 rotrMod<word64>(word64 x, unsigned int y)
|
|||||||
return y ? _rotr64(x, static_cast<byte>(y)) : x;
|
return y ? _rotr64(x, static_cast<byte>(y)) : x;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // #if _MSC_VER >= 1310
|
#endif // #if CRYPTOPP_MSC_VERSION >= 1310
|
||||||
|
|
||||||
#if _MSC_VER >= 1400 && !defined(__INTEL_COMPILER)
|
#if CRYPTOPP_MSC_VERSION >= 1400 && !defined(__INTEL_COMPILER)
|
||||||
// Intel C++ Compiler 10.0 gives undefined externals with these
|
// Intel C++ Compiler 10.0 gives undefined externals with these
|
||||||
template<> inline word16 rotlFixed<word16>(word16 x, unsigned int y)
|
template<> inline word16 rotlFixed<word16>(word16 x, unsigned int y)
|
||||||
{
|
{
|
||||||
@ -2169,7 +2169,7 @@ template<> inline byte rotrMod<byte>(byte x, unsigned int y)
|
|||||||
return _rotr8(x, static_cast<byte>(y));
|
return _rotr8(x, static_cast<byte>(y));
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // #if _MSC_VER >= 1400
|
#endif // #if CRYPTOPP_MSC_VERSION >= 1400
|
||||||
|
|
||||||
#if (defined(__MWERKS__) && TARGET_CPU_PPC)
|
#if (defined(__MWERKS__) && TARGET_CPU_PPC)
|
||||||
|
|
||||||
@ -2241,7 +2241,7 @@ inline word16 ByteReverse(word16 value)
|
|||||||
{
|
{
|
||||||
#if defined(CRYPTOPP_BYTESWAP_AVAILABLE)
|
#if defined(CRYPTOPP_BYTESWAP_AVAILABLE)
|
||||||
return bswap_16(value);
|
return bswap_16(value);
|
||||||
#elif (_MSC_VER >= 1400) || (defined(_MSC_VER) && !defined(_DLL))
|
#elif (CRYPTOPP_MSC_VERSION >= 1400) || (defined(CRYPTOPP_MSC_VERSION) && !defined(_DLL))
|
||||||
return _byteswap_ushort(value);
|
return _byteswap_ushort(value);
|
||||||
#else
|
#else
|
||||||
return rotlFixed(value, 8U);
|
return rotlFixed(value, 8U);
|
||||||
@ -2265,7 +2265,7 @@ inline word32 ByteReverse(word32 value)
|
|||||||
return value;
|
return value;
|
||||||
#elif defined(__MWERKS__) && TARGET_CPU_PPC
|
#elif defined(__MWERKS__) && TARGET_CPU_PPC
|
||||||
return (word32)__lwbrx(&value,0);
|
return (word32)__lwbrx(&value,0);
|
||||||
#elif (_MSC_VER >= 1400) || (defined(_MSC_VER) && !defined(_DLL))
|
#elif (CRYPTOPP_MSC_VERSION >= 1400) || (defined(CRYPTOPP_MSC_VERSION) && !defined(_DLL))
|
||||||
return _byteswap_ulong(value);
|
return _byteswap_ulong(value);
|
||||||
#elif CRYPTOPP_FAST_ROTATE(32) && !defined(__xlC__)
|
#elif CRYPTOPP_FAST_ROTATE(32) && !defined(__xlC__)
|
||||||
// 5 instructions with rotate instruction, 9 without
|
// 5 instructions with rotate instruction, 9 without
|
||||||
@ -2288,7 +2288,7 @@ inline word64 ByteReverse(word64 value)
|
|||||||
#elif defined(__GNUC__) && defined(CRYPTOPP_X86_ASM_AVAILABLE) && defined(__x86_64__)
|
#elif defined(__GNUC__) && defined(CRYPTOPP_X86_ASM_AVAILABLE) && defined(__x86_64__)
|
||||||
__asm__ ("bswap %0" : "=r" (value) : "0" (value));
|
__asm__ ("bswap %0" : "=r" (value) : "0" (value));
|
||||||
return value;
|
return value;
|
||||||
#elif (_MSC_VER >= 1400) || (defined(_MSC_VER) && !defined(_DLL))
|
#elif (CRYPTOPP_MSC_VERSION >= 1400) || (defined(CRYPTOPP_MSC_VERSION) && !defined(_DLL))
|
||||||
return _byteswap_uint64(value);
|
return _byteswap_uint64(value);
|
||||||
#elif CRYPTOPP_BOOL_SLOW_WORD64
|
#elif CRYPTOPP_BOOL_SLOW_WORD64
|
||||||
return (word64(ByteReverse(word32(value))) << 32) | ByteReverse(word32(value>>32));
|
return (word64(ByteReverse(word32(value))) << 32) | ByteReverse(word32(value>>32));
|
||||||
|
4
osrng.h
4
osrng.h
@ -69,11 +69,11 @@ private:
|
|||||||
ProviderHandle m_hProvider;
|
ProviderHandle m_hProvider;
|
||||||
};
|
};
|
||||||
|
|
||||||
#if defined(_MSC_VER) && defined(USE_MS_CRYPTOAPI)
|
#if defined(CRYPTOPP_MSC_VERSION) && defined(USE_MS_CRYPTOAPI)
|
||||||
# pragma comment(lib, "advapi32.lib")
|
# pragma comment(lib, "advapi32.lib")
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(_MSC_VER) && defined(USE_MS_CNGAPI)
|
#if defined(CRYPTOPP_MSC_VERSION) && defined(USE_MS_CNGAPI)
|
||||||
# pragma comment(lib, "bcrypt.lib")
|
# pragma comment(lib, "bcrypt.lib")
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ void PadlockRNG::GenerateBlock(byte *output, size_t size)
|
|||||||
std::memcpy(output, m_buffer, rem);
|
std::memcpy(output, m_buffer, rem);
|
||||||
size -= rem; output += rem;
|
size -= rem; output += rem;
|
||||||
}
|
}
|
||||||
#elif defined(CRYPTOPP_X86_ASM_AVAILABLE) && defined(_MSC_VER) && defined(_M_IX86)
|
#elif defined(CRYPTOPP_X86_ASM_AVAILABLE) && defined(CRYPTOPP_MSC_VERSION) && defined(_M_IX86)
|
||||||
while (size)
|
while (size)
|
||||||
{
|
{
|
||||||
word32 result, divisor = m_divisor;
|
word32 result, divisor = m_divisor;
|
||||||
|
@ -90,7 +90,7 @@ being unloaded from L1 cache, until that round is finished.
|
|||||||
|
|
||||||
// VS2017 and global optimization bug. Also see
|
// VS2017 and global optimization bug. Also see
|
||||||
// https://github.com/weidai11/cryptopp/issues/649
|
// https://github.com/weidai11/cryptopp/issues/649
|
||||||
#if (_MSC_VER >= 1910) && (_MSC_VER <= 1916)
|
#if (CRYPTOPP_MSC_VERSION >= 1910) && (CRYPTOPP_MSC_VERSION <= 1916)
|
||||||
# ifndef CRYPTOPP_DEBUG
|
# ifndef CRYPTOPP_DEBUG
|
||||||
# pragma optimize("", off)
|
# pragma optimize("", off)
|
||||||
# pragma optimize("ts", on)
|
# pragma optimize("ts", on)
|
||||||
@ -422,7 +422,7 @@ void Rijndael::Base::UncheckedSetKey(const byte *userKey, unsigned int keyLen, c
|
|||||||
m_key.New(4*(m_rounds+1));
|
m_key.New(4*(m_rounds+1));
|
||||||
word32 *rk = m_key;
|
word32 *rk = m_key;
|
||||||
|
|
||||||
#if (CRYPTOPP_AESNI_AVAILABLE && CRYPTOPP_SSE41_AVAILABLE && (!defined(_MSC_VER) || _MSC_VER >= 1600 || CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X32))
|
#if (CRYPTOPP_AESNI_AVAILABLE && CRYPTOPP_SSE41_AVAILABLE && (!defined(CRYPTOPP_MSC_VERSION) || CRYPTOPP_MSC_VERSION >= 1600 || CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X32))
|
||||||
// MSVC 2008 SP1 generates bad code for _mm_extract_epi32() when compiling for X64
|
// MSVC 2008 SP1 generates bad code for _mm_extract_epi32() when compiling for X64
|
||||||
if (HasAESNI() && HasSSE41())
|
if (HasAESNI() && HasSSE41())
|
||||||
{
|
{
|
||||||
@ -1204,7 +1204,7 @@ CRYPTOPP_NAKED void CRYPTOPP_FASTCALL Rijndael_Enc_AdvancedProcessBlocks_SSE2(vo
|
|||||||
#endif
|
#endif
|
||||||
AS_POP_IF86(bp)
|
AS_POP_IF86(bp)
|
||||||
AS_POP_IF86(bx)
|
AS_POP_IF86(bx)
|
||||||
#if defined(_MSC_VER) && CRYPTOPP_BOOL_X86
|
#if defined(CRYPTOPP_MSC_VERSION) && CRYPTOPP_BOOL_X86
|
||||||
AS_POP_IF86(di)
|
AS_POP_IF86(di)
|
||||||
AS_POP_IF86(si)
|
AS_POP_IF86(si)
|
||||||
AS1(ret)
|
AS1(ret)
|
||||||
|
10
secblock.h
10
secblock.h
@ -11,7 +11,7 @@
|
|||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "stdcpp.h"
|
#include "stdcpp.h"
|
||||||
|
|
||||||
#if CRYPTOPP_MSC_VERSION
|
#if defined(CRYPTOPP_MSC_VERSION)
|
||||||
# pragma warning(push)
|
# pragma warning(push)
|
||||||
# pragma warning(disable: 4231 4275 4700)
|
# pragma warning(disable: 4231 4275 4700)
|
||||||
# if (CRYPTOPP_MSC_VERSION >= 1400)
|
# if (CRYPTOPP_MSC_VERSION >= 1400)
|
||||||
@ -56,7 +56,7 @@ public:
|
|||||||
/// \since Crypto++ 6.0
|
/// \since Crypto++ 6.0
|
||||||
#if defined(CRYPTOPP_DOXYGEN_PROCESSING)
|
#if defined(CRYPTOPP_DOXYGEN_PROCESSING)
|
||||||
static const size_type ELEMS_MAX = ...;
|
static const size_type ELEMS_MAX = ...;
|
||||||
#elif defined(_MSC_VER) && (_MSC_VER <= 1400)
|
#elif defined(CRYPTOPP_MSC_VERSION) && (CRYPTOPP_MSC_VERSION <= 1400)
|
||||||
static const size_type ELEMS_MAX = (~(size_type)0)/sizeof(T);
|
static const size_type ELEMS_MAX = (~(size_type)0)/sizeof(T);
|
||||||
#elif defined(CRYPTOPP_CXX11_STRONG_ENUM)
|
#elif defined(CRYPTOPP_CXX11_STRONG_ENUM)
|
||||||
enum : size_type {ELEMS_MAX = SIZE_MAX/sizeof(T)};
|
enum : size_type {ELEMS_MAX = SIZE_MAX/sizeof(T)};
|
||||||
@ -270,7 +270,7 @@ public:
|
|||||||
/// \details VS.NET STL enforces the policy of "All STL-compliant allocators
|
/// \details VS.NET STL enforces the policy of "All STL-compliant allocators
|
||||||
/// have to provide a template class member called rebind".
|
/// have to provide a template class member called rebind".
|
||||||
template <class V> struct rebind { typedef AllocatorWithCleanup<V, T_Align16> other; };
|
template <class V> struct rebind { typedef AllocatorWithCleanup<V, T_Align16> other; };
|
||||||
#if _MSC_VER >= 1500
|
#if (CRYPTOPP_MSC_VERSION >= 1500)
|
||||||
AllocatorWithCleanup() {}
|
AllocatorWithCleanup() {}
|
||||||
template <class V, bool A> AllocatorWithCleanup(const AllocatorWithCleanup<V, A> &) {}
|
template <class V, bool A> AllocatorWithCleanup(const AllocatorWithCleanup<V, A> &) {}
|
||||||
#endif
|
#endif
|
||||||
@ -749,7 +749,7 @@ public:
|
|||||||
/// \since Crypto++ 6.0
|
/// \since Crypto++ 6.0
|
||||||
#if defined(CRYPTOPP_DOXYGEN_PROCESSING)
|
#if defined(CRYPTOPP_DOXYGEN_PROCESSING)
|
||||||
static const size_type ELEMS_MAX = ...;
|
static const size_type ELEMS_MAX = ...;
|
||||||
#elif defined(_MSC_VER) && (_MSC_VER <= 1400)
|
#elif defined(CRYPTOPP_MSC_VERSION) && (CRYPTOPP_MSC_VERSION <= 1400)
|
||||||
static const size_type ELEMS_MAX = (~(size_type)0)/sizeof(T);
|
static const size_type ELEMS_MAX = (~(size_type)0)/sizeof(T);
|
||||||
#elif defined(CRYPTOPP_CXX11_STRONG_ENUM)
|
#elif defined(CRYPTOPP_CXX11_STRONG_ENUM)
|
||||||
enum : size_type {ELEMS_MAX = A::ELEMS_MAX};
|
enum : size_type {ELEMS_MAX = A::ELEMS_MAX};
|
||||||
@ -1303,7 +1303,7 @@ __stl_alloc_rebind(CryptoPP::AllocatorWithCleanup<_Tp1>& __a, const _Tp2*)
|
|||||||
|
|
||||||
NAMESPACE_END
|
NAMESPACE_END
|
||||||
|
|
||||||
#if CRYPTOPP_MSC_VERSION
|
#if defined(CRYPTOPP_MSC_VERSION)
|
||||||
# pragma warning(pop)
|
# pragma warning(pop)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
4
sha.cpp
4
sha.cpp
@ -655,7 +655,7 @@ void CRYPTOPP_FASTCALL SHA256_HashMultipleBlocks_SSE2(word32 *state, const word3
|
|||||||
AS2( mov edi, [len])
|
AS2( mov edi, [len])
|
||||||
AS2( lea WORD_REG(si), [SHA256_K+48*4])
|
AS2( lea WORD_REG(si), [SHA256_K+48*4])
|
||||||
#endif
|
#endif
|
||||||
#if !defined(_MSC_VER) || (_MSC_VER < 1400)
|
#if !defined(CRYPTOPP_MSC_VERSION) || (CRYPTOPP_MSC_VERSION < 1400)
|
||||||
AS_PUSH_IF86(bx)
|
AS_PUSH_IF86(bx)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -807,7 +807,7 @@ INTEL_NOPREFIX
|
|||||||
|
|
||||||
AS_POP_IF86(sp)
|
AS_POP_IF86(sp)
|
||||||
AS_POP_IF86(bp)
|
AS_POP_IF86(bp)
|
||||||
#if !defined(_MSC_VER) || (_MSC_VER < 1400)
|
#if !defined(CRYPTOPP_MSC_VERSION) || (CRYPTOPP_MSC_VERSION < 1400)
|
||||||
AS_POP_IF86(bx)
|
AS_POP_IF86(bx)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ using CryptoPP::vec_swap; // SunCC
|
|||||||
#if (CRYPTOPP_ARM_NEON_AVAILABLE)
|
#if (CRYPTOPP_ARM_NEON_AVAILABLE)
|
||||||
|
|
||||||
// Missing from Microsoft's ARM A-32 implementation
|
// Missing from Microsoft's ARM A-32 implementation
|
||||||
#if defined(_MSC_VER) && !defined(_M_ARM64)
|
#if defined(CRYPTOPP_MSC_VERSION) && !defined(_M_ARM64)
|
||||||
inline uint64x2_t vld1q_dup_u64(const uint64_t* ptr)
|
inline uint64x2_t vld1q_dup_u64(const uint64_t* ptr)
|
||||||
{
|
{
|
||||||
return vmovq_n_u64(*ptr);
|
return vmovq_n_u64(*ptr);
|
||||||
|
@ -406,7 +406,7 @@ void SosemanukPolicy::OperateKeystream(KeystreamOperation operation, byte *outpu
|
|||||||
AS2( mov SSE2_output, WORD_REG(di))
|
AS2( mov SSE2_output, WORD_REG(di))
|
||||||
AS2( mov SSE2_input, WORD_REG(dx))
|
AS2( mov SSE2_input, WORD_REG(dx))
|
||||||
AS2( mov SSE2_state, WORD_REG(ax))
|
AS2( mov SSE2_state, WORD_REG(ax))
|
||||||
#ifndef _MSC_VER
|
#ifndef CRYPTOPP_MSC_VERSION
|
||||||
AS2( mov SSE2_pMulTables, WORD_REG(si))
|
AS2( mov SSE2_pMulTables, WORD_REG(si))
|
||||||
#endif
|
#endif
|
||||||
AS2( lea WORD_REG(cx), [4*WORD_REG(cx)+WORD_REG(cx)])
|
AS2( lea WORD_REG(cx), [4*WORD_REG(cx)+WORD_REG(cx)])
|
||||||
@ -469,7 +469,7 @@ void SosemanukPolicy::OperateKeystream(KeystreamOperation operation, byte *outpu
|
|||||||
AS2( mov SSE2_wordsLeft2, WORD_REG(si))
|
AS2( mov SSE2_wordsLeft2, WORD_REG(si))
|
||||||
AS2( lea WORD_REG(si), [WORD_REG(di)+WORD_REG(si)]) // use to end first inner loop
|
AS2( lea WORD_REG(si), [WORD_REG(di)+WORD_REG(si)]) // use to end first inner loop
|
||||||
AS2( mov SSE2_diEnd, WORD_REG(si))
|
AS2( mov SSE2_diEnd, WORD_REG(si))
|
||||||
#ifdef _MSC_VER
|
#ifdef CRYPTOPP_MSC_VERSION
|
||||||
AS2( lea WORD_REG(si), s_sosemanukMulTables)
|
AS2( lea WORD_REG(si), s_sosemanukMulTables)
|
||||||
#else
|
#else
|
||||||
AS2( mov WORD_REG(si), SSE2_pMulTables)
|
AS2( mov WORD_REG(si), SSE2_pMulTables)
|
||||||
|
@ -62,7 +62,7 @@ using CryptoPP::word64;
|
|||||||
#if (CRYPTOPP_ARM_NEON_AVAILABLE)
|
#if (CRYPTOPP_ARM_NEON_AVAILABLE)
|
||||||
|
|
||||||
// Missing from Microsoft's ARM A-32 implementation
|
// Missing from Microsoft's ARM A-32 implementation
|
||||||
#if defined(_MSC_VER) && !defined(_M_ARM64)
|
#if defined(CRYPTOPP_MSC_VERSION) && !defined(_M_ARM64)
|
||||||
inline uint64x2_t vld1q_dup_u64(const uint64_t* ptr)
|
inline uint64x2_t vld1q_dup_u64(const uint64_t* ptr)
|
||||||
{
|
{
|
||||||
return vmovq_n_u64(*ptr);
|
return vmovq_n_u64(*ptr);
|
||||||
|
12
stdcpp.h
12
stdcpp.h
@ -6,7 +6,7 @@
|
|||||||
#ifndef CRYPTOPP_STDCPP_H
|
#ifndef CRYPTOPP_STDCPP_H
|
||||||
#define CRYPTOPP_STDCPP_H
|
#define CRYPTOPP_STDCPP_H
|
||||||
|
|
||||||
#if _MSC_VER >= 1500
|
#if (CRYPTOPP_MSC_VERSION >= 1500)
|
||||||
#define _DO_NOT_DECLARE_INTERLOCKED_INTRINSICS_IN_MEMORY
|
#define _DO_NOT_DECLARE_INTERLOCKED_INTRINSICS_IN_MEMORY
|
||||||
#include <intrin.h>
|
#include <intrin.h>
|
||||||
#endif
|
#endif
|
||||||
@ -26,7 +26,7 @@
|
|||||||
#include <new>
|
#include <new>
|
||||||
|
|
||||||
// http://connect.microsoft.com/VisualStudio/feedback/details/1600701/type-info-does-not-compile-with-has-exceptions-0
|
// http://connect.microsoft.com/VisualStudio/feedback/details/1600701/type-info-does-not-compile-with-has-exceptions-0
|
||||||
#if defined(_MSC_VER) && (_MSC_VER < 1900) && defined(_HAS_EXCEPTIONS) && (_HAS_EXCEPTIONS == 0)
|
#if defined(CRYPTOPP_MSC_VERSION) && (CRYPTOPP_MSC_VERSION < 1900) && defined(_HAS_EXCEPTIONS) && (_HAS_EXCEPTIONS == 0)
|
||||||
namespace std {
|
namespace std {
|
||||||
using ::type_info;
|
using ::type_info;
|
||||||
}
|
}
|
||||||
@ -43,7 +43,7 @@ namespace std {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// make_unchecked_array_iterator
|
// make_unchecked_array_iterator
|
||||||
#if _MSC_VER >= 1600
|
#if (CRYPTOPP_MSC_VERSION >= 1600)
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -68,7 +68,7 @@ namespace std {
|
|||||||
// program that includes <cstddef> without making users
|
// program that includes <cstddef> without making users
|
||||||
// do something special. "Epic fail" comes to mind.
|
// do something special. "Epic fail" comes to mind.
|
||||||
// Also see https://github.com/weidai11/cryptopp/issues/781
|
// Also see https://github.com/weidai11/cryptopp/issues/781
|
||||||
#ifndef _MSC_VER
|
#ifndef CRYPTOPP_MSC_VERSION
|
||||||
# include <cstddef>
|
# include <cstddef>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -77,8 +77,8 @@ namespace std {
|
|||||||
# if (__SUNPRO_CC >= 0x5100)
|
# if (__SUNPRO_CC >= 0x5100)
|
||||||
# include <stdint.h>
|
# include <stdint.h>
|
||||||
# endif
|
# endif
|
||||||
#elif defined(_MSC_VER)
|
#elif defined(CRYPTOPP_MSC_VERSION)
|
||||||
# if (_MSC_VER >= 1700)
|
# if (CRYPTOPP_MSC_VERSION >= 1700)
|
||||||
# include <stdint.h>
|
# include <stdint.h>
|
||||||
# else
|
# else
|
||||||
# include <stddef.h>
|
# include <stddef.h>
|
||||||
|
4
test.cpp
4
test.cpp
@ -57,7 +57,7 @@
|
|||||||
#define UNIX_PATH_FAMILY 1
|
#define UNIX_PATH_FAMILY 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (_MSC_VER >= 1000)
|
#if (CRYPTOPP_MSC_VERSION >= 1000)
|
||||||
#include <crtdbg.h> // for the debug heap
|
#include <crtdbg.h> // for the debug heap
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -510,7 +510,7 @@ void SetArgvPathHint(const char* argv0, std::string& pathHint)
|
|||||||
#if defined(AT_EXECFN)
|
#if defined(AT_EXECFN)
|
||||||
if (getauxval(AT_EXECFN))
|
if (getauxval(AT_EXECFN))
|
||||||
pathHint = getauxval(AT_EXECFN);
|
pathHint = getauxval(AT_EXECFN);
|
||||||
#elif defined(_MSC_VER) && (_MSC_VER > 1310)
|
#elif defined(CRYPTOPP_MSC_VERSION) && (CRYPTOPP_MSC_VERSION > 1310)
|
||||||
char* pgmptr = NULLPTR;
|
char* pgmptr = NULLPTR;
|
||||||
errno_t err = _get_pgmptr(&pgmptr);
|
errno_t err = _get_pgmptr(&pgmptr);
|
||||||
if (err == 0 && pgmptr != NULLPTR)
|
if (err == 0 && pgmptr != NULLPTR)
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
// Aggressive stack checking with VS2005 SP1 and above.
|
// Aggressive stack checking with VS2005 SP1 and above.
|
||||||
#if (_MSC_VER >= 1500)
|
#if (CRYPTOPP_MSC_VERSION >= 1500)
|
||||||
# pragma strict_gs_check (on)
|
# pragma strict_gs_check (on)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -224,7 +224,7 @@ bool TestSettings()
|
|||||||
word32 w;
|
word32 w;
|
||||||
const byte s[] = "\x01\x02\x03\x04";
|
const byte s[] = "\x01\x02\x03\x04";
|
||||||
|
|
||||||
#if (_MSC_VER >= 1400)
|
#if (CRYPTOPP_MSC_VERSION >= 1400)
|
||||||
memcpy_s(&w, 4, s, 4);
|
memcpy_s(&w, 4, s, 4);
|
||||||
#else
|
#else
|
||||||
std::copy(s, s+4, reinterpret_cast<byte*>(&w));
|
std::copy(s, s+4, reinterpret_cast<byte*>(&w));
|
||||||
|
6
vmac.cpp
6
vmac.cpp
@ -9,7 +9,7 @@
|
|||||||
#include "argnames.h"
|
#include "argnames.h"
|
||||||
#include "secblock.h"
|
#include "secblock.h"
|
||||||
|
|
||||||
#if defined(_MSC_VER) && !CRYPTOPP_BOOL_SLOW_WORD64
|
#if defined(CRYPTOPP_MSC_VERSION) && !CRYPTOPP_BOOL_SLOW_WORD64
|
||||||
#include <intrin.h>
|
#include <intrin.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -455,7 +455,7 @@ void VMAC_Base::VHASH_Update_SSE2(const word64 *data, size_t blocksRemainingInWo
|
|||||||
#define AccumulateNH(a, b, c) a += word128(b)*(c)
|
#define AccumulateNH(a, b, c) a += word128(b)*(c)
|
||||||
#define Multiply128(r, i1, i2) r = word128(word64(i1)) * word64(i2)
|
#define Multiply128(r, i1, i2) r = word128(word64(i1)) * word64(i2)
|
||||||
#else
|
#else
|
||||||
#if _MSC_VER >= 1400 && !defined(__INTEL_COMPILER) && (defined(_M_IX86) || defined(_M_X64) || defined(_M_IA64))
|
#if CRYPTOPP_MSC_VERSION >= 1400 && !defined(__INTEL_COMPILER) && (defined(_M_IX86) || defined(_M_X64) || defined(_M_IA64))
|
||||||
#define MUL32(a, b) __emulu(word32(a), word32(b))
|
#define MUL32(a, b) __emulu(word32(a), word32(b))
|
||||||
#else
|
#else
|
||||||
#define MUL32(a, b) ((word64)((word32)(a)) * (word32)(b))
|
#define MUL32(a, b) ((word64)((word32)(a)) * (word32)(b))
|
||||||
@ -465,7 +465,7 @@ void VMAC_Base::VHASH_Update_SSE2(const word64 *data, size_t blocksRemainingInWo
|
|||||||
#define MUL64(rh,rl,i1,i2) asm ("mulq %3" : "=a"(rl), "=d"(rh) : "a"(i1), "g"(i2) : "cc");
|
#define MUL64(rh,rl,i1,i2) asm ("mulq %3" : "=a"(rl), "=d"(rh) : "a"(i1), "g"(i2) : "cc");
|
||||||
#define AccumulateNH(a, b, c) asm ("mulq %3; addq %%rax, %0; adcq %%rdx, %1" : "+r"(a##0), "+r"(a##1) : "a"(b), "g"(c) : "%rdx", "cc");
|
#define AccumulateNH(a, b, c) asm ("mulq %3; addq %%rax, %0; adcq %%rdx, %1" : "+r"(a##0), "+r"(a##1) : "a"(b), "g"(c) : "%rdx", "cc");
|
||||||
#define ADD128(rh,rl,ih,il) asm ("addq %3, %1; adcq %2, %0" : "+r"(rh),"+r"(rl) : "r"(ih),"r"(il) : "cc");
|
#define ADD128(rh,rl,ih,il) asm ("addq %3, %1; adcq %2, %0" : "+r"(rh),"+r"(rl) : "r"(ih),"r"(il) : "cc");
|
||||||
#elif defined(_MSC_VER) && !CRYPTOPP_BOOL_SLOW_WORD64
|
#elif defined(CRYPTOPP_MSC_VERSION) && !CRYPTOPP_BOOL_SLOW_WORD64
|
||||||
#define DeclareNH(a) word64 a##0=0, a##1=0
|
#define DeclareNH(a) word64 a##0=0, a##1=0
|
||||||
#define MUL64(rh,rl,i1,i2) (rl) = _umul128(i1,i2,&(rh));
|
#define MUL64(rh,rl,i1,i2) (rl) = _umul128(i1,i2,&(rh));
|
||||||
#define AccumulateNH(a, b, c) {\
|
#define AccumulateNH(a, b, c) {\
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
NAMESPACE_BEGIN(CryptoPP)
|
NAMESPACE_BEGIN(CryptoPP)
|
||||||
|
|
||||||
#if (defined(_MSC_VER) && (_MSC_VER < 1400)) && !defined(__MWERKS__)
|
#if (defined(CRYPTOPP_MSC_VERSION) && (CRYPTOPP_MSC_VERSION < 1400)) && !defined(__MWERKS__)
|
||||||
// VC60 and VC7 workaround: built-in std::reverse_iterator has two template parameters, Dinkumware only has one
|
// VC60 and VC7 workaround: built-in std::reverse_iterator has two template parameters, Dinkumware only has one
|
||||||
typedef std::reverse_bidirectional_iterator<unsigned int *, unsigned int> RevIt;
|
typedef std::reverse_bidirectional_iterator<unsigned int *, unsigned int> RevIt;
|
||||||
#elif defined(_RWSTD_NO_CLASS_PARTIAL_SPEC)
|
#elif defined(_RWSTD_NO_CLASS_PARTIAL_SPEC)
|
||||||
@ -413,12 +413,12 @@ unsigned int Deflator::LongestMatch(unsigned int &bestMatch) const
|
|||||||
{
|
{
|
||||||
CRYPTOPP_ASSERT(scan[2] == match[2]);
|
CRYPTOPP_ASSERT(scan[2] == match[2]);
|
||||||
unsigned int len = (unsigned int)(
|
unsigned int len = (unsigned int)(
|
||||||
#if defined(_STDEXT_BEGIN) && !(defined(_MSC_VER) && (_MSC_VER < 1400 || _MSC_VER >= 1600)) && !defined(_STLPORT_VERSION)
|
#if defined(_STDEXT_BEGIN) && !(defined(CRYPTOPP_MSC_VERSION) && (CRYPTOPP_MSC_VERSION < 1400 || CRYPTOPP_MSC_VERSION >= 1600)) && !defined(_STLPORT_VERSION)
|
||||||
stdext::unchecked_mismatch
|
stdext::unchecked_mismatch
|
||||||
#else
|
#else
|
||||||
std::mismatch
|
std::mismatch
|
||||||
#endif
|
#endif
|
||||||
#if _MSC_VER >= 1600
|
#if CRYPTOPP_MSC_VERSION >= 1600
|
||||||
(stdext::make_unchecked_array_iterator(scan)+3, stdext::make_unchecked_array_iterator(scanEnd), stdext::make_unchecked_array_iterator(match)+3).first - stdext::make_unchecked_array_iterator(scan));
|
(stdext::make_unchecked_array_iterator(scan)+3, stdext::make_unchecked_array_iterator(scanEnd), stdext::make_unchecked_array_iterator(match)+3).first - stdext::make_unchecked_array_iterator(scan));
|
||||||
#else
|
#else
|
||||||
(scan+3, scanEnd, match+3).first - scan);
|
(scan+3, scanEnd, match+3).first - scan);
|
||||||
|
Loading…
Reference in New Issue
Block a user