From 18a05659f38dc268b732de73d36f3e98408a01d0 Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Fri, 4 Aug 2017 18:31:52 -0400 Subject: [PATCH 1/3] Switch from -O2 to -O3 in the makefile (Issue 454) Also see https://groups.google.com/d/msg/cryptopp-users/AEiGyjq15tw/GBAyDA6fBgAJ --- GNUmakefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index 31d26606..0cf7d4ec 100755 --- a/GNUmakefile +++ b/GNUmakefile @@ -81,12 +81,12 @@ HAS_NEWLIB := $(shell $(CXX) -x c++ $(CXXFLAGS) -dM -E adhoc.cpp.proto 2>&1 | $( # Base CXXFLAGS used if the user did not specify them ifeq ($(SUN_COMPILER),1) ifeq ($(SUNCC_512_OR_LATER),1) - CXXFLAGS ?= -DNDEBUG -g3 -xO2 + CXXFLAGS ?= -DNDEBUG -g3 -xO3 else - CXXFLAGS ?= -DNDEBUG -g -xO2 + CXXFLAGS ?= -DNDEBUG -g -xO3 endif else - CXXFLAGS ?= -DNDEBUG -g2 -O2 + CXXFLAGS ?= -DNDEBUG -g2 -O3 endif # Default prefix for make install From 3fe6709ae7b2289ea9f5cf925aeae6e4300324e3 Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Fri, 4 Aug 2017 19:11:16 -0400 Subject: [PATCH 2/3] Cleanup comments in AppVeyor config file --- .appveyor.yml | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index aebae5d8..0a43a049 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -22,20 +22,14 @@ image: - Visual Studio 2015 - Visual Studio 2013 +# Disable build through solution file build: off -# project: cryptest.sln -# verbosity: minimal -# parallel: true - +# Build through commands in script below test_script: - cmd: >- - copy /y TestScripts\cryptlib.vcxproj . - - copy /y TestScripts\cryptest.vcxproj . - msbuild /t:Build /p:platform=%platform%;configuration=%configuration% cryptlib.vcxproj msbuild /t:Build /p:platform=%platform%;configuration=%configuration% cryptest.vcxproj @@ -46,13 +40,9 @@ test_script: cryptest.exe tv all -# Right now, we have a few failures that we don't know how to workaround. -# - https://stackoverflow.com/questions/43441273/how-to-run-vcupgrade-before-appveyor-build -# - https://stackoverflow.com/questions/43423761/cant-perform-64-bit-testing-under-appveyor - notifications: - - provider: Email - to: - - cryptopp-build@googlegroups.com - on_build_success: true - on_build_failure: true + - provider: Email + to: + - cryptopp-build@googlegroups.com + on_build_success: true + on_build_failure: true From 662cccce3be959eacda271dac1859f6168750e2a Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Fri, 4 Aug 2017 19:11:53 -0400 Subject: [PATCH 3/3] Switch to reinterpret_cast in MDC --- mdc.h | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/mdc.h b/mdc.h index ac5ba977..80279454 100644 --- a/mdc.h +++ b/mdc.h @@ -39,13 +39,12 @@ class MDC : public MDC_Info { CRYPTOPP_UNUSED(params); this->AssertValidKeyLength(length); - memcpy_s(m_key, m_key.size(), userKey, this->KEYLENGTH); - ConditionalByteReverse(BIG_ENDIAN_ORDER, Key(), Key(), this->KEYLENGTH); + ConditionalByteReverse(BIG_ENDIAN_ORDER, Key(), reinterpret_cast(userKey), this->KEYLENGTH); } void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const { - ConditionalByteReverse(BIG_ENDIAN_ORDER, Buffer(), (HashWordType *)inBlock, this->BLOCKSIZE); + ConditionalByteReverse(BIG_ENDIAN_ORDER, Buffer(), reinterpret_cast(inBlock), this->BLOCKSIZE); H::Transform(Buffer(), Key()); if (xorBlock) @@ -55,7 +54,7 @@ class MDC : public MDC_Info } else { - ConditionalByteReverse(BIG_ENDIAN_ORDER, (HashWordType *)outBlock, Buffer(), this->BLOCKSIZE); + ConditionalByteReverse(BIG_ENDIAN_ORDER, reinterpret_cast(outBlock), Buffer(), this->BLOCKSIZE); } } @@ -64,9 +63,9 @@ class MDC : public MDC_Info unsigned int OptimalDataAlignment() const {return sizeof(HashWordType);} private: - HashWordType *Key() {return (HashWordType *)m_key.data();} - const HashWordType *Key() const {return (const HashWordType *)m_key.data();} - HashWordType *Buffer() const {return (HashWordType *)m_buffer.data();} + HashWordType *Key() {return reinterpret_cast(m_key.data());} + const HashWordType *Key() const {return reinterpret_cast(m_key.data());} + HashWordType *Buffer() const {return reinterpret_cast(m_buffer.data());} // VC60 workaround: bug triggered if using FixedSizeAllocatorWithCleanup FixedSizeSecBlock::KEYLENGTH, AllocatorWithCleanup > m_key;