Whitespace checkin
parent
7ad12ab5b0
commit
77206baf56
|
|
@ -191,7 +191,7 @@ public:
|
||||||
if (!m_done)
|
if (!m_done)
|
||||||
{
|
{
|
||||||
R value;
|
R value;
|
||||||
if(!m_source.GetValue(name, value))
|
if (!m_source.GetValue(name, value))
|
||||||
throw InvalidArgument(std::string(typeid(T).name()) + ": Missing required parameter '" + name + "'");
|
throw InvalidArgument(std::string(typeid(T).name()) + ": Missing required parameter '" + name + "'");
|
||||||
(m_pObject->*pm)(value);
|
(m_pObject->*pm)(value);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -299,7 +299,7 @@ public:
|
||||||
CRYPTOPP_DLL bool GetAsUIntValue(const char *name, unsigned int &value) const
|
CRYPTOPP_DLL bool GetAsUIntValue(const char *name, unsigned int &value) const
|
||||||
{
|
{
|
||||||
int v;
|
int v;
|
||||||
if(!GetValue(name, v) || v < 0) return false;
|
if (!GetValue(name, v) || v < 0) return false;
|
||||||
value = static_cast<unsigned int>(v);
|
value = static_cast<unsigned int>(v);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -314,7 +314,7 @@ public:
|
||||||
CRYPTOPP_DLL unsigned int GetAsUIntValueWithDefault(const char *name, unsigned int defaultValue) const
|
CRYPTOPP_DLL unsigned int GetAsUIntValueWithDefault(const char *name, unsigned int defaultValue) const
|
||||||
{
|
{
|
||||||
int v;
|
int v;
|
||||||
if(!GetValue(name, v) || v < 0) return defaultValue;
|
if (!GetValue(name, v) || v < 0) return defaultValue;
|
||||||
return static_cast<unsigned int>(v);
|
return static_cast<unsigned int>(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
4
gzip.cpp
4
gzip.cpp
|
|
@ -65,12 +65,12 @@ void Gunzip::ProcessPrestreamHeader()
|
||||||
|
|
||||||
if (flags & FILENAME) // skip filename
|
if (flags & FILENAME) // skip filename
|
||||||
do
|
do
|
||||||
if(!m_inQueue.Get(b)) throw HeaderErr();
|
if (!m_inQueue.Get(b)) throw HeaderErr();
|
||||||
while (b);
|
while (b);
|
||||||
|
|
||||||
if (flags & COMMENTS) // skip comments
|
if (flags & COMMENTS) // skip comments
|
||||||
do
|
do
|
||||||
if(!m_inQueue.Get(b)) throw HeaderErr();
|
if (!m_inQueue.Get(b)) throw HeaderErr();
|
||||||
while (b);
|
while (b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
6
hkdf.h
6
hkdf.h
|
|
@ -55,7 +55,7 @@ unsigned int HKDF<T>::DeriveKey(byte *derived, size_t derivedLen, const byte *se
|
||||||
CRYPTOPP_ASSERT(derived && derivedLen);
|
CRYPTOPP_ASSERT(derived && derivedLen);
|
||||||
CRYPTOPP_ASSERT(derivedLen <= MaxDerivedKeyLength());
|
CRYPTOPP_ASSERT(derivedLen <= MaxDerivedKeyLength());
|
||||||
|
|
||||||
if(derivedLen > MaxDerivedKeyLength())
|
if (derivedLen > MaxDerivedKeyLength())
|
||||||
throw InvalidArgument("HKDF: derivedLen must be less than or equal to MaxDerivedKeyLength");
|
throw InvalidArgument("HKDF: derivedLen must be less than or equal to MaxDerivedKeyLength");
|
||||||
|
|
||||||
HMAC<T> hmac;
|
HMAC<T> hmac;
|
||||||
|
|
@ -74,8 +74,8 @@ unsigned int HKDF<T>::DeriveKey(byte *derived, size_t derivedLen, const byte *se
|
||||||
|
|
||||||
while (derivedLen > 0)
|
while (derivedLen > 0)
|
||||||
{
|
{
|
||||||
if(block++) {hmac.Update(buffer, buffer.size());}
|
if (block++) {hmac.Update(buffer, buffer.size());}
|
||||||
if(context && contextLen) {hmac.Update(context, contextLen);}
|
if (context && contextLen) {hmac.Update(context, contextLen);}
|
||||||
hmac.CalculateDigest(buffer, &block, 1);
|
hmac.CalculateDigest(buffer, &block, 1);
|
||||||
|
|
||||||
size_t segmentLen = STDMIN(derivedLen, DIGEST_SIZE);
|
size_t segmentLen = STDMIN(derivedLen, DIGEST_SIZE);
|
||||||
|
|
|
||||||
4
ida.cpp
4
ida.cpp
|
|
@ -380,7 +380,7 @@ size_t PaddingRemover::Put2(const byte *begin, size_t length, int messageEnd, bo
|
||||||
|
|
||||||
if (m_possiblePadding)
|
if (m_possiblePadding)
|
||||||
{
|
{
|
||||||
size_t len = find_if(begin, end, bind2nd(not_equal_to<byte>(), byte(0))) - begin;
|
size_t len = find_if (begin, end, bind2nd(not_equal_to<byte>(), byte(0))) - begin;
|
||||||
m_zeroCount += len;
|
m_zeroCount += len;
|
||||||
begin += len;
|
begin += len;
|
||||||
if (begin == end)
|
if (begin == end)
|
||||||
|
|
@ -401,7 +401,7 @@ size_t PaddingRemover::Put2(const byte *begin, size_t length, int messageEnd, bo
|
||||||
#else
|
#else
|
||||||
typedef reverse_iterator<const byte *> RevIt;
|
typedef reverse_iterator<const byte *> RevIt;
|
||||||
#endif
|
#endif
|
||||||
const byte *x = find_if(RevIt(end), RevIt(begin), bind2nd(not_equal_to<byte>(), byte(0))).base();
|
const byte *x = find_if (RevIt(end), RevIt(begin), bind2nd(not_equal_to<byte>(), byte(0))).base();
|
||||||
if (x != begin && *(x-1) == 1)
|
if (x != begin && *(x-1) == 1)
|
||||||
{
|
{
|
||||||
AttachedTransformation()->Put(begin, x-begin-1);
|
AttachedTransformation()->Put(begin, x-begin-1);
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ template <class T, class BASE> void IteratedHashBase<T, BASE>::Update(const byte
|
||||||
{
|
{
|
||||||
if (num+len >= blockSize)
|
if (num+len >= blockSize)
|
||||||
{
|
{
|
||||||
if(data && input)
|
if (data && input)
|
||||||
memcpy(data+num, input, blockSize-num);
|
memcpy(data+num, input, blockSize-num);
|
||||||
|
|
||||||
HashBlock(dataBuf);
|
HashBlock(dataBuf);
|
||||||
|
|
@ -39,7 +39,7 @@ template <class T, class BASE> void IteratedHashBase<T, BASE>::Update(const byte
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(data && input)
|
if (data && input)
|
||||||
memcpy(data+num, input, len);
|
memcpy(data+num, input, len);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
@ -64,7 +64,7 @@ template <class T, class BASE> void IteratedHashBase<T, BASE>::Update(const byte
|
||||||
else
|
else
|
||||||
do
|
do
|
||||||
{ // copy input first if it's not aligned correctly
|
{ // copy input first if it's not aligned correctly
|
||||||
if(data && input)
|
if (data && input)
|
||||||
memcpy(data, input, blockSize);
|
memcpy(data, input, blockSize);
|
||||||
|
|
||||||
HashBlock(dataBuf);
|
HashBlock(dataBuf);
|
||||||
|
|
|
||||||
10
misc.h
10
misc.h
|
|
@ -205,7 +205,7 @@ inline void memcpy_s(void *dest, size_t sizeInBytes, const void *src, size_t cou
|
||||||
|
|
||||||
// TODO: fix callers. Its easier than it sounds because of the way
|
// TODO: fix callers. Its easier than it sounds because of the way
|
||||||
// Put and Put2 are used in filters.
|
// Put and Put2 are used in filters.
|
||||||
if(dest && src && count)
|
if (dest && src && count)
|
||||||
memcpy(dest, src, count);
|
memcpy(dest, src, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -219,7 +219,7 @@ inline void memmove_s(void *dest, size_t sizeInBytes, const void *src, size_t co
|
||||||
|
|
||||||
// TODO: fix callers. Its easier than it sounds because of the way
|
// TODO: fix callers. Its easier than it sounds because of the way
|
||||||
// Put and Put2 are used in filters.
|
// Put and Put2 are used in filters.
|
||||||
if(dest && src && count)
|
if (dest && src && count)
|
||||||
memmove(dest, src, count);
|
memmove(dest, src, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -237,8 +237,8 @@ inline void * memset_z(void *ptr, int value, size_t num)
|
||||||
if (__builtin_constant_p(num) && num==0)
|
if (__builtin_constant_p(num) && num==0)
|
||||||
return ptr;
|
return ptr;
|
||||||
#endif
|
#endif
|
||||||
if(!ptr) return NULL;
|
if (!ptr) return NULL;
|
||||||
if(!num) return ptr;
|
if (!num) return ptr;
|
||||||
return memset(ptr, value, num);
|
return memset(ptr, value, num);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1531,7 +1531,7 @@ inline void PutWord(bool assumeAligned, ByteOrder order, byte *block, T value, c
|
||||||
|
|
||||||
T t1, t2 = 0;
|
T t1, t2 = 0;
|
||||||
t1 = ConditionalByteReverse(order, value);
|
t1 = ConditionalByteReverse(order, value);
|
||||||
if(xorBlock) memmove(&t2, xorBlock, sizeof(T));
|
if (xorBlock) memmove(&t2, xorBlock, sizeof(T));
|
||||||
memmove(block, &(t1 ^= t2), sizeof(T));
|
memmove(block, &(t1 ^= t2), sizeof(T));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ void CFB_ModePolicy::TransformRegister()
|
||||||
m_cipher->ProcessBlock(m_register, m_temp);
|
m_cipher->ProcessBlock(m_register, m_temp);
|
||||||
const unsigned int updateSize = BlockSize()-m_feedbackSize;
|
const unsigned int updateSize = BlockSize()-m_feedbackSize;
|
||||||
|
|
||||||
if(updateSize)
|
if (updateSize)
|
||||||
memmove_s(m_register, m_register.size(), m_register+m_feedbackSize, updateSize);
|
memmove_s(m_register, m_register.size(), m_register+m_feedbackSize, updateSize);
|
||||||
memcpy_s(m_register+updateSize, m_register.size()-updateSize, m_temp, m_feedbackSize);
|
memcpy_s(m_register+updateSize, m_register.size()-updateSize, m_temp, m_feedbackSize);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
2
oaep.cpp
2
oaep.cpp
|
|
@ -87,7 +87,7 @@ DecodingResult OAEP_Base::Unpad(const byte *oaepBlock, size_t oaepBlockLen, byte
|
||||||
// DB = pHash' || 00 ... || 01 || M
|
// DB = pHash' || 00 ... || 01 || M
|
||||||
byte *M = std::find(maskedDB+hLen, maskedDB+dbLen, 0x01);
|
byte *M = std::find(maskedDB+hLen, maskedDB+dbLen, 0x01);
|
||||||
invalid = (M == maskedDB+dbLen) || invalid;
|
invalid = (M == maskedDB+dbLen) || invalid;
|
||||||
invalid = (std::find_if(maskedDB+hLen, M, std::bind2nd(std::not_equal_to<byte>(), byte(0))) != M) || invalid;
|
invalid = (std::find_if (maskedDB+hLen, M, std::bind2nd(std::not_equal_to<byte>(), byte(0))) != M) || invalid;
|
||||||
invalid = !pHash->VerifyDigest(maskedDB, encodingParameters.begin(), encodingParameters.size()) || invalid;
|
invalid = !pHash->VerifyDigest(maskedDB, encodingParameters.begin(), encodingParameters.size()) || invalid;
|
||||||
|
|
||||||
if (invalid)
|
if (invalid)
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ OS_RNG_Err::OS_RNG_Err(const std::string &operation)
|
||||||
|
|
||||||
MicrosoftCryptoProvider::MicrosoftCryptoProvider()
|
MicrosoftCryptoProvider::MicrosoftCryptoProvider()
|
||||||
{
|
{
|
||||||
if(!CryptAcquireContext(&m_hProvider, 0, 0, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT))
|
if (!CryptAcquireContext(&m_hProvider, 0, 0, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT))
|
||||||
throw OS_RNG_Err("CryptAcquireContext");
|
throw OS_RNG_Err("CryptAcquireContext");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
6
pssr.cpp
6
pssr.cpp
|
|
@ -78,7 +78,7 @@ void PSSR_MEM_Base::ComputeMessageRepresentative(RandomNumberGenerator &rng,
|
||||||
xorbuf(xorStart + 1, recoverableMessage, recoverableMessageLength);
|
xorbuf(xorStart + 1, recoverableMessage, recoverableMessageLength);
|
||||||
xorbuf(xorStart + 1 + recoverableMessageLength, salt, salt.size());
|
xorbuf(xorStart + 1 + recoverableMessageLength, salt, salt.size());
|
||||||
|
|
||||||
if(representative && hashIdentifier.first)
|
if (representative && hashIdentifier.first)
|
||||||
memcpy(representative + representativeByteLength - u, hashIdentifier.first, hashIdentifier.second);
|
memcpy(representative + representativeByteLength - u, hashIdentifier.first, hashIdentifier.second);
|
||||||
representative[representativeByteLength - 1] = hashIdentifier.second ? 0xcc : 0xbc;
|
representative[representativeByteLength - 1] = hashIdentifier.second ? 0xcc : 0xbc;
|
||||||
|
|
||||||
|
|
@ -115,13 +115,13 @@ DecodingResult PSSR_MEM_Base::RecoverMessageFromRepresentative(
|
||||||
|
|
||||||
// extract salt and recoverableMessage from DB = 00 ... || 01 || M || salt
|
// extract salt and recoverableMessage from DB = 00 ... || 01 || M || salt
|
||||||
byte *salt = representative + representativeByteLength - u - digestSize - saltSize;
|
byte *salt = representative + representativeByteLength - u - digestSize - saltSize;
|
||||||
byte *M = std::find_if(representative, salt-1, std::bind2nd(std::not_equal_to<byte>(), byte(0)));
|
byte *M = std::find_if (representative, salt-1, std::bind2nd(std::not_equal_to<byte>(), byte(0)));
|
||||||
recoverableMessageLength = salt-M-1;
|
recoverableMessageLength = salt-M-1;
|
||||||
if (*M == 0x01
|
if (*M == 0x01
|
||||||
&& (size_t)(M - representative - (representativeBitLength % 8 != 0)) >= MinPadLen(digestSize)
|
&& (size_t)(M - representative - (representativeBitLength % 8 != 0)) >= MinPadLen(digestSize)
|
||||||
&& recoverableMessageLength <= MaxRecoverableLength(representativeBitLength, hashIdentifier.second, digestSize))
|
&& recoverableMessageLength <= MaxRecoverableLength(representativeBitLength, hashIdentifier.second, digestSize))
|
||||||
{
|
{
|
||||||
if(recoverableMessage && M && recoverableMessageLength)
|
if (recoverableMessage && M && recoverableMessageLength)
|
||||||
memcpy(recoverableMessage, M+1, recoverableMessageLength);
|
memcpy(recoverableMessage, M+1, recoverableMessageLength);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ public:
|
||||||
|
|
||||||
inline size_t Put(const byte *begin, size_t length)
|
inline size_t Put(const byte *begin, size_t length)
|
||||||
{
|
{
|
||||||
if(!begin || !length) return length;
|
if (!begin || !length) return length;
|
||||||
size_t l = STDMIN(length, MaxSize()-m_tail);
|
size_t l = STDMIN(length, MaxSize()-m_tail);
|
||||||
if (buf+m_tail != begin)
|
if (buf+m_tail != begin)
|
||||||
memcpy(buf+m_tail, begin, l);
|
memcpy(buf+m_tail, begin, l);
|
||||||
|
|
@ -61,7 +61,7 @@ public:
|
||||||
|
|
||||||
inline size_t Peek(byte *target, size_t copyMax) const
|
inline size_t Peek(byte *target, size_t copyMax) const
|
||||||
{
|
{
|
||||||
if(!target || !copyMax) return 0;
|
if (!target || !copyMax) return 0;
|
||||||
size_t len = STDMIN(copyMax, m_tail-m_head);
|
size_t len = STDMIN(copyMax, m_tail-m_head);
|
||||||
memcpy(target, buf+m_head, len);
|
memcpy(target, buf+m_head, len);
|
||||||
return len;
|
return len;
|
||||||
|
|
@ -428,7 +428,7 @@ byte * ByteQueue::CreatePutSpace(size_t &size)
|
||||||
|
|
||||||
ByteQueue & ByteQueue::operator=(const ByteQueue &rhs)
|
ByteQueue & ByteQueue::operator=(const ByteQueue &rhs)
|
||||||
{
|
{
|
||||||
if(this == &rhs) return *this;
|
if (this == &rhs) return *this;
|
||||||
|
|
||||||
Destroy();
|
Destroy();
|
||||||
CopyFrom(rhs);
|
CopyFrom(rhs);
|
||||||
|
|
|
||||||
12
rw.cpp
12
rw.cpp
|
|
@ -124,7 +124,7 @@ void InvertibleRWFunction::PrecomputeTweakedRoots() const
|
||||||
{
|
{
|
||||||
ModularArithmetic modp(m_p), modq(m_q);
|
ModularArithmetic modp(m_p), modq(m_q);
|
||||||
|
|
||||||
#pragma omp parallel sections if(CRYPTOPP_RW_USE_OMP)
|
#pragma omp parallel sections if (CRYPTOPP_RW_USE_OMP)
|
||||||
{
|
{
|
||||||
#pragma omp section
|
#pragma omp section
|
||||||
m_pre_2_9p = modp.Exponentiate(2, (9 * m_p - 11)/8);
|
m_pre_2_9p = modp.Exponentiate(2, (9 * m_p - 11)/8);
|
||||||
|
|
@ -150,7 +150,7 @@ void InvertibleRWFunction::LoadPrecomputation(BufferedTransformation &bt)
|
||||||
|
|
||||||
void InvertibleRWFunction::SavePrecomputation(BufferedTransformation &bt) const
|
void InvertibleRWFunction::SavePrecomputation(BufferedTransformation &bt) const
|
||||||
{
|
{
|
||||||
if(!m_precompute)
|
if (!m_precompute)
|
||||||
Precompute();
|
Precompute();
|
||||||
|
|
||||||
DERSequenceEncoder seq(bt);
|
DERSequenceEncoder seq(bt);
|
||||||
|
|
@ -187,7 +187,7 @@ Integer InvertibleRWFunction::CalculateInverse(RandomNumberGenerator &rng, const
|
||||||
{
|
{
|
||||||
DoQuickSanityCheck();
|
DoQuickSanityCheck();
|
||||||
|
|
||||||
if(!m_precompute)
|
if (!m_precompute)
|
||||||
Precompute();
|
Precompute();
|
||||||
|
|
||||||
ModularArithmetic modn(m_n), modp(m_p), modq(m_q);
|
ModularArithmetic modn(m_n), modp(m_p), modq(m_q);
|
||||||
|
|
@ -210,19 +210,19 @@ Integer InvertibleRWFunction::CalculateInverse(RandomNumberGenerator &rng, const
|
||||||
Integer e, f;
|
Integer e, f;
|
||||||
|
|
||||||
const Integer U = modq.Exponentiate(h, (q+1)/8);
|
const Integer U = modq.Exponentiate(h, (q+1)/8);
|
||||||
if(((modq.Exponentiate(U, 4) - h) % q).IsZero())
|
if (((modq.Exponentiate(U, 4) - h) % q).IsZero())
|
||||||
e = Integer::One();
|
e = Integer::One();
|
||||||
else
|
else
|
||||||
e = -1;
|
e = -1;
|
||||||
|
|
||||||
const Integer eh = e*h, V = modp.Exponentiate(eh, (p-3)/8);
|
const Integer eh = e*h, V = modp.Exponentiate(eh, (p-3)/8);
|
||||||
if(((modp.Multiply(modp.Exponentiate(V, 4), modp.Exponentiate(eh, 2)) - eh) % p).IsZero())
|
if (((modp.Multiply(modp.Exponentiate(V, 4), modp.Exponentiate(eh, 2)) - eh) % p).IsZero())
|
||||||
f = Integer::One();
|
f = Integer::One();
|
||||||
else
|
else
|
||||||
f = 2;
|
f = 2;
|
||||||
|
|
||||||
Integer W, X;
|
Integer W, X;
|
||||||
#pragma omp parallel sections if(CRYPTOPP_RW_USE_OMP)
|
#pragma omp parallel sections if (CRYPTOPP_RW_USE_OMP)
|
||||||
{
|
{
|
||||||
#pragma omp section
|
#pragma omp section
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -114,7 +114,7 @@ public:
|
||||||
|
|
||||||
template <class T> value_ptr<T>& value_ptr<T>::operator=(const value_ptr<T>& rhs)
|
template <class T> value_ptr<T>& value_ptr<T>::operator=(const value_ptr<T>& rhs)
|
||||||
{
|
{
|
||||||
if(this != &rhs)
|
if (this != &rhs)
|
||||||
{
|
{
|
||||||
T *old_p = this->m_p;
|
T *old_p = this->m_p;
|
||||||
this->m_p = rhs.m_p ? new T(*rhs.m_p) : NULL;
|
this->m_p = rhs.m_p ? new T(*rhs.m_p) : NULL;
|
||||||
|
|
@ -138,7 +138,7 @@ public:
|
||||||
|
|
||||||
template <class T> clonable_ptr<T>& clonable_ptr<T>::operator=(const clonable_ptr<T>& rhs)
|
template <class T> clonable_ptr<T>& clonable_ptr<T>::operator=(const clonable_ptr<T>& rhs)
|
||||||
{
|
{
|
||||||
if(this != &rhs)
|
if (this != &rhs)
|
||||||
{
|
{
|
||||||
T *old_p = this->m_p;
|
T *old_p = this->m_p;
|
||||||
this->m_p = rhs.m_p ? rhs.m_p->Clone() : NULL;
|
this->m_p = rhs.m_p ? rhs.m_p->Clone() : NULL;
|
||||||
|
|
@ -225,7 +225,7 @@ template <class T> T* counted_ptr<T>::get()
|
||||||
|
|
||||||
template <class T> counted_ptr<T> & counted_ptr<T>::operator=(const counted_ptr<T>& rhs)
|
template <class T> counted_ptr<T> & counted_ptr<T>::operator=(const counted_ptr<T>& rhs)
|
||||||
{
|
{
|
||||||
if(this == &rhs) { return *this; }
|
if (this == &rhs) { return *this; }
|
||||||
|
|
||||||
if (m_p != rhs.m_p)
|
if (m_p != rhs.m_p)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
2
trap.h
2
trap.h
|
|
@ -23,7 +23,7 @@
|
||||||
// Linux and Unix
|
// Linux and Unix
|
||||||
#if !defined(NDEBUG) && defined(CRYPTOPP_UNIX_AVAILABLE)
|
#if !defined(NDEBUG) && defined(CRYPTOPP_UNIX_AVAILABLE)
|
||||||
# define CRYPTOPP_ASSERT(exp) { \
|
# define CRYPTOPP_ASSERT(exp) { \
|
||||||
if(!(exp)) { \
|
if (!(exp)) { \
|
||||||
std::ostringstream oss; \
|
std::ostringstream oss; \
|
||||||
oss << "Assertion failed: " << (char*)(__FILE__) << "(" \
|
oss << "Assertion failed: " << (char*)(__FILE__) << "(" \
|
||||||
<< (int)(__LINE__) << "): " << (char*)(__func__) \
|
<< (int)(__LINE__) << "): " << (char*)(__func__) \
|
||||||
|
|
|
||||||
12
validat0.cpp
12
validat0.cpp
|
|
@ -337,14 +337,14 @@ bool TestConversion()
|
||||||
signed int v; bool p = true;
|
signed int v; bool p = true;
|
||||||
{
|
{
|
||||||
// Guard i686 collision of type sizes
|
// Guard i686 collision of type sizes
|
||||||
if(sizeof(signed int) != sizeof(signed long))
|
if (sizeof(signed int) != sizeof(signed long))
|
||||||
{
|
{
|
||||||
signed long v1 = std::numeric_limits<signed long>::min(); p = !SafeConvert(v1, v) && p;
|
signed long v1 = std::numeric_limits<signed long>::min(); p = !SafeConvert(v1, v) && p;
|
||||||
signed long v2 = std::numeric_limits<signed long>::max(); p = !SafeConvert(v2, v) && p;
|
signed long v2 = std::numeric_limits<signed long>::max(); p = !SafeConvert(v2, v) && p;
|
||||||
unsigned long v3 = std::numeric_limits<unsigned long>::max(); p = !SafeConvert(v3, v) && p;
|
unsigned long v3 = std::numeric_limits<unsigned long>::max(); p = !SafeConvert(v3, v) && p;
|
||||||
}
|
}
|
||||||
// Guard i686 collision of type sizes
|
// Guard i686 collision of type sizes
|
||||||
if(sizeof(signed int) != sizeof(signed long long))
|
if (sizeof(signed int) != sizeof(signed long long))
|
||||||
{
|
{
|
||||||
signed long long v1 = std::numeric_limits<signed long long>::min(); p = !SafeConvert(v1, v) && p;
|
signed long long v1 = std::numeric_limits<signed long long>::min(); p = !SafeConvert(v1, v) && p;
|
||||||
signed long long v2 = std::numeric_limits<signed long long>::max(); p = !SafeConvert(v2, v) && p;
|
signed long long v2 = std::numeric_limits<signed long long>::max(); p = !SafeConvert(v2, v) && p;
|
||||||
|
|
@ -373,12 +373,12 @@ bool TestConversion()
|
||||||
unsigned int v; bool p = true;
|
unsigned int v; bool p = true;
|
||||||
{
|
{
|
||||||
// Guard i686 collision of type sizes
|
// Guard i686 collision of type sizes
|
||||||
if(sizeof(unsigned int) != sizeof(unsigned long))
|
if (sizeof(unsigned int) != sizeof(unsigned long))
|
||||||
{
|
{
|
||||||
unsigned long v1 = std::numeric_limits<unsigned long>::max(); p = !SafeConvert(v1, v) && p;
|
unsigned long v1 = std::numeric_limits<unsigned long>::max(); p = !SafeConvert(v1, v) && p;
|
||||||
}
|
}
|
||||||
// Guard i686 collision of type sizes
|
// Guard i686 collision of type sizes
|
||||||
if(sizeof(unsigned int) != sizeof(unsigned long long))
|
if (sizeof(unsigned int) != sizeof(unsigned long long))
|
||||||
{
|
{
|
||||||
unsigned long long v1 = std::numeric_limits<unsigned long long>::max(); p = !SafeConvert(v1, v) && p;
|
unsigned long long v1 = std::numeric_limits<unsigned long long>::max(); p = !SafeConvert(v1, v) && p;
|
||||||
}
|
}
|
||||||
|
|
@ -406,7 +406,7 @@ bool TestConversion()
|
||||||
/********** signed long overflow **********/
|
/********** signed long overflow **********/
|
||||||
{
|
{
|
||||||
// Guard x86_64 collision of type sizes
|
// Guard x86_64 collision of type sizes
|
||||||
if(sizeof(signed long) != sizeof(signed long long))
|
if (sizeof(signed long) != sizeof(signed long long))
|
||||||
{
|
{
|
||||||
signed long v; bool p = true;
|
signed long v; bool p = true;
|
||||||
{
|
{
|
||||||
|
|
@ -439,7 +439,7 @@ bool TestConversion()
|
||||||
/********** unsigned long overflow **********/
|
/********** unsigned long overflow **********/
|
||||||
{
|
{
|
||||||
// Guard x86_64 collision of type sizes
|
// Guard x86_64 collision of type sizes
|
||||||
if(sizeof(unsigned long) != sizeof(unsigned long long))
|
if (sizeof(unsigned long) != sizeof(unsigned long long))
|
||||||
{
|
{
|
||||||
unsigned long v; bool p = true;
|
unsigned long v; bool p = true;
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -668,11 +668,11 @@ void Deflator::EncodeBlock(bool eof, unsigned int blockType)
|
||||||
m_literalCounts[256] = 1;
|
m_literalCounts[256] = 1;
|
||||||
HuffmanEncoder::GenerateCodeLengths(literalCodeLengths, 15, m_literalCounts, 286);
|
HuffmanEncoder::GenerateCodeLengths(literalCodeLengths, 15, m_literalCounts, 286);
|
||||||
m_dynamicLiteralEncoder.Initialize(literalCodeLengths, 286);
|
m_dynamicLiteralEncoder.Initialize(literalCodeLengths, 286);
|
||||||
unsigned int hlit = (unsigned int)(find_if(RevIt(literalCodeLengths.end()), RevIt(literalCodeLengths.begin()+257), bind2nd(not_equal_to<unsigned int>(), 0)).base() - (literalCodeLengths.begin()+257));
|
unsigned int hlit = (unsigned int)(find_if (RevIt(literalCodeLengths.end()), RevIt(literalCodeLengths.begin()+257), bind2nd(not_equal_to<unsigned int>(), 0)).base() - (literalCodeLengths.begin()+257));
|
||||||
|
|
||||||
HuffmanEncoder::GenerateCodeLengths(distanceCodeLengths, 15, m_distanceCounts, 30);
|
HuffmanEncoder::GenerateCodeLengths(distanceCodeLengths, 15, m_distanceCounts, 30);
|
||||||
m_dynamicDistanceEncoder.Initialize(distanceCodeLengths, 30);
|
m_dynamicDistanceEncoder.Initialize(distanceCodeLengths, 30);
|
||||||
unsigned int hdist = (unsigned int)(find_if(RevIt(distanceCodeLengths.end()), RevIt(distanceCodeLengths.begin()+1), bind2nd(not_equal_to<unsigned int>(), 0)).base() - (distanceCodeLengths.begin()+1));
|
unsigned int hdist = (unsigned int)(find_if (RevIt(distanceCodeLengths.end()), RevIt(distanceCodeLengths.begin()+1), bind2nd(not_equal_to<unsigned int>(), 0)).base() - (distanceCodeLengths.begin()+1));
|
||||||
|
|
||||||
SecBlockWithHint<unsigned int, 286+30> combinedLengths(hlit+257+hdist+1);
|
SecBlockWithHint<unsigned int, 286+30> combinedLengths(hlit+257+hdist+1);
|
||||||
memcpy(combinedLengths, literalCodeLengths, (hlit+257)*sizeof(unsigned int));
|
memcpy(combinedLengths, literalCodeLengths, (hlit+257)*sizeof(unsigned int));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue