Update documentation

pull/867/head
Jeffrey Walton 2019-07-06 16:06:27 -04:00
parent 2ffa70fbc6
commit 195cd6e7c8
No known key found for this signature in database
GPG Key ID: B36AB348921B1838
2 changed files with 8 additions and 7 deletions

View File

@ -101,12 +101,12 @@ bool VerifyBufsEqual(const byte *buf, const byte *mask, size_t count)
{ {
CRYPTOPP_ASSERT(buf != NULLPTR); CRYPTOPP_ASSERT(buf != NULLPTR);
CRYPTOPP_ASSERT(mask != NULLPTR); CRYPTOPP_ASSERT(mask != NULLPTR);
CRYPTOPP_ASSERT(count > 0); // CRYPTOPP_ASSERT(count > 0);
size_t i=0; size_t i=0;
byte acc8 = 0; byte acc8 = 0;
if (IsAligned<word32>(buf) && IsAligned<word32>(mask)) if (IsAligned<word32>(buf) && IsAligned<word32>(mask) && count)
{ {
word32 acc32 = 0; word32 acc32 = 0;
if (!CRYPTOPP_BOOL_SLOW_WORD64 && IsAligned<word64>(buf) && IsAligned<word64>(mask)) if (!CRYPTOPP_BOOL_SLOW_WORD64 && IsAligned<word64>(buf) && IsAligned<word64>(mask))

11
misc.h
View File

@ -936,11 +936,12 @@ CRYPTOPP_DLL void CRYPTOPP_API xorbuf(byte *output, const byte *input, const byt
/// \param buf1 the first buffer /// \param buf1 the first buffer
/// \param buf2 the second buffer /// \param buf2 the second buffer
/// \param count the size of the buffers, in bytes /// \param count the size of the buffers, in bytes
/// \details The function effectively performs an XOR of the elements in two equally sized /// \details VerifyBufsEqual performs an XOR of the elements in two equally sized
/// buffers and retruns a result based on the XOR operation. The function is near /// buffers and retruns a result based on the XOR operation. A count of 0 returns
/// constant-time because CPU micro-code timings could affect the "constant-ness". /// true because two empty buffers are considered equal.
/// Calling code is responsible for mitigating timing attacks if the buffers are not /// \details The function is near constant-time because CPU micro-code timings could
/// equally sized. /// affect the "constant-ness". Calling code is responsible for mitigating timing
/// attacks if the buffers are not equally sized.
/// \sa ModPowerOf2 /// \sa ModPowerOf2
CRYPTOPP_DLL bool CRYPTOPP_API VerifyBufsEqual(const byte *buf1, const byte *buf2, size_t count); CRYPTOPP_DLL bool CRYPTOPP_API VerifyBufsEqual(const byte *buf1, const byte *buf2, size_t count);