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.
pull/655/head
Asen Kovachev 2018-05-04 03:12:34 +03:00 committed by Jeffrey Walton
parent 91faa5d399
commit 039db17da7
1 changed files with 1 additions and 0 deletions

View File

@ -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