Skip to content

Commit

Permalink
Switch to std::copy due to MinGW issues with memcpy_s
Browse files Browse the repository at this point in the history
  • Loading branch information
noloader committed Oct 18, 2016
1 parent 54d17c7 commit 51d3cc9
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions validat1.cpp
Expand Up @@ -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)
{
Expand Down

1 comment on commit 51d3cc9

@noloader
Copy link
Collaborator Author

@noloader noloader commented on 51d3cc9 Oct 18, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.