Update comments

This commit is contained in:
Jeffrey Walton 2023-06-24 22:51:26 -04:00
parent acb48cc180
commit d6bc19da7f
No known key found for this signature in database
GPG Key ID: B36AB348921B1838
2 changed files with 23 additions and 23 deletions

40
misc.h
View File

@ -434,7 +434,7 @@ inline size_t PtrByteDiff(const PTR pointer1, const PTR pointer2)
}
/// \brief Pointer to the first element of a string
/// \param str std::string
/// \param str string
/// \details BytePtr returns NULL pointer for an empty string.
/// \return Pointer to the first element of a string
/// \since Crypto++ 8.0
@ -456,7 +456,7 @@ inline byte* BytePtr(std::string& str)
byte* BytePtr(SecByteBlock& str);
/// \brief Const pointer to the first element of a string
/// \param str std::string
/// \param str string
/// \details ConstBytePtr returns non-NULL pointer for an empty string.
/// \return Pointer to the first element of a string
/// \since Crypto++ 8.0
@ -475,7 +475,7 @@ inline const byte* ConstBytePtr(const std::string& str)
const byte* ConstBytePtr(const SecByteBlock& str);
/// \brief Size of a string
/// \param str std::string
/// \param str string
/// \return size of a string
/// \since Crypto++ 8.3
inline size_t BytePtrSize(const std::string& str)
@ -506,14 +506,14 @@ constexpr int EnumToInt(T v) {
#if (!__STDC_WANT_SECURE_LIB__ && !defined(_MEMORY_S_DEFINED)) || defined(CRYPTOPP_WANT_SECURE_LIB)
/// \brief Bounds checking replacement for std::memcpy()
/// \brief Bounds checking replacement for memcpy()
/// \param dest pointer to the destination memory block
/// \param sizeInBytes size of the destination memory block, in bytes
/// \param src pointer to the source memory block
/// \param count the number of bytes to copy
/// \throw InvalidArgument
/// \details ISO/IEC TR-24772 provides bounds checking interfaces for potentially
/// unsafe functions like std::memcpy(), strcpy() and std::memmove(). However,
/// 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.
@ -552,14 +552,14 @@ inline void memcpy_s(void *dest, size_t sizeInBytes, const void *src, size_t cou
#endif
}
/// \brief Bounds checking replacement for std::memmove()
/// \brief Bounds checking replacement for memmove()
/// \param dest pointer to the destination memory block
/// \param sizeInBytes size of the destination memory block, in bytes
/// \param src pointer to the source memory block
/// \param count the number of bytes to copy
/// \throw InvalidArgument
/// \details ISO/IEC TR-24772 provides bounds checking interfaces for potentially
/// unsafe functions like std::memcpy(), strcpy() and std::memmove(). However,
/// 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.
@ -632,7 +632,7 @@ inline void vec_swap(T& a, T& b)
/// \param ptr pointer to the memory block being written
/// \param val the integer value to write for each byte
/// \param num the size of the source memory block, in bytes
/// \details Internally the function calls std::memset with the value <tt>val</tt>.
/// \details Internally the function calls memset with the value <tt>val</tt>.
/// memset_z can be used to initialize a freshly allocated memory block.
/// To zeroize a memory block on destruction use <tt>SecureWipeBuffer</tt>.
/// \return the pointer to the memory block
@ -736,7 +736,7 @@ inline bool SafeConvert(T1 from, T2 &to)
/// \return true if its safe to convert from \p from to \p to, false otherwise.
/// \details if the function returns true, then it is safe to use \p to. If the function
/// returns false, then \p to is undefined and should not be used.
/// \since Crypto++ 8.7
/// \since Crypto++ 8.8
template<>
inline bool SafeConvert(sword64 from, word64 &to)
{
@ -752,7 +752,7 @@ inline bool SafeConvert(sword64 from, word64 &to)
/// \return true if its safe to convert from \p from to \p to, false otherwise.
/// \details if the function returns true, then it is safe to use \p to. If the function
/// returns false, then \p to is undefined and should not be used.
/// \since Crypto++ 8.7
/// \since Crypto++ 8.8
template<>
inline bool SafeConvert(word32 from, word64 &to)
{
@ -766,7 +766,7 @@ inline bool SafeConvert(word32 from, word64 &to)
/// \return true if its safe to convert from \p from to \p to, false otherwise.
/// \details if the function returns true, then it is safe to use \p to. If the function
/// returns false, then \p to is undefined and should not be used.
/// \since Crypto++ 8.7
/// \since Crypto++ 8.8
template<>
inline bool SafeConvert(sword32 from, word64 &to)
{
@ -782,7 +782,7 @@ inline bool SafeConvert(sword32 from, word64 &to)
/// \return true if its safe to convert from \p from to \p to, false otherwise.
/// \details if the function returns true, then it is safe to use \p to. If the function
/// returns false, then \p to is undefined and should not be used.
/// \since Crypto++ 8.7
/// \since Crypto++ 8.8
template<>
inline bool SafeConvert(word64 from, sword64 &to)
{
@ -798,7 +798,7 @@ inline bool SafeConvert(word64 from, sword64 &to)
/// \return true if its safe to convert from \p from to \p to, false otherwise.
/// \details if the function returns true, then it is safe to use \p to. If the function
/// returns false, then \p to is undefined and should not be used.
/// \since Crypto++ 8.7
/// \since Crypto++ 8.8
template<>
inline bool SafeConvert(word32 from, sword64 &to)
{
@ -812,7 +812,7 @@ inline bool SafeConvert(word32 from, sword64 &to)
/// \return true if its safe to convert from \p from to \p to, false otherwise.
/// \details if the function returns true, then it is safe to use \p to. If the function
/// returns false, then \p to is undefined and should not be used.
/// \since Crypto++ 8.7
/// \since Crypto++ 8.8
template<>
inline bool SafeConvert(sword32 from, sword64 &to)
{
@ -826,7 +826,7 @@ inline bool SafeConvert(sword32 from, sword64 &to)
/// \return true if its safe to convert from \p from to \p to, false otherwise.
/// \details if the function returns true, then it is safe to use \p to. If the function
/// returns false, then \p to is undefined and should not be used.
/// \since Crypto++ 8.7
/// \since Crypto++ 8.8
template<>
inline bool SafeConvert(word64 from, word32 &to)
{
@ -842,7 +842,7 @@ inline bool SafeConvert(word64 from, word32 &to)
/// \return true if its safe to convert from \p from to \p to, false otherwise.
/// \details if the function returns true, then it is safe to use \p to. If the function
/// returns false, then \p to is undefined and should not be used.
/// \since Crypto++ 8.7
/// \since Crypto++ 8.8
template<>
inline bool SafeConvert(sword64 from, word32 &to)
{
@ -860,7 +860,7 @@ inline bool SafeConvert(sword64 from, word32 &to)
/// \return true if its safe to convert from \p from to \p to, false otherwise.
/// \details if the function returns true, then it is safe to use \p to. If the function
/// returns false, then \p to is undefined and should not be used.
/// \since Crypto++ 8.7
/// \since Crypto++ 8.8
template<>
inline bool SafeConvert(sword32 from, word32 &to)
{
@ -876,7 +876,7 @@ inline bool SafeConvert(sword32 from, word32 &to)
/// \return true if its safe to convert from \p from to \p to, false otherwise.
/// \details if the function returns true, then it is safe to use \p to. If the function
/// returns false, then \p to is undefined and should not be used.
/// \since Crypto++ 8.7
/// \since Crypto++ 8.8
template<>
inline bool SafeConvert(word64 from, sword32 &to)
{
@ -892,7 +892,7 @@ inline bool SafeConvert(word64 from, sword32 &to)
/// \return true if its safe to convert from \p from to \p to, false otherwise.
/// \details if the function returns true, then it is safe to use \p to. If the function
/// returns false, then \p to is undefined and should not be used.
/// \since Crypto++ 8.7
/// \since Crypto++ 8.8
template<>
inline bool SafeConvert(sword64 from, sword32 &to)
{
@ -910,7 +910,7 @@ inline bool SafeConvert(sword64 from, sword32 &to)
/// \return true if its safe to convert from \p from to \p to, false otherwise.
/// \details if the function returns true, then it is safe to use \p to. If the function
/// returns false, then \p to is undefined and should not be used.
/// \since Crypto++ 8.7
/// \since Crypto++ 8.8
template<>
inline bool SafeConvert(word32 from, sword32 &to)
{

View File

@ -100,12 +100,12 @@ OS_RNG_Err::OS_RNG_Err(const std::string &operation)
#if defined(USE_MS_CNGAPI)
inline DWORD NtStatusToErrorCode(NTSTATUS status)
{
if (status == (NTSTATUS)STATUS_INVALID_PARAMETER)
if (status == static_cast<NTSTATUS>(STATUS_INVALID_PARAMETER))
return ERROR_INVALID_PARAMETER;
else if (status == (NTSTATUS)STATUS_INVALID_HANDLE)
else if (status == static_cast<NTSTATUS>(STATUS_INVALID_HANDLE))
return ERROR_INVALID_HANDLE;
else
return (DWORD)status;
return static_cast<DWORD>(status);
}
#endif