From 96172f95ab3c70fc2cb5e819e1a18250db177435 Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Mon, 11 May 2020 13:15:41 -0400 Subject: [PATCH] Whitespace check-in --- misc.h | 454 ++++++++++++++++++++++++++++----------------------------- 1 file changed, 227 insertions(+), 227 deletions(-) diff --git a/misc.h b/misc.h index 666f9903..18854617 100644 --- a/misc.h +++ b/misc.h @@ -182,10 +182,10 @@ struct CompileAssert /// \brief Counts elements in an array /// \param arr an array of elements /// \details COUNTOF counts elements in an array. On Windows COUNTOF(x) is defined -/// to _countof(x) to ensure correct results for pointers. +/// to _countof(x) to ensure correct results for pointers. /// \note COUNTOF does not produce correct results with pointers, and an array must be used. -/// sizeof(x)/sizeof(x[0]) suffers the same problem. The risk is eliminated by using -/// _countof(x) on Windows. Windows will provide the immunity for other platforms. +/// sizeof(x)/sizeof(x[0]) suffers the same problem. The risk is eliminated by using +/// _countof(x) on Windows. Windows will provide the immunity for other platforms. # define COUNTOF(arr) #else // VS2005 added _countof @@ -230,8 +230,8 @@ protected: /// \brief Ensures an object is not copyable /// \details NotCopyable ensures an object is not copyable by making the -/// copy constructor and assignment operator private. Deleters are used -/// under C++11. +/// copy constructor and assignment operator private. Deleters are used +/// under C++11. /// \sa Clonable class class NotCopyable { @@ -259,12 +259,12 @@ struct NewObject #if CRYPTOPP_DOXYGEN_PROCESSING /// \brief A memory barrier /// \details MEMORY_BARRIER attempts to ensure reads and writes are completed -/// in the absence of a language synchronization point. It is used by the -/// Singleton class if the compiler supports it. The barrier is provided at the -/// customary places in a double-checked initialization. +/// in the absence of a language synchronization point. It is used by the +/// Singleton class if the compiler supports it. The barrier is provided at the +/// customary places in a double-checked initialization. /// \details Internally, MEMORY_BARRIER uses std::atomic_thread_fence if -/// C++11 atomics are available. Otherwise, intrinsic(_ReadWriteBarrier), -/// _ReadWriteBarrier() or __asm__("" ::: "memory") is used. +/// C++11 atomics are available. Otherwise, intrinsic(_ReadWriteBarrier), +/// _ReadWriteBarrier() or __asm__("" ::: "memory") is used. #define MEMORY_BARRIER ... #else #if defined(CRYPTOPP_CXX11_ATOMICS) @@ -286,19 +286,19 @@ struct NewObject /// \tparam F the object factory for T /// \tparam instance an instance counter for the class object /// \details This class safely initializes a static object in a multithreaded environment. For C++03 -/// and below it will do so without using locks for portability. If two threads call Ref() at the same -/// time, they may get back different references, and one object may end up being memory leaked. This -/// is by design and it avoids a subltle initialization problem ina multithreaded environment with thread -/// local storage on early Windows platforms, like Windows XP and Windows 2003. +/// and below it will do so without using locks for portability. If two threads call Ref() at the same +/// time, they may get back different references, and one object may end up being memory leaked. This +/// is by design and it avoids a subltle initialization problem ina multithreaded environment with thread +/// local storage on early Windows platforms, like Windows XP and Windows 2003. /// \details For C++11 and above, a standard double-checked locking pattern with thread fences -/// are used. The locks and fences are standard and do not hinder portability. +/// are used. The locks and fences are standard and do not hinder portability. /// \details Microsoft's C++11 implementation provides the necessary primitive support on Windows Vista and -/// above when using Visual Studio 2015 (cl.exe version 19.00). If C++11 is desired, you should -/// set WINVER or _WIN32_WINNT to 0x600 (or above), and compile with Visual Studio 2015. +/// above when using Visual Studio 2015 (cl.exe version 19.00). If C++11 is desired, you should +/// set WINVER or _WIN32_WINNT to 0x600 (or above), and compile with Visual Studio 2015. /// \sa Double-Checked Locking -/// is Fixed In C++11, Dynamic -/// Initialization and Destruction with Concurrency and -/// Thread Local Storage (TLS) on MSDN. +/// is Fixed In C++11, Dynamic +/// Initialization and Destruction with Concurrency and +/// Thread Local Storage (TLS) on MSDN. /// \since Crypto++ 5.2 template , int instance=0> class Singleton @@ -318,7 +318,7 @@ private: /// \tparam F the object factory for T /// \tparam instance an instance counter for the class object /// \details Ref() is used to create the object using the object factory. The -/// object is only created once with the limitations discussed in the class documentation. +/// object is only created once with the limitations discussed in the class documentation. /// \sa Double-Checked Locking is Fixed In C++11 /// \since Crypto++ 5.2 template @@ -379,7 +379,7 @@ template /// \param pointer a pointer /// \param offset a offset into the pointer /// \details PtrAdd can be used to squash Clang and GCC -/// UBsan findings for pointer addition and subtraction. +/// UBsan findings for pointer addition and subtraction. template inline PTR PtrAdd(PTR pointer, OFF offset) { @@ -392,7 +392,7 @@ inline PTR PtrAdd(PTR pointer, OFF offset) /// \param pointer a pointer /// \param offset a offset into the pointer /// \details PtrSub can be used to squash Clang and GCC -/// UBsan findings for pointer addition and subtraction. +/// UBsan findings for pointer addition and subtraction. template inline PTR PtrSub(PTR pointer, OFF offset) { @@ -404,10 +404,10 @@ inline PTR PtrSub(PTR pointer, OFF offset) /// \param pointer1 the first pointer /// \param pointer2 the second pointer /// \details PtrDiff can be used to squash Clang and GCC -/// UBsan findings for pointer addition and subtraction. -/// pointer1 and pointer2 must point to the same object or -/// array (or one past the end), and yields the number of -/// elements (not bytes) difference. +/// UBsan findings for pointer addition and subtraction. +/// pointer1 and pointer2 must point to the same object or +/// array (or one past the end), and yields the number of +/// elements (not bytes) difference. template inline ptrdiff_t PtrDiff(const PTR pointer1, const PTR pointer2) { @@ -419,10 +419,10 @@ inline ptrdiff_t PtrDiff(const PTR pointer1, const PTR pointer2) /// \param pointer1 the first pointer /// \param pointer2 the second pointer /// \details PtrByteDiff can be used to squash Clang and GCC -/// UBsan findings for pointer addition and subtraction. -/// pointer1 and pointer2 must point to the same object or -/// array (or one past the end), and yields the number of -/// bytes (not elements) difference. +/// UBsan findings for pointer addition and subtraction. +/// pointer1 and pointer2 must point to the same object or +/// array (or one past the end), and yields the number of +/// bytes (not elements) difference. template inline size_t PtrByteDiff(const PTR pointer1, const PTR pointer2) { @@ -492,17 +492,17 @@ size_t BytePtrSize(const SecByteBlock& str); /// \param count the number of bytes to copy /// \throws InvalidArgument /// \details ISO/IEC TR-24772 provides bounds checking interfaces for potentially -/// unsafe functions like memcpy(), strcpy() and memmove(). However, -/// not all standard libraries provides them, like Glibc. The library's -/// memcpy_s() is a near-drop in replacement. Its only a near-replacement -/// because the library's version throws an InvalidArgument on a bounds violation. +/// unsafe functions like memcpy(), strcpy() and memmove(). However, +/// not all standard libraries provides them, like Glibc. The library's +/// memcpy_s() is a near-drop in replacement. Its only a near-replacement +/// because the library's version throws an InvalidArgument on a bounds violation. /// \details memcpy_s() and memmove_s() are guarded by __STDC_WANT_SECURE_LIB__. -/// If __STDC_WANT_SECURE_LIB__ is not defined or defined to 0, then the library -/// makes memcpy_s() and memmove_s() available. The library will also optionally -/// make the symbols available if CRYPTOPP_WANT_SECURE_LIB is defined. -/// CRYPTOPP_WANT_SECURE_LIB is in config.h, but it is disabled by default. +/// If __STDC_WANT_SECURE_LIB__ is not defined or defined to 0, then the library +/// makes memcpy_s() and memmove_s() available. The library will also optionally +/// make the symbols available if CRYPTOPP_WANT_SECURE_LIB is defined. +/// CRYPTOPP_WANT_SECURE_LIB is in config.h, but it is disabled by default. /// \details memcpy_s() will assert the pointers src and dest are not NULL -/// in debug builds. Passing NULL for either pointer is undefined behavior. +/// in debug builds. Passing NULL for either pointer is undefined behavior. inline void memcpy_s(void *dest, size_t sizeInBytes, const void *src, size_t count) { // Safer functions on Windows for C&A, http://github.com/weidai11/cryptopp/issues/55 @@ -524,7 +524,7 @@ inline void memcpy_s(void *dest, size_t sizeInBytes, const void *src, size_t cou # pragma warning(disable: 6386) # endif #endif - if (src && dest) + if (src != NULLPTR && dest != NULLPTR) std::memcpy(dest, src, count); #if CRYPTOPP_MSC_VERSION # pragma warning(pop) @@ -538,17 +538,17 @@ inline void memcpy_s(void *dest, size_t sizeInBytes, const void *src, size_t cou /// \param count the number of bytes to copy /// \throws InvalidArgument /// \details ISO/IEC TR-24772 provides bounds checking interfaces for potentially -/// unsafe functions like memcpy(), strcpy() and memmove(). However, -/// not all standard libraries provides them, like Glibc. The library's -/// memmove_s() is a near-drop in replacement. Its only a near-replacement -/// because the library's version throws an InvalidArgument on a bounds violation. +/// unsafe functions like memcpy(), strcpy() and memmove(). However, +/// not all standard libraries provides them, like Glibc. The library's +/// memmove_s() is a near-drop in replacement. Its only a near-replacement +/// because the library's version throws an InvalidArgument on a bounds violation. /// \details memcpy_s() and memmove_s() are guarded by __STDC_WANT_SECURE_LIB__. -/// If __STDC_WANT_SECURE_LIB__ is not defined or defined to 0, then the library -/// makes memcpy_s() and memmove_s() available. The library will also optionally -/// make the symbols available if CRYPTOPP_WANT_SECURE_LIB is defined. -/// CRYPTOPP_WANT_SECURE_LIB is in config.h, but it is disabled by default. +/// If __STDC_WANT_SECURE_LIB__ is not defined or defined to 0, then the library +/// makes memcpy_s() and memmove_s() available. The library will also optionally +/// make the symbols available if CRYPTOPP_WANT_SECURE_LIB is defined. +/// CRYPTOPP_WANT_SECURE_LIB is in config.h, but it is disabled by default. /// \details memmove_s() will assert the pointers src and dest are not NULL -/// in debug builds. Passing NULL for either pointer is undefined behavior. +/// in debug builds. Passing NULL for either pointer is undefined behavior. inline void memmove_s(void *dest, size_t sizeInBytes, const void *src, size_t count) { // Safer functions on Windows for C&A, http://github.com/weidai11/cryptopp/issues/55 @@ -568,7 +568,7 @@ inline void memmove_s(void *dest, size_t sizeInBytes, const void *src, size_t co # pragma warning(disable: 6386) # endif #endif - if (src && dest) + if (src != NULLPTR && dest != NULLPTR) std::memmove(dest, src, count); #if CRYPTOPP_MSC_VERSION # pragma warning(pop) @@ -588,10 +588,10 @@ inline void memmove_s(void *dest, size_t sizeInBytes, const void *src, size_t co /// \param a the first value /// \param b the second value /// \details C++03 does not provide support for std::swap(__m128i a, __m128i b) -/// because __m128i is an unsigned long long[2]. Most compilers -/// support it out of the box, but Sun Studio C++ compilers 12.2 and 12.3 do not. +/// because __m128i is an unsigned long long[2]. Most compilers +/// support it out of the box, but Sun Studio C++ compilers 12.2 and 12.3 do not. /// \sa How to swap two __m128i variables -/// in C++03 given its an opaque type and an array? on Stack Overflow. +/// in C++03 given its an opaque type and an array? on Stack Overflow. template inline void vec_swap(T& a, T& b) { @@ -611,7 +611,7 @@ inline void vec_swap(T& a, T& b) /// \param value the integer value to write for each byte /// \param num the size of the source memory block, in bytes /// \details Internally the function calls memset with the value value, and receives the -/// return value from memset as a volatile pointer. +/// return value from memset as a volatile pointer. inline void * memset_z(void *ptr, int value, size_t num) { // avoid extranous warning on GCC 4.3.2 Ubuntu 8.10 @@ -732,7 +732,7 @@ std::string IntToString(T value, unsigned int base = 10) /// \param base the base to use during the conversion /// \returns the string representation of value in base. /// \details this template function specialization was added to suppress -/// Coverity findings on IntToString() with unsigned types. +/// Coverity findings on IntToString() with unsigned types. template <> CRYPTOPP_DLL std::string IntToString(word64 value, unsigned int base); @@ -741,20 +741,20 @@ std::string IntToString(word64 value, unsigned int base); /// \param base the base to use during the conversion /// \returns the string representation of value in base. /// \details This is a template specialization of IntToString(). Use it -/// like IntToString(): +/// like IntToString(): ///
-///   // Print integer in base 10
-///   Integer n...
-///   std::string s = IntToString(n, 10);
+///  // Print integer in base 10
+///  Integer n...
+///  std::string s = IntToString(n, 10);
 /// 
