summaryrefslogtreecommitdiff
path: root/sha3.cpp
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2018-05-05 22:56:15 -0400
committerJeffrey Walton <noloader@gmail.com>2018-05-05 22:56:15 -0400
commit3159969808669a35a3a185bd6bef8955f0cf1822 (patch)
tree0b4fb88b70d4f6c5767db3048d4d7542d989389a /sha3.cpp
parent3deb24b7dee3d3aee4b5c2a0bc502237b065bcd1 (diff)
downloadcryptopp-git-3159969808669a35a3a185bd6bef8955f0cf1822.tar.gz
Back-off on Hash asserts (GH #652)
The asserts were a little aggressive and caused very noisy Debug runs. The library itself was one of the biggest offenders.
Diffstat (limited to 'sha3.cpp')
-rw-r--r--sha3.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/sha3.cpp b/sha3.cpp
index ec3b04e3..51e01117 100644
--- a/sha3.cpp
+++ b/sha3.cpp
@@ -251,8 +251,8 @@ static void KeccakF1600(word64 *state)
void SHA3::Update(const byte *input, size_t length)
{
- CRYPTOPP_ASSERT((input && length) || !(input || length));
- if (!length) { return; }
+ CRYPTOPP_ASSERT(!(input == NULLPTR && length != 0));
+ if (length == 0) { return; }
size_t spaceLeft;
while (length >= (spaceLeft = r() - m_counter))
@@ -278,6 +278,7 @@ void SHA3::Restart()
void SHA3::TruncatedFinal(byte *hash, size_t size)
{
+ CRYPTOPP_ASSERT(hash != NULLPTR);
ThrowIfInvalidTruncatedSize(size);
m_state.BytePtr()[m_counter] ^= 0x06;