diff options
author | Asen Kovachev <akovachev@users.noreply.github.com> | 2018-05-04 03:12:34 +0300 |
---|---|---|
committer | Jeffrey Walton <noloader@gmail.com> | 2018-05-03 20:12:34 -0400 |
commit | 039db17da7880692ed0e808d9a002fbc9e33f3c5 (patch) | |
tree | 6a53d41bf545a5946d185f46b02f43e27bf9f974 /iterhash.cpp | |
parent | 91faa5d399e83f388704341c9854370801c62ba7 (diff) | |
download | cryptopp-git-039db17da7880692ed0e808d9a002fbc9e33f3c5.tar.gz |
Add CRYPTOPP_ASSERT to match Keccak and SHA3 (#654)
As described in https://github.com/weidai11/cryptopp/issues/652 for consistency we should add assert in all hash transformations. The expectation is to have a good pointer and a non-0 length or a null pointer and 0-length.
Diffstat (limited to 'iterhash.cpp')
-rw-r--r-- | iterhash.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/iterhash.cpp b/iterhash.cpp index bf287164..33a697a5 100644 --- a/iterhash.cpp +++ b/iterhash.cpp @@ -12,6 +12,7 @@ NAMESPACE_BEGIN(CryptoPP) template <class T, class BASE> void IteratedHashBase<T, BASE>::Update(const byte *input, size_t len)
{
+ CRYPTOPP_ASSERT((input && len) || !(input || len));
HashWordType oldCountLo = m_countLo, oldCountHi = m_countHi;
if ((m_countLo = oldCountLo + HashWordType(len)) < oldCountLo)
m_countHi++; // carry from low to high
|