diff --git a/ida.cpp b/ida.cpp index 1c8b3ab2..30d7381b 100644 --- a/ida.cpp +++ b/ida.cpp @@ -250,7 +250,7 @@ size_t SecretSharing::Put2(const byte *begin, size_t length, int messageEnd, boo if (!blocking) throw BlockingInputOnly("SecretSharing"); - SecByteBlock buf(UnsignedMin(256, length)); + SecByteBlock buf(UnsignedMin(256u, length)); unsigned int threshold = m_ida.GetThreshold(); while (length > 0) { diff --git a/misc.h b/misc.h index f72bc615..1f6f80de 100644 --- a/misc.h +++ b/misc.h @@ -14,6 +14,10 @@ #include "stdcpp.h" #include "trap.h" +#if defined(CRYPTOPP_CXX11) +# include +#endif + #if !defined(CRYPTOPP_DOXYGEN_PROCESSING) #if (CRYPTOPP_MSC_VERSION) @@ -695,6 +699,12 @@ template inline const T& STDMAX(const T& a, const T& b) template inline const T1 UnsignedMin(const T1& a, const T2& b) { CRYPTOPP_COMPILE_ASSERT((sizeof(T1)<=sizeof(T2) && T2(-1)>0) || (sizeof(T1)>sizeof(T2) && T1(-1)>0)); + +#if defined(CRYPTOPP_CXX11) + CRYPTOPP_COMPILE_ASSERT(std::is_unsigned_v == true); + CRYPTOPP_COMPILE_ASSERT(std::is_unsigned_v == true); +#endif + if (sizeof(T1)<=sizeof(T2)) return b < (T2)a ? (T1)b : a; else diff --git a/randpool.cpp b/randpool.cpp index bda49ec0..2cac4eeb 100644 --- a/randpool.cpp +++ b/randpool.cpp @@ -68,7 +68,7 @@ void RandomPool::GenerateIntoBufferedTransformation(BufferedTransformation &targ do { m_pCipher->ProcessBlock(m_seed); - size_t len = UnsignedMin(16, size); + size_t len = UnsignedMin(16u, size); target.ChannelPut(channel, m_seed, len); size -= len; } while (size > 0);