diff --git a/GNUmakefile b/GNUmakefile index 84f89dd4..605e45d3 100755 --- a/GNUmakefile +++ b/GNUmakefile @@ -42,7 +42,7 @@ IS_SPARC64 := $(shell echo "$(MACHINE)" | $(GREP) -i -c "sparc64") IS_LINUX := $(shell echo "$(MACHINE)" | $(GREP) -i -c "Linux") IS_MINGW := $(shell echo "$(MACHINE)" | $(GREP) -i -c "MinGW") -IS_MINGW32 := $(shell echo "$(MACHINE)" | $(GREP) -x -c "mingw32") +IS_MINGW32 := $(shell echo "$(MACHINE)" | $(GREP) -x -i -c "mingw32") IS_CYGWIN := $(shell echo "$(MACHINE)" | $(GREP) -i -c "Cygwin") IS_DARWIN := $(shell echo "$(MACHINE)" | $(GREP) -i -c "Darwin") IS_NETBSD := $(shell echo "$(MACHINE)" | $(GREP) -i -c "NetBSD") @@ -65,7 +65,7 @@ ifneq ($(MACPORTS_COMPILER)$(HOMEBREW_COMPILER),00) endif # Sun Studio 12.0 provides SunCC 0x0510; and Sun Studio 12.3 provides SunCC 0x0512 -SUNCC_VERSION := $(shell $(CXX) -V 2>&1) +SUNCC_VERSION := $(subst `,',$(shell $(CXX) -V 2>&1)) SUNCC_510_OR_LATER := $(shell echo "$(SUNCC_VERSION)" | $(GREP) -i -c -E "CC: (Sun|Studio) .* (5\.1[0-9]|5\.[2-9]|6\.)") SUNCC_511_OR_LATER := $(shell echo "$(SUNCC_VERSION)" | $(GREP) -i -c -E "CC: (Sun|Studio) .* (5\.1[1-9]|5\.[2-9]|6\.)") SUNCC_512_OR_LATER := $(shell echo "$(SUNCC_VERSION)" | $(GREP) -i -c -E "CC: (Sun|Studio) .* (5\.1[2-9]|5\.[2-9]|6\.)") diff --git a/integer.cpp b/integer.cpp index 691746d1..16112575 100644 --- a/integer.cpp +++ b/integer.cpp @@ -2994,17 +2994,18 @@ Integer::Integer(BufferedTransformation &encodedInteger, size_t byteCount, Signe { CRYPTOPP_ASSERT(o == BIG_ENDIAN_ORDER || o == LITTLE_ENDIAN_ORDER); - if (o == LITTLE_ENDIAN_ORDER) + if (o != LITTLE_ENDIAN_ORDER) + { + Decode(encodedInteger, byteCount, s); + } + else { SecByteBlock block(byteCount); encodedInteger.Get(block, block.size()); std::reverse(block.begin(), block.begin()+block.size()); Decode(block.begin(), block.size(), s); - return; } - - Decode(encodedInteger, byteCount, s); } Integer::Integer(const byte *encodedInteger, size_t byteCount, Signedness s, ByteOrder o) @@ -3012,7 +3013,11 @@ Integer::Integer(const byte *encodedInteger, size_t byteCount, Signedness s, Byt CRYPTOPP_ASSERT(encodedInteger && byteCount); // NULL buffer CRYPTOPP_ASSERT(o == BIG_ENDIAN_ORDER || o == LITTLE_ENDIAN_ORDER); - if (o == LITTLE_ENDIAN_ORDER) + if (o != LITTLE_ENDIAN_ORDER) + { + Decode(encodedInteger, byteCount, s); + } + else { SecByteBlock block(byteCount); #if (_MSC_FULL_VER >= 140050727) @@ -3024,13 +3029,12 @@ Integer::Integer(const byte *encodedInteger, size_t byteCount, Signedness s, Byt Decode(block.begin(), block.size(), s); return; } - - Decode(encodedInteger, byteCount, s); } Integer::Integer(BufferedTransformation &bt) { - BERDecode(bt); + // Make explicit call to avoid virtual-dispatch findings in ctor + Integer::BERDecode(bt); } Integer::Integer(RandomNumberGenerator &rng, size_t bitcount) diff --git a/rng.cpp b/rng.cpp index 7b0e7382..9432cf37 100644 --- a/rng.cpp +++ b/rng.cpp @@ -86,8 +86,10 @@ X917RNG::X917RNG(BlockTransformation *c, const byte *seed, const byte *determini // for FIPS 140-2 // GenerateBlock(m_lastBlock, m_size); + + // Make explicit call to avoid virtual-dispatch findings in ctor ArraySink target(m_lastBlock, m_size); - GenerateIntoBufferedTransformation(target, DEFAULT_CHANNEL, m_size); + X917RNG::GenerateIntoBufferedTransformation(target, DEFAULT_CHANNEL, m_size); } void X917RNG::GenerateIntoBufferedTransformation(BufferedTransformation &target, const std::string &channel, lword size)