Updated documentation

pull/136/head
Jeffrey Walton 2016-02-01 13:41:25 -05:00
parent ff92dfc562
commit 389b6fc5da
1 changed files with 23 additions and 12 deletions

View File

@ -929,13 +929,14 @@ public:
//! size is the requested size of the buffer. When the call returns, size is the size of //! size is the requested size of the buffer. When the call returns, size is the size of
//! the array returned to the caller. //! the array returned to the caller.
//! \details The base class implementation sets size to 0 and returns NULL. //! \details The base class implementation sets size to 0 and returns NULL.
//! \note Some objects, like ArraySink, cannot create a space because its fixed. In the case of //! \note Some objects, like ArraySink, cannot create a space because its fixed.
virtual byte * CreateUpdateSpace(size_t &size) {size=0; return NULL;} virtual byte * CreateUpdateSpace(size_t &size) {size=0; return NULL;}
//! \brief Computes the hash of the current message //! \brief Computes the hash of the current message
//! \param digest a pointer to the buffer to receive the hash //! \param digest a pointer to the buffer to receive the hash
//! \details digest must be equal to (or greater than) DigestSize(). Final() restarts the //! \details Final() restarts the hash for a new message.
//! hash for a new message. //! \pre <tt>COUNTOF(digest) == DigestSize()</tt> or <tt>COUNTOF(digest) == HASH::DIGESTSIZE</tt> ensures
//! the output byte buffer is large enough for the digest.
virtual void Final(byte *digest) virtual void Final(byte *digest)
{TruncatedFinal(digest, DigestSize());} {TruncatedFinal(digest, DigestSize());}
@ -946,7 +947,6 @@ public:
//! Provides the digest size of the hash //! Provides the digest size of the hash
//! \return the digest size of the hash. //! \return the digest size of the hash.
//! \details Calls to Final() require a buffer that is equal to (or greater than) DigestSize().
virtual unsigned int DigestSize() const =0; virtual unsigned int DigestSize() const =0;
//! Provides the tag size of the hash //! Provides the tag size of the hash
@ -963,7 +963,7 @@ public:
//! \brief Provides the input block size most efficient for this hash. //! \brief Provides the input block size most efficient for this hash.
//! \return The input block size that is most efficient for the cipher //! \return The input block size that is most efficient for the cipher
//! \details The base class implementation returns MandatoryBlockSize(). //! \details The base class implementation returns MandatoryBlockSize().
//! \note Optimal input length is //! \details Optimal input length is
//! <tt>n * OptimalBlockSize() - GetOptimalBlockSizeUsed()</tt> for any <tt>n \> 0</tt>. //! <tt>n * OptimalBlockSize() - GetOptimalBlockSizeUsed()</tt> for any <tt>n \> 0</tt>.
virtual unsigned int OptimalBlockSize() const {return 1;} virtual unsigned int OptimalBlockSize() const {return 1;}
@ -977,7 +977,9 @@ public:
//! \param length the size of the buffer, in bytes //! \param length the size of the buffer, in bytes
//! \details Use this if your input is in one piece and you don't want to call Update() //! \details Use this if your input is in one piece and you don't want to call Update()
//! and Final() separately //! and Final() separately
//! \details CalculateDigest() restarts the hash for the next nmessage. //! \details CalculateDigest() restarts the hash for the next message.
//! \pre <tt>COUNTOF(digest) == DigestSize()</tt> or <tt>COUNTOF(digest) == HASH::DIGESTSIZE</tt> ensures
//! the output byte buffer is large enough for the digest.
virtual void CalculateDigest(byte *digest, const byte *input, size_t length) virtual void CalculateDigest(byte *digest, const byte *input, size_t length)
{Update(input, length); Final(digest);} {Update(input, length); Final(digest);}
@ -985,10 +987,11 @@ public:
//! \param digest a pointer to the buffer of an \a existing hash //! \param digest a pointer to the buffer of an \a existing hash
//! \return \p true if the existing hash matches the computed hash, \p false otherwise //! \return \p true if the existing hash matches the computed hash, \p false otherwise
//! \throws ThrowIfInvalidTruncatedSize() if the existing hash's size exceeds DigestSize() //! \throws ThrowIfInvalidTruncatedSize() if the existing hash's size exceeds DigestSize()
//! \details Calls to Verify() require a buffer that is equal to (or greater than) DigestSize().
//! \details Verify() performs a bitwise compare on the buffers using VerifyBufsEqual(), which is //! \details Verify() performs a bitwise compare on the buffers using VerifyBufsEqual(), which is
//! a constant time comparison function. digestLength cannot exceed DigestSize(). //! a constant time comparison function. digestLength cannot exceed DigestSize().
//! \details Verify() restarts the hash for the next nmessage. //! \details Verify() restarts the hash for the next message.
//! \pre <tt>COUNTOF(digest) == DigestSize()</tt> or <tt>COUNTOF(digest) == HASH::DIGESTSIZE</tt> ensures
//! the output byte buffer is large enough for the digest.
virtual bool Verify(const byte *digest) virtual bool Verify(const byte *digest)
{return TruncatedVerify(digest, DigestSize());} {return TruncatedVerify(digest, DigestSize());}
@ -1002,7 +1005,9 @@ public:
//! and Verify() separately //! and Verify() separately
//! \details VerifyDigest() performs a bitwise compare on the buffers using VerifyBufsEqual(), //! \details VerifyDigest() performs a bitwise compare on the buffers using VerifyBufsEqual(),
//! which is a constant time comparison function. digestLength cannot exceed DigestSize(). //! which is a constant time comparison function. digestLength cannot exceed DigestSize().
//! \details VerifyDigest() restarts the hash for the next nmessage. //! \details VerifyDigest() restarts the hash for the next message.
//! \pre <tt>COUNTOF(digest) == DigestSize()</tt> or <tt>COUNTOF(digest) == HASH::DIGESTSIZE</tt> ensures
//! the output byte buffer is large enough for the digest.
virtual bool VerifyDigest(const byte *digest, const byte *input, size_t length) virtual bool VerifyDigest(const byte *digest, const byte *input, size_t length)
{Update(input, length); return Verify(digest);} {Update(input, length); return Verify(digest);}
@ -1011,6 +1016,8 @@ public:
//! \param digestSize the size of the truncated digest, in bytes //! \param digestSize the size of the truncated digest, in bytes
//! \details TruncatedFinal() call Final() and then copies digestSize bytes to digest //! \details TruncatedFinal() call Final() and then copies digestSize bytes to digest
//! \details TruncatedFinal() restarts the hash for the next message. //! \details TruncatedFinal() restarts the hash for the next message.
//! \pre <tt>COUNTOF(digest) == DigestSize()</tt> or <tt>COUNTOF(digest) == HASH::DIGESTSIZE</tt> ensures
//! the output byte buffer is large enough for the digest.
virtual void TruncatedFinal(byte *digest, size_t digestSize) =0; virtual void TruncatedFinal(byte *digest, size_t digestSize) =0;
//! \brief Updates the hash with additional input and computes the hash of the current message //! \brief Updates the hash with additional input and computes the hash of the current message
@ -1020,7 +1027,9 @@ public:
//! \param length the size of the buffer, in bytes //! \param length the size of the buffer, in bytes
//! \details Use this if your input is in one piece and you don't want to call Update() //! \details Use this if your input is in one piece and you don't want to call Update()
//! and CalculateDigest() separately. //! and CalculateDigest() separately.
//! \details CalculateTruncatedDigest() restarts the hash for the next nmessage. //! \details CalculateTruncatedDigest() restarts the hash for the next message.
//! \pre <tt>COUNTOF(digest) == DigestSize()</tt> or <tt>COUNTOF(digest) == HASH::DIGESTSIZE</tt> ensures
//! the output byte buffer is large enough for the digest.
virtual void CalculateTruncatedDigest(byte *digest, size_t digestSize, const byte *input, size_t length) virtual void CalculateTruncatedDigest(byte *digest, size_t digestSize, const byte *input, size_t length)
{Update(input, length); TruncatedFinal(digest, digestSize);} {Update(input, length); TruncatedFinal(digest, digestSize);}
@ -1033,7 +1042,7 @@ public:
//! buffer smaller than DigestSize(). However, digestLength cannot exceed DigestSize(). //! buffer smaller than DigestSize(). However, digestLength cannot exceed DigestSize().
//! \details Verify() performs a bitwise compare on the buffers using VerifyBufsEqual(), which is //! \details Verify() performs a bitwise compare on the buffers using VerifyBufsEqual(), which is
//! a constant time comparison function. digestLength cannot exceed DigestSize(). //! a constant time comparison function. digestLength cannot exceed DigestSize().
//! \details TruncatedVerify() restarts the hash for the next nmessage. //! \details TruncatedVerify() restarts the hash for the next message.
virtual bool TruncatedVerify(const byte *digest, size_t digestLength); virtual bool TruncatedVerify(const byte *digest, size_t digestLength);
//! \brief Updates the hash with additional input and verifies the hash of the current message //! \brief Updates the hash with additional input and verifies the hash of the current message
@ -1047,7 +1056,9 @@ public:
//! and TruncatedVerify() separately. //! and TruncatedVerify() separately.
//! \details VerifyTruncatedDigest() is a truncated version of VerifyDigest(). It can operate //! \details VerifyTruncatedDigest() is a truncated version of VerifyDigest(). It can operate
//! on a buffer smaller than DigestSize(). However, digestLength cannot exceed DigestSize(). //! on a buffer smaller than DigestSize(). However, digestLength cannot exceed DigestSize().
//! \details VerifyTruncatedDigest() restarts the hash for the next nmessage. //! \details VerifyTruncatedDigest() restarts the hash for the next message.
//! \pre <tt>COUNTOF(digest) == DigestSize()</tt> or <tt>COUNTOF(digest) == HASH::DIGESTSIZE</tt> ensures
//! the output byte buffer is large enough for the digest.
virtual bool VerifyTruncatedDigest(const byte *digest, size_t digestLength, const byte *input, size_t length) virtual bool VerifyTruncatedDigest(const byte *digest, size_t digestLength, const byte *input, size_t length)
{Update(input, length); return TruncatedVerify(digest, digestLength);} {Update(input, length); return TruncatedVerify(digest, digestLength);}