mirror of
https://github.com/shadps4-emu/ext-cryptopp.git
synced 2025-01-18 23:34:06 +00:00
Clear clang-tidy warnings
This commit also tweaks the way Integer parses byte arrays. The modified routines are slightly faster. On a Core-i5 6400 the self tests are 0.1 to 0.2 seconds faster
This commit is contained in:
parent
1a7f19cdde
commit
fb0ecfde62
@ -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\.)")
|
||||
|
20
integer.cpp
20
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)
|
||||
|
4
rng.cpp
4
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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user