/// \details The string is presented with lowercase letters by default. A -/// hack is available to switch to uppercase letters without modifying -/// the function signature. +/// hack is available to switch to uppercase letters without modifying +/// the function signature. ///
-///   // Print integer in base 16, uppercase letters
-///   Integer n...
-///   const unsigned int UPPER = (1 << 31);
-///   std::string s = IntToString(n, (UPPER | 16));
+/// // Print integer in base 16, uppercase letters +/// Integer n... +/// const unsigned int UPPER = (1 << 31); +/// std::string s = IntToString(n, (UPPER | 16)); template <> CRYPTOPP_DLL std::string IntToString(Integer value, unsigned int base); @@ -839,7 +839,7 @@ unsigned int BitPrecision(const T &value) /// \param v the 32-bit value to test /// \returns the number of trailing 0-bits in v, starting at the least significant bit position /// \details TrailingZeros returns the number of trailing 0-bits in v, starting at the least -/// significant bit position. The return value is undefined if there are no 1-bits set in the value v. +/// significant bit position. The return value is undefined if there are no 1-bits set in the value v. /// \note The function does not return 0 if no 1-bits are set because 0 collides with a 1-bit at the 0-th position. inline unsigned int TrailingZeros(word32 v) { @@ -870,7 +870,7 @@ inline unsigned int TrailingZeros(word32 v) /// \param v the 64-bit value to test /// \returns the number of trailing 0-bits in v, starting at the least significant bit position /// \details TrailingZeros returns the number of trailing 0-bits in v, starting at the least -/// significant bit position. The return value is undefined if there are no 1-bits set in the value v. +/// significant bit position. The return value is undefined if there are no 1-bits set in the value v. /// \note The function does not return 0 if no 1-bits are set because 0 collides with a 1-bit at the 0-th position. inline unsigned int TrailingZeros(word64 v) { @@ -896,9 +896,9 @@ inline unsigned int TrailingZeros(word64 v) /// \param value the value to truncate or mask /// \param bits the number of bits to truncate or mask /// \returns the value truncated to the specified number of bits, starting at the least -/// significant bit position +/// significant bit position /// \details This function masks the low-order bits of value and returns the result. The -/// mask is created with (1 << bits) - 1. +/// mask is created with (1 << bits) - 1. template inline T Crop(T value, size_t bits) { @@ -921,7 +921,7 @@ inline size_t BitsToBytes(size_t bitCount) /// \param byteCount the number of bytes /// \returns the minimum number of words required by byteCount /// \details BytesToWords is effectively a ceiling function based on WORD_SIZE. -/// WORD_SIZE is defined in config.h +/// WORD_SIZE is defined in config.h inline size_t BytesToWords(size_t byteCount) { return ((byteCount+WORD_SIZE-1)/WORD_SIZE); @@ -931,7 +931,7 @@ inline size_t BytesToWords(size_t byteCount) /// \param bitCount the number of bits /// \returns the minimum number of words required by bitCount /// \details BitsToWords is effectively a ceiling function based on WORD_BITS. -/// WORD_BITS is defined in config.h +/// WORD_BITS is defined in config.h inline size_t BitsToWords(size_t bitCount) { return ((bitCount+WORD_BITS-1)/(WORD_BITS)); @@ -941,7 +941,7 @@ inline size_t BitsToWords(size_t bitCount) /// \param bitCount the number of bits /// \returns the minimum number of double words required by bitCount /// \details BitsToDwords is effectively a ceiling function based on 2*WORD_BITS. -/// WORD_BITS is defined in config.h +/// WORD_BITS is defined in config.h inline size_t BitsToDwords(size_t bitCount) { return ((bitCount+2*WORD_BITS-1)/(2*WORD_BITS)); @@ -952,7 +952,7 @@ inline size_t BitsToDwords(size_t bitCount) /// \param mask the mask to XOR with the buffer /// \param count the size of the buffers, in bytes /// \details The function effectively visits each element in the buffers and performs -/// buf[i] ^= mask[i]. buf and mask must be of equal size. +/// buf[i] ^= mask[i]. buf and mask must be of equal size. CRYPTOPP_DLL void CRYPTOPP_API xorbuf(byte *buf, const byte *mask, size_t count); /// Performs an XOR of an input buffer with a mask and stores the result in an output buffer @@ -961,7 +961,7 @@ CRYPTOPP_DLL void CRYPTOPP_API xorbuf(byte *buf, const byte *mask, size_t count) /// \param mask the mask buffer to XOR with the input buffer /// \param count the size of the buffers, in bytes /// \details The function effectively visits each element in the buffers and performs -/// output[i] = input[i] ^ mask[i]. output, input and mask must be of equal size. +/// output[i] = input[i] ^ mask[i]. output, input and mask must be of equal size. CRYPTOPP_DLL void CRYPTOPP_API xorbuf(byte *output, const byte *input, const byte *mask, size_t count); /// \brief Performs a near constant-time comparison of two equally sized buffers @@ -969,11 +969,11 @@ CRYPTOPP_DLL void CRYPTOPP_API xorbuf(byte *output, const byte *input, const byt /// \param buf2 the second buffer /// \param count the size of the buffers, in bytes /// \details VerifyBufsEqual performs an XOR of the elements in two equally sized -/// buffers and retruns a result based on the XOR operation. A count of 0 returns -/// true because two empty buffers are considered equal. +/// buffers and retruns a result based on the XOR operation. A count of 0 returns +/// true because two empty buffers are considered equal. /// \details The function is near constant-time because CPU micro-code timings could -/// affect the "constant-ness". Calling code is responsible for mitigating timing -/// attacks if the buffers are not equally sized. +/// affect the "constant-ness". Calling code is responsible for mitigating timing +/// attacks if the buffers are not equally sized. /// \sa ModPowerOf2 CRYPTOPP_DLL bool CRYPTOPP_API VerifyBufsEqual(const byte *buf1, const byte *buf2, size_t count); @@ -981,8 +981,8 @@ CRYPTOPP_DLL bool CRYPTOPP_API VerifyBufsEqual(const byte *buf1, const byte *buf /// \param value the value to test /// \returns true if value is a power of 2, false otherwise /// \details The function creates a mask of value - 1 and returns the result -/// of an AND operation compared to 0. If value is 0 or less than 0, then the function -/// returns false. +/// of an AND operation compared to 0. If value is 0 or less than 0, then the function +/// returns false. template inline bool IsPowerOf2(const T &value) { @@ -1063,9 +1063,9 @@ inline word128 NumericLimitsMax() /// \param b the subtrahend /// \returns the difference produced by the saturating subtract /// \details Saturating arithmetic restricts results to a fixed range. Results that are -/// less than 0 are clamped at 0. +/// less than 0 are clamped at 0. /// \details Use of saturating arithmetic in places can be advantageous because it can -/// avoid a branch by using an instruction like a conditional move (CMOVE). +/// avoid a branch by using an instruction like a conditional move (CMOVE). template inline T1 SaturatingSubtract(const T1 &a, const T2 &b) { @@ -1080,9 +1080,9 @@ inline T1 SaturatingSubtract(const T1 &a, const T2 &b) /// \param b the subtrahend /// \returns the difference produced by the saturating subtract /// \details Saturating arithmetic restricts results to a fixed range. Results that are -/// less than 1 are clamped at 1. +/// less than 1 are clamped at 1. /// \details Use of saturating arithmetic in places can be advantageous because it can -/// avoid a branch by using an instruction like a conditional move (CMOVE). +/// avoid a branch by using an instruction like a conditional move (CMOVE). template inline T1 SaturatingSubtract1(const T1 &a, const T2 &b) { @@ -1096,7 +1096,7 @@ inline T1 SaturatingSubtract1(const T1 &a, const T2 &b) /// \param a the first value /// \param b the second value /// \returns ModPowerOf2() returns a & (b-1). b must be a power of 2. -/// Use IsPowerOf2() to determine if b is a suitable candidate. +/// Use IsPowerOf2() to determine if b is a suitable candidate. /// \sa IsPowerOf2 template inline T2 ModPowerOf2(const T1 &a, const T2 &b) @@ -1113,10 +1113,10 @@ inline T2 ModPowerOf2(const T1 &a, const T2 &b) /// \param m the value to reduce \n to to a multiple /// \returns the possibly unmodified value \n /// \details RoundDownToMultipleOf is effectively a floor function based on m. The function returns -/// the value n - n\%m. If n is a multiple of m, then the original value is returned. +/// the value n - n\%m. If n is a multiple of m, then the original value is returned. /// \note T1 and T2 should be usigned arithmetic types. If T1 or -/// T2 is signed, then the value should be non-negative. The library asserts in -/// debug builds when practical, but allows you to perform the operation in release builds. +/// T2 is signed, then the value should be non-negative. The library asserts in +/// debug builds when practical, but allows you to perform the operation in release builds. template inline T1 RoundDownToMultipleOf(const T1 &n, const T2 &m) { @@ -1142,11 +1142,11 @@ inline T1 RoundDownToMultipleOf(const T1 &n, const T2 &m) /// \param m the value to reduce \n to to a multiple /// \returns the possibly unmodified value \n /// \details RoundUpToMultipleOf is effectively a ceiling function based on m. The function -/// returns the value n + n\%m. If n is a multiple of m, then the original value is -/// returned. If the value n would overflow, then an InvalidArgument exception is thrown. +/// returns the value n + n\%m. If n is a multiple of m, then the original value is +/// returned. If the value n would overflow, then an InvalidArgument exception is thrown. /// \note T1 and T2 should be usigned arithmetic types. If T1 or -/// T2 is signed, then the value should be non-negative. The library asserts in -/// debug builds when practical, but allows you to perform the operation in release builds. +/// T2 is signed, then the value should be non-negative. The library asserts in +/// debug builds when practical, but allows you to perform the operation in release builds. template inline T1 RoundUpToMultipleOf(const T1 &n, const T2 &m) { @@ -1168,11 +1168,11 @@ inline T1 RoundUpToMultipleOf(const T1 &n, const T2 &m) /// \tparam T class or type /// \returns the minimum alignment requirements of T, in bytes /// \details Internally the function calls C++11's alignof if available. If not -/// available, then the function uses compiler specific extensions such as -/// __alignof and _alignof_. If an extension is not available, then -/// the function uses __BIGGEST_ALIGNMENT__ if __BIGGEST_ALIGNMENT__ -/// is smaller than sizeof(T). sizeof(T) is used if all others are -/// not available. +/// available, then the function uses compiler specific extensions such as +/// __alignof and _alignof_. If an extension is not available, then +/// the function uses __BIGGEST_ALIGNMENT__ if __BIGGEST_ALIGNMENT__ +/// is smaller than sizeof(T). sizeof(T) is used if all others are +/// not available. template inline unsigned int GetAlignmentOf() { @@ -1226,11 +1226,11 @@ inline bool IsAligned(const void *ptr) } #if (CRYPTOPP_LITTLE_ENDIAN) - typedef LittleEndian NativeByteOrder; +typedef LittleEndian NativeByteOrder; #elif (CRYPTOPP_BIG_ENDIAN) - typedef BigEndian NativeByteOrder; +typedef BigEndian NativeByteOrder; #else -# error "Unable to determine endian-ness" +# error "Unable to determine endianness" #endif /// \brief Returns NativeByteOrder as an enumerated ByteOrder value @@ -1260,12 +1260,12 @@ inline bool NativeByteOrderIs(ByteOrder order) /// \tparam T class or type /// \param obj the cipher object being queried /// \returns ENCRYPTION if the cipher obj is being operated in its forward direction, -/// DECRYPTION otherwise +/// DECRYPTION otherwise /// \details A cipher can be operated in a "forward" direction (encryption) or a "reverse" -/// direction (decryption). The operations do not have to be symmetric, meaning a second -/// application of the transformation does not necessariy return the original message. -/// That is, E(D(m)) may not equal E(E(m)); and D(E(m)) may not -/// equal D(D(m)). +/// direction (decryption). The operations do not have to be symmetric, meaning a second +/// application of the transformation does not necessariy return the original message. +/// That is, E(D(m)) may not equal E(E(m)); and D(E(m)) may not +/// equal D(D(m)). template inline CipherDir GetCipherDir(const T &obj) { @@ -1276,7 +1276,7 @@ inline CipherDir GetCipherDir(const T &obj) /// \param inout the byte block /// \param size the size of the block, in bytes /// \details Performs an addition with carry by adding 1 on a block of bytes starting at the least -/// significant byte. Once carry is 0, the function terminates and returns to the caller. +/// significant byte. Once carry is 0, the function terminates and returns to the caller. /// \note The function is not constant time because it stops processing when the carry is 0. inline void IncrementCounterByOne(byte *inout, unsigned int size) { @@ -1296,7 +1296,7 @@ inline void IncrementCounterByOne(byte *inout, unsigned int size) /// \param input the source block of bytes /// \param size the size of the block /// \details Performs an addition with carry on a block of bytes starting at the least significant -/// byte. Once carry is 0, the remaining bytes from input are copied to output using memcpy. +/// byte. Once carry is 0, the remaining bytes from input are copied to output using memcpy. /// \details The function is close to near-constant time because it operates on all the bytes in the blocks. inline void IncrementCounterByOne(byte *output, const byte *input, unsigned int size) { @@ -1352,7 +1352,7 @@ inline void ConditionalSwapPointers(bool c, T &a, T &b) /// \param buf an array of elements /// \param n the number of elements in the array /// \details The operation performs a wipe or zeroization. The function -/// attempts to survive optimizations and dead code removal. +/// attempts to survive optimizations and dead code removal. template void SecureWipeBuffer(T *buf, size_t n) { @@ -1371,7 +1371,7 @@ void SecureWipeBuffer(T *buf, size_t n) /// \param buf an array of bytes /// \param n the number of elements in the array /// \details The operation performs a wipe or zeroization. The function -/// attempts to survive optimizations and dead code removal. +/// attempts to survive optimizations and dead code removal. template<> inline void SecureWipeBuffer(byte *buf, size_t n) { volatile byte *p = buf; @@ -1386,7 +1386,7 @@ template<> inline void SecureWipeBuffer(byte *buf, size_t n) /// \param buf an array of 16-bit words /// \param n the number of elements in the array /// \details The operation performs a wipe or zeroization. The function -/// attempts to survive optimizations and dead code removal. +/// attempts to survive optimizations and dead code removal. template<> inline void SecureWipeBuffer(word16 *buf, size_t n) { volatile word16 *p = buf; @@ -1401,7 +1401,7 @@ template<> inline void SecureWipeBuffer(word16 *buf, size_t n) /// \param buf an array of 32-bit words /// \param n the number of elements in the array /// \details The operation performs a wipe or zeroization. The function -/// attempts to survive optimizations and dead code removal. +/// attempts to survive optimizations and dead code removal. template<> inline void SecureWipeBuffer(word32 *buf, size_t n) { volatile word32 *p = buf; @@ -1416,7 +1416,7 @@ template<> inline void SecureWipeBuffer(word32 *buf, size_t n) /// \param buf an array of 64-bit words /// \param n the number of elements in the array /// \details The operation performs a wipe or zeroization. The function -/// attempts to survive optimizations and dead code removal. +/// attempts to survive optimizations and dead code removal. template<> inline void SecureWipeBuffer(word64 *buf, size_t n) { #if CRYPTOPP_BOOL_X64 @@ -1468,7 +1468,7 @@ template<> inline void SecureWipeBuffer(word64 *buf, size_t n) /// \param buf an array of elements /// \param n the number of elements in the array /// \details The operation performs a wipe or zeroization. The function -/// attempts to survive optimizations and dead code removal. +/// attempts to survive optimizations and dead code removal. template inline void SecureWipeArray(T *buf, size_t n) { @@ -1487,13 +1487,13 @@ inline void SecureWipeArray(T *buf, size_t n) /// \param throwOnError flag indicating the function should throw on error /// \returns str converted to a multibyte string or an empty string. /// \details StringNarrow() converts a wide string to a narrow string using C++ std::wcstombs() under -/// the executing thread's locale. A locale must be set before using this function, and it can be -/// set with std::setlocale() if needed. Upon success, the converted string is returned. +/// the executing thread's locale. A locale must be set before using this function, and it can be +/// set with std::setlocale() if needed. Upon success, the converted string is returned. /// \details Upon failure with throwOnError as false, the function returns an empty string. If -/// throwOnError as true, the function throws an InvalidArgument() exception. +/// throwOnError as true, the function throws an InvalidArgument() exception. /// \note If you try to convert, say, the Chinese character for "bone" from UTF-16 (0x9AA8) to UTF-8 -/// (0xE9 0xAA 0xA8), then you must ensure the locale is available. If the locale is not available, -/// then a 0x21 error is returned on Windows which eventually results in an InvalidArgument() exception. +/// (0xE9 0xAA 0xA8), then you must ensure the locale is available. If the locale is not available, +/// then a 0x21 error is returned on Windows which eventually results in an InvalidArgument() exception. std::string StringNarrow(const wchar_t *str, bool throwOnError = true); /// \brief Converts a multibyte C-string to a wide character string @@ -1501,13 +1501,13 @@ std::string StringNarrow(const wchar_t *str, bool throwOnError = true); /// \param throwOnError flag indicating the function should throw on error /// \returns str converted to a multibyte string or an empty string. /// \details StringWiden() converts a narrow string to a wide string using C++ std::mbstowcs() under -/// the executing thread's locale. A locale must be set before using this function, and it can be -/// set with std::setlocale() if needed. Upon success, the converted string is returned. +/// the executing thread's locale. A locale must be set before using this function, and it can be +/// set with std::setlocale() if needed. Upon success, the converted string is returned. /// \details Upon failure with throwOnError as false, the function returns an empty string. If -/// throwOnError as true, the function throws an InvalidArgument() exception. +/// throwOnError as true, the function throws an InvalidArgument() exception. /// \note If you try to convert, say, the Chinese character for "bone" from UTF-8 (0xE9 0xAA 0xA8) -/// to UTF-16 (0x9AA8), then you must ensure the locale is available. If the locale is not available, -/// then a 0x21 error is returned on Windows which eventually results in an InvalidArgument() exception. +/// to UTF-16 (0x9AA8), then you must ensure the locale is available. If the locale is not available, +/// then a 0x21 error is returned on Windows which eventually results in an InvalidArgument() exception. std::wstring StringWiden(const char *str, bool throwOnError = true); // ************** rotate functions *************** @@ -1518,13 +1518,13 @@ std::wstring StringWiden(const char *str, bool throwOnError = true); /// \param x the value to rotate /// \details This is a portable C/C++ implementation. The value x to be rotated can be 8 to 64-bits wide. /// \details R must be in the range [0, sizeof(T)*8 - 1] to avoid undefined behavior. -/// Use rotlMod if the rotate amount R is outside the range. +/// Use rotlMod if the rotate amount R is outside the range. /// \details Use rotlConstant when the rotate amount is constant. The template function was added -/// because Clang did not propagate the constant when passed as a function parameter. Clang's -/// need for a constexpr meant rotlFixed failed to compile on occassion. +/// because Clang did not propagate the constant when passed as a function parameter. Clang's +/// need for a constexpr meant rotlFixed failed to compile on occassion. /// \note rotlConstant attempts to enlist a rotate IMM instruction because its often faster -/// than a rotate REG. Immediate rotates can be up to three times faster than their register -/// counterparts. +/// than a rotate REG. Immediate rotates can be up to three times faster than their register +/// counterparts. /// \sa rotlConstant, rotrConstant, rotlFixed, rotrFixed, rotlVariable, rotrVariable /// \since Crypto++ 6.0 template inline T rotlConstant(T x) @@ -1545,13 +1545,13 @@ template inline T rotlConstant(T x) /// \param x the value to rotate /// \details This is a portable C/C++ implementation. The value x to be rotated can be 8 to 64-bits wide. /// \details R must be in the range [0, sizeof(T)*8 - 1] to avoid undefined behavior. -/// Use rotrMod if the rotate amount R is outside the range. +/// Use rotrMod if the rotate amount R is outside the range. /// \details Use rotrConstant when the rotate amount is constant. The template function was added -/// because Clang did not propagate the constant when passed as a function parameter. Clang's -/// need for a constexpr meant rotrFixed failed to compile on occassion. +/// because Clang did not propagate the constant when passed as a function parameter. Clang's +/// need for a constexpr meant rotrFixed failed to compile on occassion. /// \note rotrConstant attempts to enlist a rotate IMM instruction because its often faster -/// than a rotate REG. Immediate rotates can be up to three times faster than their register -/// counterparts. +/// than a rotate REG. Immediate rotates can be up to three times faster than their register +/// counterparts. /// \sa rotlConstant, rotrConstant, rotlFixed, rotrFixed, rotlVariable, rotrVariable template inline T rotrConstant(T x) { @@ -1571,11 +1571,11 @@ template inline T rotrConstant(T x) /// \param y the number of bit positions to rotate the value /// \details This is a portable C/C++ implementation. The value x to be rotated can be 8 to 64-bits wide. /// \details y must be in the range [0, sizeof(T)*8 - 1] to avoid undefined behavior. -/// Use rotlMod if the rotate amount y is outside the range. +/// Use rotlMod if the rotate amount y is outside the range. /// \note rotlFixed attempts to enlist a rotate IMM instruction because its often faster -/// than a rotate REG. Immediate rotates can be up to three times faster than their register -/// counterparts. New code should use rotlConstant, which accepts the rotate amount as a -/// template parameter. +/// than a rotate REG. Immediate rotates can be up to three times faster than their register +/// counterparts. New code should use rotlConstant, which accepts the rotate amount as a +/// template parameter. /// \sa rotlConstant, rotrConstant, rotlFixed, rotrFixed, rotlVariable, rotrVariable /// \since Crypto++ 6.0 template inline T rotlFixed(T x, unsigned int y) @@ -1596,11 +1596,11 @@ template inline T rotlFixed(T x, unsigned int y) /// \param y the number of bit positions to rotate the value /// \details This is a portable C/C++ implementation. The value x to be rotated can be 8 to 64-bits wide. /// \details y must be in the range [0, sizeof(T)*8 - 1] to avoid undefined behavior. -/// Use rotrMod if the rotate amount y is outside the range. +/// Use rotrMod if the rotate amount y is outside the range. /// \note rotrFixed attempts to enlist a rotate IMM instruction because its often faster -/// than a rotate REG. Immediate rotates can be up to three times faster than their register -/// counterparts. New code should use rotrConstant, which accepts the rotate amount as a -/// template parameter. +/// than a rotate REG. Immediate rotates can be up to three times faster than their register +/// counterparts. New code should use rotrConstant, which accepts the rotate amount as a +/// template parameter. /// \sa rotlConstant, rotrConstant, rotlFixed, rotrFixed, rotlVariable, rotrVariable /// \since Crypto++ 3.0 template inline T rotrFixed(T x, unsigned int y) @@ -1621,10 +1621,10 @@ template inline T rotrFixed(T x, unsigned int y) /// \param y the number of bit positions to rotate the value /// \details This is a portable C/C++ implementation. The value x to be rotated can be 8 to 64-bits wide. /// \details y must be in the range [0, sizeof(T)*8 - 1] to avoid undefined behavior. -/// Use rotlMod if the rotate amount y is outside the range. +/// Use rotlMod if the rotate amount y is outside the range. /// \note rotlVariable attempts to enlist a rotate IMM instruction because its often faster -/// than a rotate REG. Immediate rotates can be up to three times faster than their register -/// counterparts. +/// than a rotate REG. Immediate rotates can be up to three times faster than their register +/// counterparts. /// \sa rotlConstant, rotrConstant, rotlFixed, rotrFixed, rotlVariable, rotrVariable /// \since Crypto++ 3.0 template inline T rotlVariable(T x, unsigned int y) @@ -1641,10 +1641,10 @@ template inline T rotlVariable(T x, unsigned int y) /// \param y the number of bit positions to rotate the value /// \details This is a portable C/C++ implementation. The value x to be rotated can be 8 to 64-bits wide. /// \details y must be in the range [0, sizeof(T)*8 - 1] to avoid undefined behavior. -/// Use rotrMod if the rotate amount y is outside the range. +/// Use rotrMod if the rotate amount y is outside the range. /// \note rotrVariable attempts to enlist a rotate IMM instruction because its often faster -/// than a rotate REG. Immediate rotates can be up to three times faster than their register -/// counterparts. +/// than a rotate REG. Immediate rotates can be up to three times faster than their register +/// counterparts. /// \sa rotlConstant, rotrConstant, rotlFixed, rotrFixed, rotlVariable, rotrVariable /// \since Crypto++ 3.0 template inline T rotrVariable(T x, unsigned int y) @@ -1694,8 +1694,8 @@ template inline T rotrMod(T x, unsigned int y) /// \param x the 32-bit value to rotate /// \param y the number of bit positions to rotate the value /// \details This is a Microsoft specific implementation using _lrotl provided by -/// . The value x to be rotated is 32-bits. y must be in the range -/// [0, sizeof(T)*8 - 1] to avoid undefined behavior. +/// . The value x to be rotated is 32-bits. y must be in the range +/// [0, sizeof(T)*8 - 1] to avoid undefined behavior. /// \note rotlFixed will assert in Debug builds if is outside the allowed range. /// \since Crypto++ 3.0 template<> inline word32 rotlFixed(word32 x, unsigned int y) @@ -1710,8 +1710,8 @@ template<> inline word32 rotlFixed(word32 x, unsigned int y) /// \param x the 32-bit value to rotate /// \param y the number of bit positions to rotate the value /// \details This is a Microsoft specific implementation using _lrotr provided by -/// . The value x to be rotated is 32-bits. y must be in the range -/// [0, sizeof(T)*8 - 1] to avoid undefined behavior. +/// . The value x to be rotated is 32-bits. y must be in the range +/// [0, sizeof(T)*8 - 1] to avoid undefined behavior. /// \note rotrFixed will assert in Debug builds if is outside the allowed range. /// \since Crypto++ 3.0 template<> inline word32 rotrFixed(word32 x, unsigned int y) @@ -1726,8 +1726,8 @@ template<> inline word32 rotrFixed(word32 x, unsigned int y) /// \param x the 32-bit value to rotate /// \param y the number of bit positions to rotate the value /// \details This is a Microsoft specific implementation using _lrotl provided by -/// . The value x to be rotated is 32-bits. y must be in the range -/// [0, sizeof(T)*8 - 1] to avoid undefined behavior. +/// . The value x to be rotated is 32-bits. y must be in the range +/// [0, sizeof(T)*8 - 1] to avoid undefined behavior. /// \note rotlVariable will assert in Debug builds if is outside the allowed range. /// \since Crypto++ 3.0 template<> inline word32 rotlVariable(word32 x, unsigned int y) @@ -1741,8 +1741,8 @@ template<> inline word32 rotlVariable(word32 x, unsigned int y) /// \param x the 32-bit value to rotate /// \param y the number of bit positions to rotate the value /// \details This is a Microsoft specific implementation using _lrotr provided by -/// . The value x to be rotated is 32-bits. y must be in the range -/// [0, sizeof(T)*8 - 1] to avoid undefined behavior. +/// . The value x to be rotated is 32-bits. y must be in the range +/// [0, sizeof(T)*8 - 1] to avoid undefined behavior. /// \note rotrVariable will assert in Debug builds if is outside the allowed range. /// \since Crypto++ 3.0 template<> inline word32 rotrVariable(word32 x, unsigned int y) @@ -1756,8 +1756,8 @@ template<> inline word32 rotrVariable(word32 x, unsigned int y) /// \param x the 32-bit value to rotate /// \param y the number of bit positions to rotate the value /// \details This is a Microsoft specific implementation using _lrotl provided by -/// . The value x to be rotated is 32-bits. y must be in the range -/// [0, sizeof(T)*8 - 1] to avoid undefined behavior. +/// . The value x to be rotated is 32-bits. y must be in the range +/// [0, sizeof(T)*8 - 1] to avoid undefined behavior. /// \since Crypto++ 3.0 template<> inline word32 rotlMod(word32 x, unsigned int y) { @@ -1770,8 +1770,8 @@ template<> inline word32 rotlMod(word32 x, unsigned int y) /// \param x the 32-bit value to rotate /// \param y the number of bit positions to rotate the value /// \details This is a Microsoft specific implementation using _lrotr provided by -/// . The value x to be rotated is 32-bits. y must be in the range -/// [0, sizeof(T)*8 - 1] to avoid undefined behavior. +/// . The value x to be rotated is 32-bits. y must be in the range +/// [0, sizeof(T)*8 - 1] to avoid undefined behavior. /// \since Crypto++ 3.0 template<> inline word32 rotrMod(word32 x, unsigned int y) { @@ -1789,8 +1789,8 @@ template<> inline word32 rotrMod(word32 x, unsigned int y) /// \param x the 64-bit value to rotate /// \param y the number of bit positions to rotate the value /// \details This is a Microsoft specific implementation using _lrotl provided by -/// . The value x to be rotated is 64-bits. y must be in the range -/// [0, sizeof(T)*8 - 1] to avoid undefined behavior. +/// . The value x to be rotated is 64-bits. y must be in the range +/// [0, sizeof(T)*8 - 1] to avoid undefined behavior. /// \note rotrFixed will assert in Debug builds if is outside the allowed range. /// \since Crypto++ 3.0 template<> inline word64 rotlFixed(word64 x, unsigned int y) @@ -1805,8 +1805,8 @@ template<> inline word64 rotlFixed(word64 x, unsigned int y) /// \param x the 64-bit value to rotate /// \param y the number of bit positions to rotate the value /// \details This is a Microsoft specific implementation using _lrotr provided by -/// . The value x to be rotated is 64-bits. y must be in the range -/// [0, sizeof(T)*8 - 1] to avoid undefined behavior. +/// . The value x to be rotated is 64-bits. y must be in the range +/// [0, sizeof(T)*8 - 1] to avoid undefined behavior. /// \note rotrFixed will assert in Debug builds if is outside the allowed range. /// \since Crypto++ 3.0 template<> inline word64 rotrFixed(word64 x, unsigned int y) @@ -1821,8 +1821,8 @@ template<> inline word64 rotrFixed(word64 x, unsigned int y) /// \param x the 64-bit value to rotate /// \param y the number of bit positions to rotate the value /// \details This is a Microsoft specific implementation using _lrotl provided by -/// . The value x to be rotated is 64-bits. y must be in the range -/// [0, sizeof(T)*8 - 1] to avoid undefined behavior. +/// . The value x to be rotated is 64-bits. y must be in the range +/// [0, sizeof(T)*8 - 1] to avoid undefined behavior. /// \note rotlVariable will assert in Debug builds if is outside the allowed range. /// \since Crypto++ 3.0 template<> inline word64 rotlVariable(word64 x, unsigned int y) @@ -1836,8 +1836,8 @@ template<> inline word64 rotlVariable(word64 x, unsigned int y) /// \param x the 64-bit value to rotate /// \param y the number of bit positions to rotate the value /// \details This is a Microsoft specific implementation using _lrotr provided by -/// . The value x to be rotated is 64-bits. y must be in the range -/// [0, sizeof(T)*8 - 1] to avoid undefined behavior. +/// . The value x to be rotated is 64-bits. y must be in the range +/// [0, sizeof(T)*8 - 1] to avoid undefined behavior. /// \note rotrVariable will assert in Debug builds if is outside the allowed range. /// \since Crypto++ 3.0 template<> inline word64 rotrVariable(word64 x, unsigned int y) @@ -1851,8 +1851,8 @@ template<> inline word64 rotrVariable(word64 x, unsigned int y) /// \param x the 64-bit value to rotate /// \param y the number of bit positions to rotate the value /// \details This is a Microsoft specific implementation using _lrotl provided by -/// . The value x to be rotated is 64-bits. y must be in the range -/// [0, sizeof(T)*8 - 1] to avoid undefined behavior. +/// . The value x to be rotated is 64-bits. y must be in the range +/// [0, sizeof(T)*8 - 1] to avoid undefined behavior. /// \since Crypto++ 3.0 template<> inline word64 rotlMod(word64 x, unsigned int y) { @@ -1865,8 +1865,8 @@ template<> inline word64 rotlMod(word64 x, unsigned int y) /// \param x the 64-bit value to rotate /// \param y the number of bit positions to rotate the value /// \details This is a Microsoft specific implementation using _lrotr provided by -/// . The value x to be rotated is 64-bits. y must be in the range -/// [0, sizeof(T)*8 - 1] to avoid undefined behavior. +/// . The value x to be rotated is 64-bits. y must be in the range +/// [0, sizeof(T)*8 - 1] to avoid undefined behavior. /// \since Crypto++ 3.0 template<> inline word64 rotrMod(word64 x, unsigned int y) { @@ -2138,9 +2138,9 @@ inline word64 BitReverse(word64 value) /// \brief Reverses bits in a value /// \param value the value to reverse /// \details The template overload of BitReverse operates on signed and unsigned values. -/// Internally the size of T is checked, and then value is cast to a byte, -/// word16, word32 or word64. After the cast, the appropriate BitReverse -/// overload is called. +/// Internally the size of T is checked, and then value is cast to a byte, +/// word16, word32 or word64. After the cast, the appropriate BitReverse +/// overload is called. template inline T BitReverse(T value) { @@ -2164,8 +2164,8 @@ inline T BitReverse(T value) /// \param order the ByteOrder of the data /// \param value the value to conditionally reverse /// \details Internally, the ConditionalByteReverse calls NativeByteOrderIs. -/// If order matches native byte order, then the original value is returned. -/// If not, then ByteReverse is called on the value before returning to the caller. +/// If order matches native byte order, then the original value is returned. +/// If not, then ByteReverse is called on the value before returning to the caller. template inline T ConditionalByteReverse(ByteOrder order, T value) { @@ -2178,11 +2178,11 @@ inline T ConditionalByteReverse(ByteOrder order, T value) /// \param in the input array of elements /// \param byteCount the total number of bytes in the array /// \details Internally, ByteReverse visits each element in the in array -/// calls ByteReverse on it, and writes the result to out. +/// calls ByteReverse on it, and writes the result to out. /// \details ByteReverse does not process tail byes, or bytes that are -/// not part of a full element. If T is int (and int is 4 bytes), then -/// byteCount = 10 means only the first 2 elements or 8 bytes are -/// reversed. +/// not part of a full element. If T is int (and int is 4 bytes), then +/// byteCount = 10 means only the first 2 elements or 8 bytes are +/// reversed. /// \details The following program should help illustrate the behavior. ///
vector v1, v2;
 ///
@@ -2196,12 +2196,12 @@ inline T ConditionalByteReverse(ByteOrder order, T value)
 ///
 /// cout << "V1: ";
 /// for(unsigned int i = 0; i < v1.size(); i++)
-///   cout << std::hex << v1[i] << " ";
+///  cout << std::hex << v1[i] << " ";
 /// cout << endl;
 ///
 /// cout << "V2: ";
 /// for(unsigned int i = 0; i < v2.size(); i++)
-///   cout << std::hex << v2[i] << " ";
+///  cout << std::hex << v2[i] << " ";
 /// cout << endl;
/// The program above results in the following output. ///
V1: 00000001 00000002 00000003 00000004
@@ -2227,11 +2227,11 @@ void ByteReverse(T *out, const T *in, size_t byteCount)
 /// \param in the input array of elements
 /// \param byteCount the byte count of the arrays
 /// \details Internally, ByteReverse visits each element in the in array
-///   calls ByteReverse on it depending on the desired endianness, and writes the result to out.
+///  calls ByteReverse on it depending on the desired endianness, and writes the result to out.
 /// \details ByteReverse does not process tail byes, or bytes that are
-///   not part of a full element. If T is int (and int is 4 bytes), then
-///   byteCount = 10 means only the first 2 elements or 8 bytes are
-///   reversed.
+///  not part of a full element. If T is int (and int is 4 bytes), then
+///  byteCount = 10 means only the first 2 elements or 8 bytes are
+///  reversed.
 /// \sa ByteReverse
 template 
 inline void ConditionalByteReverse(ByteOrder order, T *out, const T *in, size_t byteCount)
@@ -2430,14 +2430,14 @@ inline void UnalignedbyteNonTemplate(ByteOrder order, byte *block, word64 value,
 /// \param block the byte buffer to be processed
 /// \returns the word in the specified byte order
 /// \details GetWord() provides alternate read access to a block of memory. The flag assumeAligned indicates
-///   if the memory block is aligned for class or type T. The enumeration ByteOrder is BIG_ENDIAN_ORDER or
-///   LITTLE_ENDIAN_ORDER.
+///  if the memory block is aligned for class or type T. The enumeration ByteOrder is BIG_ENDIAN_ORDER or
+///  LITTLE_ENDIAN_ORDER.
 /// \details An example of reading two word32 values from a block of memory is shown below. w
-///   will be 0x03020100.
+///  will be 0x03020100.
 /// 
-///    word32 w;
-///    byte buffer[4] = {0,1,2,3};
-///    w = GetWord(false, LITTLE_ENDIAN_ORDER, buffer);
+///   word32 w;
+///   byte buffer[4] = {0,1,2,3};
+///   w = GetWord(false, LITTLE_ENDIAN_ORDER, buffer);
 /// 
template inline T GetWord(bool assumeAligned, ByteOrder order, const byte *block) @@ -2445,7 +2445,7 @@ inline T GetWord(bool assumeAligned, ByteOrder order, const byte *block) CRYPTOPP_UNUSED(assumeAligned); T temp = 0; - if (block) {std::memcpy(&temp, block, sizeof(T));} + if (block != NULLPTR) {std::memcpy(&temp, block, sizeof(T));} return ConditionalByteReverse(order, temp); } @@ -2456,14 +2456,14 @@ inline T GetWord(bool assumeAligned, ByteOrder order, const byte *block) /// \param result the word in the specified byte order /// \param block the byte buffer to be processed /// \details GetWord() provides alternate read access to a block of memory. The flag assumeAligned indicates -/// if the memory block is aligned for class or type T. The enumeration ByteOrder is BIG_ENDIAN_ORDER or -/// LITTLE_ENDIAN_ORDER. +/// if the memory block is aligned for class or type T. The enumeration ByteOrder is BIG_ENDIAN_ORDER or +/// LITTLE_ENDIAN_ORDER. /// \details An example of reading two word32 values from a block of memory is shown below. w -/// will be 0x03020100. +/// will be 0x03020100. ///
-///    word32 w;
-///    byte buffer[4] = {0,1,2,3};
-///    w = GetWord(false, LITTLE_ENDIAN_ORDER, buffer);
+///   word32 w;
+///   byte buffer[4] = {0,1,2,3};
+///   w = GetWord(false, LITTLE_ENDIAN_ORDER, buffer);
 /// 
template inline void GetWord(bool assumeAligned, ByteOrder order, T &result, const byte *block) @@ -2479,8 +2479,8 @@ inline void GetWord(bool assumeAligned, ByteOrder order, T &result, const byte * /// \param value the word in the specified byte order /// \param xorBlock an optional byte buffer to xor /// \details PutWord() provides alternate write access to a block of memory. The flag assumeAligned indicates -/// if the memory block is aligned for class or type T. The enumeration ByteOrder is BIG_ENDIAN_ORDER or -/// LITTLE_ENDIAN_ORDER. +/// if the memory block is aligned for class or type T. The enumeration ByteOrder is BIG_ENDIAN_ORDER or +/// LITTLE_ENDIAN_ORDER. template inline void PutWord(bool assumeAligned, ByteOrder order, byte *block, T value, const byte *xorBlock = NULLPTR) { @@ -2488,8 +2488,8 @@ inline void PutWord(bool assumeAligned, ByteOrder order, byte *block, T value, c T t1, t2; t1 = ConditionalByteReverse(order, value); - if (xorBlock) {std::memcpy(&t2, xorBlock, sizeof(T)); t1 ^= t2;} - if (block) {std::memcpy(block, &t1, sizeof(T));} + if (xorBlock != NULLPTR) {std::memcpy(&t2, xorBlock, sizeof(T)); t1 ^= t2;} + if (block != NULLPTR) {std::memcpy(block, &t1, sizeof(T));} } /// \brief Access a block of memory @@ -2497,15 +2497,15 @@ inline void PutWord(bool assumeAligned, ByteOrder order, byte *block, T value, c /// \tparam B enumeration indicating endianness /// \tparam A flag indicating alignment /// \details GetBlock() provides alternate read access to a block of memory. The enumeration B is -/// BigEndian or LittleEndian. The flag A indicates if the memory block is aligned for class or type T. -/// Repeatedly applying operator() results in advancing in the block of memory. +/// BigEndian or LittleEndian. The flag A indicates if the memory block is aligned for class or type T. +/// Repeatedly applying operator() results in advancing in the block of memory. /// \details An example of reading two word32 values from a block of memory is shown below. w1 -/// will be 0x03020100 and w1 will be 0x07060504. +/// will be 0x03020100 and w1 will be 0x07060504. ///
-///    word32 w1, w2;
-///    byte buffer[8] = {0,1,2,3,4,5,6,7};
-///    GetBlock block(buffer);
-///    block(w1)(w2);
+///   word32 w1, w2;
+///   byte buffer[8] = {0,1,2,3,4,5,6,7};
+///   GetBlock block(buffer);
+///   block(w1)(w2);
 /// 
template class GetBlock @@ -2538,15 +2538,15 @@ private: /// \tparam B enumeration indicating endianness /// \tparam A flag indicating alignment /// \details PutBlock() provides alternate write access to a block of memory. The enumeration B is -/// BigEndian or LittleEndian. The flag A indicates if the memory block is aligned for class or type T. -/// Repeatedly applying operator() results in advancing in the block of memory. +/// BigEndian or LittleEndian. The flag A indicates if the memory block is aligned for class or type T. +/// Repeatedly applying operator() results in advancing in the block of memory. /// \details An example of writing two word32 values from a block of memory is shown below. After the code -/// executes, the byte buffer will be {0,1,2,3,4,5,6,7}. +/// executes, the byte buffer will be {0,1,2,3,4,5,6,7}. ///
-///    word32 w1=0x03020100, w2=0x07060504;
-///    byte buffer[8];
-///    PutBlock block(NULLPTR, buffer);
-///    block(w1)(w2);
+///   word32 w1=0x03020100, w2=0x07060504;
+///   byte buffer[8];
+///   PutBlock block(NULLPTR, buffer);
+///   block(w1)(w2);
 /// 
template class PutBlock @@ -2583,7 +2583,7 @@ private: /// \tparam GA flag indicating alignment for the Get operation /// \tparam PA flag indicating alignment for the Put operation /// \details GetBlock() provides alternate write access to a block of memory. The enumeration B is -/// BigEndian or LittleEndian. The flag A indicates if the memory block is aligned for class or type T. +/// BigEndian or LittleEndian. The flag A indicates if the memory block is aligned for class or type T. /// \sa GetBlock() and PutBlock(). template struct BlockGetAndPut @@ -2625,14 +2625,14 @@ T StringToWord(const std::string &str, ByteOrder order = BIG_ENDIAN_ORDER) /// \brief Safely shift values when undefined behavior could occur /// \tparam overflow boolean flag indicating if overflow is present /// \details SafeShifter safely shifts values when undefined behavior could occur under C/C++ rules. -/// The class behaves much like a saturating arithmetic class, clamping values rather than allowing -/// the compiler to remove undefined behavior. +/// The class behaves much like a saturating arithmetic class, clamping values rather than allowing +/// the compiler to remove undefined behavior. /// \sa SafeShifter, SafeShifter template struct SafeShifter; /// \brief Shifts a value in the presence of overflow /// \details the true template parameter indicates overflow would occur. -/// In this case, SafeShifter clamps the value and returns 0. +/// In this case, SafeShifter clamps the value and returns 0. template<> struct SafeShifter { /// \brief Right shifts a value that overflows @@ -2662,7 +2662,7 @@ template<> struct SafeShifter /// \brief Shifts a value in the absence of overflow /// \details the false template parameter indicates overflow would not occur. -/// In this case, SafeShifter returns the shfted value. +/// In this case, SafeShifter returns the shfted value. template<> struct SafeShifter { /// \brief Right shifts a value that does not overflow @@ -2694,8 +2694,8 @@ template<> struct SafeShifter /// \param value the value to right shift /// \result the shifted value or 0 /// \details SafeRightShift safely shifts the value to the right when undefined behavior -/// could occur under C/C++ rules. SafeRightShift will return the shifted value or 0 -/// if undefined behavior would occur. +/// could occur under C/C++ rules. SafeRightShift will return the shifted value or 0 +/// if undefined behavior would occur. template inline T SafeRightShift(T value) { @@ -2708,8 +2708,8 @@ inline T SafeRightShift(T value) /// \param value the value to left shift /// \result the shifted value or 0 /// \details SafeLeftShift safely shifts the value to the left when undefined behavior -/// could occur under C/C++ rules. SafeLeftShift will return the shifted value or 0 -/// if undefined behavior would occur. +/// could occur under C/C++ rules. SafeLeftShift will return the shifted value or 0 +/// if undefined behavior would occur. template inline T SafeLeftShift(T value) {