summaryrefslogtreecommitdiff
path: root/blake2.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 /blake2.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 'blake2.cpp')
-rw-r--r--blake2.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/blake2.cpp b/blake2.cpp
index 0500e7a0..e858f8c7 100644
--- a/blake2.cpp
+++ b/blake2.cpp
@@ -356,6 +356,9 @@ void BLAKE2_Base<W, T_64bit>::Restart(const BLAKE2_ParameterBlock<T_64bit>& bloc
template <class W, bool T_64bit>
void BLAKE2_Base<W, T_64bit>::Update(const byte *input, size_t length)
{
+ CRYPTOPP_ASSERT(input != NULLPTR);
+ if (length == 0) { return; }
+
State& state = *m_state.data();
if (state.length + length > BLOCKSIZE)
{
@@ -390,6 +393,7 @@ void BLAKE2_Base<W, T_64bit>::Update(const byte *input, size_t length)
template <class W, bool T_64bit>
void BLAKE2_Base<W, T_64bit>::TruncatedFinal(byte *hash, size_t size)
{
+ CRYPTOPP_ASSERT(hash != NULLPTR);
this->ThrowIfInvalidTruncatedSize(size);
// Set last block unconditionally