From 8f4b0dc0816aec3bbf9e1a716c941aeafb5ae49c Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Wed, 16 Aug 2017 11:24:48 -0400 Subject: [PATCH 1/2] Suppress C4251 and C4275 warnings in project files (Issue 412) --- cryptdll.vcxproj | 2 +- cryptest.vcxproj | 2 +- cryptlib.vcxproj | 2 +- dlltest.vcxproj | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cryptdll.vcxproj b/cryptdll.vcxproj index 51bc8841..f2589944 100644 --- a/cryptdll.vcxproj +++ b/cryptdll.vcxproj @@ -56,7 +56,7 @@ true None Level4 - 4231; 4355; 4505 + 4231; 4251; 4275; 4355; 4505 Use pch.h diff --git a/cryptest.vcxproj b/cryptest.vcxproj index b7670ae7..5c121432 100644 --- a/cryptest.vcxproj +++ b/cryptest.vcxproj @@ -86,7 +86,7 @@ true None Level4 - 4231; 4355; 4505 + 4231; 4251; 4275; 4355; 4505 diff --git a/cryptlib.vcxproj b/cryptlib.vcxproj index 33d67dfa..acea306b 100644 --- a/cryptlib.vcxproj +++ b/cryptlib.vcxproj @@ -86,7 +86,7 @@ true None Level4 - 4231; 4355; 4505 + 4231; 4251; 4275; 4355; 4505 Use pch.h diff --git a/dlltest.vcxproj b/dlltest.vcxproj index f7971456..ed0c8be7 100644 --- a/dlltest.vcxproj +++ b/dlltest.vcxproj @@ -54,7 +54,7 @@ true None Level4 - 4231; 4355; 4505 + 4231; 4251; 4275; 4355; 4505 StdCall From c40a4dc9f71f1fe1683dd5cad933fe59748e8caf Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Wed, 16 Aug 2017 12:21:07 -0400 Subject: [PATCH 2/2] Fix Clang warning on missing template definitions --- bench2.cpp | 1 + dll.cpp | 1 + dlltest.cpp | 1 + fipstest.cpp | 1 + luc.cpp | 1 + pkcspad.h | 9 ++++++++- rsa.cpp | 1 + test.cpp | 1 + validat2.cpp | 1 + 9 files changed, 16 insertions(+), 1 deletion(-) diff --git a/bench2.cpp b/bench2.cpp index 3d07b2d0..4381d317 100644 --- a/bench2.cpp +++ b/bench2.cpp @@ -8,6 +8,7 @@ #include "pubkey.h" #include "gfpcrypt.h" #include "eccrypto.h" +#include "pkcspad.h" #include "files.h" #include "filters.h" diff --git a/dll.cpp b/dll.cpp index 372ed712..9cd51d15 100644 --- a/dll.cpp +++ b/dll.cpp @@ -6,6 +6,7 @@ #include "dll.h" #include "config.h" #include "iterhash.h" +#include "pkcspad.h" // Cast from FARPROC to funcptr with args, http://stackoverflow.com/q/4192058/608639 #pragma warning(disable: 4191) diff --git a/dlltest.cpp b/dlltest.cpp index e46ccdd5..addced55 100644 --- a/dlltest.cpp +++ b/dlltest.cpp @@ -5,6 +5,7 @@ #include "dll.h" #include "cryptlib.h" #include "filters.h" +#include "pkcspad.h" #if CRYPTOPP_MSC_VERSION # pragma warning(disable: 4505 4355) diff --git a/fipstest.cpp b/fipstest.cpp index 132c6510..3a1d9070 100644 --- a/fipstest.cpp +++ b/fipstest.cpp @@ -10,6 +10,7 @@ #include "cryptlib.h" #include "filters.h" #include "smartptr.h" +#include "pkcspad.h" #include "misc.h" // Simply disable CRYPTOPP_WIN32_AVAILABLE for Windows Phone and Windows Store apps diff --git a/luc.cpp b/luc.cpp index 702fc9f6..9a25662c 100644 --- a/luc.cpp +++ b/luc.cpp @@ -7,6 +7,7 @@ #include "integer.h" #include "nbtheory.h" #include "algparam.h" +#include "pkcspad.h" NAMESPACE_BEGIN(CryptoPP) diff --git a/pkcspad.h b/pkcspad.h index b75bce6a..5d4909fb 100644 --- a/pkcspad.h +++ b/pkcspad.h @@ -53,12 +53,19 @@ class MD5; } // end of list -#ifdef CRYPTOPP_IS_DLL +#if defined(CRYPTOPP_IS_DLL) CRYPTOPP_DLL_TEMPLATE_CLASS PKCS_DigestDecoration; CRYPTOPP_DLL_TEMPLATE_CLASS PKCS_DigestDecoration; CRYPTOPP_DLL_TEMPLATE_CLASS PKCS_DigestDecoration; CRYPTOPP_DLL_TEMPLATE_CLASS PKCS_DigestDecoration; CRYPTOPP_DLL_TEMPLATE_CLASS PKCS_DigestDecoration; +#elif defined(__clang__) +// Provide a default definition to avoid Clang warnings. CRTP will provide a +// real definition later. The single element is due to MSVC compile failures +// after adding the default definition. However, GCC produces multiple +// definitions which result in link failures. I give up... +template +const byte PKCS_DigestDecoration::decoration[1] = {0x00}; #endif //! \class PKCS1v15_SignatureMessageEncodingMethod diff --git a/rsa.cpp b/rsa.cpp index 6853d22d..095a99dd 100644 --- a/rsa.cpp +++ b/rsa.cpp @@ -9,6 +9,7 @@ #include "nbtheory.h" #include "algparam.h" #include "fips140.h" +#include "pkcspad.h" #if defined(CRYPTOPP_DEBUG) && !defined(CRYPTOPP_DOXYGEN_PROCESSING) && !defined(CRYPTOPP_IS_DLL) #include "pssr.h" diff --git a/test.cpp b/test.cpp index de97afb2..1d7a7b7d 100644 --- a/test.cpp +++ b/test.cpp @@ -24,6 +24,7 @@ #include "whrlpool.h" #include "tiger.h" #include "smartptr.h" +#include "pkcspad.h" #include "stdcpp.h" #include "ossig.h" #include "trap.h" diff --git a/validat2.cpp b/validat2.cpp index 3d984e92..e0fde064 100644 --- a/validat2.cpp +++ b/validat2.cpp @@ -39,6 +39,7 @@ #include "sha.h" #include "ripemd.h" #include "smartptr.h" +#include "pkcspad.h" #include #include