summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2016-10-18 02:02:49 -0400
committerJeffrey Walton <noloader@gmail.com>2016-10-18 02:02:49 -0400
commit51d3cc945fe388c776a1a20683ba8ff1c2f191e2 (patch)
treec2ee43f86c40f7773b1bc592454fa11ab2d016f5
parent54d17c7361dc97313ca0ad54bf07420e33a735c0 (diff)
downloadcryptopp-git-51d3cc945fe388c776a1a20683ba8ff1c2f191e2.tar.gz
Switch to std::copy due to MinGW issues with memcpy_s
Also see http://github.com/weidai11/cryptopp/issues/28 and http://groups.google.com/d/msg/cryptopp-users/PRTVKTh0gRk/euPM_TzdBAAJ
-rw-r--r--validat1.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/validat1.cpp b/validat1.cpp
index fdda7957..b91eaf29 100644
--- a/validat1.cpp
+++ b/validat1.cpp
@@ -173,17 +173,19 @@ bool ValidateAll(bool thorough)
bool TestSettings()
{
- // Thanks to IlyaBizyaev and Zireael, http://github.com/weidai11/cryptopp/issues/28
-#if defined(__MINGW32__)
- using CryptoPP::memcpy_s;
-#endif
-
bool pass = true;
cout << "\nTesting Settings...\n\n";
word32 w;
- memcpy_s(&w, sizeof(w), "\x01\x02\x03\x04", 4);
+ const byte s[] = "\x01\x02\x03\x04";
+
+#if (CRYPTOPP_MSC_VERSION >= 1400)
+ std::copy(s, s+4,
+ stdext::make_checked_array_iterator(reinterpret_cast<byte*>(&w), sizeof(w)));
+#else
+ std::copy(s, s+4, reinterpret_cast<byte*>(&w));
+#endif
if (w == 0x04030201L)
{