Update comments in IterHashBase and friends

We also switched to "IsAligned<HashWordType>(input)". Using word64 was due to debug testing on Solaris (the alignment check is needed). Hard coding word64 should not have been checked in.
pull/696/head
Jeffrey Walton 2018-07-21 06:51:41 -04:00
parent 61f1456a5a
commit f1192fd044
No known key found for this signature in database
GPG Key ID: B36AB348921B1838
2 changed files with 7 additions and 9 deletions

View File

@ -96,16 +96,17 @@ template <class T, class BASE> size_t IteratedHashBase<T, BASE>::HashMultipleBlo
bool noReverse = NativeByteOrderIs(this->GetByteOrder());
T* dataBuf = this->DataBuf();
// IteratedHashBase Update calls this with an aligned input,
// but HashBlock may call it with an unaligned buffer.
// Alignment checks due to Issues 690/
// Alignment checks due to http://github.com/weidai11/cryptopp/issues/690.
// Sparc requires 8-byte aligned buffer when HashWordType is word64.
// We also had to provide a GetAlignmentOf specialization for word64 on Sparc.
do
{
if (noReverse)
{
if (IsAligned<word64>(input))
if (IsAligned<HashWordType>(input))
{
// Sparc bus error with non-aligned input.
this->HashEndianCorrectedBlock(input);
}
else
@ -116,8 +117,9 @@ template <class T, class BASE> size_t IteratedHashBase<T, BASE>::HashMultipleBlo
}
else
{
if (IsAligned<word64>(input))
if (IsAligned<HashWordType>(input))
{
// Sparc bus error with non-aligned input.
ByteReverse(dataBuf, input, blockSize);
this->HashEndianCorrectedBlock(dataBuf);
}

View File

@ -16,10 +16,6 @@
# endif
#endif
// GCC cast warning
#define HashWordPtr(x) ((HashWordType*)(void*)(x))
#define ConstHashWordPtr(x) ((const HashWordType*)(const void*)(x))
NAMESPACE_BEGIN(CryptoPP)
/// \brief Exception thrown when trying to hash more data than is allowed by a hash function