Cut-in CRYPTOPP_ASSERT in all remaining header and source files
parent
7b64ca489a
commit
b7de164d62
|
|
@ -47,8 +47,8 @@ void Adler32::Update(const byte *input, size_t length)
|
|||
s2 %= BASE;
|
||||
}
|
||||
|
||||
assert(s1 < BASE);
|
||||
assert(s2 < BASE);
|
||||
CRYPTOPP_ASSERT(s1 < BASE);
|
||||
CRYPTOPP_ASSERT(s2 < BASE);
|
||||
|
||||
m_s1 = (word16)s1;
|
||||
m_s2 = (word16)s2;
|
||||
|
|
|
|||
|
|
@ -263,7 +263,7 @@ void AbstractGroup<T>::SimultaneousMultiply(T *results, const T &base, const Int
|
|||
|
||||
for (i=0; i<expCount; i++)
|
||||
{
|
||||
assert(expBegin->NotNegative());
|
||||
CRYPTOPP_ASSERT(expBegin->NotNegative());
|
||||
exponents.push_back(WindowSlider(*expBegin++, InversionIsFast(), 0));
|
||||
exponents[i].FindNextWindow();
|
||||
buckets[i].resize(1<<(exponents[i].m_windowSize-1), Identity());
|
||||
|
|
|
|||
2
asn.cpp
2
asn.cpp
|
|
@ -246,7 +246,7 @@ size_t OID::DecodeValue(BufferedTransformation &bt, word32 &v)
|
|||
|
||||
void OID::DEREncode(BufferedTransformation &bt) const
|
||||
{
|
||||
assert(m_values.size() >= 2);
|
||||
CRYPTOPP_ASSERT(m_values.size() >= 2);
|
||||
ByteQueue temp;
|
||||
temp.Put(byte(m_values[0] * 40 + m_values[1]));
|
||||
for (size_t i=2; i<m_values.size(); i++)
|
||||
|
|
|
|||
4
asn.h
4
asn.h
|
|
@ -134,7 +134,7 @@ public:
|
|||
~BERGeneralDecoder();
|
||||
|
||||
bool IsDefiniteLength() const {return m_definiteLength;}
|
||||
lword RemainingLength() const {assert(m_definiteLength); return m_length;}
|
||||
lword RemainingLength() const {CRYPTOPP_ASSERT(m_definiteLength); return m_length;}
|
||||
bool EndReached() const;
|
||||
byte PeekByte() const;
|
||||
void CheckByte(byte b);
|
||||
|
|
@ -152,7 +152,7 @@ protected:
|
|||
|
||||
private:
|
||||
void Init(byte asnTag);
|
||||
void StoreInitialize(const NameValuePairs ¶meters) {assert(false);}
|
||||
void StoreInitialize(const NameValuePairs ¶meters) {CRYPTOPP_ASSERT(false);}
|
||||
lword ReduceLength(lword delta);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ void AuthenticatedSymmetricCipherBase::Update(const byte *input, size_t length)
|
|||
m_totalFooterLength += length;
|
||||
break;
|
||||
default:
|
||||
assert(false);
|
||||
CRYPTOPP_ASSERT(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -130,7 +130,7 @@ reswitch:
|
|||
AuthenticateData(outString, length);
|
||||
break;
|
||||
default:
|
||||
assert(false);
|
||||
CRYPTOPP_ASSERT(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -170,7 +170,7 @@ void AuthenticatedSymmetricCipherBase::TruncatedFinal(byte *mac, size_t macSize)
|
|||
break;
|
||||
|
||||
default:
|
||||
assert(false);
|
||||
CRYPTOPP_ASSERT(false);
|
||||
}
|
||||
|
||||
m_state = State_KeySet;
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ public:
|
|||
|
||||
bool IsRandomAccess() const {return false;}
|
||||
bool IsSelfInverting() const {return true;}
|
||||
void UncheckedSetKey(const byte *,unsigned int,const CryptoPP::NameValuePairs &) {assert(false);}
|
||||
void UncheckedSetKey(const byte *,unsigned int,const CryptoPP::NameValuePairs &) {CRYPTOPP_ASSERT(false);}
|
||||
|
||||
void SetKey(const byte *userKey, size_t keylength, const NameValuePairs ¶ms);
|
||||
void Restart() {if (m_state > State_KeySet) m_state = State_KeySet;}
|
||||
|
|
|
|||
12
basecode.cpp
12
basecode.cpp
|
|
@ -54,7 +54,7 @@ size_t BaseN_Encoder::Put2(const byte *begin, size_t length, int messageEnd, boo
|
|||
unsigned int b = begin[m_inputPosition++], bitsLeftInSource = 8;
|
||||
while (true)
|
||||
{
|
||||
assert(m_bitPos < m_bitsPerChar);
|
||||
CRYPTOPP_ASSERT(m_bitPos < m_bitsPerChar);
|
||||
unsigned int bitsLeftInTarget = m_bitsPerChar-m_bitPos;
|
||||
m_outBuf[m_bytePos] |= b >> (8-bitsLeftInTarget);
|
||||
if (bitsLeftInSource >= bitsLeftInTarget)
|
||||
|
|
@ -75,13 +75,13 @@ size_t BaseN_Encoder::Put2(const byte *begin, size_t length, int messageEnd, boo
|
|||
}
|
||||
}
|
||||
|
||||
assert(m_bytePos <= m_outputBlockSize);
|
||||
CRYPTOPP_ASSERT(m_bytePos <= m_outputBlockSize);
|
||||
if (m_bytePos == m_outputBlockSize)
|
||||
{
|
||||
int i;
|
||||
for (i=0; i<m_bytePos; i++)
|
||||
{
|
||||
assert(m_outBuf[i] < (1 << m_bitsPerChar));
|
||||
CRYPTOPP_ASSERT(m_outBuf[i] < (1 << m_bitsPerChar));
|
||||
m_outBuf[i] = m_alphabet[m_outBuf[i]];
|
||||
}
|
||||
FILTER_OUTPUT(1, m_outBuf, m_outputBlockSize, 0);
|
||||
|
|
@ -180,14 +180,14 @@ void BaseN_Decoder::InitializeDecodingLookupArray(int *lookup, const byte *alpha
|
|||
{
|
||||
if (caseInsensitive && isalpha(alphabet[i]))
|
||||
{
|
||||
assert(lookup[toupper(alphabet[i])] == -1);
|
||||
CRYPTOPP_ASSERT(lookup[toupper(alphabet[i])] == -1);
|
||||
lookup[toupper(alphabet[i])] = i;
|
||||
assert(lookup[tolower(alphabet[i])] == -1);
|
||||
CRYPTOPP_ASSERT(lookup[tolower(alphabet[i])] == -1);
|
||||
lookup[tolower(alphabet[i])] = i;
|
||||
}
|
||||
else
|
||||
{
|
||||
assert(lookup[alphabet[i]] == -1);
|
||||
CRYPTOPP_ASSERT(lookup[alphabet[i]] == -1);
|
||||
lookup[alphabet[i]] = i;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
2
cast.cpp
2
cast.cpp
|
|
@ -283,7 +283,7 @@ void CAST256::Base::UncheckedSetKey(const byte *userKey, unsigned int keylength,
|
|||
int i1=8*j+i;
|
||||
int i2=8*(11-j)+i;
|
||||
|
||||
assert(i1<i2);
|
||||
CRYPTOPP_ASSERT(i1<i2);
|
||||
|
||||
std::swap(K[i1],K[i2]);
|
||||
std::swap(K[i1+4],K[i2+4]);
|
||||
|
|
|
|||
4
ccm.cpp
4
ccm.cpp
|
|
@ -31,7 +31,7 @@ void CCM_Base::Resync(const byte *iv, size_t len)
|
|||
BlockCipher &cipher = AccessBlockCipher();
|
||||
|
||||
m_L = REQUIRED_BLOCKSIZE-1-(int)len;
|
||||
assert(m_L >= 2);
|
||||
CRYPTOPP_ASSERT(m_L >= 2);
|
||||
if (m_L > 8)
|
||||
m_L = 8;
|
||||
|
||||
|
|
@ -67,7 +67,7 @@ void CCM_Base::UncheckedSpecifyDataLengths(lword headerLength, lword messageLeng
|
|||
|
||||
if (headerLength>0)
|
||||
{
|
||||
assert(m_bufferedDataLength == 0);
|
||||
CRYPTOPP_ASSERT(m_bufferedDataLength == 0);
|
||||
|
||||
if (headerLength < ((1<<16) - (1<<8)))
|
||||
{
|
||||
|
|
|
|||
6
cmac.cpp
6
cmac.cpp
|
|
@ -81,7 +81,7 @@ void CMAC_Base::Update(const byte *input, size_t length)
|
|||
|
||||
if (length > blockSize)
|
||||
{
|
||||
assert(m_counter == 0);
|
||||
CRYPTOPP_ASSERT(m_counter == 0);
|
||||
size_t leftOver = 1 + cipher.AdvancedProcessBlocks(m_reg, input, m_reg, length-1, BlockTransformation::BT_DontIncrementInOutPointers|BlockTransformation::BT_XorInput);
|
||||
input += (length - leftOver);
|
||||
length = leftOver;
|
||||
|
|
@ -89,12 +89,12 @@ void CMAC_Base::Update(const byte *input, size_t length)
|
|||
|
||||
if (length > 0)
|
||||
{
|
||||
assert(m_counter + length <= blockSize);
|
||||
CRYPTOPP_ASSERT(m_counter + length <= blockSize);
|
||||
xorbuf(m_reg+m_counter, input, length);
|
||||
m_counter += (unsigned int)length;
|
||||
}
|
||||
|
||||
assert(m_counter > 0);
|
||||
CRYPTOPP_ASSERT(m_counter > 0);
|
||||
}
|
||||
|
||||
void CMAC_Base::TruncatedFinal(byte *mac, size_t size)
|
||||
|
|
|
|||
18
cryptlib.cpp
18
cryptlib.cpp
|
|
@ -153,7 +153,7 @@ size_t BlockTransformation::AdvancedProcessBlocks(const byte *inBlocks, const by
|
|||
|
||||
if (flags & BT_ReverseDirection)
|
||||
{
|
||||
assert(length % blockSize == 0);
|
||||
CRYPTOPP_ASSERT(length % blockSize == 0);
|
||||
inBlocks += length - blockSize;
|
||||
xorBlocks += length - blockSize;
|
||||
outBlocks += length - blockSize;
|
||||
|
|
@ -199,7 +199,7 @@ unsigned int HashTransformation::OptimalDataAlignment() const
|
|||
|
||||
void StreamTransformation::ProcessLastBlock(byte *outString, const byte *inString, size_t length)
|
||||
{
|
||||
assert(MinLastBlockSize() == 0); // this function should be overriden otherwise
|
||||
CRYPTOPP_ASSERT(MinLastBlockSize() == 0); // this function should be overriden otherwise
|
||||
|
||||
if (length == MandatoryBlockSize())
|
||||
ProcessData(outString, inString, length);
|
||||
|
|
@ -333,19 +333,19 @@ void BufferedTransformation::GetWaitObjects(WaitObjectContainer &container, Call
|
|||
|
||||
void BufferedTransformation::Initialize(const NameValuePairs ¶meters, int propagation)
|
||||
{
|
||||
assert(!AttachedTransformation());
|
||||
CRYPTOPP_ASSERT(!AttachedTransformation());
|
||||
IsolatedInitialize(parameters);
|
||||
}
|
||||
|
||||
bool BufferedTransformation::Flush(bool hardFlush, int propagation, bool blocking)
|
||||
{
|
||||
assert(!AttachedTransformation());
|
||||
CRYPTOPP_ASSERT(!AttachedTransformation());
|
||||
return IsolatedFlush(hardFlush, blocking);
|
||||
}
|
||||
|
||||
bool BufferedTransformation::MessageSeriesEnd(int propagation, bool blocking)
|
||||
{
|
||||
assert(!AttachedTransformation());
|
||||
CRYPTOPP_ASSERT(!AttachedTransformation());
|
||||
return IsolatedMessageSeriesEnd(blocking);
|
||||
}
|
||||
|
||||
|
|
@ -484,7 +484,7 @@ bool BufferedTransformation::GetNextMessage()
|
|||
return AttachedTransformation()->GetNextMessage();
|
||||
else
|
||||
{
|
||||
assert(!AnyMessages());
|
||||
CRYPTOPP_ASSERT(!AnyMessages());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -521,7 +521,7 @@ size_t BufferedTransformation::TransferMessagesTo2(BufferedTransformation &targe
|
|||
return 1;
|
||||
|
||||
bool result = GetNextMessage();
|
||||
assert(result);
|
||||
CRYPTOPP_ASSERT(result);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -552,7 +552,7 @@ size_t BufferedTransformation::TransferAllTo2(BufferedTransformation &target, co
|
|||
return AttachedTransformation()->TransferAllTo2(target, channel, blocking);
|
||||
else
|
||||
{
|
||||
assert(!NumberOfMessageSeries());
|
||||
CRYPTOPP_ASSERT(!NumberOfMessageSeries());
|
||||
|
||||
unsigned int messageCount;
|
||||
do
|
||||
|
|
@ -584,7 +584,7 @@ void BufferedTransformation::CopyAllTo(BufferedTransformation &target, const std
|
|||
AttachedTransformation()->CopyAllTo(target, channel);
|
||||
else
|
||||
{
|
||||
assert(!NumberOfMessageSeries());
|
||||
CRYPTOPP_ASSERT(!NumberOfMessageSeries());
|
||||
while (CopyMessagesTo(target, UINT_MAX, channel)) {}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
14
cryptlib.h
14
cryptlib.h
|
|
@ -448,7 +448,7 @@ protected:
|
|||
size_t ThrowIfInvalidIVLength(int size);
|
||||
const byte * GetIVAndThrowIfInvalid(const NameValuePairs ¶ms, size_t &size);
|
||||
inline void AssertValidKeyLength(size_t length) const
|
||||
{assert(IsValidKeyLength(length));}
|
||||
{CRYPTOPP_ASSERT(IsValidKeyLength(length));}
|
||||
};
|
||||
|
||||
//! interface for the data processing part of block ciphers
|
||||
|
|
@ -542,7 +542,7 @@ public:
|
|||
//! for random access ciphers, seek to an absolute position
|
||||
virtual void Seek(lword n)
|
||||
{
|
||||
assert(!IsRandomAccess());
|
||||
CRYPTOPP_ASSERT(!IsRandomAccess());
|
||||
throw NotImplemented("StreamTransformation: this object doesn't support random access");
|
||||
}
|
||||
|
||||
|
|
@ -1040,13 +1040,13 @@ public:
|
|||
//! returns whether this object allows attachment
|
||||
virtual bool Attachable() {return false;}
|
||||
//! returns the object immediately attached to this object or NULL for no attachment
|
||||
virtual BufferedTransformation *AttachedTransformation() {assert(!Attachable()); return 0;}
|
||||
virtual BufferedTransformation *AttachedTransformation() {CRYPTOPP_ASSERT(!Attachable()); return 0;}
|
||||
//!
|
||||
virtual const BufferedTransformation *AttachedTransformation() const
|
||||
{return const_cast<BufferedTransformation *>(this)->AttachedTransformation();}
|
||||
//! delete the current attachment chain and replace it with newAttachment
|
||||
virtual void Detach(BufferedTransformation *newAttachment = 0)
|
||||
{assert(!Attachable()); throw NotImplemented("BufferedTransformation: this object is not attachable");}
|
||||
{CRYPTOPP_ASSERT(!Attachable()); throw NotImplemented("BufferedTransformation: this object is not attachable");}
|
||||
//! add newAttachment to the end of attachment chain
|
||||
virtual void Attach(BufferedTransformation *newAttachment);
|
||||
//@}
|
||||
|
|
@ -1111,13 +1111,13 @@ public:
|
|||
typically it means calculate a table of n objects
|
||||
that can be used later to speed up computation. */
|
||||
virtual void Precompute(unsigned int n)
|
||||
{assert(!SupportsPrecomputation()); throw NotImplemented("CryptoMaterial: this object does not support precomputation");}
|
||||
{CRYPTOPP_ASSERT(!SupportsPrecomputation()); throw NotImplemented("CryptoMaterial: this object does not support precomputation");}
|
||||
//! retrieve previously saved precomputation
|
||||
virtual void LoadPrecomputation(BufferedTransformation &storedPrecomputation)
|
||||
{assert(!SupportsPrecomputation()); throw NotImplemented("CryptoMaterial: this object does not support precomputation");}
|
||||
{CRYPTOPP_ASSERT(!SupportsPrecomputation()); throw NotImplemented("CryptoMaterial: this object does not support precomputation");}
|
||||
//! save precomputation for later use
|
||||
virtual void SavePrecomputation(BufferedTransformation &storedPrecomputation) const
|
||||
{assert(!SupportsPrecomputation()); throw NotImplemented("CryptoMaterial: this object does not support precomputation");}
|
||||
{CRYPTOPP_ASSERT(!SupportsPrecomputation()); throw NotImplemented("CryptoMaterial: this object does not support precomputation");}
|
||||
|
||||
// for internal library use
|
||||
void DoQuickSanityCheck() const {ThrowIfInvalid(NullRNG(), 0);}
|
||||
|
|
|
|||
14
datatest.cpp
14
datatest.cpp
|
|
@ -264,17 +264,17 @@ void TestSignatureScheme(TestData &v)
|
|||
else if (test == "DeterministicSign")
|
||||
{
|
||||
SignalTestError();
|
||||
assert(false); // TODO: implement
|
||||
CRYPTOPP_ASSERT(false); // TODO: implement
|
||||
}
|
||||
else if (test == "RandomSign")
|
||||
{
|
||||
SignalTestError();
|
||||
assert(false); // TODO: implement
|
||||
CRYPTOPP_ASSERT(false); // TODO: implement
|
||||
}
|
||||
else
|
||||
{
|
||||
SignalTestError();
|
||||
assert(false);
|
||||
CRYPTOPP_ASSERT(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -314,7 +314,7 @@ void TestAsymmetricCipher(TestData &v)
|
|||
else
|
||||
{
|
||||
SignalTestError();
|
||||
assert(false);
|
||||
CRYPTOPP_ASSERT(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -412,7 +412,7 @@ void TestSymmetricCipher(TestData &v, const NameValuePairs &overrideParameters)
|
|||
while (ss.Pump(64)) {}
|
||||
ss.PumpAll();
|
||||
for (int i=0; i<z.length(); i++)
|
||||
assert(encrypted[i] == z[i]);
|
||||
CRYPTOPP_ASSERT(encrypted[i] == z[i]);
|
||||
}*/
|
||||
if (test != "EncryptXorDigest")
|
||||
ciphertext = GetDecodedDatum(v, "Ciphertext");
|
||||
|
|
@ -577,7 +577,7 @@ void TestDigestOrMAC(TestData &v, bool testDigest)
|
|||
else
|
||||
{
|
||||
SignalTestError();
|
||||
assert(false);
|
||||
CRYPTOPP_ASSERT(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -641,7 +641,7 @@ void OutputPair(const NameValuePairs &v, const char *name)
|
|||
{
|
||||
Integer x;
|
||||
bool b = v.GetValue(name, x);
|
||||
assert(b); CRYPTOPP_UNUSED(b);
|
||||
CRYPTOPP_ASSERT(b); CRYPTOPP_UNUSED(b);
|
||||
cout << name << ": \\\n ";
|
||||
x.Encode(HexEncoder(new FileSink(cout), false, 64, "\\\n ").Ref(), x.MinEncodedSize());
|
||||
cout << endl;
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ void FIPS140_SampleApplication()
|
|||
// sign and verify
|
||||
byte signature[40];
|
||||
DSA::Signer signer(dsaPrivateKey);
|
||||
assert(signer.SignatureLength() == 40);
|
||||
CRYPTOPP_ASSERT(signer.SignatureLength() == 40);
|
||||
signer.SignMessage(rng, message, 3, signature);
|
||||
|
||||
DSA::Verifier verifier(dsaPublicKey);
|
||||
|
|
|
|||
4
eax.cpp
4
eax.cpp
|
|
@ -35,7 +35,7 @@ size_t EAX_Base::AuthenticateBlocks(const byte *data, size_t len)
|
|||
|
||||
void EAX_Base::AuthenticateLastHeaderBlock()
|
||||
{
|
||||
assert(m_bufferedDataLength == 0);
|
||||
CRYPTOPP_ASSERT(m_bufferedDataLength == 0);
|
||||
MessageAuthenticationCode &mac = AccessMAC();
|
||||
unsigned int blockSize = mac.TagSize();
|
||||
|
||||
|
|
@ -49,7 +49,7 @@ void EAX_Base::AuthenticateLastHeaderBlock()
|
|||
|
||||
void EAX_Base::AuthenticateLastFooterBlock(byte *tag, size_t macSize)
|
||||
{
|
||||
assert(m_bufferedDataLength == 0);
|
||||
CRYPTOPP_ASSERT(m_bufferedDataLength == 0);
|
||||
MessageAuthenticationCode &mac = AccessMAC();
|
||||
unsigned int blockSize = mac.TagSize();
|
||||
|
||||
|
|
|
|||
8
ec2n.cpp
8
ec2n.cpp
|
|
@ -71,11 +71,11 @@ bool EC2N::DecodePoint(EC2N::Point &P, BufferedTransformation &bt, size_t encode
|
|||
}
|
||||
|
||||
FieldElement z = m_field->Square(P.x);
|
||||
assert(P.x == m_field->SquareRoot(z));
|
||||
CRYPTOPP_ASSERT(P.x == m_field->SquareRoot(z));
|
||||
P.y = m_field->Divide(m_field->Add(m_field->Multiply(z, m_field->Add(P.x, m_a)), m_b), z);
|
||||
assert(P.x == m_field->Subtract(m_field->Divide(m_field->Subtract(m_field->Multiply(P.y, z), m_b), z), m_a));
|
||||
CRYPTOPP_ASSERT(P.x == m_field->Subtract(m_field->Divide(m_field->Subtract(m_field->Multiply(P.y, z), m_b), z), m_a));
|
||||
z = m_field->SolveQuadraticEquation(P.y);
|
||||
assert(m_field->Add(m_field->Square(z), z) == P.y);
|
||||
CRYPTOPP_ASSERT(m_field->Add(m_field->Square(z), z) == P.y);
|
||||
z.SetCoefficient(0, type & 1);
|
||||
|
||||
P.y = m_field->Multiply(z, P.x);
|
||||
|
|
@ -119,7 +119,7 @@ void EC2N::EncodePoint(byte *encodedPoint, const Point &P, bool compressed) cons
|
|||
{
|
||||
ArraySink sink(encodedPoint, EncodedPointSize(compressed));
|
||||
EncodePoint(sink, P, compressed);
|
||||
assert(sink.TotalPutLength() == EncodedPointSize(compressed));
|
||||
CRYPTOPP_ASSERT(sink.TotalPutLength() == EncodedPointSize(compressed));
|
||||
}
|
||||
|
||||
EC2N::Point EC2N::BERDecodePoint(BufferedTransformation &bt) const
|
||||
|
|
|
|||
|
|
@ -447,7 +447,7 @@ template <class EC> void DL_GroupParameters_EC<EC>::Initialize(const OID &oid)
|
|||
Element G;
|
||||
bool result = GetCurve().DecodePoint(G, ssG, (size_t)ssG.MaxRetrievable());
|
||||
this->SetSubgroupGenerator(G);
|
||||
assert(result); CRYPTOPP_UNUSED(result);
|
||||
CRYPTOPP_ASSERT(result); CRYPTOPP_UNUSED(result);
|
||||
|
||||
StringSource ssN(param.n, true, new HexDecoder);
|
||||
m_n.Decode(ssN, (size_t)ssN.MaxRetrievable());
|
||||
|
|
|
|||
4
ecp.cpp
4
ecp.cpp
|
|
@ -139,7 +139,7 @@ void ECP::EncodePoint(byte *encodedPoint, const Point &P, bool compressed) const
|
|||
{
|
||||
ArraySink sink(encodedPoint, EncodedPointSize(compressed));
|
||||
EncodePoint(sink, P, compressed);
|
||||
assert(sink.TotalPutLength() == EncodedPointSize(compressed));
|
||||
CRYPTOPP_ASSERT(sink.TotalPutLength() == EncodedPointSize(compressed));
|
||||
}
|
||||
|
||||
ECP::Point ECP::BERDecodePoint(BufferedTransformation &bt) const
|
||||
|
|
@ -382,7 +382,7 @@ void ECP::SimultaneousMultiply(ECP::Point *results, const ECP::Point &P, const I
|
|||
|
||||
for (i=0; i<expCount; i++)
|
||||
{
|
||||
assert(expBegin->NotNegative());
|
||||
CRYPTOPP_ASSERT(expBegin->NotNegative());
|
||||
exponents.push_back(WindowSlider(*expBegin++, InversionIsFast(), 5));
|
||||
exponents[i].FindNextWindow();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ void EMSA2Pad::ComputeMessageRepresentative(RandomNumberGenerator &rng,
|
|||
HashTransformation &hash, HashIdentifier hashIdentifier, bool messageEmpty,
|
||||
byte *representative, size_t representativeBitLength) const
|
||||
{
|
||||
assert(representativeBitLength >= MinRepresentativeBitLength(hashIdentifier.second, hash.DigestSize()));
|
||||
CRYPTOPP_ASSERT(representativeBitLength >= MinRepresentativeBitLength(hashIdentifier.second, hash.DigestSize()));
|
||||
|
||||
if (representativeBitLength % 8 != 7)
|
||||
throw PK_SignatureScheme::InvalidKeyLength("EMSA2: EMSA2 requires a key length that is a multiple of 8");
|
||||
|
|
|
|||
|
|
@ -26,8 +26,8 @@ template <class T> void DL_FixedBasePrecomputationImpl<T>::SetBase(const DL_Grou
|
|||
|
||||
template <class T> void DL_FixedBasePrecomputationImpl<T>::Precompute(const DL_GroupPrecomputation<Element> &group, unsigned int maxExpBits, unsigned int storage)
|
||||
{
|
||||
assert(m_bases.size() > 0);
|
||||
assert(storage <= maxExpBits);
|
||||
CRYPTOPP_ASSERT(m_bases.size() > 0);
|
||||
CRYPTOPP_ASSERT(storage <= maxExpBits);
|
||||
|
||||
if (storage > 1)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ void InvertibleESIGNFunction::GenerateRandom(RandomNumberGenerator &rng, const N
|
|||
|
||||
m_n = m_p * m_p * m_q;
|
||||
|
||||
assert(m_n.BitCount() == modulusSize);
|
||||
CRYPTOPP_ASSERT(m_n.BitCount() == modulusSize);
|
||||
}
|
||||
|
||||
void InvertibleESIGNFunction::BERDecode(BufferedTransformation &bt)
|
||||
|
|
@ -164,7 +164,7 @@ Integer InvertibleESIGNFunction::CalculateRandomizedInverse(RandomNumberGenerato
|
|||
ModularArithmetic modp(m_p);
|
||||
Integer t = modp.Divide(w0 * r % m_p, m_e * re % m_p);
|
||||
Integer s = r + t*pq;
|
||||
assert(s < m_n);
|
||||
CRYPTOPP_ASSERT(s < m_n);
|
||||
/*
|
||||
using namespace std;
|
||||
cout << "f = " << x << endl;
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ size_t FileStore::CopyRangeTo2(BufferedTransformation &target, lword &begin, lwo
|
|||
m_stream->seekg(newPosition);
|
||||
try
|
||||
{
|
||||
assert(!m_waiting);
|
||||
CRYPTOPP_ASSERT(!m_waiting);
|
||||
lword copyMax = end-begin;
|
||||
size_t blockedBytes = const_cast<FileStore *>(this)->TransferTo2(target, copyMax, channel, blocking);
|
||||
begin += copyMax;
|
||||
|
|
|
|||
76
filters.cpp
76
filters.cpp
|
|
@ -108,7 +108,7 @@ void Filter::PropagateInitialize(const NameValuePairs ¶meters, int propagati
|
|||
|
||||
size_t Filter::OutputModifiable(int outputSite, byte *inString, size_t length, int messageEnd, bool blocking, const std::string &channel)
|
||||
{
|
||||
assert(inString || (!inString && !length));
|
||||
CRYPTOPP_ASSERT(inString || (!inString && !length));
|
||||
if (inString == NULL) { length = 0; }
|
||||
|
||||
if (messageEnd)
|
||||
|
|
@ -121,7 +121,7 @@ size_t Filter::OutputModifiable(int outputSite, byte *inString, size_t length, i
|
|||
size_t Filter::Output(int outputSite, const byte *inString, size_t length, int messageEnd, bool blocking, const std::string &channel)
|
||||
{
|
||||
// Formerly fired because inString was not NULL, but length was 0.
|
||||
assert(inString || (!inString && !length));
|
||||
CRYPTOPP_ASSERT(inString || (!inString && !length));
|
||||
if (inString == NULL) { length = 0; }
|
||||
|
||||
if (messageEnd)
|
||||
|
|
@ -186,7 +186,7 @@ size_t MeterFilter::PutMaybeModifiable(byte *begin, size_t length, int messageEn
|
|||
{
|
||||
FILTER_OUTPUT_MAYBE_MODIFIABLE(1, m_begin, t = (size_t)SaturatingSubtract(m_rangesToSkip.front().position, m_currentMessageBytes), false, modifiable);
|
||||
|
||||
assert(t < m_length);
|
||||
CRYPTOPP_ASSERT(t < m_length);
|
||||
m_begin += t;
|
||||
m_length -= t;
|
||||
m_currentMessageBytes += t;
|
||||
|
|
@ -197,7 +197,7 @@ size_t MeterFilter::PutMaybeModifiable(byte *begin, size_t length, int messageEn
|
|||
else
|
||||
{
|
||||
t = (size_t)SaturatingSubtract(m_rangesToSkip.front().position + m_rangesToSkip.front().size, m_currentMessageBytes);
|
||||
assert(t <= m_length);
|
||||
CRYPTOPP_ASSERT(t <= m_length);
|
||||
m_rangesToSkip.pop_front();
|
||||
}
|
||||
|
||||
|
|
@ -299,7 +299,7 @@ size_t FilterWithBufferedInput::BlockQueue::Put(const byte *inString, size_t len
|
|||
if (!inString || !length) return length;
|
||||
if (!m_buffer.data()) return length;
|
||||
|
||||
assert(m_size + length <= m_buffer.size());
|
||||
CRYPTOPP_ASSERT(m_size + length <= m_buffer.size());
|
||||
byte *end = (m_size < size_t(m_buffer.end()-m_begin)) ? m_begin + m_size : m_begin + m_size - m_buffer.size();
|
||||
size_t len = STDMIN(length, size_t(m_buffer.end()-end));
|
||||
memcpy(end, inString, len);
|
||||
|
|
@ -347,7 +347,7 @@ bool FilterWithBufferedInput::IsolatedFlush(bool hardFlush, bool blocking)
|
|||
|
||||
size_t FilterWithBufferedInput::PutMaybeModifiable(byte *inString, size_t length, int messageEnd, bool blocking, bool modifiable)
|
||||
{
|
||||
assert(inString || (!inString && !length));
|
||||
CRYPTOPP_ASSERT(inString || (!inString && !length));
|
||||
if (inString == NULL) { length = 0; }
|
||||
|
||||
if (!blocking)
|
||||
|
|
@ -362,7 +362,7 @@ size_t FilterWithBufferedInput::PutMaybeModifiable(byte *inString, size_t length
|
|||
size_t len = m_firstSize - m_queue.CurrentSize();
|
||||
m_queue.Put(inString, len);
|
||||
FirstPut(m_queue.GetContigousBlocks(m_firstSize));
|
||||
assert(m_queue.CurrentSize() == 0);
|
||||
CRYPTOPP_ASSERT(m_queue.CurrentSize() == 0);
|
||||
m_queue.ResetQueue(m_blockSize, (2*m_blockSize+m_lastSize-2)/m_blockSize);
|
||||
|
||||
inString += len;
|
||||
|
|
@ -400,7 +400,7 @@ size_t FilterWithBufferedInput::PutMaybeModifiable(byte *inString, size_t length
|
|||
|
||||
if (newLength >= m_blockSize + m_lastSize && m_queue.CurrentSize() > 0)
|
||||
{
|
||||
assert(m_queue.CurrentSize() < m_blockSize);
|
||||
CRYPTOPP_ASSERT(m_queue.CurrentSize() < m_blockSize);
|
||||
size_t len = m_blockSize - m_queue.CurrentSize();
|
||||
m_queue.Put(inString, len);
|
||||
inString += len;
|
||||
|
|
@ -458,13 +458,13 @@ void FilterWithBufferedInput::ForceNextPut()
|
|||
|
||||
void FilterWithBufferedInput::NextPutMultiple(const byte *inString, size_t length)
|
||||
{
|
||||
assert(inString || (!inString && !length));
|
||||
CRYPTOPP_ASSERT(inString || (!inString && !length));
|
||||
if (inString == NULL) { length = 0; }
|
||||
|
||||
assert(m_blockSize > 1); // m_blockSize = 1 should always override this function
|
||||
CRYPTOPP_ASSERT(m_blockSize > 1); // m_blockSize = 1 should always override this function
|
||||
while (length > 0)
|
||||
{
|
||||
assert(length >= m_blockSize);
|
||||
CRYPTOPP_ASSERT(length >= m_blockSize);
|
||||
NextPutSingle(inString);
|
||||
inString += m_blockSize;
|
||||
length -= m_blockSize;
|
||||
|
|
@ -577,7 +577,7 @@ StreamTransformationFilter::StreamTransformationFilter(StreamTransformation &c,
|
|||
: FilterWithBufferedInput(attachment)
|
||||
, m_cipher(c)
|
||||
{
|
||||
assert(c.MinLastBlockSize() == 0 || c.MinLastBlockSize() > c.MandatoryBlockSize());
|
||||
CRYPTOPP_ASSERT(c.MinLastBlockSize() == 0 || c.MinLastBlockSize() > c.MandatoryBlockSize());
|
||||
|
||||
if (!allowAuthenticatedSymmetricCipher && dynamic_cast<AuthenticatedSymmetricCipher *>(&c) != 0)
|
||||
throw InvalidArgument("StreamTransformationFilter: please use AuthenticatedEncryptionFilter and AuthenticatedDecryptionFilter for AuthenticatedSymmetricCipher");
|
||||
|
|
@ -616,14 +616,14 @@ void StreamTransformationFilter::InitializeDerivedAndReturnNewSizes(const NameVa
|
|||
void StreamTransformationFilter::FirstPut(const byte *inString)
|
||||
{
|
||||
// FilterWithBufferedInput::PutMaybeModifiable causes this to fire.
|
||||
// assert(inString);
|
||||
// CRYPTOPP_ASSERT(inString);
|
||||
m_optimalBufferSize = m_cipher.OptimalBlockSize();
|
||||
m_optimalBufferSize = (unsigned int)STDMAX(m_optimalBufferSize, RoundDownToMultipleOf(4096U, m_optimalBufferSize));
|
||||
}
|
||||
|
||||
void StreamTransformationFilter::NextPutMultiple(const byte *inString, size_t length)
|
||||
{
|
||||
assert(inString || (!inString && !length));
|
||||
CRYPTOPP_ASSERT(inString || (!inString && !length));
|
||||
if (inString == NULL) { length = 0; }
|
||||
|
||||
size_t s = m_cipher.MandatoryBlockSize();
|
||||
|
|
@ -652,7 +652,7 @@ void StreamTransformationFilter::NextPutMultiple(const byte *inString, size_t le
|
|||
|
||||
void StreamTransformationFilter::NextPutModifiable(byte *inString, size_t length)
|
||||
{
|
||||
assert(inString || (!inString && !length));
|
||||
CRYPTOPP_ASSERT(inString || (!inString && !length));
|
||||
if (inString == NULL) { length = 0; }
|
||||
|
||||
m_cipher.ProcessString(inString, length);
|
||||
|
|
@ -661,7 +661,7 @@ void StreamTransformationFilter::NextPutModifiable(byte *inString, size_t length
|
|||
|
||||
void StreamTransformationFilter::LastPut(const byte *inString, size_t length)
|
||||
{
|
||||
assert(inString || (!inString && !length));
|
||||
CRYPTOPP_ASSERT(inString || (!inString && !length));
|
||||
if (inString == NULL) { length = 0; }
|
||||
|
||||
byte *space = NULL;
|
||||
|
|
@ -707,16 +707,16 @@ void StreamTransformationFilter::LastPut(const byte *inString, size_t length)
|
|||
case ONE_AND_ZEROS_PADDING:
|
||||
unsigned int s;
|
||||
s = m_cipher.MandatoryBlockSize();
|
||||
assert(s > 1);
|
||||
CRYPTOPP_ASSERT(s > 1);
|
||||
space = HelpCreatePutSpace(*AttachedTransformation(), DEFAULT_CHANNEL, s, m_optimalBufferSize);
|
||||
if (m_cipher.IsForwardTransformation())
|
||||
{
|
||||
assert(length < s);
|
||||
CRYPTOPP_ASSERT(length < s);
|
||||
if (inString && length)
|
||||
memcpy(space, inString, length);
|
||||
if (m_padding == PKCS_PADDING)
|
||||
{
|
||||
assert(s < 256);
|
||||
CRYPTOPP_ASSERT(s < 256);
|
||||
byte pad = byte(s-length);
|
||||
memset(space+length, pad, s-length);
|
||||
}
|
||||
|
|
@ -752,7 +752,7 @@ void StreamTransformationFilter::LastPut(const byte *inString, size_t length)
|
|||
break;
|
||||
|
||||
default:
|
||||
assert(false);
|
||||
CRYPTOPP_ASSERT(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -774,7 +774,7 @@ void HashFilter::IsolatedInitialize(const NameValuePairs ¶meters)
|
|||
|
||||
size_t HashFilter::Put2(const byte *inString, size_t length, int messageEnd, bool blocking)
|
||||
{
|
||||
assert(inString || (!inString && !length));
|
||||
CRYPTOPP_ASSERT(inString || (!inString && !length));
|
||||
if (inString == NULL) { length = 0; }
|
||||
|
||||
FILTER_BEGIN;
|
||||
|
|
@ -816,7 +816,7 @@ void HashVerificationFilter::InitializeDerivedAndReturnNewSizes(const NameValueP
|
|||
void HashVerificationFilter::FirstPut(const byte *inString)
|
||||
{
|
||||
// FilterWithBufferedInput::PutMaybeModifiable causes this to fire.
|
||||
// assert(inString);
|
||||
// CRYPTOPP_ASSERT(inString);
|
||||
|
||||
if (m_flags & HASH_AT_BEGIN)
|
||||
{
|
||||
|
|
@ -831,7 +831,7 @@ void HashVerificationFilter::FirstPut(const byte *inString)
|
|||
|
||||
void HashVerificationFilter::NextPutMultiple(const byte *inString, size_t length)
|
||||
{
|
||||
assert(inString || (!inString && !length));
|
||||
CRYPTOPP_ASSERT(inString || (!inString && !length));
|
||||
if (inString == NULL) { length = 0; }
|
||||
|
||||
m_hashModule.Update(inString, length);
|
||||
|
|
@ -841,12 +841,12 @@ void HashVerificationFilter::NextPutMultiple(const byte *inString, size_t length
|
|||
|
||||
void HashVerificationFilter::LastPut(const byte *inString, size_t length)
|
||||
{
|
||||
assert(inString || (!inString && !length));
|
||||
CRYPTOPP_ASSERT(inString || (!inString && !length));
|
||||
if (inString == NULL) { length = 0; }
|
||||
|
||||
if (m_flags & HASH_AT_BEGIN)
|
||||
{
|
||||
assert(length == 0);
|
||||
CRYPTOPP_ASSERT(length == 0);
|
||||
m_verified = m_hashModule.TruncatedVerify(m_expectedHash, m_digestSize);
|
||||
}
|
||||
else
|
||||
|
|
@ -870,7 +870,7 @@ AuthenticatedEncryptionFilter::AuthenticatedEncryptionFilter(AuthenticatedSymmet
|
|||
: StreamTransformationFilter(c, attachment, padding, true)
|
||||
, m_hf(c, new OutputProxy(*this, false), putAAD, truncatedDigestSize, AAD_CHANNEL, macChannel)
|
||||
{
|
||||
assert(c.IsForwardTransformation());
|
||||
CRYPTOPP_ASSERT(c.IsForwardTransformation());
|
||||
}
|
||||
|
||||
void AuthenticatedEncryptionFilter::IsolatedInitialize(const NameValuePairs ¶meters)
|
||||
|
|
@ -903,7 +903,7 @@ size_t AuthenticatedEncryptionFilter::ChannelPut2(const std::string &channel, co
|
|||
|
||||
void AuthenticatedEncryptionFilter::LastPut(const byte *inString, size_t length)
|
||||
{
|
||||
assert(inString || (!inString && !length));
|
||||
CRYPTOPP_ASSERT(inString || (!inString && !length));
|
||||
if (inString == NULL) { length = 0; }
|
||||
|
||||
StreamTransformationFilter::LastPut(inString, length);
|
||||
|
|
@ -917,7 +917,7 @@ AuthenticatedDecryptionFilter::AuthenticatedDecryptionFilter(AuthenticatedSymmet
|
|||
, m_hashVerifier(c, new OutputProxy(*this, false))
|
||||
, m_streamFilter(c, new OutputProxy(*this, false), padding, true)
|
||||
{
|
||||
assert(!c.IsForwardTransformation() || c.IsSelfInverting());
|
||||
CRYPTOPP_ASSERT(!c.IsForwardTransformation() || c.IsSelfInverting());
|
||||
IsolatedInitialize(MakeParameters(Name::BlockPaddingScheme(), padding)(Name::AuthenticatedDecryptionFilterFlags(), flags)(Name::TruncatedDigestSize(), truncatedDigestSize));
|
||||
}
|
||||
|
||||
|
|
@ -962,13 +962,13 @@ size_t AuthenticatedDecryptionFilter::ChannelPut2(const std::string &channel, co
|
|||
void AuthenticatedDecryptionFilter::FirstPut(const byte *inString)
|
||||
{
|
||||
// FilterWithBufferedInput::PutMaybeModifiable causes this to fire.
|
||||
// assert(inString);
|
||||
// CRYPTOPP_ASSERT(inString);
|
||||
m_hashVerifier.Put(inString, m_firstSize);
|
||||
}
|
||||
|
||||
void AuthenticatedDecryptionFilter::NextPutMultiple(const byte *inString, size_t length)
|
||||
{
|
||||
assert(inString || (!inString && !length));
|
||||
CRYPTOPP_ASSERT(inString || (!inString && !length));
|
||||
if (inString == NULL) { length = 0; }
|
||||
|
||||
m_streamFilter.Put(inString, length);
|
||||
|
|
@ -976,7 +976,7 @@ void AuthenticatedDecryptionFilter::NextPutMultiple(const byte *inString, size_t
|
|||
|
||||
void AuthenticatedDecryptionFilter::LastPut(const byte *inString, size_t length)
|
||||
{
|
||||
assert(inString || (!inString && !length));
|
||||
CRYPTOPP_ASSERT(inString || (!inString && !length));
|
||||
if (inString == NULL) { length = 0; }
|
||||
|
||||
m_streamFilter.MessageEnd();
|
||||
|
|
@ -993,7 +993,7 @@ void SignerFilter::IsolatedInitialize(const NameValuePairs ¶meters)
|
|||
|
||||
size_t SignerFilter::Put2(const byte *inString, size_t length, int messageEnd, bool blocking)
|
||||
{
|
||||
assert(inString || (!inString && !length));
|
||||
CRYPTOPP_ASSERT(inString || (!inString && !length));
|
||||
if (inString == NULL) { length = 0; }
|
||||
|
||||
FILTER_BEGIN;
|
||||
|
|
@ -1022,7 +1022,7 @@ void SignatureVerificationFilter::InitializeDerivedAndReturnNewSizes(const NameV
|
|||
m_flags = parameters.GetValueWithDefault(Name::SignatureVerificationFilterFlags(), (word32)DEFAULT_FLAGS);
|
||||
m_messageAccumulator.reset(m_verifier.NewVerificationAccumulator());
|
||||
size_t size = m_verifier.SignatureLength();
|
||||
assert(size != 0); // TODO: handle recoverable signature scheme
|
||||
CRYPTOPP_ASSERT(size != 0); // TODO: handle recoverable signature scheme
|
||||
m_verified = false;
|
||||
firstSize = m_flags & SIGNATURE_AT_BEGIN ? size : 0;
|
||||
blockSize = 1;
|
||||
|
|
@ -1032,7 +1032,7 @@ void SignatureVerificationFilter::InitializeDerivedAndReturnNewSizes(const NameV
|
|||
void SignatureVerificationFilter::FirstPut(const byte *inString)
|
||||
{
|
||||
// FilterWithBufferedInput::PutMaybeModifiable causes this to fire.
|
||||
// assert(inString);
|
||||
// CRYPTOPP_ASSERT(inString);
|
||||
|
||||
if (m_flags & SIGNATURE_AT_BEGIN)
|
||||
{
|
||||
|
|
@ -1049,13 +1049,13 @@ void SignatureVerificationFilter::FirstPut(const byte *inString)
|
|||
}
|
||||
else
|
||||
{
|
||||
assert(!m_verifier.SignatureUpfront());
|
||||
CRYPTOPP_ASSERT(!m_verifier.SignatureUpfront());
|
||||
}
|
||||
}
|
||||
|
||||
void SignatureVerificationFilter::NextPutMultiple(const byte *inString, size_t length)
|
||||
{
|
||||
assert(inString || (!inString && !length));
|
||||
CRYPTOPP_ASSERT(inString || (!inString && !length));
|
||||
if (inString == NULL) { length = 0; }
|
||||
|
||||
m_messageAccumulator->Update(inString, length);
|
||||
|
|
@ -1065,12 +1065,12 @@ void SignatureVerificationFilter::NextPutMultiple(const byte *inString, size_t l
|
|||
|
||||
void SignatureVerificationFilter::LastPut(const byte *inString, size_t length)
|
||||
{
|
||||
assert(inString || (!inString && !length));
|
||||
CRYPTOPP_ASSERT(inString || (!inString && !length));
|
||||
if (inString == NULL) { length = 0; }
|
||||
|
||||
if (m_flags & SIGNATURE_AT_BEGIN)
|
||||
{
|
||||
assert(length == 0);
|
||||
CRYPTOPP_ASSERT(length == 0);
|
||||
m_verifier.InputSignature(*m_messageAccumulator, m_signature, m_signature.size());
|
||||
m_verified = m_verifier.VerifyAndRestart(*m_messageAccumulator);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ struct CRYPTOPP_DLL FilterPutSpaceHelper
|
|||
// desiredSize is how much to ask target, bufferSize is how much to allocate in m_tempSpace
|
||||
byte *HelpCreatePutSpace(BufferedTransformation &target, const std::string &channel, size_t minSize, size_t desiredSize, size_t &bufferSize)
|
||||
{
|
||||
assert(desiredSize >= minSize && bufferSize >= minSize);
|
||||
CRYPTOPP_ASSERT(desiredSize >= minSize && bufferSize >= minSize);
|
||||
if (m_tempSpace.size() < minSize)
|
||||
{
|
||||
byte *result = target.ChannelCreatePutSpace(channel, desiredSize);
|
||||
|
|
@ -180,7 +180,7 @@ protected:
|
|||
// or (firstSize == 0 and (totalLength > 0 or a MessageEnd() is received))
|
||||
virtual void FirstPut(const byte *inString) =0;
|
||||
// NextPut() is called if totalLength >= firstSize+blockSize+lastSize
|
||||
virtual void NextPutSingle(const byte *inString) {assert(false);}
|
||||
virtual void NextPutSingle(const byte *inString) {CRYPTOPP_ASSERT(false);}
|
||||
// Same as NextPut() except length can be a multiple of blockSize
|
||||
// Either NextPut() or NextPutMultiple() must be overriden
|
||||
virtual void NextPutMultiple(const byte *inString, size_t length);
|
||||
|
|
@ -204,7 +204,7 @@ protected:
|
|||
|
||||
// This function should no longer be used, put this here to cause a compiler error
|
||||
// if someone tries to override NextPut().
|
||||
virtual int NextPut(const byte *inString, size_t length) {assert(false); return 0;}
|
||||
virtual int NextPut(const byte *inString, size_t length) {CRYPTOPP_ASSERT(false); return 0;}
|
||||
|
||||
class BlockQueue
|
||||
{
|
||||
|
|
@ -591,7 +591,7 @@ public:
|
|||
typedef typename T::traits_type::char_type char_type;
|
||||
|
||||
StringSinkTemplate(T &output)
|
||||
: m_output(&output) {assert(sizeof(output[0])==1);}
|
||||
: m_output(&output) {CRYPTOPP_ASSERT(sizeof(output[0])==1);}
|
||||
|
||||
void IsolatedInitialize(const NameValuePairs ¶meters)
|
||||
{if (!parameters.GetValue("OutputStringPointer", m_output)) throw InvalidArgument("StringSink: OutputStringPointer not specified");}
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ bool PowerUpSelfTestInProgressOnThisThread()
|
|||
#if CRYPTOPP_ENABLE_COMPLIANCE_WITH_FIPS_140_2
|
||||
return AccessPowerUpSelfTestInProgress().GetValue() != NULL;
|
||||
#else
|
||||
assert(false); // should not be called
|
||||
CRYPTOPP_ASSERT(false); // should not be called
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -259,7 +259,7 @@ protected:
|
|||
|
||||
static inline void Xor(SecByteBlock &z, const SecByteBlock &x, const SecByteBlock &y)
|
||||
{
|
||||
assert(x.size() == y.size());
|
||||
CRYPTOPP_ASSERT(x.size() == y.size());
|
||||
z.resize(x.size());
|
||||
xorbuf(z, x, y, x.size());
|
||||
}
|
||||
|
|
@ -634,7 +634,7 @@ protected:
|
|||
}
|
||||
else
|
||||
{
|
||||
assert(m_test == "Gen");
|
||||
CRYPTOPP_ASSERT(m_test == "Gen");
|
||||
int modLen = atol(m_bracketString.substr(6).c_str());
|
||||
std::string &encodedKey = m_data["PrivKey"];
|
||||
RSA::PrivateKey priv;
|
||||
|
|
@ -1031,7 +1031,7 @@ protected:
|
|||
}
|
||||
else
|
||||
{
|
||||
assert(m_test == "KAT");
|
||||
CRYPTOPP_ASSERT(m_test == "KAT");
|
||||
|
||||
SecByteBlock &input = m_data2[INPUT];
|
||||
SecByteBlock result(input.size());
|
||||
|
|
@ -1094,7 +1094,7 @@ protected:
|
|||
|
||||
if (m_line.substr(0, 2) == "H>")
|
||||
{
|
||||
assert(m_test == "sha");
|
||||
CRYPTOPP_ASSERT(m_test == "sha");
|
||||
m_bracketString = m_line.substr(2, m_line.size()-4);
|
||||
m_line = m_line.substr(0, 13) + "Hashes<H";
|
||||
copyLine = true;
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
#define FILTER_END_NO_MESSAGE_END_NO_RETURN \
|
||||
break; \
|
||||
default: \
|
||||
assert(false); \
|
||||
CRYPTOPP_ASSERT(false); \
|
||||
}
|
||||
|
||||
#define FILTER_END_NO_MESSAGE_END \
|
||||
|
|
|
|||
10
gf2_32.cpp
10
gf2_32.cpp
|
|
@ -53,7 +53,7 @@ GF2_32::Element GF2_32::MultiplicativeInverse(Element a) const
|
|||
word32 g0=m_modulus, g1=a, g2=a;
|
||||
word32 v0=0, v1=1, v2=1;
|
||||
|
||||
assert(g1);
|
||||
CRYPTOPP_ASSERT(g1);
|
||||
|
||||
while (!(g2 & 0x80000000))
|
||||
{
|
||||
|
|
@ -71,25 +71,25 @@ GF2_32::Element GF2_32::MultiplicativeInverse(Element a) const
|
|||
{
|
||||
if (g1 < g0 || ((g0^g1) < g0 && (g0^g1) < g1))
|
||||
{
|
||||
assert(BitPrecision(g1) <= BitPrecision(g0));
|
||||
CRYPTOPP_ASSERT(BitPrecision(g1) <= BitPrecision(g0));
|
||||
g2 = g1;
|
||||
v2 = v1;
|
||||
}
|
||||
else
|
||||
{
|
||||
assert(BitPrecision(g1) > BitPrecision(g0));
|
||||
CRYPTOPP_ASSERT(BitPrecision(g1) > BitPrecision(g0));
|
||||
g2 = g0; g0 = g1; g1 = g2;
|
||||
v2 = v0; v0 = v1; v1 = v2;
|
||||
}
|
||||
|
||||
while ((g0^g2) >= g2)
|
||||
{
|
||||
assert(BitPrecision(g0) > BitPrecision(g2));
|
||||
CRYPTOPP_ASSERT(BitPrecision(g0) > BitPrecision(g2));
|
||||
g2 <<= 1;
|
||||
v2 <<= 1;
|
||||
}
|
||||
|
||||
assert(BitPrecision(g0) == BitPrecision(g2));
|
||||
CRYPTOPP_ASSERT(BitPrecision(g0) == BitPrecision(g2));
|
||||
g0 ^= g2;
|
||||
v0 ^= v2;
|
||||
}
|
||||
|
|
|
|||
14
gf2n.cpp
14
gf2n.cpp
|
|
@ -23,7 +23,7 @@ PolynomialMod2::PolynomialMod2()
|
|||
PolynomialMod2::PolynomialMod2(word value, size_t bitLength)
|
||||
: reg(BitsToWords(bitLength))
|
||||
{
|
||||
assert(value==0 || reg.size()>0);
|
||||
CRYPTOPP_ASSERT(value==0 || reg.size()>0);
|
||||
|
||||
if (reg.size() > 0)
|
||||
{
|
||||
|
|
@ -550,7 +550,7 @@ GF2NP::Element GF2NP::SquareRoot(const Element &a) const
|
|||
|
||||
GF2NP::Element GF2NP::HalfTrace(const Element &a) const
|
||||
{
|
||||
assert(m%2 == 1);
|
||||
CRYPTOPP_ASSERT(m%2 == 1);
|
||||
Element h = a;
|
||||
for (unsigned int i=1; i<=(m-1)/2; i++)
|
||||
h = Add(Square(Square(h)), a);
|
||||
|
|
@ -589,7 +589,7 @@ GF2NT::GF2NT(unsigned int t0, unsigned int t1, unsigned int t2)
|
|||
, t0(t0), t1(t1)
|
||||
, result((word)0, m)
|
||||
{
|
||||
assert(t0 > t1 && t1 > t2 && t2==0);
|
||||
CRYPTOPP_ASSERT(t0 > t1 && t1 > t2 && t2==0);
|
||||
}
|
||||
|
||||
const GF2NT::Element& GF2NT::MultiplicativeInverse(const Element &a) const
|
||||
|
|
@ -607,7 +607,7 @@ const GF2NT::Element& GF2NT::MultiplicativeInverse(const Element &a) const
|
|||
|
||||
SetWords(T, 0, 3*m_modulus.reg.size());
|
||||
b[0]=1;
|
||||
assert(a.reg.size() <= m_modulus.reg.size());
|
||||
CRYPTOPP_ASSERT(a.reg.size() <= m_modulus.reg.size());
|
||||
CopyWords(f, a.reg, a.reg.size());
|
||||
CopyWords(g, m_modulus.reg, m_modulus.reg.size());
|
||||
|
||||
|
|
@ -619,7 +619,7 @@ const GF2NT::Element& GF2NT::MultiplicativeInverse(const Element &a) const
|
|||
ShiftWordsRightByWords(f, fgLen, 1);
|
||||
if (c[bcLen-1])
|
||||
bcLen++;
|
||||
assert(bcLen <= m_modulus.reg.size());
|
||||
CRYPTOPP_ASSERT(bcLen <= m_modulus.reg.size());
|
||||
ShiftWordsLeftByWords(c, bcLen, 1);
|
||||
k+=WORD_BITS;
|
||||
t=f[0];
|
||||
|
|
@ -650,7 +650,7 @@ const GF2NT::Element& GF2NT::MultiplicativeInverse(const Element &a) const
|
|||
{
|
||||
c[bcLen] = t;
|
||||
bcLen++;
|
||||
assert(bcLen <= m_modulus.reg.size());
|
||||
CRYPTOPP_ASSERT(bcLen <= m_modulus.reg.size());
|
||||
}
|
||||
|
||||
if (f[fgLen-1]==0 && g[fgLen-1]==0)
|
||||
|
|
@ -790,7 +790,7 @@ const GF2NT::Element& GF2NT::Reduced(const Element &a) const
|
|||
if ((t0-t1)%WORD_BITS > t0%WORD_BITS)
|
||||
b[i-(t0-t1)/WORD_BITS-1] ^= temp << (WORD_BITS - (t0-t1)%WORD_BITS);
|
||||
else
|
||||
assert(temp << (WORD_BITS - (t0-t1)%WORD_BITS) == 0);
|
||||
CRYPTOPP_ASSERT(temp << (WORD_BITS - (t0-t1)%WORD_BITS) == 0);
|
||||
}
|
||||
else
|
||||
b[i-(t0-t1)/WORD_BITS] ^= temp;
|
||||
|
|
|
|||
|
|
@ -70,8 +70,8 @@ void DL_SignatureMessageEncodingMethod_DSA::ComputeMessageRepresentative(RandomN
|
|||
HashTransformation &hash, HashIdentifier hashIdentifier, bool messageEmpty,
|
||||
byte *representative, size_t representativeBitLength) const
|
||||
{
|
||||
assert(recoverableMessageLength == 0);
|
||||
assert(hashIdentifier.second == 0);
|
||||
CRYPTOPP_ASSERT(recoverableMessageLength == 0);
|
||||
CRYPTOPP_ASSERT(hashIdentifier.second == 0);
|
||||
const size_t representativeByteLength = BitsToBytes(representativeBitLength);
|
||||
const size_t digestSize = hash.DigestSize();
|
||||
const size_t paddingLength = SaturatingSubtract(representativeByteLength, digestSize);
|
||||
|
|
@ -92,8 +92,8 @@ void DL_SignatureMessageEncodingMethod_NR::ComputeMessageRepresentative(RandomNu
|
|||
HashTransformation &hash, HashIdentifier hashIdentifier, bool messageEmpty,
|
||||
byte *representative, size_t representativeBitLength) const
|
||||
{
|
||||
assert(recoverableMessageLength == 0);
|
||||
assert(hashIdentifier.second == 0);
|
||||
CRYPTOPP_ASSERT(recoverableMessageLength == 0);
|
||||
CRYPTOPP_ASSERT(hashIdentifier.second == 0);
|
||||
const size_t representativeByteLength = BitsToBytes(representativeBitLength);
|
||||
const size_t digestSize = hash.DigestSize();
|
||||
const size_t paddingLength = SaturatingSubtract(representativeByteLength, digestSize);
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@ public:
|
|||
r %= q;
|
||||
Integer kInv = k.InverseMod(q);
|
||||
s = (kInv * (x*r + e)) % q;
|
||||
assert(!!r && !!s);
|
||||
CRYPTOPP_ASSERT(!!r && !!s);
|
||||
}
|
||||
|
||||
bool Verify(const DL_GroupParameters<T> ¶ms, const DL_PublicKey<T> &publicKey, const Integer &e, const Integer &r, const Integer &s) const
|
||||
|
|
@ -199,7 +199,7 @@ public:
|
|||
const Integer &q = params.GetSubgroupOrder();
|
||||
r = (r + e) % q;
|
||||
s = (k - x*r) % q;
|
||||
assert(!!r);
|
||||
CRYPTOPP_ASSERT(!!r);
|
||||
}
|
||||
|
||||
bool Verify(const DL_GroupParameters<T> ¶ms, const DL_PublicKey<T> &publicKey, const Integer &e, const Integer &r, const Integer &s) const
|
||||
|
|
|
|||
6
hkdf.h
6
hkdf.h
|
|
@ -51,9 +51,9 @@ unsigned int HKDF<T>::DeriveKey(byte *derived, size_t derivedLen, const byte *se
|
|||
CRYPTOPP_COMPILE_ASSERT(DIGEST_SIZE <= COUNTOF(s_NullVector));
|
||||
const unsigned int req = static_cast<unsigned int>(derivedLen);
|
||||
|
||||
assert(secret && secretLen);
|
||||
assert(derived && derivedLen);
|
||||
assert(derivedLen <= MaxDerivedKeyLength());
|
||||
CRYPTOPP_ASSERT(secret && secretLen);
|
||||
CRYPTOPP_ASSERT(derived && derivedLen);
|
||||
CRYPTOPP_ASSERT(derivedLen <= MaxDerivedKeyLength());
|
||||
|
||||
if(derivedLen > MaxDerivedKeyLength())
|
||||
throw InvalidArgument("HKDF: derivedLen must be less than or equal to MaxDerivedKeyLength");
|
||||
|
|
|
|||
4
hmac.cpp
4
hmac.cpp
|
|
@ -31,7 +31,7 @@ void HMAC_Base::UncheckedSetKey(const byte *userKey, unsigned int keylength, con
|
|||
keylength = hash.DigestSize();
|
||||
}
|
||||
|
||||
assert(keylength <= blockSize);
|
||||
CRYPTOPP_ASSERT(keylength <= blockSize);
|
||||
memset(AccessIpad()+keylength, 0, blockSize-keylength);
|
||||
|
||||
for (unsigned int i=0; i<blockSize; i++)
|
||||
|
|
@ -43,7 +43,7 @@ void HMAC_Base::UncheckedSetKey(const byte *userKey, unsigned int keylength, con
|
|||
|
||||
void HMAC_Base::KeyInnerHash()
|
||||
{
|
||||
assert(!m_innerHashKeyed);
|
||||
CRYPTOPP_ASSERT(!m_innerHashKeyed);
|
||||
HashTransformation &hash = AccessHash();
|
||||
hash.Update(AccessIpad(), hash.BlockSize());
|
||||
m_innerHashKeyed = true;
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ double TimerBase::ConvertTo(TimerWord t, Unit unit)
|
|||
{
|
||||
static unsigned long unitsPerSecondTable[] = {1, 1000, 1000*1000, 1000*1000*1000};
|
||||
|
||||
assert(unit < COUNTOF(unitsPerSecondTable));
|
||||
CRYPTOPP_ASSERT(unit < COUNTOF(unitsPerSecondTable));
|
||||
return (double)CRYPTOPP_VC6_INT64 t * unitsPerSecondTable[unit] / CRYPTOPP_VC6_INT64 TicksPerSecond();
|
||||
}
|
||||
|
||||
|
|
@ -56,7 +56,7 @@ double TimerBase::ElapsedTimeAsDouble()
|
|||
unsigned long TimerBase::ElapsedTime()
|
||||
{
|
||||
double elapsed = ElapsedTimeAsDouble();
|
||||
assert(elapsed <= ULONG_MAX);
|
||||
CRYPTOPP_ASSERT(elapsed <= ULONG_MAX);
|
||||
return (unsigned long)elapsed;
|
||||
}
|
||||
|
||||
|
|
|
|||
2
ida.cpp
2
ida.cpp
|
|
@ -151,7 +151,7 @@ void RawIDA::AddOutputChannel(word32 channelId)
|
|||
|
||||
void RawIDA::PrepareInterpolation()
|
||||
{
|
||||
assert(m_inputChannelIds.size() == m_threshold);
|
||||
CRYPTOPP_ASSERT(m_inputChannelIds.size() == m_threshold);
|
||||
PrepareBulkPolynomialInterpolation(field, m_w.begin(), &(m_inputChannelIds[0]), m_threshold);
|
||||
for (unsigned int i=0; i<m_outputChannelIds.size(); i++)
|
||||
ComputeV(i);
|
||||
|
|
|
|||
2
idea.cpp
2
idea.cpp
|
|
@ -22,7 +22,7 @@ CRYPTOPP_COMPILE_ASSERT(sizeof(IDEA::Word) >= 2);
|
|||
// should use an inline function but macros are still faster in MSVC 4.0
|
||||
#define DirectMUL(a,b) \
|
||||
{ \
|
||||
assert(b <= 0xffff); \
|
||||
CRYPTOPP_ASSERT(b <= 0xffff); \
|
||||
\
|
||||
word32 p=(word32)low16(a)*b; \
|
||||
\
|
||||
|
|
|
|||
100
integer.cpp
100
integer.cpp
|
|
@ -61,7 +61,7 @@ inline static int Compare(const word *A, const word *B, size_t N)
|
|||
|
||||
inline static int Increment(word *A, size_t N, word B=1)
|
||||
{
|
||||
assert(N);
|
||||
CRYPTOPP_ASSERT(N);
|
||||
word t = A[0];
|
||||
A[0] = t+B;
|
||||
if (A[0] >= t)
|
||||
|
|
@ -74,7 +74,7 @@ inline static int Increment(word *A, size_t N, word B=1)
|
|||
|
||||
inline static int Decrement(word *A, size_t N, word B=1)
|
||||
{
|
||||
assert(N);
|
||||
CRYPTOPP_ASSERT(N);
|
||||
word t = A[0];
|
||||
A[0] = t-B;
|
||||
if (A[0] <= t)
|
||||
|
|
@ -94,14 +94,14 @@ static void TwosComplement(word *A, size_t N)
|
|||
|
||||
static word AtomicInverseModPower2(word A)
|
||||
{
|
||||
assert(A%2==1);
|
||||
CRYPTOPP_ASSERT(A%2==1);
|
||||
|
||||
word R=A%8;
|
||||
|
||||
for (unsigned i=3; i<WORD_BITS; i*=2)
|
||||
R = R*(2-R*A);
|
||||
|
||||
assert(R*A==1);
|
||||
CRYPTOPP_ASSERT(R*A==1);
|
||||
return R;
|
||||
}
|
||||
|
||||
|
|
@ -358,7 +358,7 @@ template <class S, class D>
|
|||
S DivideThreeWordsByTwo(S *A, S B0, S B1, D *dummy=NULL)
|
||||
{
|
||||
// assert {A[2],A[1]} < {B1,B0}, so quotient can fit in a S
|
||||
assert(A[2] < B1 || (A[2]==B1 && A[1] < B0));
|
||||
CRYPTOPP_ASSERT(A[2] < B1 || (A[2]==B1 && A[1] < B0));
|
||||
|
||||
// estimate the quotient: do a 2 S by 1 S divide
|
||||
S Q;
|
||||
|
|
@ -386,7 +386,7 @@ S DivideThreeWordsByTwo(S *A, S B0, S B1, D *dummy=NULL)
|
|||
A[1] = u.GetLowHalf();
|
||||
A[2] += u.GetHighHalf();
|
||||
Q++;
|
||||
assert(Q); // shouldn't overflow
|
||||
CRYPTOPP_ASSERT(Q); // shouldn't overflow
|
||||
}
|
||||
|
||||
return Q;
|
||||
|
|
@ -797,7 +797,7 @@ CRYPTOPP_NAKED int CRYPTOPP_FASTCALL SSE2_Sub(size_t N, word *C, const word *A,
|
|||
#else
|
||||
int CRYPTOPP_FASTCALL Baseline_Add(size_t N, word *C, const word *A, const word *B)
|
||||
{
|
||||
assert (N%2 == 0);
|
||||
CRYPTOPP_ASSERT (N%2 == 0);
|
||||
|
||||
Declare2Words(u);
|
||||
AssignWord(u, 0);
|
||||
|
|
@ -813,7 +813,7 @@ int CRYPTOPP_FASTCALL Baseline_Add(size_t N, word *C, const word *A, const word
|
|||
|
||||
int CRYPTOPP_FASTCALL Baseline_Sub(size_t N, word *C, const word *A, const word *B)
|
||||
{
|
||||
assert (N%2 == 0);
|
||||
CRYPTOPP_ASSERT (N%2 == 0);
|
||||
|
||||
Declare2Words(u);
|
||||
AssignWord(u, 0);
|
||||
|
|
@ -2064,7 +2064,7 @@ inline int Subtract(word *C, const word *A, const word *B, size_t N)
|
|||
|
||||
void RecursiveMultiply(word *R, word *T, const word *A, const word *B, size_t N)
|
||||
{
|
||||
assert(N>=2 && N%2==0);
|
||||
CRYPTOPP_ASSERT(N>=2 && N%2==0);
|
||||
|
||||
if (N <= s_recursionLimit)
|
||||
s_pMul[N/4](R, A, B);
|
||||
|
|
@ -2095,7 +2095,7 @@ void RecursiveMultiply(word *R, word *T, const word *A, const word *B, size_t N)
|
|||
c3 += Add(R1, R1, T0, N);
|
||||
|
||||
c3 += Increment(R2, N2, c2);
|
||||
assert (c3 >= 0 && c3 <= 2);
|
||||
CRYPTOPP_ASSERT (c3 >= 0 && c3 <= 2);
|
||||
Increment(R3, N2, c3);
|
||||
}
|
||||
}
|
||||
|
|
@ -2106,7 +2106,7 @@ void RecursiveMultiply(word *R, word *T, const word *A, const word *B, size_t N)
|
|||
|
||||
void RecursiveSquare(word *R, word *T, const word *A, size_t N)
|
||||
{
|
||||
assert(N && N%2==0);
|
||||
CRYPTOPP_ASSERT(N && N%2==0);
|
||||
|
||||
if (N <= s_recursionLimit)
|
||||
s_pSqu[N/4](R, A);
|
||||
|
|
@ -2131,7 +2131,7 @@ void RecursiveSquare(word *R, word *T, const word *A, size_t N)
|
|||
|
||||
void RecursiveMultiplyBottom(word *R, word *T, const word *A, const word *B, size_t N)
|
||||
{
|
||||
assert(N>=2 && N%2==0);
|
||||
CRYPTOPP_ASSERT(N>=2 && N%2==0);
|
||||
|
||||
if (N <= s_recursionLimit)
|
||||
s_pBot[N/4](R, A, B);
|
||||
|
|
@ -2155,7 +2155,7 @@ void RecursiveMultiplyBottom(word *R, word *T, const word *A, const word *B, siz
|
|||
|
||||
void MultiplyTop(word *R, word *T, const word *L, const word *A, const word *B, size_t N)
|
||||
{
|
||||
assert(N>=2 && N%2==0);
|
||||
CRYPTOPP_ASSERT(N>=2 && N%2==0);
|
||||
|
||||
if (N <= s_recursionLimit)
|
||||
s_pTop[N/4](R, A, B, L[N-1]);
|
||||
|
|
@ -2197,7 +2197,7 @@ void MultiplyTop(word *R, word *T, const word *L, const word *A, const word *B,
|
|||
c3 -= Decrement(T2, N2, -c2);
|
||||
c3 += Add(R0, T2, R1, N2);
|
||||
|
||||
assert (c3 >= 0 && c3 <= 2);
|
||||
CRYPTOPP_ASSERT (c3 >= 0 && c3 <= 2);
|
||||
Increment(R1, N2, c3);
|
||||
}
|
||||
}
|
||||
|
|
@ -2240,7 +2240,7 @@ void AsymmetricMultiply(word *R, word *T, const word *A, size_t NA, const word *
|
|||
std::swap(NA, NB);
|
||||
}
|
||||
|
||||
assert(NB % NA == 0);
|
||||
CRYPTOPP_ASSERT(NB % NA == 0);
|
||||
|
||||
if (NA==2 && !A[1])
|
||||
{
|
||||
|
|
@ -2326,7 +2326,7 @@ void MontgomeryReduce(word *R, word *T, word *X, const word *M, const word *U, s
|
|||
word borrow = Subtract(T, X+N, T, N);
|
||||
// defend against timing attack by doing this Add even when not needed
|
||||
word carry = Add(T+N, T, M, N);
|
||||
assert(carry | !borrow);
|
||||
CRYPTOPP_ASSERT(carry | !borrow);
|
||||
CopyWords(R, T + ((0-borrow) & N), N);
|
||||
#elif 0
|
||||
const word u = 0-U[0];
|
||||
|
|
@ -2393,7 +2393,7 @@ void MontgomeryReduce(word *R, word *T, word *X, const word *M, const word *U, s
|
|||
|
||||
void HalfMontgomeryReduce(word *R, word *T, const word *X, const word *M, const word *U, const word *V, size_t N)
|
||||
{
|
||||
assert(N%2==0 && N>=4);
|
||||
CRYPTOPP_ASSERT(N%2==0 && N>=4);
|
||||
|
||||
#define M0 M
|
||||
#define M1 (M+N2)
|
||||
|
|
@ -2422,7 +2422,7 @@ void HalfMontgomeryReduce(word *R, word *T, const word *X, const word *M, const
|
|||
else if (c2<0)
|
||||
c3 -= Decrement(R1, N2, -c2);
|
||||
|
||||
assert(c3>=-1 && c3<=1);
|
||||
CRYPTOPP_ASSERT(c3>=-1 && c3<=1);
|
||||
if (c3>0)
|
||||
Subtract(R, R, M, N);
|
||||
else if (c3<0)
|
||||
|
|
@ -2459,7 +2459,7 @@ void HalfMontgomeryReduce(word *R, word *T, const word *X, const word *M, const
|
|||
static word SubatomicDivide(word *A, word B0, word B1)
|
||||
{
|
||||
// assert {A[2],A[1]} < {B1,B0}, so quotient can fit in a word
|
||||
assert(A[2] < B1 || (A[2]==B1 && A[1] < B0));
|
||||
CRYPTOPP_ASSERT(A[2] < B1 || (A[2]==B1 && A[1] < B0));
|
||||
|
||||
// estimate the quotient: do a 2 word by 1 word divide
|
||||
word Q;
|
||||
|
|
@ -2485,7 +2485,7 @@ static word SubatomicDivide(word *A, word B0, word B1)
|
|||
A[1] = u.GetLowHalf();
|
||||
A[2] += u.GetHighHalf();
|
||||
Q++;
|
||||
assert(Q); // shouldn't overflow
|
||||
CRYPTOPP_ASSERT(Q); // shouldn't overflow
|
||||
}
|
||||
|
||||
return Q;
|
||||
|
|
@ -2508,11 +2508,11 @@ static inline void AtomicDivide(word *Q, const word *A, const word *B)
|
|||
|
||||
#ifndef NDEBUG
|
||||
// multiply quotient and divisor and add remainder, make sure it equals dividend
|
||||
assert(!T[2] && !T[3] && (T[1] < B[1] || (T[1]==B[1] && T[0]<B[0])));
|
||||
CRYPTOPP_ASSERT(!T[2] && !T[3] && (T[1] < B[1] || (T[1]==B[1] && T[0]<B[0])));
|
||||
word P[4];
|
||||
LowLevel::Multiply2(P, Q, B);
|
||||
Add(P, P, T, 4);
|
||||
assert(memcmp(P, A, 4*WORD_SIZE)==0);
|
||||
CRYPTOPP_ASSERT(memcmp(P, A, 4*WORD_SIZE)==0);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
@ -2529,11 +2529,11 @@ static inline void AtomicDivide(word *Q, const word *A, const word *B)
|
|||
if (B[0] || B[1])
|
||||
{
|
||||
// multiply quotient and divisor and add remainder, make sure it equals dividend
|
||||
assert(!T[2] && !T[3] && (T[1] < B[1] || (T[1]==B[1] && T[0]<B[0])));
|
||||
CRYPTOPP_ASSERT(!T[2] && !T[3] && (T[1] < B[1] || (T[1]==B[1] && T[0]<B[0])));
|
||||
word P[4];
|
||||
s_pMul[0](P, Q, B);
|
||||
Add(P, P, T, 4);
|
||||
assert(memcmp(P, A, 4*WORD_SIZE)==0);
|
||||
CRYPTOPP_ASSERT(memcmp(P, A, 4*WORD_SIZE)==0);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
@ -2541,18 +2541,18 @@ static inline void AtomicDivide(word *Q, const word *A, const word *B)
|
|||
// for use by Divide(), corrects the underestimated quotient {Q1,Q0}
|
||||
static void CorrectQuotientEstimate(word *R, word *T, word *Q, const word *B, size_t N)
|
||||
{
|
||||
assert(N && N%2==0);
|
||||
CRYPTOPP_ASSERT(N && N%2==0);
|
||||
|
||||
AsymmetricMultiply(T, T+N+2, Q, 2, B, N);
|
||||
|
||||
word borrow = Subtract(R, R, T, N+2);
|
||||
assert(!borrow && !R[N+1]);
|
||||
CRYPTOPP_ASSERT(!borrow && !R[N+1]);
|
||||
|
||||
while (R[N] || Compare(R, B, N) >= 0)
|
||||
{
|
||||
R[N] -= Subtract(R, R, B, N);
|
||||
Q[1] += (++Q[0]==0);
|
||||
assert(Q[0] || Q[1]); // no overflow
|
||||
CRYPTOPP_ASSERT(Q[0] || Q[1]); // no overflow
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2564,9 +2564,9 @@ static void CorrectQuotientEstimate(word *R, word *T, word *Q, const word *B, si
|
|||
|
||||
void Divide(word *R, word *Q, word *T, const word *A, size_t NA, const word *B, size_t NB)
|
||||
{
|
||||
assert(NA && NB && NA%2==0 && NB%2==0);
|
||||
assert(B[NB-1] || B[NB-2]);
|
||||
assert(NB <= NA);
|
||||
CRYPTOPP_ASSERT(NA && NB && NA%2==0 && NB%2==0);
|
||||
CRYPTOPP_ASSERT(B[NB-1] || B[NB-2]);
|
||||
CRYPTOPP_ASSERT(NB <= NA);
|
||||
|
||||
// set up temporary work space
|
||||
word *const TA=T;
|
||||
|
|
@ -2578,7 +2578,7 @@ void Divide(word *R, word *Q, word *T, const word *A, size_t NA, const word *B,
|
|||
TB[0] = TB[NB-1] = 0;
|
||||
CopyWords(TB+shiftWords, B, NB-shiftWords);
|
||||
unsigned shiftBits = WORD_BITS - BitPrecision(TB[NB-1]);
|
||||
assert(shiftBits < WORD_BITS);
|
||||
CRYPTOPP_ASSERT(shiftBits < WORD_BITS);
|
||||
ShiftWordsLeftByBits(TB, NB, shiftBits);
|
||||
|
||||
// copy A into TA and normalize it
|
||||
|
|
@ -2598,7 +2598,7 @@ void Divide(word *R, word *Q, word *T, const word *A, size_t NA, const word *B,
|
|||
else
|
||||
{
|
||||
NA+=2;
|
||||
assert(Compare(TA+NA-NB, TB, NB) < 0);
|
||||
CRYPTOPP_ASSERT(Compare(TA+NA-NB, TB, NB) < 0);
|
||||
}
|
||||
|
||||
word BT[2];
|
||||
|
|
@ -2632,7 +2632,7 @@ static inline size_t EvenWordCount(const word *X, size_t N)
|
|||
|
||||
unsigned int AlmostInverse(word *R, word *T, const word *A, size_t NA, const word *M, size_t N)
|
||||
{
|
||||
assert(NA<=N && N && N%2==0);
|
||||
CRYPTOPP_ASSERT(NA<=N && N && N%2==0);
|
||||
|
||||
word *b = T;
|
||||
word *c = T+N;
|
||||
|
|
@ -2660,7 +2660,7 @@ unsigned int AlmostInverse(word *R, word *T, const word *A, size_t NA, const wor
|
|||
|
||||
ShiftWordsRightByWords(f, fgLen, 1);
|
||||
bcLen += 2 * (c[bcLen-1] != 0);
|
||||
assert(bcLen <= N);
|
||||
CRYPTOPP_ASSERT(bcLen <= N);
|
||||
ShiftWordsLeftByWords(c, bcLen, 1);
|
||||
k+=WORD_BITS;
|
||||
t=f[0];
|
||||
|
|
@ -2683,7 +2683,7 @@ unsigned int AlmostInverse(word *R, word *T, const word *A, size_t NA, const wor
|
|||
t = ShiftWordsLeftByBits(c, bcLen, i);
|
||||
c[bcLen] += t;
|
||||
bcLen += 2 * (t!=0);
|
||||
assert(bcLen <= N);
|
||||
CRYPTOPP_ASSERT(bcLen <= N);
|
||||
|
||||
bool swap = Compare(f, g, fgLen)==-1;
|
||||
ConditionalSwapPointers(swap, f, g);
|
||||
|
|
@ -2696,7 +2696,7 @@ unsigned int AlmostInverse(word *R, word *T, const word *A, size_t NA, const wor
|
|||
t = Add(b, b, c, bcLen);
|
||||
b[bcLen] += t;
|
||||
bcLen += 2*t;
|
||||
assert(bcLen <= N);
|
||||
CRYPTOPP_ASSERT(bcLen <= N);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2816,7 +2816,7 @@ bool Integer::IsConvertableToLong() const
|
|||
|
||||
signed long Integer::ConvertToLong() const
|
||||
{
|
||||
assert(IsConvertableToLong());
|
||||
CRYPTOPP_ASSERT(IsConvertableToLong());
|
||||
|
||||
unsigned long value = (unsigned long)reg[0];
|
||||
value += SafeLeftShift<WORD_BITS, unsigned long>((unsigned long)reg[1]);
|
||||
|
|
@ -2937,7 +2937,7 @@ void Integer::SetByte(size_t n, byte value)
|
|||
lword Integer::GetBits(size_t i, size_t n) const
|
||||
{
|
||||
lword v = 0;
|
||||
assert(n <= sizeof(v)*8);
|
||||
CRYPTOPP_ASSERT(n <= sizeof(v)*8);
|
||||
for (unsigned int j=0; j<n; j++)
|
||||
v |= lword(GetBit(i+j)) << j;
|
||||
return v;
|
||||
|
|
@ -3076,7 +3076,7 @@ void Integer::Decode(const byte *input, size_t inputLen, Signedness s)
|
|||
|
||||
void Integer::Decode(BufferedTransformation &bt, size_t inputLen, Signedness s)
|
||||
{
|
||||
assert(bt.MaxRetrievable() >= inputLen);
|
||||
CRYPTOPP_ASSERT(bt.MaxRetrievable() >= inputLen);
|
||||
|
||||
byte b;
|
||||
bt.Peek(b);
|
||||
|
|
@ -3442,7 +3442,7 @@ Integer& Integer::operator++()
|
|||
else
|
||||
{
|
||||
word borrow = Decrement(reg, reg.size());
|
||||
assert(!borrow);
|
||||
CRYPTOPP_ASSERT(!borrow);
|
||||
if (WordCount()==0)
|
||||
*this = Zero();
|
||||
}
|
||||
|
|
@ -3518,7 +3518,7 @@ void PositiveSubtract(Integer &diff, const Integer &a, const Integer& b)
|
|||
word borrow = Subtract(diff.reg, a.reg, b.reg, bSize);
|
||||
CopyWords(diff.reg+bSize, a.reg+bSize, aSize-bSize);
|
||||
borrow = Decrement(diff.reg+bSize, aSize-bSize, borrow);
|
||||
assert(!borrow);
|
||||
CRYPTOPP_ASSERT(!borrow);
|
||||
diff.sign = Integer::POSITIVE;
|
||||
}
|
||||
else
|
||||
|
|
@ -3526,7 +3526,7 @@ void PositiveSubtract(Integer &diff, const Integer &a, const Integer& b)
|
|||
word borrow = Subtract(diff.reg, b.reg, a.reg, aSize);
|
||||
CopyWords(diff.reg+aSize, b.reg+aSize, bSize-aSize);
|
||||
borrow = Decrement(diff.reg+aSize, bSize-aSize, borrow);
|
||||
assert(!borrow);
|
||||
CRYPTOPP_ASSERT(!borrow);
|
||||
diff.sign = Integer::NEGATIVE;
|
||||
}
|
||||
}
|
||||
|
|
@ -3798,7 +3798,7 @@ void Integer::Divide(word &remainder, Integer "ient, const Integer ÷nd
|
|||
if (!divisor)
|
||||
throw Integer::DivideByZero();
|
||||
|
||||
assert(divisor);
|
||||
CRYPTOPP_ASSERT(divisor);
|
||||
|
||||
if ((divisor & (divisor-1)) == 0) // divisor is a power of 2
|
||||
{
|
||||
|
|
@ -3842,7 +3842,7 @@ word Integer::Modulo(word divisor) const
|
|||
if (!divisor)
|
||||
throw Integer::DivideByZero();
|
||||
|
||||
assert(divisor);
|
||||
CRYPTOPP_ASSERT(divisor);
|
||||
|
||||
word remainder;
|
||||
|
||||
|
|
@ -3914,7 +3914,7 @@ Integer Integer::SquareRoot() const
|
|||
|
||||
// overestimate square root
|
||||
Integer x, y = Power2((BitCount()+1)/2);
|
||||
assert(y*y >= *this);
|
||||
CRYPTOPP_ASSERT(y*y >= *this);
|
||||
|
||||
do
|
||||
{
|
||||
|
|
@ -3959,7 +3959,7 @@ Integer Integer::Gcd(const Integer &a, const Integer &b)
|
|||
|
||||
Integer Integer::InverseMod(const Integer &m) const
|
||||
{
|
||||
assert(m.NotNegative());
|
||||
CRYPTOPP_ASSERT(m.NotNegative());
|
||||
|
||||
if (IsNegative())
|
||||
return Modulo(m).InverseMod(m);
|
||||
|
|
@ -4175,7 +4175,7 @@ const Integer& MontgomeryRepresentation::Multiply(const Integer &a, const Intege
|
|||
word *const T = m_workspace.begin();
|
||||
word *const R = m_result.reg.begin();
|
||||
const size_t N = m_modulus.reg.size();
|
||||
assert(a.reg.size()<=N && b.reg.size()<=N);
|
||||
CRYPTOPP_ASSERT(a.reg.size()<=N && b.reg.size()<=N);
|
||||
|
||||
AsymmetricMultiply(T, T+2*N, a.reg, a.reg.size(), b.reg, b.reg.size());
|
||||
SetWords(T+a.reg.size()+b.reg.size(), 0, 2*N-a.reg.size()-b.reg.size());
|
||||
|
|
@ -4188,7 +4188,7 @@ const Integer& MontgomeryRepresentation::Square(const Integer &a) const
|
|||
word *const T = m_workspace.begin();
|
||||
word *const R = m_result.reg.begin();
|
||||
const size_t N = m_modulus.reg.size();
|
||||
assert(a.reg.size()<=N);
|
||||
CRYPTOPP_ASSERT(a.reg.size()<=N);
|
||||
|
||||
CryptoPP::Square(T, T+2*N, a.reg, a.reg.size());
|
||||
SetWords(T+2*a.reg.size(), 0, 2*N-2*a.reg.size());
|
||||
|
|
@ -4201,7 +4201,7 @@ Integer MontgomeryRepresentation::ConvertOut(const Integer &a) const
|
|||
word *const T = m_workspace.begin();
|
||||
word *const R = m_result.reg.begin();
|
||||
const size_t N = m_modulus.reg.size();
|
||||
assert(a.reg.size()<=N);
|
||||
CRYPTOPP_ASSERT(a.reg.size()<=N);
|
||||
|
||||
CopyWords(T, a.reg, a.reg.size());
|
||||
SetWords(T+a.reg.size(), 0, 2*N-a.reg.size());
|
||||
|
|
@ -4215,7 +4215,7 @@ const Integer& MontgomeryRepresentation::MultiplicativeInverse(const Integer &a)
|
|||
word *const T = m_workspace.begin();
|
||||
word *const R = m_result.reg.begin();
|
||||
const size_t N = m_modulus.reg.size();
|
||||
assert(a.reg.size()<=N);
|
||||
CRYPTOPP_ASSERT(a.reg.size()<=N);
|
||||
|
||||
CopyWords(T, a.reg, a.reg.size());
|
||||
SetWords(T+a.reg.size(), 0, 2*N-a.reg.size());
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ template <class T, class BASE> void IteratedHashBase<T, BASE>::Update(const byte
|
|||
{
|
||||
if (input == data)
|
||||
{
|
||||
assert(len == blockSize);
|
||||
CRYPTOPP_ASSERT(len == blockSize);
|
||||
HashBlock(dataBuf);
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
2
luc.h
2
luc.h
|
|
@ -116,7 +116,7 @@ typedef LUCSS<PKCS1v15, SHA>::Verifier LUCSSA_PKCS1v15_SHA_Verifier;
|
|||
class DL_GroupPrecomputation_LUC : public DL_GroupPrecomputation<Integer>
|
||||
{
|
||||
public:
|
||||
const AbstractGroup<Element> & GetGroup() const {assert(false); throw 0;}
|
||||
const AbstractGroup<Element> & GetGroup() const {CRYPTOPP_ASSERT(false); throw 0;}
|
||||
Element BERDecodeElement(BufferedTransformation &bt) const {return Integer(bt);}
|
||||
void DEREncodeElement(BufferedTransformation &bt, const Element &v) const {v.DEREncode(bt);}
|
||||
|
||||
|
|
|
|||
16
misc.cpp
16
misc.cpp
|
|
@ -27,8 +27,8 @@ void xorbuf(byte *buf, const byte *mask, size_t count)
|
|||
{
|
||||
if (!CRYPTOPP_BOOL_SLOW_WORD64 && IsStrictAligned<word64>(buf) && IsStrictAligned<word64>(mask))
|
||||
{
|
||||
assert(IsAlignedOn(buf, GetStrictAlignmentOf<word64>()));
|
||||
assert(IsAlignedOn(mask, GetStrictAlignmentOf<word64>()));
|
||||
CRYPTOPP_ASSERT(IsAlignedOn(buf, GetStrictAlignmentOf<word64>()));
|
||||
CRYPTOPP_ASSERT(IsAlignedOn(mask, GetStrictAlignmentOf<word64>()));
|
||||
|
||||
for (i=0; i<count/8; i++)
|
||||
((word64*)buf)[i] ^= ((word64*)mask)[i];
|
||||
|
|
@ -60,9 +60,9 @@ void xorbuf(byte *output, const byte *input, const byte *mask, size_t count)
|
|||
{
|
||||
if (!CRYPTOPP_BOOL_SLOW_WORD64 && IsStrictAligned<word64>(output) && IsStrictAligned<word64>(input) && IsStrictAligned<word64>(mask))
|
||||
{
|
||||
assert(IsAlignedOn(output, GetStrictAlignmentOf<word64>()));
|
||||
assert(IsAlignedOn(input, GetStrictAlignmentOf<word64>()));
|
||||
assert(IsAlignedOn(mask, GetStrictAlignmentOf<word64>()));
|
||||
CRYPTOPP_ASSERT(IsAlignedOn(output, GetStrictAlignmentOf<word64>()));
|
||||
CRYPTOPP_ASSERT(IsAlignedOn(input, GetStrictAlignmentOf<word64>()));
|
||||
CRYPTOPP_ASSERT(IsAlignedOn(mask, GetStrictAlignmentOf<word64>()));
|
||||
|
||||
for (i=0; i<count/8; i++)
|
||||
((word64*)output)[i] = ((word64*)input)[i] ^ ((word64*)mask)[i];
|
||||
|
|
@ -98,8 +98,8 @@ bool VerifyBufsEqual(const byte *buf, const byte *mask, size_t count)
|
|||
word32 acc32 = 0;
|
||||
if (!CRYPTOPP_BOOL_SLOW_WORD64 && IsStrictAligned<word64>(buf) && IsStrictAligned<word64>(mask))
|
||||
{
|
||||
assert(IsAlignedOn(buf, GetStrictAlignmentOf<word64>()));
|
||||
assert(IsAlignedOn(mask, GetStrictAlignmentOf<word64>()));
|
||||
CRYPTOPP_ASSERT(IsAlignedOn(buf, GetStrictAlignmentOf<word64>()));
|
||||
CRYPTOPP_ASSERT(IsAlignedOn(mask, GetStrictAlignmentOf<word64>()));
|
||||
|
||||
word64 acc64 = 0;
|
||||
for (i=0; i<count/8; i++)
|
||||
|
|
@ -166,7 +166,7 @@ void * AlignedAllocate(size_t size)
|
|||
p[-1] = (byte)adjustment;
|
||||
#endif
|
||||
|
||||
assert(IsAlignedOn(p, 16));
|
||||
CRYPTOPP_ASSERT(IsAlignedOn(p, 16));
|
||||
return p;
|
||||
}
|
||||
|
||||
|
|
|
|||
22
modes.cpp
22
modes.cpp
|
|
@ -27,8 +27,8 @@ void Modes_TestInstantiations()
|
|||
|
||||
void CFB_ModePolicy::Iterate(byte *output, const byte *input, CipherDir dir, size_t iterationCount)
|
||||
{
|
||||
assert(m_cipher->IsForwardTransformation()); // CFB mode needs the "encrypt" direction of the underlying block cipher, even to decrypt
|
||||
assert(m_feedbackSize == BlockSize());
|
||||
CRYPTOPP_ASSERT(m_cipher->IsForwardTransformation()); // CFB mode needs the "encrypt" direction of the underlying block cipher, even to decrypt
|
||||
CRYPTOPP_ASSERT(m_feedbackSize == BlockSize());
|
||||
|
||||
const unsigned int s = BlockSize();
|
||||
if (dir == ENCRYPTION)
|
||||
|
|
@ -48,7 +48,7 @@ void CFB_ModePolicy::Iterate(byte *output, const byte *input, CipherDir dir, siz
|
|||
|
||||
void CFB_ModePolicy::TransformRegister()
|
||||
{
|
||||
assert(m_cipher->IsForwardTransformation()); // CFB mode needs the "encrypt" direction of the underlying block cipher, even to decrypt
|
||||
CRYPTOPP_ASSERT(m_cipher->IsForwardTransformation()); // CFB mode needs the "encrypt" direction of the underlying block cipher, even to decrypt
|
||||
m_cipher->ProcessBlock(m_register, m_temp);
|
||||
const unsigned int updateSize = BlockSize()-m_feedbackSize;
|
||||
|
||||
|
|
@ -59,7 +59,7 @@ void CFB_ModePolicy::TransformRegister()
|
|||
|
||||
void CFB_ModePolicy::CipherResynchronize(const byte *iv, size_t length)
|
||||
{
|
||||
assert(length == BlockSize());
|
||||
CRYPTOPP_ASSERT(length == BlockSize());
|
||||
CopyOrZero(m_register, iv, length);
|
||||
TransformRegister();
|
||||
}
|
||||
|
|
@ -79,7 +79,7 @@ void CFB_ModePolicy::ResizeBuffers()
|
|||
|
||||
void OFB_ModePolicy::WriteKeystream(byte *keystreamBuffer, size_t iterationCount)
|
||||
{
|
||||
assert(m_cipher->IsForwardTransformation()); // OFB mode needs the "encrypt" direction of the underlying block cipher, even to decrypt
|
||||
CRYPTOPP_ASSERT(m_cipher->IsForwardTransformation()); // OFB mode needs the "encrypt" direction of the underlying block cipher, even to decrypt
|
||||
unsigned int s = BlockSize();
|
||||
m_cipher->ProcessBlock(m_register, keystreamBuffer);
|
||||
if (iterationCount > 1)
|
||||
|
|
@ -89,7 +89,7 @@ void OFB_ModePolicy::WriteKeystream(byte *keystreamBuffer, size_t iterationCount
|
|||
|
||||
void OFB_ModePolicy::CipherResynchronize(byte *keystreamBuffer, const byte *iv, size_t length)
|
||||
{
|
||||
assert(length == BlockSize());
|
||||
CRYPTOPP_ASSERT(length == BlockSize());
|
||||
CopyOrZero(m_register, iv, length);
|
||||
}
|
||||
|
||||
|
|
@ -112,7 +112,7 @@ void CTR_ModePolicy::IncrementCounterBy256()
|
|||
|
||||
void CTR_ModePolicy::OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, size_t iterationCount)
|
||||
{
|
||||
assert(m_cipher->IsForwardTransformation()); // CTR mode needs the "encrypt" direction of the underlying block cipher, even to decrypt
|
||||
CRYPTOPP_ASSERT(m_cipher->IsForwardTransformation()); // CTR mode needs the "encrypt" direction of the underlying block cipher, even to decrypt
|
||||
unsigned int s = BlockSize();
|
||||
unsigned int inputIncrement = input ? s : 0;
|
||||
|
||||
|
|
@ -132,7 +132,7 @@ void CTR_ModePolicy::OperateKeystream(KeystreamOperation operation, byte *output
|
|||
|
||||
void CTR_ModePolicy::CipherResynchronize(byte *keystreamBuffer, const byte *iv, size_t length)
|
||||
{
|
||||
assert(length == BlockSize());
|
||||
CRYPTOPP_ASSERT(length == BlockSize());
|
||||
CopyOrZero(m_register, iv, length);
|
||||
m_counterArray = m_register;
|
||||
}
|
||||
|
|
@ -151,7 +151,7 @@ void BlockOrientedCipherModeBase::UncheckedSetKey(const byte *key, unsigned int
|
|||
|
||||
void ECB_OneWay::ProcessData(byte *outString, const byte *inString, size_t length)
|
||||
{
|
||||
assert(length%BlockSize()==0);
|
||||
CRYPTOPP_ASSERT(length%BlockSize()==0);
|
||||
m_cipher->AdvancedProcessBlocks(inString, NULL, outString, length, BlockTransformation::BT_AllowParallel);
|
||||
}
|
||||
|
||||
|
|
@ -159,7 +159,7 @@ void CBC_Encryption::ProcessData(byte *outString, const byte *inString, size_t l
|
|||
{
|
||||
if (!length)
|
||||
return;
|
||||
assert(length%BlockSize()==0);
|
||||
CRYPTOPP_ASSERT(length%BlockSize()==0);
|
||||
|
||||
unsigned int blockSize = BlockSize();
|
||||
m_cipher->AdvancedProcessBlocks(inString, m_register, outString, blockSize, BlockTransformation::BT_XorInput);
|
||||
|
|
@ -199,7 +199,7 @@ void CBC_Decryption::ProcessData(byte *outString, const byte *inString, size_t l
|
|||
{
|
||||
if (!length)
|
||||
return;
|
||||
assert(length%BlockSize()==0);
|
||||
CRYPTOPP_ASSERT(length%BlockSize()==0);
|
||||
|
||||
unsigned int blockSize = BlockSize();
|
||||
memcpy(m_temp, inString+length-blockSize, blockSize); // save copy now in case of in-place decryption
|
||||
|
|
|
|||
2
modes.h
2
modes.h
|
|
@ -62,7 +62,7 @@ public:
|
|||
|
||||
protected:
|
||||
CipherModeBase() : m_cipher(NULL) {}
|
||||
inline unsigned int BlockSize() const {assert(m_register.size() > 0); return (unsigned int)m_register.size();}
|
||||
inline unsigned int BlockSize() const {CRYPTOPP_ASSERT(m_register.size() > 0); return (unsigned int)m_register.size();}
|
||||
virtual void SetFeedbackSize(unsigned int feedbackSize)
|
||||
{
|
||||
if (!(feedbackSize == 0 || feedbackSize == BlockSize()))
|
||||
|
|
|
|||
66
nbtheory.cpp
66
nbtheory.cpp
|
|
@ -78,7 +78,7 @@ bool TrialDivision(const Integer &p, unsigned bound)
|
|||
unsigned int primeTableSize;
|
||||
const word16 * primeTable = GetPrimeTable(primeTableSize);
|
||||
|
||||
assert(primeTable[primeTableSize-1] >= bound);
|
||||
CRYPTOPP_ASSERT(primeTable[primeTableSize-1] >= bound);
|
||||
|
||||
unsigned int i;
|
||||
for (i = 0; primeTable[i]<bound; i++)
|
||||
|
|
@ -103,7 +103,7 @@ bool IsFermatProbablePrime(const Integer &n, const Integer &b)
|
|||
if (n <= 3)
|
||||
return n==2 || n==3;
|
||||
|
||||
assert(n>3 && b>1 && b<n-1);
|
||||
CRYPTOPP_ASSERT(n>3 && b>1 && b<n-1);
|
||||
return a_exp_b_mod_c(b, n-1, n)==1;
|
||||
}
|
||||
|
||||
|
|
@ -112,7 +112,7 @@ bool IsStrongProbablePrime(const Integer &n, const Integer &b)
|
|||
if (n <= 3)
|
||||
return n==2 || n==3;
|
||||
|
||||
assert(n>3 && b>1 && b<n-1);
|
||||
CRYPTOPP_ASSERT(n>3 && b>1 && b<n-1);
|
||||
|
||||
if ((n.IsEven() && n!=2) || GCD(b, n) != 1)
|
||||
return false;
|
||||
|
|
@ -145,7 +145,7 @@ bool RabinMillerTest(RandomNumberGenerator &rng, const Integer &n, unsigned int
|
|||
if (n <= 3)
|
||||
return n==2 || n==3;
|
||||
|
||||
assert(n>3);
|
||||
CRYPTOPP_ASSERT(n>3);
|
||||
|
||||
Integer b;
|
||||
for (unsigned int i=0; i<rounds; i++)
|
||||
|
|
@ -165,7 +165,7 @@ bool IsLucasProbablePrime(const Integer &n)
|
|||
if (n.IsEven())
|
||||
return n==2;
|
||||
|
||||
assert(n>2);
|
||||
CRYPTOPP_ASSERT(n>2);
|
||||
|
||||
Integer b=3;
|
||||
unsigned int i=0;
|
||||
|
|
@ -192,7 +192,7 @@ bool IsStrongLucasProbablePrime(const Integer &n)
|
|||
if (n.IsEven())
|
||||
return n==2;
|
||||
|
||||
assert(n>2);
|
||||
CRYPTOPP_ASSERT(n>2);
|
||||
|
||||
Integer b=3;
|
||||
unsigned int i=0;
|
||||
|
|
@ -313,7 +313,7 @@ PrimeSieve::PrimeSieve(const Integer &first, const Integer &last, const Integer
|
|||
bool PrimeSieve::NextCandidate(Integer &c)
|
||||
{
|
||||
bool safe = SafeConvert(std::find(m_sieve.begin()+m_next, m_sieve.end(), false) - m_sieve.begin(), m_next);
|
||||
assert(safe); CRYPTOPP_UNUSED(safe);
|
||||
CRYPTOPP_ASSERT(safe); CRYPTOPP_UNUSED(safe);
|
||||
|
||||
if (m_next == m_sieve.size())
|
||||
{
|
||||
|
|
@ -367,7 +367,7 @@ void PrimeSieve::DoSieve()
|
|||
}
|
||||
else
|
||||
{
|
||||
assert(m_step%2==0);
|
||||
CRYPTOPP_ASSERT(m_step%2==0);
|
||||
Integer qFirst = (m_first-m_delta) >> 1;
|
||||
Integer halfStep = m_step >> 1;
|
||||
for (unsigned int i = 0; i < primeTableSize; ++i)
|
||||
|
|
@ -384,7 +384,7 @@ void PrimeSieve::DoSieve()
|
|||
|
||||
bool FirstPrime(Integer &p, const Integer &max, const Integer &equiv, const Integer &mod, const PrimeSelector *pSelector)
|
||||
{
|
||||
assert(!equiv.IsNegative() && equiv < mod);
|
||||
CRYPTOPP_ASSERT(!equiv.IsNegative() && equiv < mod);
|
||||
|
||||
Integer gcd = GCD(equiv, mod);
|
||||
if (gcd != Integer::One())
|
||||
|
|
@ -424,7 +424,7 @@ bool FirstPrime(Integer &p, const Integer &max, const Integer &equiv, const Inte
|
|||
p = primeTable[primeTableSize-1]+1;
|
||||
}
|
||||
|
||||
assert(p > primeTable[primeTableSize-1]);
|
||||
CRYPTOPP_ASSERT(p > primeTable[primeTableSize-1]);
|
||||
|
||||
if (mod.IsOdd())
|
||||
return FirstPrime(p, max, CRT(equiv, mod, 1, 2, 1), mod<<1, pSelector);
|
||||
|
|
@ -448,8 +448,8 @@ bool FirstPrime(Integer &p, const Integer &max, const Integer &equiv, const Inte
|
|||
// the following two functions are based on code and comments provided by Preda Mihailescu
|
||||
static bool ProvePrime(const Integer &p, const Integer &q)
|
||||
{
|
||||
assert(p < q*q*q);
|
||||
assert(p % q == 1);
|
||||
CRYPTOPP_ASSERT(p < q*q*q);
|
||||
CRYPTOPP_ASSERT(p % q == 1);
|
||||
|
||||
// this is the Quisquater test. Numbers p having passed the Lucas - Lehmer test
|
||||
// for q and verifying p < q^3 can only be built up of two factors, both = 1 mod q,
|
||||
|
|
@ -463,7 +463,7 @@ static bool ProvePrime(const Integer &p, const Integer &q)
|
|||
unsigned int primeTableSize;
|
||||
const word16 * primeTable = GetPrimeTable(primeTableSize);
|
||||
|
||||
assert(primeTableSize >= 50);
|
||||
CRYPTOPP_ASSERT(primeTableSize >= 50);
|
||||
for (int i=0; i<50; i++)
|
||||
{
|
||||
Integer b = a_exp_b_mod_c(primeTable[i], r, p);
|
||||
|
|
@ -620,7 +620,7 @@ Integer ModularSquareRoot(const Integer &a, const Integer &p)
|
|||
b = tempb*y%p;
|
||||
}
|
||||
|
||||
assert(x.Squared()%p == a);
|
||||
CRYPTOPP_ASSERT(x.Squared()%p == a);
|
||||
return x;
|
||||
}
|
||||
|
||||
|
|
@ -630,21 +630,21 @@ bool SolveModularQuadraticEquation(Integer &r1, Integer &r2, const Integer &a, c
|
|||
switch (Jacobi(D, p))
|
||||
{
|
||||
default:
|
||||
assert(false); // not reached
|
||||
CRYPTOPP_ASSERT(false); // not reached
|
||||
return false;
|
||||
case -1:
|
||||
return false;
|
||||
case 0:
|
||||
r1 = r2 = (-b*(a+a).InverseMod(p)) % p;
|
||||
assert(((r1.Squared()*a + r1*b + c) % p).IsZero());
|
||||
CRYPTOPP_ASSERT(((r1.Squared()*a + r1*b + c) % p).IsZero());
|
||||
return true;
|
||||
case 1:
|
||||
Integer s = ModularSquareRoot(D, p);
|
||||
Integer t = (a+a).InverseMod(p);
|
||||
r1 = (s-b)*t % p;
|
||||
r2 = (-s-b)*t % p;
|
||||
assert(((r1.Squared()*a + r1*b + c) % p).IsZero());
|
||||
assert(((r2.Squared()*a + r2*b + c) % p).IsZero());
|
||||
CRYPTOPP_ASSERT(((r1.Squared()*a + r1*b + c) % p).IsZero());
|
||||
CRYPTOPP_ASSERT(((r2.Squared()*a + r2*b + c) % p).IsZero());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -670,7 +670,7 @@ Integer ModularRoot(const Integer &a, const Integer &e,
|
|||
Integer dp = EuclideanMultiplicativeInverse(e, p-1);
|
||||
Integer dq = EuclideanMultiplicativeInverse(e, q-1);
|
||||
Integer u = EuclideanMultiplicativeInverse(p, q);
|
||||
assert(!!dp && !!dq && !!u);
|
||||
CRYPTOPP_ASSERT(!!dp && !!dq && !!u);
|
||||
return ModularRoot(a, dp, dq, p, q, u);
|
||||
}
|
||||
|
||||
|
|
@ -680,7 +680,7 @@ Integer GCDI(const Integer &x, const Integer &y)
|
|||
Integer a=x, b=y;
|
||||
unsigned k=0;
|
||||
|
||||
assert(!!a && !!b);
|
||||
CRYPTOPP_ASSERT(!!a && !!b);
|
||||
|
||||
while (a[0]==0 && b[0]==0)
|
||||
{
|
||||
|
|
@ -715,14 +715,14 @@ Integer GCDI(const Integer &x, const Integer &y)
|
|||
break;
|
||||
|
||||
default:
|
||||
assert(false);
|
||||
CRYPTOPP_ASSERT(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Integer EuclideanMultiplicativeInverse(const Integer &a, const Integer &b)
|
||||
{
|
||||
assert(b.Positive());
|
||||
CRYPTOPP_ASSERT(b.Positive());
|
||||
|
||||
if (a.Negative())
|
||||
return EuclideanMultiplicativeInverse(a%b, b);
|
||||
|
|
@ -790,7 +790,7 @@ Integer EuclideanMultiplicativeInverse(const Integer &a, const Integer &b)
|
|||
|
||||
int Jacobi(const Integer &aIn, const Integer &bIn)
|
||||
{
|
||||
assert(bIn.IsOdd());
|
||||
CRYPTOPP_ASSERT(bIn.IsOdd());
|
||||
|
||||
Integer b = bIn, a = aIn%bIn;
|
||||
int result = 1;
|
||||
|
|
@ -983,7 +983,7 @@ Integer Lucas(const Integer &n, const Integer &P, const Integer &modulus)
|
|||
continue;
|
||||
}
|
||||
|
||||
assert(em2 == 0);
|
||||
CRYPTOPP_ASSERT(em2 == 0);
|
||||
// #9
|
||||
e >>= 1;
|
||||
C = f(C, B, A);
|
||||
|
|
@ -1042,8 +1042,8 @@ unsigned int DiscreteLogWorkFactor(unsigned int n)
|
|||
void PrimeAndGenerator::Generate(signed int delta, RandomNumberGenerator &rng, unsigned int pbits, unsigned int qbits)
|
||||
{
|
||||
// no prime exists for delta = -1, qbits = 4, and pbits = 5
|
||||
assert(qbits > 4);
|
||||
assert(pbits > qbits);
|
||||
CRYPTOPP_ASSERT(qbits > 4);
|
||||
CRYPTOPP_ASSERT(pbits > qbits);
|
||||
|
||||
if (qbits+1 == pbits)
|
||||
{
|
||||
|
|
@ -1058,9 +1058,9 @@ void PrimeAndGenerator::Generate(signed int delta, RandomNumberGenerator &rng, u
|
|||
|
||||
while (sieve.NextCandidate(p))
|
||||
{
|
||||
assert(IsSmallPrime(p) || SmallDivisorsTest(p));
|
||||
CRYPTOPP_ASSERT(IsSmallPrime(p) || SmallDivisorsTest(p));
|
||||
q = (p-delta) >> 1;
|
||||
assert(IsSmallPrime(q) || SmallDivisorsTest(q));
|
||||
CRYPTOPP_ASSERT(IsSmallPrime(q) || SmallDivisorsTest(q));
|
||||
if (FastProbablePrimeTest(q) && FastProbablePrimeTest(p) && IsPrime(q) && IsPrime(p))
|
||||
{
|
||||
success = true;
|
||||
|
|
@ -1075,11 +1075,11 @@ void PrimeAndGenerator::Generate(signed int delta, RandomNumberGenerator &rng, u
|
|||
// g=4 always works, but this way we get the smallest quadratic residue (other than 1)
|
||||
for (g=2; Jacobi(g, p) != 1; ++g) {}
|
||||
// contributed by Walt Tuvell: g should be the following according to the Law of Quadratic Reciprocity
|
||||
assert((p%8==1 || p%8==7) ? g==2 : (p%12==1 || p%12==11) ? g==3 : g==4);
|
||||
CRYPTOPP_ASSERT((p%8==1 || p%8==7) ? g==2 : (p%12==1 || p%12==11) ? g==3 : g==4);
|
||||
}
|
||||
else
|
||||
{
|
||||
assert(delta == -1);
|
||||
CRYPTOPP_ASSERT(delta == -1);
|
||||
// find g such that g*g-4 is a quadratic non-residue,
|
||||
// and such that g has order q
|
||||
for (g=3; ; ++g)
|
||||
|
|
@ -1107,11 +1107,11 @@ void PrimeAndGenerator::Generate(signed int delta, RandomNumberGenerator &rng, u
|
|||
Integer h(rng, 2, p-2, Integer::ANY);
|
||||
g = a_exp_b_mod_c(h, (p-1)/q, p);
|
||||
} while (g <= 1);
|
||||
assert(a_exp_b_mod_c(g, q, p)==1);
|
||||
CRYPTOPP_ASSERT(a_exp_b_mod_c(g, q, p)==1);
|
||||
}
|
||||
else
|
||||
{
|
||||
assert(delta==-1);
|
||||
CRYPTOPP_ASSERT(delta==-1);
|
||||
do
|
||||
{
|
||||
Integer h(rng, 3, p-1, Integer::ANY);
|
||||
|
|
@ -1119,7 +1119,7 @@ void PrimeAndGenerator::Generate(signed int delta, RandomNumberGenerator &rng, u
|
|||
continue;
|
||||
g = Lucas((p+1)/q, h, p);
|
||||
} while (g <= 2);
|
||||
assert(Lucas(q, g, p) == 2);
|
||||
CRYPTOPP_ASSERT(Lucas(q, g, p) == 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -434,7 +434,7 @@ size_t NetworkSink::Put2(const byte *inString, size_t length, int messageEnd, bo
|
|||
{
|
||||
if (m_skipBytes)
|
||||
{
|
||||
assert(length >= m_skipBytes);
|
||||
CRYPTOPP_ASSERT(length >= m_skipBytes);
|
||||
inString += m_skipBytes;
|
||||
length -= m_skipBytes;
|
||||
}
|
||||
|
|
@ -450,7 +450,7 @@ size_t NetworkSink::Put2(const byte *inString, size_t length, int messageEnd, bo
|
|||
|
||||
if (m_buffer.CurrentSize() > targetSize)
|
||||
{
|
||||
assert(!blocking);
|
||||
CRYPTOPP_ASSERT(!blocking);
|
||||
m_wasBlocked = true;
|
||||
m_skipBytes += length;
|
||||
size_t blockedBytes = UnsignedMin(length, m_buffer.CurrentSize() - targetSize);
|
||||
|
|
|
|||
2
oaep.cpp
2
oaep.cpp
|
|
@ -18,7 +18,7 @@ size_t OAEP_Base::MaxUnpaddedLength(size_t paddedLength) const
|
|||
|
||||
void OAEP_Base::Pad(RandomNumberGenerator &rng, const byte *input, size_t inputLength, byte *oaepBlock, size_t oaepBlockLen, const NameValuePairs ¶meters) const
|
||||
{
|
||||
assert (inputLength <= MaxUnpaddedLength(oaepBlockLen));
|
||||
CRYPTOPP_ASSERT (inputLength <= MaxUnpaddedLength(oaepBlockLen));
|
||||
|
||||
// convert from bit length to byte length
|
||||
if (oaepBlockLen % 8 != 0)
|
||||
|
|
|
|||
|
|
@ -442,14 +442,14 @@ void PanamaHash<B>::TruncatedFinal(byte *hash, size_t size)
|
|||
template <class B>
|
||||
void PanamaCipherPolicy<B>::CipherSetKey(const NameValuePairs ¶ms, const byte *key, size_t length)
|
||||
{
|
||||
assert(length==32);
|
||||
CRYPTOPP_ASSERT(length==32);
|
||||
memcpy(m_key, key, 32);
|
||||
}
|
||||
|
||||
template <class B>
|
||||
void PanamaCipherPolicy<B>::CipherResynchronize(byte *keystreamBuffer, const byte *iv, size_t length)
|
||||
{
|
||||
assert(length==32);
|
||||
CRYPTOPP_ASSERT(length==32);
|
||||
this->Reset();
|
||||
this->Iterate(1, m_key);
|
||||
if (iv && IsAligned<word32>(iv))
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ size_t PKCS_EncryptionPaddingScheme::MaxUnpaddedLength(size_t paddedLength) cons
|
|||
|
||||
void PKCS_EncryptionPaddingScheme::Pad(RandomNumberGenerator &rng, const byte *input, size_t inputLen, byte *pkcsBlock, size_t pkcsBlockLen, const NameValuePairs ¶meters) const
|
||||
{
|
||||
assert (inputLen <= MaxUnpaddedLength(pkcsBlockLen)); // this should be checked by caller
|
||||
CRYPTOPP_ASSERT (inputLen <= MaxUnpaddedLength(pkcsBlockLen)); // this should be checked by caller
|
||||
|
||||
// convert from bit length to byte length
|
||||
if (pkcsBlockLen % 8 != 0)
|
||||
|
|
@ -70,7 +70,7 @@ DecodingResult PKCS_EncryptionPaddingScheme::Unpad(const byte *pkcsBlock, size_t
|
|||
size_t i=1;
|
||||
while (i<pkcsBlockLen && pkcsBlock[i++]) { // null body
|
||||
}
|
||||
assert(i==pkcsBlockLen || pkcsBlock[i-1]==0);
|
||||
CRYPTOPP_ASSERT(i==pkcsBlockLen || pkcsBlock[i-1]==0);
|
||||
|
||||
size_t outputLen = pkcsBlockLen - i;
|
||||
invalid = (outputLen > maxOutputLen) || invalid;
|
||||
|
|
@ -91,7 +91,7 @@ void PKCS1v15_SignatureMessageEncodingMethod::ComputeMessageRepresentative(Rando
|
|||
HashTransformation &hash, HashIdentifier hashIdentifier, bool messageEmpty,
|
||||
byte *representative, size_t representativeBitLength) const
|
||||
{
|
||||
assert(representativeBitLength >= MinRepresentativeBitLength(hashIdentifier.second, hash.DigestSize()));
|
||||
CRYPTOPP_ASSERT(representativeBitLength >= MinRepresentativeBitLength(hashIdentifier.second, hash.DigestSize()));
|
||||
|
||||
size_t pkcsBlockLen = representativeBitLength;
|
||||
// convert from bit length to byte length
|
||||
|
|
|
|||
|
|
@ -476,7 +476,7 @@ void RingOfPolynomialsOver<T>::CalculateAlpha(std::vector<CoefficientType> &alph
|
|||
template <class T>
|
||||
typename RingOfPolynomialsOver<T>::Element RingOfPolynomialsOver<T>::Interpolate(const CoefficientType x[], const CoefficientType y[], unsigned int n) const
|
||||
{
|
||||
assert(n > 0);
|
||||
CRYPTOPP_ASSERT(n > 0);
|
||||
|
||||
std::vector<CoefficientType> alpha(n);
|
||||
CalculateAlpha(alpha, x, y, n);
|
||||
|
|
@ -498,7 +498,7 @@ typename RingOfPolynomialsOver<T>::Element RingOfPolynomialsOver<T>::Interpolate
|
|||
template <class T>
|
||||
typename RingOfPolynomialsOver<T>::CoefficientType RingOfPolynomialsOver<T>::InterpolateAt(const CoefficientType &position, const CoefficientType x[], const CoefficientType y[], unsigned int n) const
|
||||
{
|
||||
assert(n > 0);
|
||||
CRYPTOPP_ASSERT(n > 0);
|
||||
|
||||
std::vector<CoefficientType> alpha(n);
|
||||
CalculateAlpha(alpha, x, y, n);
|
||||
|
|
@ -528,7 +528,7 @@ void PrepareBulkPolynomialInterpolation(const Ring &ring, Element *w, const Elem
|
|||
template <class Ring, class Element>
|
||||
void PrepareBulkPolynomialInterpolationAt(const Ring &ring, Element *v, const Element &position, const Element x[], const Element w[], unsigned int n)
|
||||
{
|
||||
assert(n > 0);
|
||||
CRYPTOPP_ASSERT(n > 0);
|
||||
|
||||
std::vector<Element> a(2*n-1);
|
||||
unsigned int i;
|
||||
|
|
|
|||
4
pssr.cpp
4
pssr.cpp
|
|
@ -49,7 +49,7 @@ void PSSR_MEM_Base::ComputeMessageRepresentative(RandomNumberGenerator &rng,
|
|||
HashTransformation &hash, HashIdentifier hashIdentifier, bool messageEmpty,
|
||||
byte *representative, size_t representativeBitLength) const
|
||||
{
|
||||
assert(representativeBitLength >= MinRepresentativeBitLength(hashIdentifier.second, hash.DigestSize()));
|
||||
CRYPTOPP_ASSERT(representativeBitLength >= MinRepresentativeBitLength(hashIdentifier.second, hash.DigestSize()));
|
||||
|
||||
const size_t u = hashIdentifier.second + 1;
|
||||
const size_t representativeByteLength = BitsToBytes(representativeBitLength);
|
||||
|
|
@ -91,7 +91,7 @@ DecodingResult PSSR_MEM_Base::RecoverMessageFromRepresentative(
|
|||
byte *representative, size_t representativeBitLength,
|
||||
byte *recoverableMessage) const
|
||||
{
|
||||
assert(representativeBitLength >= MinRepresentativeBitLength(hashIdentifier.second, hash.DigestSize()));
|
||||
CRYPTOPP_ASSERT(representativeBitLength >= MinRepresentativeBitLength(hashIdentifier.second, hash.DigestSize()));
|
||||
|
||||
const size_t u = hashIdentifier.second + 1;
|
||||
const size_t representativeByteLength = BitsToBytes(representativeBitLength);
|
||||
|
|
|
|||
6
pubkey.h
6
pubkey.h
|
|
@ -210,7 +210,7 @@ public:
|
|||
SecByteBlock &semisignature) const
|
||||
{
|
||||
if (RecoverablePartFirst())
|
||||
assert(!"ProcessRecoverableMessage() not implemented");
|
||||
CRYPTOPP_ASSERT(!"ProcessRecoverableMessage() not implemented");
|
||||
}
|
||||
|
||||
virtual void ComputeMessageRepresentative(RandomNumberGenerator &rng,
|
||||
|
|
@ -972,7 +972,7 @@ public:
|
|||
size_t MaxRecoverableLength() const
|
||||
{return GetMessageEncodingInterface().MaxRecoverableLength(0, GetHashIdentifier().second, GetDigestSize());}
|
||||
size_t MaxRecoverableLengthFromSignatureLength(size_t signatureLength) const
|
||||
{assert(false); return 0;} // TODO
|
||||
{CRYPTOPP_ASSERT(false); return 0;} // TODO
|
||||
|
||||
bool IsProbabilistic() const
|
||||
{return true;}
|
||||
|
|
@ -1460,7 +1460,7 @@ public:
|
|||
return params.ExponentiateElement(publicElement, privateExponent*params.GetCofactor());
|
||||
else
|
||||
{
|
||||
assert(COFACTOR_OPTION::ToEnum() == NO_COFACTOR_MULTIPLICTION);
|
||||
CRYPTOPP_ASSERT(COFACTOR_OPTION::ToEnum() == NO_COFACTOR_MULTIPLICTION);
|
||||
|
||||
if (!validateOtherPublicKey)
|
||||
return params.ExponentiateElement(publicElement, privateExponent);
|
||||
|
|
|
|||
12
pwdbased.h
12
pwdbased.h
|
|
@ -57,8 +57,8 @@ public:
|
|||
template <class T>
|
||||
unsigned int PKCS5_PBKDF1<T>::DeriveKey(byte *derived, size_t derivedLen, byte purpose, const byte *password, size_t passwordLen, const byte *salt, size_t saltLen, unsigned int iterations, double timeInSeconds) const
|
||||
{
|
||||
assert(derivedLen <= MaxDerivedKeyLength());
|
||||
assert(iterations > 0 || timeInSeconds > 0);
|
||||
CRYPTOPP_ASSERT(derivedLen <= MaxDerivedKeyLength());
|
||||
CRYPTOPP_ASSERT(iterations > 0 || timeInSeconds > 0);
|
||||
|
||||
if (!iterations)
|
||||
iterations = 1;
|
||||
|
|
@ -86,8 +86,8 @@ unsigned int PKCS5_PBKDF1<T>::DeriveKey(byte *derived, size_t derivedLen, byte p
|
|||
template <class T>
|
||||
unsigned int PKCS5_PBKDF2_HMAC<T>::DeriveKey(byte *derived, size_t derivedLen, byte purpose, const byte *password, size_t passwordLen, const byte *salt, size_t saltLen, unsigned int iterations, double timeInSeconds) const
|
||||
{
|
||||
assert(derivedLen <= MaxDerivedKeyLength());
|
||||
assert(iterations > 0 || timeInSeconds > 0);
|
||||
CRYPTOPP_ASSERT(derivedLen <= MaxDerivedKeyLength());
|
||||
CRYPTOPP_ASSERT(iterations > 0 || timeInSeconds > 0);
|
||||
|
||||
if (!iterations)
|
||||
iterations = 1;
|
||||
|
|
@ -150,8 +150,8 @@ public:
|
|||
template <class T>
|
||||
unsigned int PKCS12_PBKDF<T>::DeriveKey(byte *derived, size_t derivedLen, byte purpose, const byte *password, size_t passwordLen, const byte *salt, size_t saltLen, unsigned int iterations, double timeInSeconds) const
|
||||
{
|
||||
assert(derivedLen <= MaxDerivedKeyLength());
|
||||
assert(iterations > 0 || timeInSeconds > 0);
|
||||
CRYPTOPP_ASSERT(derivedLen <= MaxDerivedKeyLength());
|
||||
CRYPTOPP_ASSERT(iterations > 0 || timeInSeconds > 0);
|
||||
|
||||
if (!iterations)
|
||||
iterations = 1;
|
||||
|
|
|
|||
|
|
@ -462,7 +462,7 @@ byte ByteQueue::operator[](lword i) const
|
|||
i -= current->CurrentSize();
|
||||
}
|
||||
|
||||
assert(i < m_lazyLength);
|
||||
CRYPTOPP_ASSERT(i < m_lazyLength);
|
||||
return m_lazyString[i];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1085,7 +1085,7 @@ inline size_t AESNI_AdvancedProcessBlocks(F1 func1, F4 func4, const __m128i *sub
|
|||
|
||||
if (flags & BlockTransformation::BT_ReverseDirection)
|
||||
{
|
||||
assert(length % blockSize == 0);
|
||||
CRYPTOPP_ASSERT(length % blockSize == 0);
|
||||
inBlocks += length - blockSize;
|
||||
xorBlocks += length - blockSize;
|
||||
outBlocks += length - blockSize;
|
||||
|
|
@ -1218,7 +1218,7 @@ size_t Rijndael::Enc::AdvancedProcessBlocks(const byte *inBlocks, const byte *xo
|
|||
|
||||
if (flags & BT_ReverseDirection)
|
||||
{
|
||||
assert(length % BLOCKSIZE == 0);
|
||||
CRYPTOPP_ASSERT(length % BLOCKSIZE == 0);
|
||||
inBlocks += length - BLOCKSIZE;
|
||||
xorBlocks += length - BLOCKSIZE;
|
||||
outBlocks += length - BLOCKSIZE;
|
||||
|
|
|
|||
2
rsa.cpp
2
rsa.cpp
|
|
@ -124,7 +124,7 @@ void InvertibleRSAFunction::GenerateRandom(RandomNumberGenerator &rng, const Nam
|
|||
m_q.GenerateRandom(rng, primeParam);
|
||||
|
||||
m_d = m_e.InverseMod(LCM(m_p-1, m_q-1));
|
||||
assert(m_d.IsPositive());
|
||||
CRYPTOPP_ASSERT(m_d.IsPositive());
|
||||
|
||||
m_dp = m_d % (m_p-1);
|
||||
m_dq = m_d % (m_q-1);
|
||||
|
|
|
|||
2
rw.cpp
2
rw.cpp
|
|
@ -238,7 +238,7 @@ Integer InvertibleRWFunction::CalculateInverse(RandomNumberGenerator &rng, const
|
|||
|
||||
// Signature
|
||||
Integer s = modn.Multiply(modn.Square(Y), rInv);
|
||||
assert((e * f * s.Squared()) % m_n == x);
|
||||
CRYPTOPP_ASSERT((e * f * s.Squared()) % m_n == x);
|
||||
|
||||
// IEEE P1363, Section 8.2.8 IFSP-RW, p.44
|
||||
s = STDMIN(s, m_n - s);
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ void Salsa20_Policy::CipherSetKey(const NameValuePairs ¶ms, const byte *key,
|
|||
|
||||
void Salsa20_Policy::CipherResynchronize(byte *keystreamBuffer, const byte *IV, size_t length)
|
||||
{
|
||||
assert(length==8);
|
||||
CRYPTOPP_ASSERT(length==8);
|
||||
GetBlock<word32, LittleEndian> get(IV);
|
||||
get(m_state[14])(m_state[11]);
|
||||
m_state[8] = m_state[5] = 0;
|
||||
|
|
@ -568,7 +568,7 @@ void XSalsa20_Policy::CipherSetKey(const NameValuePairs ¶ms, const byte *key
|
|||
|
||||
void XSalsa20_Policy::CipherResynchronize(byte *keystreamBuffer, const byte *IV, size_t length)
|
||||
{
|
||||
assert(length==24);
|
||||
CRYPTOPP_ASSERT(length==24);
|
||||
|
||||
word32 x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15;
|
||||
|
||||
|
|
|
|||
2
seal.cpp
2
seal.cpp
|
|
@ -69,7 +69,7 @@ void SEAL_Policy<B>::CipherSetKey(const NameValuePairs ¶ms, const byte *key,
|
|||
template <class B>
|
||||
void SEAL_Policy<B>::CipherResynchronize(byte *keystreamBuffer, const byte *IV, size_t length)
|
||||
{
|
||||
assert(length==4);
|
||||
CRYPTOPP_ASSERT(length==4);
|
||||
m_outsideCounter = IV ? GetWord<word32>(false, BIG_ENDIAN_ORDER, IV) : 0;
|
||||
m_startCount = m_outsideCounter;
|
||||
m_insideCounter = 0;
|
||||
|
|
|
|||
6
simple.h
6
simple.h
|
|
@ -68,7 +68,7 @@ public:
|
|||
bool Flush(bool completeFlush, int propagation=-1, bool blocking=true)
|
||||
{return ChannelFlush(DEFAULT_CHANNEL, completeFlush, propagation, blocking);}
|
||||
bool IsolatedFlush(bool hardFlush, bool blocking)
|
||||
{assert(false); return false;}
|
||||
{CRYPTOPP_ASSERT(false); return false;}
|
||||
bool ChannelFlush(const std::string &channel, bool hardFlush, int propagation=-1, bool blocking=true)
|
||||
{
|
||||
if (hardFlush && !InputBufferIsEmpty())
|
||||
|
|
@ -111,7 +111,7 @@ public:
|
|||
virtual bool Flush(bool hardFlush, int propagation=-1, bool blocking=true) =0;
|
||||
|
||||
private:
|
||||
bool IsolatedFlush(bool hardFlush, bool blocking) {assert(false); return false;}
|
||||
bool IsolatedFlush(bool hardFlush, bool blocking) {CRYPTOPP_ASSERT(false); return false;}
|
||||
};
|
||||
|
||||
//! _
|
||||
|
|
@ -122,7 +122,7 @@ public:
|
|||
virtual void Initialize(const NameValuePairs ¶meters=g_nullNameValuePairs, int propagation=-1) =0;
|
||||
|
||||
private:
|
||||
void IsolatedInitialize(const NameValuePairs ¶meters) {assert(false);}
|
||||
void IsolatedInitialize(const NameValuePairs ¶meters) {CRYPTOPP_ASSERT(false);}
|
||||
};
|
||||
|
||||
//! _
|
||||
|
|
|
|||
|
|
@ -228,9 +228,9 @@ public:
|
|||
{delete [] this->m_ptr;}
|
||||
|
||||
member_ptr<T>& operator[](size_t index)
|
||||
{assert(index<this->m_size); return this->m_ptr[index];}
|
||||
{CRYPTOPP_ASSERT(index<this->m_size); return this->m_ptr[index];}
|
||||
const member_ptr<T>& operator[](size_t index) const
|
||||
{assert(index<this->m_size); return this->m_ptr[index];}
|
||||
{CRYPTOPP_ASSERT(index<this->m_size); return this->m_ptr[index];}
|
||||
|
||||
size_t size() const {return this->m_size;}
|
||||
void resize(size_t newSize)
|
||||
|
|
|
|||
30
socketft.cpp
30
socketft.cpp
|
|
@ -68,7 +68,7 @@ socket_t Socket::DetachSocket()
|
|||
|
||||
void Socket::Create(int nType)
|
||||
{
|
||||
assert(m_s == INVALID_SOCKET);
|
||||
CRYPTOPP_ASSERT(m_s == INVALID_SOCKET);
|
||||
m_s = socket(AF_INET, nType, 0);
|
||||
CheckAndHandleError("socket", m_s);
|
||||
m_own = true;
|
||||
|
|
@ -116,20 +116,20 @@ void Socket::Bind(unsigned int port, const char *addr)
|
|||
|
||||
void Socket::Bind(const sockaddr *psa, socklen_t saLen)
|
||||
{
|
||||
assert(m_s != INVALID_SOCKET);
|
||||
CRYPTOPP_ASSERT(m_s != INVALID_SOCKET);
|
||||
// cygwin workaround: needs const_cast
|
||||
CheckAndHandleError_int("bind", bind(m_s, const_cast<sockaddr *>(psa), saLen));
|
||||
}
|
||||
|
||||
void Socket::Listen(int backlog)
|
||||
{
|
||||
assert(m_s != INVALID_SOCKET);
|
||||
CRYPTOPP_ASSERT(m_s != INVALID_SOCKET);
|
||||
CheckAndHandleError_int("listen", listen(m_s, backlog));
|
||||
}
|
||||
|
||||
bool Socket::Connect(const char *addr, unsigned int port)
|
||||
{
|
||||
assert(addr != NULL);
|
||||
CRYPTOPP_ASSERT(addr != NULL);
|
||||
|
||||
sockaddr_in sa;
|
||||
memset(&sa, 0, sizeof(sa));
|
||||
|
|
@ -155,7 +155,7 @@ bool Socket::Connect(const char *addr, unsigned int port)
|
|||
|
||||
bool Socket::Connect(const sockaddr* psa, socklen_t saLen)
|
||||
{
|
||||
assert(m_s != INVALID_SOCKET);
|
||||
CRYPTOPP_ASSERT(m_s != INVALID_SOCKET);
|
||||
int result = connect(m_s, const_cast<sockaddr*>(psa), saLen);
|
||||
if (result == SOCKET_ERROR && GetLastError() == SOCKET_EWOULDBLOCK)
|
||||
return false;
|
||||
|
|
@ -165,7 +165,7 @@ bool Socket::Connect(const sockaddr* psa, socklen_t saLen)
|
|||
|
||||
bool Socket::Accept(Socket& target, sockaddr *psa, socklen_t *psaLen)
|
||||
{
|
||||
assert(m_s != INVALID_SOCKET);
|
||||
CRYPTOPP_ASSERT(m_s != INVALID_SOCKET);
|
||||
socket_t s = accept(m_s, psa, psaLen);
|
||||
if (s == INVALID_SOCKET && GetLastError() == SOCKET_EWOULDBLOCK)
|
||||
return false;
|
||||
|
|
@ -176,19 +176,19 @@ bool Socket::Accept(Socket& target, sockaddr *psa, socklen_t *psaLen)
|
|||
|
||||
void Socket::GetSockName(sockaddr *psa, socklen_t *psaLen)
|
||||
{
|
||||
assert(m_s != INVALID_SOCKET);
|
||||
CRYPTOPP_ASSERT(m_s != INVALID_SOCKET);
|
||||
CheckAndHandleError_int("getsockname", getsockname(m_s, psa, psaLen));
|
||||
}
|
||||
|
||||
void Socket::GetPeerName(sockaddr *psa, socklen_t *psaLen)
|
||||
{
|
||||
assert(m_s != INVALID_SOCKET);
|
||||
CRYPTOPP_ASSERT(m_s != INVALID_SOCKET);
|
||||
CheckAndHandleError_int("getpeername", getpeername(m_s, psa, psaLen));
|
||||
}
|
||||
|
||||
unsigned int Socket::Send(const byte* buf, size_t bufLen, int flags)
|
||||
{
|
||||
assert(m_s != INVALID_SOCKET);
|
||||
CRYPTOPP_ASSERT(m_s != INVALID_SOCKET);
|
||||
int result = send(m_s, (const char *)buf, UnsignedMin(INT_MAX, bufLen), flags);
|
||||
CheckAndHandleError_int("send", result);
|
||||
return result;
|
||||
|
|
@ -196,7 +196,7 @@ unsigned int Socket::Send(const byte* buf, size_t bufLen, int flags)
|
|||
|
||||
unsigned int Socket::Receive(byte* buf, size_t bufLen, int flags)
|
||||
{
|
||||
assert(m_s != INVALID_SOCKET);
|
||||
CRYPTOPP_ASSERT(m_s != INVALID_SOCKET);
|
||||
int result = recv(m_s, (char *)buf, UnsignedMin(INT_MAX, bufLen), flags);
|
||||
CheckAndHandleError_int("recv", result);
|
||||
return result;
|
||||
|
|
@ -204,14 +204,14 @@ unsigned int Socket::Receive(byte* buf, size_t bufLen, int flags)
|
|||
|
||||
void Socket::ShutDown(int how)
|
||||
{
|
||||
assert(m_s != INVALID_SOCKET);
|
||||
CRYPTOPP_ASSERT(m_s != INVALID_SOCKET);
|
||||
int result = shutdown(m_s, how);
|
||||
CheckAndHandleError_int("shutdown", result);
|
||||
}
|
||||
|
||||
void Socket::IOCtl(long cmd, unsigned long *argp)
|
||||
{
|
||||
assert(m_s != INVALID_SOCKET);
|
||||
CRYPTOPP_ASSERT(m_s != INVALID_SOCKET);
|
||||
#ifdef USE_WINDOWS_STYLE_SOCKETS
|
||||
CheckAndHandleError_int("ioctlsocket", ioctlsocket(m_s, cmd, argp));
|
||||
#else
|
||||
|
|
@ -328,7 +328,7 @@ SocketReceiver::~SocketReceiver()
|
|||
|
||||
bool SocketReceiver::Receive(byte* buf, size_t bufLen)
|
||||
{
|
||||
assert(!m_resultPending && !m_eofReceived);
|
||||
CRYPTOPP_ASSERT(!m_resultPending && !m_eofReceived);
|
||||
|
||||
DWORD flags = 0;
|
||||
// don't queue too much at once, or we might use up non-paged memory
|
||||
|
|
@ -410,7 +410,7 @@ SocketSender::~SocketSender()
|
|||
|
||||
void SocketSender::Send(const byte* buf, size_t bufLen)
|
||||
{
|
||||
assert(!m_resultPending);
|
||||
CRYPTOPP_ASSERT(!m_resultPending);
|
||||
DWORD written = 0;
|
||||
// don't queue too much at once, or we might use up non-paged memory
|
||||
WSABUF wsabuf = {UnsignedMin((u_long)128*1024, bufLen), (char *)buf};
|
||||
|
|
@ -430,7 +430,7 @@ void SocketSender::Send(const byte* buf, size_t bufLen)
|
|||
|
||||
void SocketSender::SendEof()
|
||||
{
|
||||
assert(!m_resultPending);
|
||||
CRYPTOPP_ASSERT(!m_resultPending);
|
||||
m_s.ShutDown(SD_SEND);
|
||||
m_s.CheckAndHandleError("ResetEvent", ResetEvent(m_event));
|
||||
m_s.CheckAndHandleError_int("WSAEventSelect", WSAEventSelect(m_s, m_event, FD_CLOSE));
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ public:
|
|||
{if (result == SOCKET_ERROR) HandleError(operation);}
|
||||
#ifdef USE_WINDOWS_STYLE_SOCKETS
|
||||
void CheckAndHandleError(const char *operation, BOOL result) const
|
||||
{assert(result==TRUE || result==FALSE); if (!result) HandleError(operation);}
|
||||
{CRYPTOPP_ASSERT(result==TRUE || result==FALSE); if (!result) HandleError(operation);}
|
||||
void CheckAndHandleError(const char *operation, bool result) const
|
||||
{if (!result) HandleError(operation);}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ void SosemanukPolicy::CipherSetKey(const NameValuePairs ¶ms, const byte *use
|
|||
|
||||
void SosemanukPolicy::CipherResynchronize(byte *keystreamBuffer, const byte *iv, size_t length)
|
||||
{
|
||||
assert(length==16);
|
||||
CRYPTOPP_ASSERT(length==16);
|
||||
|
||||
word32 a, b, c, d, e;
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ void AdditiveCipherTemplate<S>::GenerateBlock(byte *outString, size_t length)
|
|||
if (!length)
|
||||
return;
|
||||
}
|
||||
assert(m_leftOver == 0);
|
||||
CRYPTOPP_ASSERT(m_leftOver == 0);
|
||||
|
||||
PolicyInterface &policy = this->AccessPolicy();
|
||||
unsigned int bytesPerIteration = policy.GetBytesPerIteration();
|
||||
|
|
@ -79,7 +79,7 @@ void AdditiveCipherTemplate<S>::ProcessData(byte *outString, const byte *inStrin
|
|||
if (!length)
|
||||
return;
|
||||
}
|
||||
assert(m_leftOver == 0);
|
||||
CRYPTOPP_ASSERT(m_leftOver == 0);
|
||||
|
||||
PolicyInterface &policy = this->AccessPolicy();
|
||||
unsigned int bytesPerIteration = policy.GetBytesPerIteration();
|
||||
|
|
@ -177,7 +177,7 @@ void CFB_CipherTemplate<BASE>::Resynchronize(const byte *iv, int length)
|
|||
template <class BASE>
|
||||
void CFB_CipherTemplate<BASE>::ProcessData(byte *outString, const byte *inString, size_t length)
|
||||
{
|
||||
assert(length % this->MandatoryBlockSize() == 0);
|
||||
CRYPTOPP_ASSERT(length % this->MandatoryBlockSize() == 0);
|
||||
|
||||
PolicyInterface &policy = this->AccessPolicy();
|
||||
unsigned int bytesPerIteration = policy.GetBytesPerIteration();
|
||||
|
|
@ -197,7 +197,7 @@ void CFB_CipherTemplate<BASE>::ProcessData(byte *outString, const byte *inString
|
|||
if (!length)
|
||||
return;
|
||||
|
||||
assert(m_leftOver == 0);
|
||||
CRYPTOPP_ASSERT(m_leftOver == 0);
|
||||
|
||||
if (policy.CanIterate() && length >= bytesPerIteration && IsAlignedOn(outString, alignment))
|
||||
{
|
||||
|
|
|
|||
12
strciphr.h
12
strciphr.h
|
|
@ -74,11 +74,11 @@ struct CRYPTOPP_DLL CRYPTOPP_NO_VTABLE AdditiveCipherAbstractPolicy
|
|||
virtual void WriteKeystream(byte *keystream, size_t iterationCount)
|
||||
{OperateKeystream(KeystreamOperation(INPUT_NULL | (KeystreamOperationFlags)IsAlignedOn(keystream, GetAlignment())), keystream, NULL, iterationCount);}
|
||||
virtual bool CanOperateKeystream() const {return false;}
|
||||
virtual void OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, size_t iterationCount) {assert(false);}
|
||||
virtual void OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, size_t iterationCount) {CRYPTOPP_ASSERT(false);}
|
||||
virtual void CipherSetKey(const NameValuePairs ¶ms, const byte *key, size_t length) =0;
|
||||
virtual void CipherResynchronize(byte *keystreamBuffer, const byte *iv, size_t length) {throw NotImplemented("SimpleKeyingInterface: this object doesn't support resynchronization");}
|
||||
virtual bool CipherIsRandomAccess() const =0;
|
||||
virtual void SeekToIteration(lword iterationCount) {assert(!CipherIsRandomAccess()); throw NotImplemented("StreamTransformation: this object doesn't support random access");}
|
||||
virtual void SeekToIteration(lword iterationCount) {CRYPTOPP_ASSERT(!CipherIsRandomAccess()); throw NotImplemented("StreamTransformation: this object doesn't support random access");}
|
||||
};
|
||||
|
||||
template <typename WT, unsigned int W, unsigned int X = 1, class BASE = AdditiveCipherAbstractPolicy>
|
||||
|
|
@ -169,7 +169,7 @@ public:
|
|||
virtual byte * GetRegisterBegin() =0;
|
||||
virtual void TransformRegister() =0;
|
||||
virtual bool CanIterate() const {return false;}
|
||||
virtual void Iterate(byte *output, const byte *input, CipherDir dir, size_t iterationCount) {assert(false); throw 0;}
|
||||
virtual void Iterate(byte *output, const byte *input, CipherDir dir, size_t iterationCount) {CRYPTOPP_ASSERT(false); throw 0;}
|
||||
virtual void CipherSetKey(const NameValuePairs ¶ms, const byte *key, size_t length) =0;
|
||||
virtual void CipherResynchronize(const byte *iv, size_t length) {throw NotImplemented("SimpleKeyingInterface: this object doesn't support resynchronization");}
|
||||
};
|
||||
|
|
@ -192,8 +192,8 @@ struct CRYPTOPP_NO_VTABLE CFB_CipherConcretePolicy : public BASE
|
|||
|
||||
inline RegisterOutput& operator()(WordType ®isterWord)
|
||||
{
|
||||
assert(IsAligned<WordType>(m_output));
|
||||
assert(IsAligned<WordType>(m_input));
|
||||
CRYPTOPP_ASSERT(IsAligned<WordType>(m_output));
|
||||
CRYPTOPP_ASSERT(IsAligned<WordType>(m_input));
|
||||
|
||||
if (!NativeByteOrderIs(B::ToEnum()))
|
||||
registerWord = ByteReverse(registerWord);
|
||||
|
|
@ -201,7 +201,7 @@ struct CRYPTOPP_NO_VTABLE CFB_CipherConcretePolicy : public BASE
|
|||
if (m_dir == ENCRYPTION)
|
||||
{
|
||||
if (m_input == NULL)
|
||||
assert(m_output == NULL);
|
||||
CRYPTOPP_ASSERT(m_output == NULL);
|
||||
else
|
||||
{
|
||||
WordType ct = *(const WordType *)m_input ^ registerWord;
|
||||
|
|
|
|||
|
|
@ -469,7 +469,7 @@ public:
|
|||
{
|
||||
std::cerr << "incorrect output " << counter << ", " << (word16)validOutput[counter] << ", " << (word16)inByte << "\n";
|
||||
fail = true;
|
||||
assert(false);
|
||||
CRYPTOPP_ASSERT(false);
|
||||
}
|
||||
counter++;
|
||||
}
|
||||
|
|
@ -482,7 +482,7 @@ public:
|
|||
if (counter != outputLen)
|
||||
{
|
||||
fail = true;
|
||||
assert(false);
|
||||
CRYPTOPP_ASSERT(false);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -452,7 +452,7 @@ bool ValidateDSA(bool thorough)
|
|||
DSA::Verifier pub(priv);
|
||||
FileSource fs2("TestData/dsa1024b.dat", true, new HexDecoder());
|
||||
DSA::Verifier pub1(fs2);
|
||||
assert(pub.GetKey() == pub1.GetKey());
|
||||
CRYPTOPP_ASSERT(pub.GetKey() == pub1.GetKey());
|
||||
pass = SignatureValidate(priv, pub, thorough) && pass;
|
||||
pass = RunTestDataFile("TestVectors/dsa.txt", g_nullNameValuePairs, thorough) && pass;
|
||||
return pass;
|
||||
|
|
|
|||
2
vmac.cpp
2
vmac.cpp
|
|
@ -133,7 +133,7 @@ void VMAC_Base::Resynchronize(const byte *nonce, int len)
|
|||
|
||||
void VMAC_Base::HashEndianCorrectedBlock(const word64 *data)
|
||||
{
|
||||
assert(false);
|
||||
CRYPTOPP_ASSERT(false);
|
||||
throw 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
2
wait.cpp
2
wait.cpp
|
|
@ -171,7 +171,7 @@ DWORD WINAPI WaitingThread(LPVOID lParam)
|
|||
SetEvent(thread.stopWaiting);
|
||||
if (!(result > WAIT_OBJECT_0 && result < WAIT_OBJECT_0 + handles.size()))
|
||||
{
|
||||
assert(!"error in WaitingThread"); // break here so we can see which thread has an error
|
||||
CRYPTOPP_ASSERT(!"error in WaitingThread"); // break here so we can see which thread has an error
|
||||
*thread.error = ::GetLastError();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ WindowsPipeReceiver::WindowsPipeReceiver()
|
|||
|
||||
bool WindowsPipeReceiver::Receive(byte* buf, size_t bufLen)
|
||||
{
|
||||
assert(!m_resultPending && !m_eofReceived);
|
||||
CRYPTOPP_ASSERT(!m_resultPending && !m_eofReceived);
|
||||
|
||||
HANDLE h = GetHandle();
|
||||
// don't queue too much at once, or we might use up non-paged memory
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ protected:
|
|||
virtual HANDLE GetHandle() const =0;
|
||||
virtual void HandleError(const char *operation) const;
|
||||
void CheckAndHandleError(const char *operation, BOOL result) const
|
||||
{assert(result==TRUE || result==FALSE); if (!result) HandleError(operation);}
|
||||
{CRYPTOPP_ASSERT(result==TRUE || result==FALSE); if (!result) HandleError(operation);}
|
||||
};
|
||||
|
||||
//! pipe-based implementation of NetworkReceiver
|
||||
|
|
|
|||
4
words.h
4
words.h
|
|
@ -50,7 +50,7 @@ inline void AndWords(word *r, const word *a, size_t n)
|
|||
|
||||
inline word ShiftWordsLeftByBits(word *r, size_t n, unsigned int shiftBits)
|
||||
{
|
||||
assert (shiftBits<WORD_BITS);
|
||||
CRYPTOPP_ASSERT (shiftBits<WORD_BITS);
|
||||
word u, carry=0;
|
||||
if (shiftBits)
|
||||
for (size_t i=0; i<n; i++)
|
||||
|
|
@ -64,7 +64,7 @@ inline word ShiftWordsLeftByBits(word *r, size_t n, unsigned int shiftBits)
|
|||
|
||||
inline word ShiftWordsRightByBits(word *r, size_t n, unsigned int shiftBits)
|
||||
{
|
||||
assert (shiftBits<WORD_BITS);
|
||||
CRYPTOPP_ASSERT (shiftBits<WORD_BITS);
|
||||
word u, carry=0;
|
||||
if (shiftBits)
|
||||
for (size_t i=n; i>0; i--)
|
||||
|
|
|
|||
12
xtr.cpp
12
xtr.cpp
|
|
@ -16,8 +16,8 @@ const GFP2Element & GFP2Element::Zero()
|
|||
|
||||
void XTR_FindPrimesAndGenerator(RandomNumberGenerator &rng, Integer &p, Integer &q, GFP2Element &g, unsigned int pbits, unsigned int qbits)
|
||||
{
|
||||
assert(qbits > 9); // no primes exist for pbits = 10, qbits = 9
|
||||
assert(pbits > qbits);
|
||||
CRYPTOPP_ASSERT(qbits > 9); // no primes exist for pbits = 10, qbits = 9
|
||||
CRYPTOPP_ASSERT(pbits > qbits);
|
||||
|
||||
const Integer minQ = Integer::Power2(qbits - 1);
|
||||
const Integer maxQ = Integer::Power2(qbits) - 1;
|
||||
|
|
@ -28,11 +28,11 @@ void XTR_FindPrimesAndGenerator(RandomNumberGenerator &rng, Integer &p, Integer
|
|||
do
|
||||
{
|
||||
bool qFound = q.Randomize(rng, minQ, maxQ, Integer::PRIME, 7, 12);
|
||||
assert(qFound); CRYPTOPP_UNUSED(qFound);
|
||||
CRYPTOPP_ASSERT(qFound); CRYPTOPP_UNUSED(qFound);
|
||||
bool solutionsExist = SolveModularQuadraticEquation(r1, r2, 1, -1, 1, q);
|
||||
assert(solutionsExist); CRYPTOPP_UNUSED(solutionsExist);
|
||||
CRYPTOPP_ASSERT(solutionsExist); CRYPTOPP_UNUSED(solutionsExist);
|
||||
} while (!p.Randomize(rng, minP, maxP, Integer::PRIME, CRT(rng.GenerateBit()?r1:r2, q, 2, 3, EuclideanMultiplicativeInverse(p, 3)), 3*q));
|
||||
assert(((p.Squared() - p + 1) % q).IsZero());
|
||||
CRYPTOPP_ASSERT(((p.Squared() - p + 1) % q).IsZero());
|
||||
|
||||
GFP2_ONB<ModularArithmetic> gfp2(p);
|
||||
GFP2Element three = gfp2.ConvertIn(3), t;
|
||||
|
|
@ -48,7 +48,7 @@ void XTR_FindPrimesAndGenerator(RandomNumberGenerator &rng, Integer &p, Integer
|
|||
if (g != three)
|
||||
break;
|
||||
}
|
||||
assert(XTR_Exponentiate(g, q, p) == three);
|
||||
CRYPTOPP_ASSERT(XTR_Exponentiate(g, q, p) == three);
|
||||
}
|
||||
|
||||
GFP2Element XTR_Exponentiate(const GFP2Element &b, const Integer &e, const Integer &p)
|
||||
|
|
|
|||
4
xtr.h
4
xtr.h
|
|
@ -179,7 +179,7 @@ public:
|
|||
// a^2 - 2a^p
|
||||
const Element & SpecialOperation1(const Element &a) const
|
||||
{
|
||||
assert(&a != &result);
|
||||
CRYPTOPP_ASSERT(&a != &result);
|
||||
result = Square(a);
|
||||
modp.Reduce(result.c1, a.c2);
|
||||
modp.Reduce(result.c1, a.c2);
|
||||
|
|
@ -191,7 +191,7 @@ public:
|
|||
// x * z - y * z^p
|
||||
const Element & SpecialOperation2(const Element &x, const Element &y, const Element &z) const
|
||||
{
|
||||
assert(&x != &result && &y != &result && &z != &result);
|
||||
CRYPTOPP_ASSERT(&x != &result && &y != &result && &z != &result);
|
||||
t = modp.Add(x.c2, y.c2);
|
||||
result.c1 = modp.Multiply(z.c1, modp.Subtract(y.c1, t));
|
||||
modp.Accumulate(result.c1, modp.Multiply(z.c2, modp.Subtract(t, x.c1)));
|
||||
|
|
|
|||
56
zdeflate.cpp
56
zdeflate.cpp
|
|
@ -26,14 +26,14 @@ LowFirstBitWriter::LowFirstBitWriter(BufferedTransformation *attachment)
|
|||
|
||||
void LowFirstBitWriter::StartCounting()
|
||||
{
|
||||
assert(!m_counting);
|
||||
CRYPTOPP_ASSERT(!m_counting);
|
||||
m_counting = true;
|
||||
m_bitCount = 0;
|
||||
}
|
||||
|
||||
unsigned long LowFirstBitWriter::FinishCounting()
|
||||
{
|
||||
assert(m_counting);
|
||||
CRYPTOPP_ASSERT(m_counting);
|
||||
m_counting = false;
|
||||
return m_bitCount;
|
||||
}
|
||||
|
|
@ -46,7 +46,7 @@ void LowFirstBitWriter::PutBits(unsigned long value, unsigned int length)
|
|||
{
|
||||
m_buffer |= value << m_bitsBuffered;
|
||||
m_bitsBuffered += length;
|
||||
assert(m_bitsBuffered <= sizeof(unsigned long)*8);
|
||||
CRYPTOPP_ASSERT(m_bitsBuffered <= sizeof(unsigned long)*8);
|
||||
while (m_bitsBuffered >= 8)
|
||||
{
|
||||
m_outputBuffer[m_bytesBuffered++] = (byte)m_buffer;
|
||||
|
|
@ -109,8 +109,8 @@ struct FreqLessThan
|
|||
|
||||
void HuffmanEncoder::GenerateCodeLengths(unsigned int *codeBits, unsigned int maxCodeBits, const unsigned int *codeCounts, size_t nCodes)
|
||||
{
|
||||
assert(nCodes > 0);
|
||||
assert(nCodes <= ((size_t)1 << maxCodeBits));
|
||||
CRYPTOPP_ASSERT(nCodes > 0);
|
||||
CRYPTOPP_ASSERT(nCodes <= ((size_t)1 << maxCodeBits));
|
||||
|
||||
size_t i;
|
||||
SecBlockWithHint<HuffmanNode, 2*286> tree(nCodes);
|
||||
|
|
@ -163,7 +163,7 @@ void HuffmanEncoder::GenerateCodeLengths(unsigned int *codeBits, unsigned int ma
|
|||
bits--;
|
||||
blCount[bits]--;
|
||||
blCount[bits+1] += 2;
|
||||
assert(blCount[maxCodeBits] > 0);
|
||||
CRYPTOPP_ASSERT(blCount[maxCodeBits] > 0);
|
||||
blCount[maxCodeBits]--;
|
||||
}
|
||||
|
||||
|
|
@ -177,12 +177,12 @@ void HuffmanEncoder::GenerateCodeLengths(unsigned int *codeBits, unsigned int ma
|
|||
codeBits[tree[i].symbol] = bits;
|
||||
blCount[bits]--;
|
||||
}
|
||||
assert(blCount[bits] == 0);
|
||||
CRYPTOPP_ASSERT(blCount[bits] == 0);
|
||||
}
|
||||
|
||||
void HuffmanEncoder::Initialize(const unsigned int *codeBits, unsigned int nCodes)
|
||||
{
|
||||
assert(nCodes > 0);
|
||||
CRYPTOPP_ASSERT(nCodes > 0);
|
||||
unsigned int maxCodeBits = *max_element(codeBits, codeBits+nCodes);
|
||||
if (maxCodeBits == 0)
|
||||
return; // assume this object won't be used
|
||||
|
|
@ -201,7 +201,7 @@ void HuffmanEncoder::Initialize(const unsigned int *codeBits, unsigned int nCode
|
|||
code = (code + blCount[i-1]) << 1;
|
||||
nextCode[i] = code;
|
||||
}
|
||||
assert(maxCodeBits == 1 || code == (1 << maxCodeBits) - blCount[maxCodeBits]);
|
||||
CRYPTOPP_ASSERT(maxCodeBits == 1 || code == (1 << maxCodeBits) - blCount[maxCodeBits]);
|
||||
|
||||
m_valueToCode.resize(nCodes);
|
||||
for (i=0; i<nCodes; i++)
|
||||
|
|
@ -214,7 +214,7 @@ void HuffmanEncoder::Initialize(const unsigned int *codeBits, unsigned int nCode
|
|||
|
||||
inline void HuffmanEncoder::Encode(LowFirstBitWriter &writer, value_t value) const
|
||||
{
|
||||
assert(m_valueToCode[value].len > 0);
|
||||
CRYPTOPP_ASSERT(m_valueToCode[value].len > 0);
|
||||
writer.PutBits(m_valueToCode[value].code, m_valueToCode[value].len);
|
||||
}
|
||||
|
||||
|
|
@ -273,7 +273,7 @@ void Deflator::Reset(bool forceReset)
|
|||
if (forceReset)
|
||||
ClearBitBuffer();
|
||||
else
|
||||
assert(m_bitsBuffered == 0);
|
||||
CRYPTOPP_ASSERT(m_bitsBuffered == 0);
|
||||
|
||||
m_headerWritten = false;
|
||||
m_matchAvailable = false;
|
||||
|
|
@ -337,11 +337,11 @@ unsigned int Deflator::FillWindow(const byte *str, size_t length)
|
|||
memcpy(m_byteBuffer, m_byteBuffer + DSIZE, DSIZE);
|
||||
|
||||
m_dictionaryEnd = m_dictionaryEnd < DSIZE ? 0 : m_dictionaryEnd-DSIZE;
|
||||
assert(m_stringStart >= DSIZE);
|
||||
CRYPTOPP_ASSERT(m_stringStart >= DSIZE);
|
||||
m_stringStart -= DSIZE;
|
||||
assert(!m_matchAvailable || m_previousMatch >= DSIZE);
|
||||
CRYPTOPP_ASSERT(!m_matchAvailable || m_previousMatch >= DSIZE);
|
||||
m_previousMatch -= DSIZE;
|
||||
assert(m_blockStart >= DSIZE);
|
||||
CRYPTOPP_ASSERT(m_blockStart >= DSIZE);
|
||||
m_blockStart -= DSIZE;
|
||||
|
||||
unsigned int i;
|
||||
|
|
@ -353,9 +353,9 @@ unsigned int Deflator::FillWindow(const byte *str, size_t length)
|
|||
m_prev[i] = SaturatingSubtract(m_prev[i], DSIZE);
|
||||
}
|
||||
|
||||
assert(maxBlockSize > m_stringStart+m_lookahead);
|
||||
CRYPTOPP_ASSERT(maxBlockSize > m_stringStart+m_lookahead);
|
||||
unsigned int accepted = UnsignedMin(maxBlockSize-(m_stringStart+m_lookahead), length);
|
||||
assert(accepted > 0);
|
||||
CRYPTOPP_ASSERT(accepted > 0);
|
||||
memcpy(m_byteBuffer + m_stringStart + m_lookahead, str, accepted);
|
||||
m_lookahead += accepted;
|
||||
return accepted;
|
||||
|
|
@ -363,13 +363,13 @@ unsigned int Deflator::FillWindow(const byte *str, size_t length)
|
|||
|
||||
inline unsigned int Deflator::ComputeHash(const byte *str) const
|
||||
{
|
||||
assert(str+3 <= m_byteBuffer + m_stringStart + m_lookahead);
|
||||
CRYPTOPP_ASSERT(str+3 <= m_byteBuffer + m_stringStart + m_lookahead);
|
||||
return ((str[0] << 10) ^ (str[1] << 5) ^ str[2]) & HMASK;
|
||||
}
|
||||
|
||||
unsigned int Deflator::LongestMatch(unsigned int &bestMatch) const
|
||||
{
|
||||
assert(m_previousLength < MAX_MATCH);
|
||||
CRYPTOPP_ASSERT(m_previousLength < MAX_MATCH);
|
||||
|
||||
bestMatch = 0;
|
||||
unsigned int bestLength = STDMAX(m_previousLength, (unsigned int)MIN_MATCH-1);
|
||||
|
|
@ -387,10 +387,10 @@ unsigned int Deflator::LongestMatch(unsigned int &bestMatch) const
|
|||
while (current > limit && --chainLength > 0)
|
||||
{
|
||||
const byte *match = m_byteBuffer + current;
|
||||
assert(scan + bestLength < m_byteBuffer + m_stringStart + m_lookahead);
|
||||
CRYPTOPP_ASSERT(scan + bestLength < m_byteBuffer + m_stringStart + m_lookahead);
|
||||
if (scan[bestLength-1] == match[bestLength-1] && scan[bestLength] == match[bestLength] && scan[0] == match[0] && scan[1] == match[1])
|
||||
{
|
||||
assert(scan[2] == match[2]);
|
||||
CRYPTOPP_ASSERT(scan[2] == match[2]);
|
||||
unsigned int len = (unsigned int)(
|
||||
#if defined(_STDEXT_BEGIN) && !(defined(_MSC_VER) && (_MSC_VER < 1400 || _MSC_VER >= 1600)) && !defined(_STLPORT_VERSION)
|
||||
stdext::unchecked_mismatch
|
||||
|
|
@ -402,7 +402,7 @@ unsigned int Deflator::LongestMatch(unsigned int &bestMatch) const
|
|||
#else
|
||||
(scan+3, scanEnd, match+3).first - scan);
|
||||
#endif
|
||||
assert(len != bestLength);
|
||||
CRYPTOPP_ASSERT(len != bestLength);
|
||||
if (len > bestLength)
|
||||
{
|
||||
bestLength = len;
|
||||
|
|
@ -410,7 +410,7 @@ unsigned int Deflator::LongestMatch(unsigned int &bestMatch) const
|
|||
|
||||
// TODO: should we throw here?
|
||||
const ptrdiff_t diff = scanEnd - scan;
|
||||
assert(diff >= 0);
|
||||
CRYPTOPP_ASSERT(diff >= 0);
|
||||
|
||||
if (len == static_cast<unsigned int>(diff))
|
||||
break;
|
||||
|
|
@ -489,7 +489,7 @@ void Deflator::ProcessBuffer()
|
|||
m_lookahead--;
|
||||
}
|
||||
|
||||
assert(m_stringStart - (m_blockStart+m_blockLength) == (unsigned int)m_matchAvailable);
|
||||
CRYPTOPP_ASSERT(m_stringStart - (m_blockStart+m_blockLength) == (unsigned int)m_matchAvailable);
|
||||
}
|
||||
|
||||
if (m_minLookahead == 0 && m_matchAvailable)
|
||||
|
|
@ -513,7 +513,7 @@ size_t Deflator::Put2(const byte *str, size_t length, int messageEnd, bool block
|
|||
ProcessUncompressedData(str+accepted, newAccepted);
|
||||
accepted += newAccepted;
|
||||
}
|
||||
assert(accepted == length);
|
||||
CRYPTOPP_ASSERT(accepted == length);
|
||||
|
||||
if (messageEnd)
|
||||
{
|
||||
|
|
@ -580,7 +580,7 @@ void Deflator::MatchFound(unsigned int distance, unsigned int length)
|
|||
{1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577};
|
||||
|
||||
EncodedMatch &m = m_matchBuffer[m_matchBufferEnd++];
|
||||
assert(length >= 3);
|
||||
CRYPTOPP_ASSERT(length >= 3);
|
||||
unsigned int lengthCode = lengthCodes[length-3];
|
||||
m.literalCode = lengthCode;
|
||||
m.literalExtra = length - lengthBases[lengthCode-257];
|
||||
|
|
@ -642,8 +642,8 @@ void Deflator::EncodeBlock(bool eof, unsigned int blockType)
|
|||
|
||||
if (blockType == STORED)
|
||||
{
|
||||
assert(m_blockStart + m_blockLength <= m_byteBuffer.size());
|
||||
assert(m_blockLength <= 65535);
|
||||
CRYPTOPP_ASSERT(m_blockStart + m_blockLength <= m_byteBuffer.size());
|
||||
CRYPTOPP_ASSERT(m_blockLength <= 65535);
|
||||
FlushBitBuffer();
|
||||
AttachedTransformation()->PutWord16(static_cast<word16>(m_blockLength), LITTLE_ENDIAN_ORDER);
|
||||
AttachedTransformation()->PutWord16(static_cast<word16>(~m_blockLength), LITTLE_ENDIAN_ORDER);
|
||||
|
|
@ -730,7 +730,7 @@ void Deflator::EncodeBlock(bool eof, unsigned int blockType)
|
|||
literalEncoder.Encode(*this, literalCode);
|
||||
if (literalCode >= 257)
|
||||
{
|
||||
assert(literalCode <= 285);
|
||||
CRYPTOPP_ASSERT(literalCode <= 285);
|
||||
PutBits(m_matchBuffer[i].literalExtra, lengthExtraBits[literalCode-257]);
|
||||
unsigned int distanceCode = m_matchBuffer[i].distanceCode;
|
||||
distanceEncoder.Encode(*this, distanceCode);
|
||||
|
|
|
|||
14
zinflate.cpp
14
zinflate.cpp
|
|
@ -30,20 +30,20 @@ inline bool LowFirstBitReader::FillBuffer(unsigned int length)
|
|||
m_buffer |= (unsigned long)b << m_bitsBuffered;
|
||||
m_bitsBuffered += 8;
|
||||
}
|
||||
assert(m_bitsBuffered <= sizeof(unsigned long)*8);
|
||||
CRYPTOPP_ASSERT(m_bitsBuffered <= sizeof(unsigned long)*8);
|
||||
return true;
|
||||
}
|
||||
|
||||
inline unsigned long LowFirstBitReader::PeekBits(unsigned int length)
|
||||
{
|
||||
bool result = FillBuffer(length);
|
||||
assert(result); CRYPTOPP_UNUSED(result);
|
||||
CRYPTOPP_ASSERT(result); CRYPTOPP_UNUSED(result);
|
||||
return m_buffer & (((unsigned long)1 << length) - 1);
|
||||
}
|
||||
|
||||
inline void LowFirstBitReader::SkipBits(unsigned int length)
|
||||
{
|
||||
assert(m_bitsBuffered >= length);
|
||||
CRYPTOPP_ASSERT(m_bitsBuffered >= length);
|
||||
m_buffer >>= length;
|
||||
m_bitsBuffered -= length;
|
||||
}
|
||||
|
|
@ -137,7 +137,7 @@ void HuffmanDecoder::Initialize(const unsigned int *codeBits, unsigned int nCode
|
|||
m_cacheBits = STDMIN(9U, m_maxCodeBits);
|
||||
m_cacheMask = (1 << m_cacheBits) - 1;
|
||||
m_normalizedCacheMask = NormalizeCode(m_cacheMask, m_cacheBits);
|
||||
assert(m_normalizedCacheMask == BitReverse(m_cacheMask));
|
||||
CRYPTOPP_ASSERT(m_normalizedCacheMask == BitReverse(m_cacheMask));
|
||||
|
||||
if (m_cache.size() != size_t(1) << m_cacheBits)
|
||||
m_cache.resize(1 << m_cacheBits);
|
||||
|
|
@ -175,7 +175,7 @@ void HuffmanDecoder::FillCacheEntry(LookupEntry &entry, code_t normalizedCode) c
|
|||
|
||||
inline unsigned int HuffmanDecoder::Decode(code_t code, /* out */ value_t &value) const
|
||||
{
|
||||
assert(m_codeToValue.size() > 0);
|
||||
CRYPTOPP_ASSERT(m_codeToValue.size() > 0);
|
||||
LookupEntry &entry = m_cache[code & m_cacheMask];
|
||||
|
||||
code_t normalizedCode;
|
||||
|
|
@ -468,7 +468,7 @@ bool Inflator::DecodeBody()
|
|||
switch (m_blockType)
|
||||
{
|
||||
case 0: // stored
|
||||
assert(m_reader.BitsBuffered() == 0);
|
||||
CRYPTOPP_ASSERT(m_reader.BitsBuffered() == 0);
|
||||
while (!m_inQueue.IsEmpty() && !blockEnd)
|
||||
{
|
||||
size_t size;
|
||||
|
|
@ -576,7 +576,7 @@ void Inflator::FlushOutput()
|
|||
{
|
||||
if (m_state != PRE_STREAM)
|
||||
{
|
||||
assert(m_current >= m_lastFlush);
|
||||
CRYPTOPP_ASSERT(m_current >= m_lastFlush);
|
||||
ProcessDecompressedData(m_window + m_lastFlush, m_current - m_lastFlush);
|
||||
m_lastFlush = m_current;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue