Cleared compile errors under Visual Studio .Net compilers

pull/131/head
Jeffrey Walton 2016-04-29 11:25:51 -04:00
parent 1ce593357f
commit 8db0e7da6d
3 changed files with 6 additions and 4 deletions

View File

@ -1150,7 +1150,7 @@ public:
//! \details Internally, Pump() calls Pump2(). //! \details Internally, Pump() calls Pump2().
//! \note pumpMax is a \p lword, which is a 64-bit value that typically uses \p LWORD_MAX. The default //! \note pumpMax is a \p lword, which is a 64-bit value that typically uses \p LWORD_MAX. The default
//! argument is a \p size_t that uses \p SIZE_MAX, and it can be 32-bits or 64-bits. //! argument is a \p size_t that uses \p SIZE_MAX, and it can be 32-bits or 64-bits.
lword Pump(lword pumpMax=size_t(SIZE_MAX)) lword Pump(lword pumpMax=(size_t)SIZE_MAX)
{Pump2(pumpMax); return pumpMax;} {Pump2(pumpMax); return pumpMax;}
//! \brief Pump messages to attached transformation //! \brief Pump messages to attached transformation

4
hkdf.h
View File

@ -29,6 +29,8 @@ template <class T>
class HKDF : public KeyDerivationFunction class HKDF : public KeyDerivationFunction
{ {
public: public:
CRYPTOPP_CONSTANT(DIGESTSIZE = T::DIGESTSIZE);
CRYPTOPP_CONSTANT(SALTSIZE = T::DIGESTSIZE);
static const char* StaticAlgorithmName () { static const char* StaticAlgorithmName () {
static const std::string name(std::string("HKDF(") + std::string(T::StaticAlgorithmName()) + std::string(")")); static const std::string name(std::string("HKDF(") + std::string(T::StaticAlgorithmName()) + std::string(")"));
return name.c_str(); return name.c_str();
@ -40,7 +42,7 @@ public:
protected: protected:
// If salt is missing (NULL), then use the NULL vector. Missing is different than EMPTY (0 length). The length // If salt is missing (NULL), then use the NULL vector. Missing is different than EMPTY (0 length). The length
// of s_NullVector used depends on the Hash function. SHA-256 will use 32 bytes of s_NullVector. // of s_NullVector used depends on the Hash function. SHA-256 will use 32 bytes of s_NullVector.
typedef byte NullVectorType[T::DIGESTSIZE]; typedef byte NullVectorType[SALTSIZE];
static const NullVectorType& GetNullVector() { static const NullVectorType& GetNullVector() {
static const NullVectorType s_NullVector = {0}; static const NullVectorType s_NullVector = {0};
return s_NullVector; return s_NullVector;

View File

@ -114,7 +114,7 @@ void HuffmanDecoder::Initialize(const unsigned int *codeBits, unsigned int nCode
} }
// MAX_CODE_BITS is 32, m_maxCodeBits may be smaller. // MAX_CODE_BITS is 32, m_maxCodeBits may be smaller.
const unsigned long long shiftedMaxCode = (1ULL << m_maxCodeBits); const word64 shiftedMaxCode = ((word64)1 << m_maxCodeBits);
if (code > shiftedMaxCode - blCount[m_maxCodeBits]) if (code > shiftedMaxCode - blCount[m_maxCodeBits])
throw Err("codes oversubscribed"); throw Err("codes oversubscribed");
else if (m_maxCodeBits != 1 && code < shiftedMaxCode - blCount[m_maxCodeBits]) else if (m_maxCodeBits != 1 && code < shiftedMaxCode - blCount[m_maxCodeBits])
@ -143,7 +143,7 @@ void HuffmanDecoder::Initialize(const unsigned int *codeBits, unsigned int nCode
m_normalizedCacheMask = NormalizeCode(m_cacheMask, m_cacheBits); m_normalizedCacheMask = NormalizeCode(m_cacheMask, m_cacheBits);
assert(m_normalizedCacheMask == BitReverse(m_cacheMask)); assert(m_normalizedCacheMask == BitReverse(m_cacheMask));
const unsigned long long shiftedCache = (1ULL << m_cacheBits); const word64 shiftedCache = ((word64)1 << m_cacheBits);
assert(shiftedCache <= SIZE_MAX); assert(shiftedCache <= SIZE_MAX);
if (m_cache.size() != shiftedCache) if (m_cache.size() != shiftedCache)
m_cache.resize((size_t)shiftedCache); m_cache.resize((size_t)shiftedCache);