openbsd-ports/devel/cryptopp/patches/patch-misc_h
dcoppa 6a1ea1cc3c Update to cryptopp-5.6.1
'go for it' espie@
2011-06-24 07:55:17 +00:00

67 lines
2.6 KiB
Plaintext

$OpenBSD: patch-misc_h,v 1.2 2011/06/24 07:55:18 dcoppa Exp $
--- misc.h.orig Fri Aug 6 18:46:18 2010
+++ misc.h Sun Oct 24 12:21:50 2010
@@ -141,7 +141,7 @@ const T & Singleton<T, F, instance>::Ref(CRYPTOPP_NOIN
// ************** misc functions ***************
-#if (!__STDC_WANT_SECURE_LIB__)
+#if (!defined(__STDC_WANT_SECURE_LIB__) || !__STDC_WANT_SECURE_LIB__)
inline void memcpy_s(void *dest, size_t sizeInBytes, const void *src, size_t count)
{
if (count > sizeInBytes)
@@ -156,7 +156,7 @@ inline void memmove_s(void *dest, size_t sizeInBytes,
memmove(dest, src, count);
}
-#if __BORLANDC__ >= 0x620
+#if defined(__BORLANDC__) && __BORLANDC__ >= 0x620
// C++Builder 2010 workaround: can't use std::memcpy_s because it doesn't allow 0 lengths
#define memcpy_s CryptoPP::memcpy_s
#define memmove_s CryptoPP::memmove_s
@@ -367,7 +367,7 @@ inline unsigned int GetAlignmentOf(T *dummy=NULL) // V
return 1;
#endif
-#if (_MSC_VER >= 1300)
+#if defined(_MSC_VER) && (_MSC_VER >= 1300)
return __alignof(T);
#elif defined(__GNUC__)
return __alignof__(T);
@@ -483,7 +483,7 @@ void SecureWipeBuffer(T *buf, size_t n)
*(--p) = 0;
}
-#if (_MSC_VER >= 1400 || defined(__GNUC__)) && (CRYPTOPP_BOOL_X64 || CRYPTOPP_BOOL_X86)
+#if (defined(_MSC_VER) && _MSC_VER >= 1400 || defined(__GNUC__)) && (CRYPTOPP_BOOL_X64 || CRYPTOPP_BOOL_X86)
template<> inline void SecureWipeBuffer(byte *buf, size_t n)
{
@@ -651,7 +651,7 @@ template<> inline word32 rotrMod<word32>(word32 x, uns
#endif // #ifdef _MSC_VER
-#if _MSC_VER >= 1300 && !defined(__INTEL_COMPILER)
+#if defined(_MSC_VER) && _MSC_VER >= 1300 && !defined(__INTEL_COMPILER)
// Intel C++ Compiler 10.0 calls a function instead of using the rotate instruction when using these instructions
template<> inline word64 rotlFixed<word64>(word64 x, unsigned int y)
@@ -690,7 +690,7 @@ template<> inline word64 rotrMod<word64>(word64 x, uns
#endif // #if _MSC_VER >= 1310
-#if _MSC_VER >= 1400 && !defined(__INTEL_COMPILER)
+#if defined(_MSC_VER) && _MSC_VER >= 1400 && !defined(__INTEL_COMPILER)
// Intel C++ Compiler 10.0 gives undefined externals with these
template<> inline word16 rotlFixed<word16>(word16 x, unsigned int y)
@@ -837,7 +837,7 @@ inline word32 ByteReverse(word32 value)
return bswap_32(value);
#elif defined(__MWERKS__) && TARGET_CPU_PPC
return (word32)__lwbrx(&value,0);
-#elif _MSC_VER >= 1400 || (_MSC_VER >= 1300 && !defined(_DLL))
+#elif (defined(_MSC_VER) && _MSC_VER >= 1400) || (defined (_MSC_VER) && _MSC_VER >= 1300 && !defined(_DLL))
return _byteswap_ulong(value);
#elif CRYPTOPP_FAST_ROTATE(32)
// 5 instructions with rotate instruction, 9 without