Fix clang warnings (GH #771)

This commit is contained in:
Marcel Raad 2019-01-02 18:05:26 +01:00 committed by Jeffrey Walton
parent da2444d243
commit 1a4b851ac1
7 changed files with 9 additions and 9 deletions

View File

@ -60,7 +60,7 @@ protected:
void AuthenticateData(const byte *data, size_t len);
const SymmetricCipher & GetSymmetricCipher() const
{return const_cast<AuthenticatedSymmetricCipherBase *>(this)->AccessSymmetricCipher();};
{return const_cast<AuthenticatedSymmetricCipherBase *>(this)->AccessSymmetricCipher();}
virtual SymmetricCipher & AccessSymmetricCipher() =0;
virtual bool AuthenticationIsOnPlaintext() const =0;

2
ccm.h
View File

@ -73,7 +73,7 @@ protected:
virtual BlockCipher & AccessBlockCipher() =0;
virtual int DefaultDigestSize() const =0;
const BlockCipher & GetBlockCipher() const {return const_cast<CCM_Base *>(this)->AccessBlockCipher();};
const BlockCipher & GetBlockCipher() const {return const_cast<CCM_Base *>(this)->AccessBlockCipher();}
byte *CBC_Buffer() {return m_buffer+REQUIRED_BLOCKSIZE;}
enum {REQUIRED_BLOCKSIZE = 16};

2
gcm.h
View File

@ -80,7 +80,7 @@ protected:
virtual BlockCipher & AccessBlockCipher() =0;
virtual GCM_TablesOption GetTablesOption() const =0;
const BlockCipher & GetBlockCipher() const {return const_cast<GCM_Base *>(this)->AccessBlockCipher();};
const BlockCipher & GetBlockCipher() const {return const_cast<GCM_Base *>(this)->AccessBlockCipher();}
byte *HashBuffer() {return m_buffer+REQUIRED_BLOCKSIZE;}
byte *HashKey() {return m_buffer+2*REQUIRED_BLOCKSIZE;}
byte *MulTable() {return m_buffer+3*REQUIRED_BLOCKSIZE;}

2
misc.h
View File

@ -617,7 +617,7 @@ template <class T1, class T2> inline const T1 UnsignedMin(const T1& a, const T2&
template <class T1, class T2>
inline bool SafeConvert(T1 from, T2 &to)
{
to = (T2)from;
to = static_cast<T2>(from);
if (from != to || (from > 0) != (to > 0))
return false;
return true;

View File

@ -379,7 +379,7 @@ public:
{
static HashIdentifier CRYPTOPP_API Lookup()
{
return HashIdentifier((const byte *)NULLPTR, 0);
return HashIdentifier(static_cast<const byte *>(NULLPTR), 0);
}
};
};

View File

@ -421,7 +421,7 @@ public:
CRYPTOPP_ASSERT(size <= S);
CRYPTOPP_ASSERT(m_allocated);
m_allocated = false;
SecureWipeArray((pointer)ptr, size);
SecureWipeArray(reinterpret_cast<pointer>(ptr), size);
}
else
m_fallbackAllocator.deallocate(ptr, size);
@ -503,7 +503,7 @@ private:
// The library is OK but users may hit it. So we need to guard
// for a large T, and that is what PAD achieves.
T* GetAlignedArray() {
T* p_array = (T*)(void*)(((byte*)m_array) + (0-(size_t)m_array)%16);
T* p_array = reinterpret_cast<T*>(static_cast<void*>((reinterpret_cast<byte*>(m_array)) + (0-reinterpret_cast<size_t>(m_array))%16));
// Verify the 16-byte alignment
CRYPTOPP_ASSERT(IsAlignedOn(p_array, 16));
// Verify allocated array with pad is large enough.

View File

@ -265,7 +265,7 @@ public:
/// \brief The maximum key length used by the algorithm
/// \returns maximum key length used by the algorithm, in bytes
size_t MaxKeyLength() const
{return (size_t)INFO::MAX_KEYLENGTH;}
{return static_cast<size_t>(INFO::MAX_KEYLENGTH);}
/// \brief The default key length used by the algorithm
/// \returns default key length used by the algorithm, in bytes
@ -286,7 +286,7 @@ public:
/// \details The default value is NOT_RESYNCHRONIZABLE. See IV_Requirement
/// in cryptlib.h for allowed values.
SimpleKeyingInterface::IV_Requirement IVRequirement() const
{return (SimpleKeyingInterface::IV_Requirement)INFO::IV_REQUIREMENT;}
{return static_cast<SimpleKeyingInterface::IV_Requirement>(INFO::IV_REQUIREMENT);}
/// \brief The initialization vector length for the algorithm
/// \details IVSize is provided in bytes, not bits. The default implementation uses