The first will break compilation if someone uses MinGW-w64 CRT with secure APIs 
support.
This is because we have two declaration of memcpy_s imported in global 
namespace (line 66):
USING_NAMESPACE(CryptoPP)

The second also break compilation if someone uses MinGW-w64 CRT v 3.x with 
secure APIs support.
This is because _MEMORY_S_DEFINED macro is defined in sec_api/memory_s.h, 
resulting in CryptoPP::memcpy_s not declared.

Note: 
- v 4.x and later move memcpy_s to string.h and do not define _MEMORY_S_DEFINED 
anymore.
- v 3.x, 4.x, 5.x are used with GCC 4.x, 5.x, 6.x respectively.
- MINGW_HAS_SECURE_API is defined if CRT has support for secure APIs.
- __MINGW32__ is defined in both cases (32bit vs 64bit).

So I suggest a change as follow:
#if defined(__MINGW32__)
// avoid ambiguity if we have two versions of memcpy_s
#if !defined(MINGW_HAS_SECURE_API) || (MINGW_HAS_SECURE_API + 0 == 0) || 
defined(CRYPTOPP_WANT_SECURE_LIB)
        using CryptoPP::memcpy_s;
#else
        using ::memcpy_s;
#endif
#endif

-- 
-- 
You received this message because you are subscribed to the "Crypto++ Users" 
Google Group.
To unsubscribe, send an email to cryptopp-users-unsubscr...@googlegroups.com.
More information about Crypto++ and this group is available at 
http://www.cryptopp.com.
--- 
You received this message because you are subscribed to the Google Groups 
"Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cryptopp-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to