Add veirtual dtor IteratedHash and ClonableImpl due to non-trivial data members

pull/280/head
Jeffrey Walton 2016-09-13 18:31:01 -04:00
parent 6bb6e8ab63
commit 11eede3926
1 changed files with 13 additions and 3 deletions

View File

@ -21,7 +21,8 @@ public:
//! \brief Iterated hash base class
//! \tparam T Hash word type
//! \tparam BASE HashTransformation derived class
//! \details BASE should be derived from HashTransformation, MessageAuthenticationCode, or similar class.
//! \details IteratedHashBase() provides an interface for derived classes. BASE should be derived from
//! HashTransformation, MessageAuthenticationCode, or a similar class.
//! \sa HashTransformation, MessageAuthenticationCode
template <class T, class BASE>
class CRYPTOPP_NO_VTABLE IteratedHashBase : public BASE
@ -95,7 +96,8 @@ private:
//! \tparam T_Endianness Endianness type of hash
//! \tparam T_BlockSize Block size of the hash
//! \tparam T_Base HashTransformation derived class
//! \details T_Base should be derived from HashTransformation, MessageAuthenticationCode, or similar class.
//! \details IteratedHash is the first implementation of the IteratedHashBase interface. T_Base should be derived
//! from HashTransformation, MessageAuthenticationCode, or a similar class.
//! \sa HashTransformation, MessageAuthenticationCode
template <class T_HashWordType, class T_Endianness, unsigned int T_BlockSize, class T_Base = HashTransformation>
class CRYPTOPP_NO_VTABLE IteratedHash : public IteratedHashBase<T_HashWordType, T_Base>
@ -104,6 +106,10 @@ public:
typedef T_Endianness ByteOrderClass;
typedef T_HashWordType HashWordType;
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~IteratedHash() { }
#endif
CRYPTOPP_CONSTANT(BLOCKSIZE = T_BlockSize)
// BCB2006 workaround: can't use BLOCKSIZE here
CRYPTOPP_COMPILE_ASSERT((T_BlockSize & (T_BlockSize - 1)) == 0); // blockSize is a power of 2
@ -143,7 +149,7 @@ protected:
//! \tparam T_Transform Static transformation class
//! \tparam T_DigestSize Digest size of the hash
//! \tparam T_StateAligned Flag indicating if state is 16-byte aligned
//! \details T_Transform should be derived from HashTransformation, MessageAuthenticationCode, or similar class.
//! \details T_Transform should be derived from HashTransformation, MessageAuthenticationCode, or a similar class.
//! \sa HashTransformation, MessageAuthenticationCode
template <class T_HashWordType, class T_Endianness, unsigned int T_BlockSize, unsigned int T_StateSize, class T_Transform, unsigned int T_DigestSize = 0, bool T_StateAligned = false>
class CRYPTOPP_NO_VTABLE IteratedHashWithStaticTransform
@ -152,6 +158,10 @@ class CRYPTOPP_NO_VTABLE IteratedHashWithStaticTransform
public:
CRYPTOPP_CONSTANT(DIGESTSIZE = T_DigestSize ? T_DigestSize : T_StateSize)
#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual ~ClonableImpl() { }
#endif
//! Provides the digest size of the hash
//! \return the digest size of the hash.
//! details DigestSize() returns <tt>DIGESTSIZE</tt>.