This is an automated email from the ASF dual-hosted git repository. jbarrett pushed a commit to branch feature/GEODE-4946-msvc-warn in repository https://gitbox.apache.org/repos/asf/geode-native.git
commit 76e9b7fcd558fb8ac8040b12c743183452298370 Author: Jacob Barrett <jbarr...@pivotal.io> AuthorDate: Wed Mar 28 19:53:56 2018 +0000 cryptoimpl warning free --- cryptoimpl/CMakeLists.txt | 7 ++++++- cryptoimpl/DHImpl.cpp | 22 +++++++++++----------- cryptoimpl/DHImpl.hpp | 4 ++-- cryptoimpl/SSLImpl.cpp | 16 +++++----------- cryptoimpl/SSLImpl.hpp | 6 +++++- 5 files changed, 29 insertions(+), 26 deletions(-) diff --git a/cryptoimpl/CMakeLists.txt b/cryptoimpl/CMakeLists.txt index b3d9969..cf2339a 100644 --- a/cryptoimpl/CMakeLists.txt +++ b/cryptoimpl/CMakeLists.txt @@ -13,15 +13,20 @@ # See the License for the specific language governing permissions and # limitations under the License. cmake_minimum_required(VERSION 3.4) -project(cryptoimpl LANGUAGES CXX) +project(cryptoImpl LANGUAGES CXX) file(GLOB_RECURSE SOURCES "*.cpp") add_library(cryptoImpl SHARED ${SOURCES}) +target_compile_definitions(cryptoImpl + PRIVATE + BUILD_CPPCACHE) + target_link_libraries(cryptoImpl PRIVATE ACE_SSL + _WarningsAsError PUBLIC apache-geode crypto diff --git a/cryptoimpl/DHImpl.cpp b/cryptoimpl/DHImpl.cpp index 28d3519..5365928 100644 --- a/cryptoimpl/DHImpl.cpp +++ b/cryptoimpl/DHImpl.cpp @@ -64,16 +64,16 @@ static const EVP_CIPHER* getCipherFunc(); static int setSkAlgo(const char * skalgo); */ -ASN1_SEQUENCE( - DH_PUBKEY) = {ASN1_SIMPLE(DH_PUBKEY, algor, X509_ALGOR), - ASN1_SIMPLE(DH_PUBKEY, public_key, - ASN1_BIT_STRING)} ASN1_SEQUENCE_END(DH_PUBKEY) +ASN1_SEQUENCE(DH_PUBKEY) = { + ASN1_SIMPLE(DH_PUBKEY, algor, X509_ALGOR), + ASN1_SIMPLE(DH_PUBKEY, public_key, ASN1_BIT_STRING)}; +ASN1_SEQUENCE_END(DH_PUBKEY); - // This gives us the i2d/d2i x.509 (ASN1 DER) encode/decode functions - IMPLEMENT_ASN1_FUNCTIONS(DH_PUBKEY) +// This gives us the i2d/d2i x.509 (ASN1 DER) encode/decode functions +IMPLEMENT_ASN1_FUNCTIONS(DH_PUBKEY); - // Returns Error code - int gf_initDhKeys(void **dhCtx, const char *dhAlgo, const char *ksPath) { +// Returns Error code +int gf_initDhKeys(void **dhCtx, const char *dhAlgo, const char *ksPath) { int errorCode = DH_ERR_NO_ERROR; // No error; DHImpl *dhimpl = new DHImpl(); @@ -161,7 +161,7 @@ ASN1_SEQUENCE( } } while (cert != NULL); - LOGDH(" Total certificats imported # %d", dhimpl->m_serverCerts.size()); + LOGDH(" Total certificats imported # %zd", dhimpl->m_serverCerts.size()); fclose(keyStoreFP); @@ -352,7 +352,7 @@ const EVP_CIPHER *DHImpl::getCipherFunc() { } unsigned char *gf_encryptDH(void *dhCtx, const unsigned char *cleartext, - size_t len, size_t *retLen) { + int len, int *retLen) { DHImpl *dhimpl = reinterpret_cast<DHImpl *>(dhCtx); // Validation @@ -420,7 +420,7 @@ unsigned char *gf_encryptDH(void *dhCtx, const unsigned char *cleartext, } unsigned char *gf_decryptDH(void *dhCtx, const unsigned char *cleartext, - size_t len, size_t *retLen) { + int len, int *retLen) { DHImpl *dhimpl = reinterpret_cast<DHImpl *>(dhCtx); // Validation diff --git a/cryptoimpl/DHImpl.hpp b/cryptoimpl/DHImpl.hpp index 665744c..f54b4da 100644 --- a/cryptoimpl/DHImpl.hpp +++ b/cryptoimpl/DHImpl.hpp @@ -63,10 +63,10 @@ _GEODE_EXPORT void gf_setPublicKeyOther(void* dhCtx, _GEODE_EXPORT void gf_computeSharedSecret(void* dhCtx); _GEODE_EXPORT unsigned char* gf_encryptDH(void* dhCtx, const unsigned char* cleartext, - size_t len, size_t* retLen); + int len, int* retLen); _GEODE_EXPORT unsigned char* gf_decryptDH(void* dhCtx, const unsigned char* cleartext, - size_t len, size_t* retLen); + int len, int* retLen); _GEODE_EXPORT bool gf_verifyDH(void* dhCtx, const char* subject, const unsigned char* challenge, int challengeLen, const unsigned char* response, int responseLen, diff --git a/cryptoimpl/SSLImpl.cpp b/cryptoimpl/SSLImpl.cpp index 59420c0..a70f6d6 100644 --- a/cryptoimpl/SSLImpl.cpp +++ b/cryptoimpl/SSLImpl.cpp @@ -17,14 +17,10 @@ #include "SSLImpl.hpp" -#include <ace/INET_Addr.h> -#include <ace/SOCK_IO.h> -#include <ace/Guard_T.h> -#include <ace/SSL/SSL_SOCK_Connector.h> -#include <ace/SSL/SSL_SOCK_Acceptor.h> -#include <ace/OS.h> #include <cstdint> +#include <ace/Guard_T.h> + namespace apache { namespace geode { namespace client { @@ -43,13 +39,11 @@ void gf_destroy_SslImpl(void *impl) { delete theLib; } -extern "C" { - -static int pem_passwd_cb(char *buf, int size, int rwflag, void *passwd) { +extern "C" static int pem_passwd_cb(char *buf, int size, int rwflag, + void *passwd) { strncpy(buf, (char *)passwd, size); buf[size - 1] = '\0'; - return (strlen(buf)); -} + return static_cast<int>(strlen(buf)); } SSLImpl::SSLImpl(ACE_HANDLE sock, const char *pubkeyfile, diff --git a/cryptoimpl/SSLImpl.hpp b/cryptoimpl/SSLImpl.hpp index e2085a6..57aeee3 100644 --- a/cryptoimpl/SSLImpl.hpp +++ b/cryptoimpl/SSLImpl.hpp @@ -20,7 +20,10 @@ #ifndef GEODE_CRYPTOIMPL_SSLIMPL_H_ #define GEODE_CRYPTOIMPL_SSLIMPL_H_ -#include <ace/ACE.h> +#pragma warning(push) +#pragma warning(disable : 4311) +#pragma warning(disable : 4302) +#pragma pack(push) #include <ace/OS.h> #include <ace/INET_Addr.h> #include <ace/SOCK_IO.h> @@ -29,6 +32,7 @@ #include <ace/OS.h> #include <ace/Recursive_Thread_Mutex.h> #include <ace/Time_Value.h> +#pragma pack(pop) #include <geode/internal/geode_base.hpp> -- To stop receiving notification emails like this one, please contact jbarr...@apache.org.