summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Readme.txt4
-rw-r--r--algebra.cpp2
-rw-r--r--algparam.h4
-rw-r--r--cbcmac.h4
-rw-r--r--dh.h14
-rw-r--r--dmac.h2
-rw-r--r--eccrypto.cpp22
-rw-r--r--eccrypto.h18
-rw-r--r--elgamal.h4
-rw-r--r--gfpcrypt.h72
-rw-r--r--hmac.h2
-rw-r--r--integer.cpp6
-rw-r--r--iterhash.h30
-rw-r--r--lubyrack.h98
-rw-r--r--mdc.h14
-rw-r--r--misc.h8
-rw-r--r--modes.h34
-rw-r--r--panama.cpp30
-rw-r--r--panama.h6
-rw-r--r--polynomi.h34
-rw-r--r--pubkey.h236
-rw-r--r--rsa.h3
-rw-r--r--secblock.h13
-rw-r--r--seckey.h10
-rw-r--r--simple.h16
-rw-r--r--smartptr.h38
-rw-r--r--strciphr.cpp14
-rw-r--r--strciphr.h36
-rw-r--r--tea.h2
-rw-r--r--xormac.h79
30 files changed, 425 insertions, 430 deletions
diff --git a/Readme.txt b/Readme.txt
index 2024258..a632244 100644
--- a/Readme.txt
+++ b/Readme.txt
@@ -321,8 +321,12 @@ synchronization when multiple threads access a common Crypto++ object.
- added ThreadUserTimer for timing thread CPU usage
- added option for password-based key derivation functions
to iterate until a mimimum elapsed thread CPU time is reached
+ - added option for DEFLATE compression to detect uncompressible
+ files and process them more quickly
- improved compatibility and performance on 64-bit platforms,
including Alpha, IA-64, x86-64, PPC64, Sparc64, and MIPS64
- fixed ONE_AND_ZEROS_PADDING to use 0x80 instead 0x01 as padding.
+ - fixed encoding/decoding of PKCS #8 privateKeyInfo to properly
+ handle optional attributes
Written by Wei Dai
diff --git a/algebra.cpp b/algebra.cpp
index 222109a..6b20bf4 100644
--- a/algebra.cpp
+++ b/algebra.cpp
@@ -54,7 +54,7 @@ template <class T> const T& AbstractEuclideanDomain<T>::Gcd(const Element &a, co
Element g[3]={b, a};
unsigned int i0=0, i1=1, i2=2;
- while (!Equal(g[i1], Identity()))
+ while (!Equal(g[i1], this->Identity()))
{
g[i2] = Mod(g[i0], g[i1]);
unsigned int t = i0; i0 = i1; i1 = i2; i2 = t;
diff --git a/algparam.h b/algparam.h
index 05de855..aa10f65 100644
--- a/algparam.h
+++ b/algparam.h
@@ -23,7 +23,7 @@ public:
}
template <class T> ConstByteArrayParameter(const T &string, bool deepCopy = false)
{
- CRYPTOPP_COMPILE_ASSERT(sizeof(string[0])==1);
+ CRYPTOPP_COMPILE_ASSERT(sizeof(CPP_TYPENAME T::value_type) == 1);
Assign((const byte *)string.data(), string.size(), deepCopy);
}
@@ -320,7 +320,7 @@ public:
template <class R>
AlgorithmParameters<AlgorithmParameters<PARENT,T>, R> operator()(const char *name, const R &value) const
{
- return AlgorithmParameters<AlgorithmParameters<PARENT,T>, R>(*this, name, value, m_throwIfNotUsed);
+ return AlgorithmParameters<AlgorithmParameters<PARENT,T>, R>(*this, name, value, this->m_throwIfNotUsed);
}
template <class R>
diff --git a/cbcmac.h b/cbcmac.h
index b15c728..a05d5c6 100644
--- a/cbcmac.h
+++ b/cbcmac.h
@@ -35,8 +35,8 @@ class CBC_MAC : public MessageAuthenticationCodeImpl<CBC_MAC_Base, CBC_MAC<T> >,
{
public:
CBC_MAC() {}
- CBC_MAC(const byte *key, unsigned int length=DEFAULT_KEYLENGTH)
- {SetKey(key, length);}
+ CBC_MAC(const byte *key, unsigned int length=SameKeyLengthAs<T>::DEFAULT_KEYLENGTH)
+ {this->SetKey(key, length);}
static std::string StaticAlgorithmName() {return std::string("CBC-MAC(") + T::StaticAlgorithmName() + ")";}
diff --git a/dh.h b/dh.h
index 641d508..86bf607 100644
--- a/dh.h
+++ b/dh.h
@@ -61,18 +61,18 @@ public:
if (FIPS_140_2_ComplianceEnabled())
{
- SecByteBlock privateKey2(PrivateKeyLength());
- GeneratePrivateKey(rng, privateKey2);
+ SecByteBlock privateKey2(this->PrivateKeyLength());
+ this->GeneratePrivateKey(rng, privateKey2);
- SecByteBlock publicKey2(PublicKeyLength());
+ SecByteBlock publicKey2(this->PublicKeyLength());
Base::GeneratePublicKey(rng, privateKey2, publicKey2);
- SecByteBlock agreedValue(AgreedValueLength()), agreedValue2(AgreedValueLength());
- Agree(agreedValue, privateKey, publicKey2);
- Agree(agreedValue2, privateKey2, publicKey);
+ SecByteBlock agreedValue(this->AgreedValueLength()), agreedValue2(this->AgreedValueLength());
+ this->Agree(agreedValue, privateKey, publicKey2);
+ this->Agree(agreedValue2, privateKey2, publicKey);
if (agreedValue != agreedValue2)
- throw SelfTestFailure(AlgorithmName() + ": pairwise consistency test failed");
+ throw SelfTestFailure(this->AlgorithmName() + ": pairwise consistency test failed");
}
}
diff --git a/dmac.h b/dmac.h
index 521ba44..f10d34f 100644
--- a/dmac.h
+++ b/dmac.h
@@ -40,7 +40,7 @@ class DMAC : public MessageAuthenticationCodeFinal<DMAC_Base<T> >
public:
DMAC() {}
DMAC(const byte *key, unsigned int length=DMAC_Base<T>::DEFAULT_KEYLENGTH)
- {SetKey(key, length);}
+ {this->SetKey(key, length);}
};
template <class T>
diff --git a/eccrypto.cpp b/eccrypto.cpp
index a934534..2622481 100644
--- a/eccrypto.cpp
+++ b/eccrypto.cpp
@@ -375,7 +375,7 @@ template <class EC> void DL_GroupParameters_EC<EC>::Initialize(const OID &oid)
const EcRecommendedParameters<EllipticCurve> &param = *it;
m_oid = oid;
std::auto_ptr<EllipticCurve> ec(param.NewEC());
- m_groupPrecomputation.SetCurve(*ec);
+ this->m_groupPrecomputation.SetCurve(*ec);
StringSource ssG(param.g, true, new HexDecoder);
Element G;
@@ -396,7 +396,7 @@ bool DL_GroupParameters_EC<EC>::GetVoidValue(const char *name, const std::type_i
if (m_oid.m_values.empty())
return false;
- ThrowIfTypeMismatch(name, typeid(OID), valueType);
+ this->ThrowIfTypeMismatch(name, typeid(OID), valueType);
*reinterpret_cast<OID *>(pValue) = m_oid;
return true;
}
@@ -477,7 +477,7 @@ void DL_GroupParameters_EC<EC>::DEREncode(BufferedTransformation &bt) const
DERSequenceEncoder seq(bt);
DEREncodeUnsigned<word32>(seq, 1); // version
GetCurve().DEREncode(seq);
- GetCurve().DEREncodePoint(seq, GetSubgroupGenerator(), m_compress);
+ GetCurve().DEREncodePoint(seq, this->GetSubgroupGenerator(), m_compress);
m_n.DEREncode(seq);
if (m_k.NotZero())
m_k.DEREncode(seq);
@@ -531,12 +531,12 @@ bool DL_GroupParameters_EC<EC>::ValidateElement(unsigned int level, const Elemen
if (level >= 1)
{
if (gpc)
- pass = pass && gpc->Exponentiate(GetGroupPrecomputation(), Integer::One()) == g;
+ pass = pass && gpc->Exponentiate(this->GetGroupPrecomputation(), Integer::One()) == g;
}
if (level >= 2)
{
const Integer &q = GetSubgroupOrder();
- pass = pass && IsIdentity(gpc ? gpc->Exponentiate(GetGroupPrecomputation(), q) : ExponentiateElement(g, q));
+ pass = pass && IsIdentity(gpc ? gpc->Exponentiate(this->GetGroupPrecomputation(), q) : ExponentiateElement(g, q));
}
return pass;
}
@@ -571,7 +571,7 @@ template <class EC>
void DL_PublicKey_EC<EC>::BERDecodeKey2(BufferedTransformation &bt, bool parametersPresent, unsigned int size)
{
typename EC::Point P;
- if (!GetGroupParameters().GetCurve().DecodePoint(P, bt, size))
+ if (!this->GetGroupParameters().GetCurve().DecodePoint(P, bt, size))
BERDecodeError();
SetPublicElement(P);
}
@@ -579,7 +579,7 @@ void DL_PublicKey_EC<EC>::BERDecodeKey2(BufferedTransformation &bt, bool paramet
template <class EC>
void DL_PublicKey_EC<EC>::DEREncodeKey(BufferedTransformation &bt) const
{
- GetGroupParameters().GetCurve().EncodePoint(bt, GetPublicElement(), GetGroupParameters().GetPointCompression());
+ this->GetGroupParameters().GetCurve().EncodePoint(bt, this->GetPublicElement(), this->GetGroupParameters().GetPointCompression());
}
// ******************************************************************
@@ -602,7 +602,7 @@ void DL_PrivateKey_EC<EC>::BERDecodeKey2(BufferedTransformation &bt, bool parame
if (!seq.EndReached() && seq.PeekByte() == (CONTEXT_SPECIFIC | CONSTRUCTED | 0))
{
BERGeneralDecoder parameters(seq, CONTEXT_SPECIFIC | CONSTRUCTED | 0);
- AccessGroupParameters().BERDecode(parameters);
+ this->AccessGroupParameters().BERDecode(parameters);
parameters.MessageEnd();
}
if (!seq.EndReached())
@@ -614,12 +614,12 @@ void DL_PrivateKey_EC<EC>::BERDecodeKey2(BufferedTransformation &bt, bool parame
BERDecodeBitString(publicKey, subjectPublicKey, unusedBits);
publicKey.MessageEnd();
Element Q;
- if (!(unusedBits == 0 && GetGroupParameters().GetCurve().DecodePoint(Q, subjectPublicKey, subjectPublicKey.size())))
+ if (!(unusedBits == 0 && this->GetGroupParameters().GetCurve().DecodePoint(Q, subjectPublicKey, subjectPublicKey.size())))
BERDecodeError();
}
seq.MessageEnd();
- SetPrivateExponent(x);
+ this->SetPrivateExponent(x);
}
template <class EC>
@@ -629,7 +629,7 @@ void DL_PrivateKey_EC<EC>::DEREncodeKey(BufferedTransformation &bt) const
DEREncodeUnsigned<word32>(privateKey, 1); // version
// SEC 1 ver 1.0 says privateKey (m_d) has the same length as order of the curve
// this will be changed to order of base point in a future version
- GetPrivateExponent().DEREncodeAsOctetString(privateKey, GetGroupParameters().GetSubgroupOrder().ByteCount());
+ this->GetPrivateExponent().DEREncodeAsOctetString(privateKey, this->GetGroupParameters().GetSubgroupOrder().ByteCount());
privateKey.MessageEnd();
}
diff --git a/eccrypto.h b/eccrypto.h
index 25c6424..20a6940 100644
--- a/eccrypto.h
+++ b/eccrypto.h
@@ -42,7 +42,7 @@ public:
void Initialize(const EllipticCurve &ec, const Point &G, const Integer &n, const Integer &k = Integer::Zero())
{
- m_groupPrecomputation.SetCurve(ec);
+ this->m_groupPrecomputation.SetCurve(ec);
SetSubgroupGenerator(G);
m_n = n;
m_k = k;
@@ -59,8 +59,8 @@ public:
void GenerateRandom(RandomNumberGenerator &rng, const NameValuePairs &alg);
// DL_GroupParameters
- const DL_FixedBasePrecomputation<Element> & GetBasePrecomputation() const {return m_gpc;}
- DL_FixedBasePrecomputation<Element> & AccessBasePrecomputation() {return m_gpc;}
+ const DL_FixedBasePrecomputation<Element> & GetBasePrecomputation() const {return this->m_gpc;}
+ DL_FixedBasePrecomputation<Element> & AccessBasePrecomputation() {return this->m_gpc;}
const Integer & GetSubgroupOrder() const {return m_n;}
Integer GetCofactor() const;
bool ValidateGroup(RandomNumberGenerator &rng, unsigned int level) const;
@@ -115,10 +115,10 @@ public:
void SetEncodeAsOID(bool encodeAsOID) {m_encodeAsOID = encodeAsOID;}
bool GetEncodeAsOID() const {return m_encodeAsOID;}
- const EllipticCurve& GetCurve() const {return m_groupPrecomputation.GetCurve();}
+ const EllipticCurve& GetCurve() const {return this->m_groupPrecomputation.GetCurve();}
bool operator==(const ThisClass &rhs) const
- {return m_groupPrecomputation.GetCurve() == rhs.m_groupPrecomputation.GetCurve() && m_gpc.GetBase(m_groupPrecomputation) == rhs.m_gpc.GetBase(rhs.m_groupPrecomputation);}
+ {return this->m_groupPrecomputation.GetCurve() == rhs.m_groupPrecomputation.GetCurve() && this->m_gpc.GetBase(this->m_groupPrecomputation) == rhs.m_gpc.GetBase(rhs.m_groupPrecomputation);}
#ifdef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY
const Point& GetBasePoint() const {return GetSubgroupGenerator();}
@@ -149,9 +149,9 @@ public:
typedef typename EC::Point Element;
void Initialize(const DL_GroupParameters_EC<EC> &params, const Element &Q)
- {AccessGroupParameters() = params; SetPublicElement(Q);}
+ {this->AccessGroupParameters() = params; SetPublicElement(Q);}
void Initialize(const EC &ec, const Element &G, const Integer &n, const Element &Q)
- {AccessGroupParameters().Initialize(ec, G, n); SetPublicElement(Q);}
+ {this->AccessGroupParameters().Initialize(ec, G, n); SetPublicElement(Q);}
// X509PublicKey
void BERDecodeKey2(BufferedTransformation &bt, bool parametersPresent, unsigned int size);
@@ -171,9 +171,9 @@ public:
typedef typename EC::Point Element;
void Initialize(const DL_GroupParameters_EC<EC> &params, const Integer &x)
- {AccessGroupParameters() = params; SetPrivateExponent(x);}
+ {this->AccessGroupParameters() = params; this->SetPrivateExponent(x);}
void Initialize(const EC &ec, const Element &G, const Integer &n, const Integer &x)
- {AccessGroupParameters().Initialize(ec, G, n); SetPrivateExponent(x);}
+ {this->AccessGroupParameters().Initialize(ec, G, n); this->SetPrivateExponent(x);}
void Initialize(RandomNumberGenerator &rng, const DL_GroupParameters_EC<EC> &params)
{GenerateRandom(rng, params);}
void Initialize(RandomNumberGenerator &rng, const EC &ec, const Element &G, const Integer &n)
diff --git a/elgamal.h b/elgamal.h
index 3d6734e..20f1dc4 100644
--- a/elgamal.h
+++ b/elgamal.h
@@ -79,9 +79,9 @@ class CRYPTOPP_NO_VTABLE ElGamalObjectImpl : public DL_ObjectImplBase<BASE, SCHE
{
public:
unsigned int FixedMaxPlaintextLength() const {return MaxPlaintextLength(FixedCiphertextLength());}
- unsigned int FixedCiphertextLength() const {return CiphertextLength(0);}
+ unsigned int FixedCiphertextLength() const {return this->CiphertextLength(0);}
- const DL_GroupParameters_GFP & GetGroupParameters() const {return GetKey().GetGroupParameters();}
+ const DL_GroupParameters_GFP & GetGroupParameters() const {return this->GetKey().GetGroupParameters();}
DecodingResult FixedLengthDecrypt(RandomNumberGenerator &rng, const byte *cipherText, byte *plainText) const
{return Decrypt(rng, cipherText, FixedCiphertextLength(), plainText);}
diff --git a/gfpcrypt.h b/gfpcrypt.h
index 2d2acb3..0bc6b3b 100644
--- a/gfpcrypt.h
+++ b/gfpcrypt.h
@@ -95,19 +95,19 @@ public:
{AssignFromHelper<DL_GroupParameters_IntegerBased>(this, source);}
// DL_GroupParameters
- const DL_FixedBasePrecomputation<Element> & GetBasePrecomputation() const {return m_gpc;}
- DL_FixedBasePrecomputation<Element> & AccessBasePrecomputation() {return m_gpc;}
+ const DL_FixedBasePrecomputation<Element> & GetBasePrecomputation() const {return this->m_gpc;}
+ DL_FixedBasePrecomputation<Element> & AccessBasePrecomputation() {return this->m_gpc;}
// IntegerGroupParameters
- const Integer & GetModulus() const {return m_groupPrecomputation.GetModulus();}
- const Integer & GetGenerator() const {return m_gpc.GetBase(GetGroupPrecomputation());}
+ const Integer & GetModulus() const {return this->m_groupPrecomputation.GetModulus();}
+ const Integer & GetGenerator() const {return this->m_gpc.GetBase(this->GetGroupPrecomputation());}
void SetModulusAndSubgroupGenerator(const Integer &p, const Integer &g) // these have to be set together
- {m_groupPrecomputation.SetModulus(p); m_gpc.SetBase(GetGroupPrecomputation(), g); ParametersChanged();}
+ {this->m_groupPrecomputation.SetModulus(p); this->m_gpc.SetBase(this->GetGroupPrecomputation(), g); this->ParametersChanged();}
// non-inherited
bool operator==(const DL_GroupParameters_IntegerBasedImpl<GROUP_PRECOMP, BASE_PRECOMP> &rhs) const
- {return GetModulus() == rhs.GetModulus() && GetGenerator() == rhs.GetGenerator() && GetSubgroupOrder() == rhs.GetSubgroupOrder();}
+ {return GetModulus() == rhs.GetModulus() && GetGenerator() == rhs.GetGenerator() && this->GetSubgroupOrder() == rhs.GetSubgroupOrder();}
bool operator!=(const DL_GroupParameters_IntegerBasedImpl<GROUP_PRECOMP, BASE_PRECOMP> &rhs) const
{return !operator==(rhs);}
};
@@ -211,17 +211,17 @@ class DL_PublicKey_GFP : public DL_PublicKeyImpl<GP>
{
public:
void Initialize(const DL_GroupParameters_IntegerBased &params, const Integer &y)
- {AccessGroupParameters().Initialize(params); SetPublicElement(y);}
+ {this->AccessGroupParameters().Initialize(params); this->SetPublicElement(y);}
void Initialize(const Integer &p, const Integer &g, const Integer &y)
- {AccessGroupParameters().Initialize(p, g); SetPublicElement(y);}
+ {this->AccessGroupParameters().Initialize(p, g); this->SetPublicElement(y);}
void Initialize(const Integer &p, const Integer &q, const Integer &g, const Integer &y)
- {AccessGroupParameters().Initialize(p, q, g); SetPublicElement(y);}
+ {this->AccessGroupParameters().Initialize(p, q, g); this->SetPublicElement(y);}
// X509PublicKey
void BERDecodeKey(BufferedTransformation &bt)
- {SetPublicElement(Integer(bt));}
+ {this->SetPublicElement(Integer(bt));}
void DEREncodeKey(BufferedTransformation &bt) const
- {GetPublicElement().DEREncode(bt);}
+ {this->GetPublicElement().DEREncode(bt);}
};
//! .
@@ -230,17 +230,17 @@ class DL_PrivateKey_GFP : public DL_PrivateKeyImpl<GP>
{
public:
void Initialize(RandomNumberGenerator &rng, unsigned int modulusBits)
- {GenerateRandomWithKeySize(rng, modulusBits);}
+ {this->GenerateRandomWithKeySize(rng, modulusBits);}
void Initialize(RandomNumberGenerator &rng, const Integer &p, const Integer &g)
- {GenerateRandom(rng, MakeParameters("Modulus", p)("SubgroupGenerator", g));}
+ {this->GenerateRandom(rng, MakeParameters("Modulus", p)("SubgroupGenerator", g));}
void Initialize(RandomNumberGenerator &rng, const Integer &p, const Integer &q, const Integer &g)
- {GenerateRandom(rng, MakeParameters("Modulus", p)("SubgroupOrder", q)("SubgroupGenerator", g));}
+ {this->GenerateRandom(rng, MakeParameters("Modulus", p)("SubgroupOrder", q)("SubgroupGenerator", g));}
void Initialize(const DL_GroupParameters_IntegerBased &params, const Integer &x)
- {AccessGroupParameters().Initialize(params); SetPrivateExponent(x);}
+ {this->AccessGroupParameters().Initialize(params); this->SetPrivateExponent(x);}
void Initialize(const Integer &p, const Integer &g, const Integer &x)
- {AccessGroupParameters().Initialize(p, g); SetPrivateExponent(x);}
+ {this->AccessGroupParameters().Initialize(p, g); this->SetPrivateExponent(x);}
void Initialize(const Integer &p, const Integer &q, const Integer &g, const Integer &x)
- {AccessGroupParameters().Initialize(p, q, g); SetPrivateExponent(x);}
+ {this->AccessGroupParameters().Initialize(p, q, g); this->SetPrivateExponent(x);}
};
//! .
@@ -273,14 +273,14 @@ public:
if (seq.EndReached())
{
- AccessGroupParameters().Initialize(v1, v1/2, v2);
- SetPublicElement(v3);
+ this->AccessGroupParameters().Initialize(v1, v1/2, v2);
+ this->SetPublicElement(v3);
}
else
{
Integer v4(seq);
- AccessGroupParameters().Initialize(v1, v2, v3);
- SetPublicElement(v4);
+ this->AccessGroupParameters().Initialize(v1, v2, v3);
+ this->SetPublicElement(v4);
}
seq.MessageEnd();
@@ -289,11 +289,11 @@ public:
void DEREncode(BufferedTransformation &bt) const
{
DERSequenceEncoder seq(bt);
- GetGroupParameters().GetModulus().DEREncode(seq);
- if (GetGroupParameters().GetCofactor() != 2)
- GetGroupParameters().GetSubgroupOrder().DEREncode(seq);
- GetGroupParameters().GetGenerator().DEREncode(seq);
- GetPublicElement().DEREncode(seq);
+ this->GetGroupParameters().GetModulus().DEREncode(seq);
+ if (this->GetGroupParameters().GetCofactor() != 2)
+ this->GetGroupParameters().GetSubgroupOrder().DEREncode(seq);
+ this->GetGroupParameters().GetGenerator().DEREncode(seq);
+ this->GetPublicElement().DEREncode(seq);
seq.MessageEnd();
}
};
@@ -313,14 +313,14 @@ public:
if (seq.EndReached())
{
- AccessGroupParameters().Initialize(v1, v1/2, v2);
- SetPrivateExponent(v4 % (v1/2)); // some old keys may have x >= q
+ this->AccessGroupParameters().Initialize(v1, v1/2, v2);
+ this->SetPrivateExponent(v4 % (v1/2)); // some old keys may have x >= q
}
else
{
Integer v5(seq);
- AccessGroupParameters().Initialize(v1, v2, v3);
- SetPrivateExponent(v5);
+ this->AccessGroupParameters().Initialize(v1, v2, v3);
+ this->SetPrivateExponent(v5);
}
seq.MessageEnd();
@@ -329,12 +329,12 @@ public:
void DEREncode(BufferedTransformation &bt) const
{
DERSequenceEncoder seq(bt);
- GetGroupParameters().GetModulus().DEREncode(seq);
- if (GetGroupParameters().GetCofactor() != 2)
- GetGroupParameters().GetSubgroupOrder().DEREncode(seq);
- GetGroupParameters().GetGenerator().DEREncode(seq);
- GetGroupParameters().ExponentiateBase(GetPrivateExponent()).DEREncode(seq);
- GetPrivateExponent().DEREncode(seq);
+ this->GetGroupParameters().GetModulus().DEREncode(seq);
+ if (this->GetGroupParameters().GetCofactor() != 2)
+ this->GetGroupParameters().GetSubgroupOrder().DEREncode(seq);
+ this->GetGroupParameters().GetGenerator().DEREncode(seq);
+ this->GetGroupParameters().ExponentiateBase(this->GetPrivateExponent()).DEREncode(seq);
+ this->GetPrivateExponent().DEREncode(seq);
seq.MessageEnd();
}
};
diff --git a/hmac.h b/hmac.h
index f8703ba..e121e67 100644
--- a/hmac.h
+++ b/hmac.h
@@ -44,7 +44,7 @@ public:
HMAC() {}
HMAC(const byte *key, unsigned int length=HMAC_Base::DEFAULT_KEYLENGTH)
- {SetKey(key, length);}
+ {this->SetKey(key, length);}
static std::string StaticAlgorithmName() {return std::string("HMAC(") + T::StaticAlgorithmName() + ")";}
std::string AlgorithmName() const {return std::string("HMAC(") + m_hash.AlgorithmName() + ")";}
diff --git a/integer.cpp b/integer.cpp
index 575b431..ecab41c 100644
--- a/integer.cpp
+++ b/integer.cpp
@@ -1560,10 +1560,12 @@ typedef Portable LowLevel;
#ifdef SSE2_INTRINSICS_AVAILABLE
#ifdef __GNUC__
-#define __fastcall
+#define CRYPTOPP_FASTCALL
+#else
+#define CRYPTOPP_FASTCALL __fastcall
#endif
-static void __fastcall P4_Mul(__m128i *C, const __m128i *A, const __m128i *B)
+static void CRYPTOPP_FASTCALL P4_Mul(__m128i *C, const __m128i *A, const __m128i *B)
{
__m128i a3210 = _mm_load_si128(A);
__m128i b3210 = _mm_load_si128(B);
diff --git a/iterhash.h b/iterhash.h
index 7769bad..b4e2682 100644
--- a/iterhash.h
+++ b/iterhash.h
@@ -77,7 +77,7 @@ public:
CRYPTOPP_COMPILE_ASSERT((BLOCKSIZE & (BLOCKSIZE - 1)) == 0); // blockSize is a power of 2
protected:
- IteratedHash() {SetBlockSize(T_BlockSize);}
+ IteratedHash() {this->SetBlockSize(T_BlockSize);}
};
template <class T_HashWordType, class T_Endianness, unsigned int T_BlockSize, unsigned int T_StateSize, class T_Transform, unsigned int T_DigestSize = T_StateSize>
@@ -91,30 +91,30 @@ public:
protected:
IteratedHashWithStaticTransform()
{
- SetStateSize(T_StateSize);
+ this->SetStateSize(T_StateSize);
Init();
}
- void HashEndianCorrectedBlock(const T_HashWordType *data) {T_Transform::Transform(m_digest, data);}
- void Init() {T_Transform::InitState(m_digest);}
+ void HashEndianCorrectedBlock(const T_HashWordType *data) {T_Transform::Transform(this->m_digest, data);}
+ void Init() {T_Transform::InitState(this->m_digest);}
};
// *************************************************************
template <class T, class B, class BASE> void IteratedHashBase2<T, B, BASE>::TruncatedFinal(byte *digest, unsigned int size)
{
- ThrowIfInvalidTruncatedSize(size);
+ this->ThrowIfInvalidTruncatedSize(size);
- PadLastBlock(BlockSize() - 2*sizeof(HashWordType));
- CorrectEndianess(m_data, m_data, BlockSize() - 2*sizeof(HashWordType));
+ PadLastBlock(this->BlockSize() - 2*sizeof(HashWordType));
+ CorrectEndianess(this->m_data, this->m_data, this->BlockSize() - 2*sizeof(HashWordType));
- m_data[m_data.size()-2] = B::ToEnum() ? GetBitCountHi() : GetBitCountLo();
- m_data[m_data.size()-1] = B::ToEnum() ? GetBitCountLo() : GetBitCountHi();
+ this->m_data[this->m_data.size()-2] = B::ToEnum() ? this->GetBitCountHi() : this->GetBitCountLo();
+ this->m_data[this->m_data.size()-1] = B::ToEnum() ? this->GetBitCountLo() : this->GetBitCountHi();
- HashEndianCorrectedBlock(m_data);
- CorrectEndianess(m_digest, m_digest, DigestSize());
- memcpy(digest, m_digest, size);
+ HashEndianCorrectedBlock(this->m_data);
+ CorrectEndianess(this->m_digest, this->m_digest, this->DigestSize());
+ memcpy(digest, this->m_digest, size);
- Restart(); // reinit for next use
+ this->Restart(); // reinit for next use
}
template <class T, class B, class BASE> void IteratedHashBase2<T, B, BASE>::HashBlock(const HashWordType *input)
@@ -123,8 +123,8 @@ template <class T, class B, class BASE> void IteratedHashBase2<T, B, BASE>::Hash
HashEndianCorrectedBlock(input);
else
{
- ByteReverse(m_data.begin(), input, BlockSize());
- HashEndianCorrectedBlock(m_data);
+ ByteReverse(this->m_data.begin(), input, this->BlockSize());
+ HashEndianCorrectedBlock(this->m_data);
}
}
diff --git a/lubyrack.h b/lubyrack.h
index 9171a24..36b47c9 100644
--- a/lubyrack.h
+++ b/lubyrack.h
@@ -29,7 +29,7 @@ class LR : public LR_Info<T>, public BlockCipherDocumentation
// VC60 workaround: have to define these functions within class definition
void UncheckedSetKey(CipherDir direction, const byte *userKey, unsigned int length)
{
- AssertValidKeyLength(length);
+ this->AssertValidKeyLength(length);
L = length/2;
buffer.New(2*S);
@@ -50,41 +50,41 @@ class LR : public LR_Info<T>, public BlockCipherDocumentation
{
public:
-#define KL key
-#define KR key+L
-#define BL buffer
-#define BR buffer+S
+#define KL this->key
+#define KR this->key+this->L
+#define BL this->buffer
+#define BR this->buffer+this->S
#define IL inBlock
-#define IR inBlock+S
+#define IR inBlock+this->S
#define OL outBlock
-#define OR outBlock+S
+#define OR outBlock+this->S
void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const
{
- hm.Update(KL, L);
- hm.Update(IL, S);
- hm.Final(BR);
- xorbuf(BR, IR, S);
-
- hm.Update(KR, L);
- hm.Update(BR, S);
- hm.Final(BL);
- xorbuf(BL, IL, S);
-
- hm.Update(KL, L);
- hm.Update(BL, S);
- hm.Final(digest);
- xorbuf(BR, digest, S);
-
- hm.Update(KR, L);
- hm.Update(OR, S);
- hm.Final(digest);
- xorbuf(BL, digest, S);
+ this->hm.Update(KL, this->L);
+ this->hm.Update(IL, this->S);
+ this->hm.Final(BR);
+ xorbuf(BR, IR, this->S);
+
+ this->hm.Update(KR, this->L);
+ this->hm.Update(BR, this->S);
+ this->hm.Final(BL);
+ xorbuf(BL, IL, this->S);
+
+ this->hm.Update(KL, this->L);
+ this->hm.Update(BL, this->S);
+ this->hm.Final(this->digest);
+ xorbuf(BR, this->digest, this->S);
+
+ this->hm.Update(KR, this->L);
+ this->hm.Update(OR, this->S);
+ this->hm.Final(this->digest);
+ xorbuf(BL, this->digest, this->S);
if (xorBlock)
- xorbuf(outBlock, xorBlock, buffer, 2*S);
+ xorbuf(outBlock, xorBlock, this->buffer, 2*this->S);
else
- memcpy(outBlock, buffer, 2*S);
+ memcpy(outBlock, this->buffer, 2*this->S);
}
};
@@ -93,30 +93,30 @@ class LR : public LR_Info<T>, public BlockCipherDocumentation
public:
void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const
{
- hm.Update(KR, L);
- hm.Update(IR, S);
- hm.Final(BL);
- xorbuf(BL, IL, S);
-
- hm.Update(KL, L);
- hm.Update(BL, S);
- hm.Final(BR);
- xorbuf(BR, IR, S);
-
- hm.Update(KR, L);
- hm.Update(BR, S);
- hm.Final(digest);
- xorbuf(BL, digest, S);
-
- hm.Update(KL, L);
- hm.Update(OL, S);
- hm.Final(digest);
- xorbuf(BR, digest, S);
+ this->hm.Update(KR, this->L);
+ this->hm.Update(IR, this->S);
+ this->hm.Final(BL);
+ xorbuf(BL, IL, this->S);
+
+ this->hm.Update(KL, this->L);
+ this->hm.Update(BL, this->S);
+ this->hm.Final(BR);
+ xorbuf(BR, IR, this->S);
+
+ this->hm.Update(KR, this->L);
+ this->hm.Update(BR, this->S);
+ this->hm.Final(this->digest);
+ xorbuf(BL, this->digest, this->S);
+
+ this->hm.Update(KL, this->L);
+ this->hm.Update(OL, this->S);
+ this->hm.Final(this->digest);
+ xorbuf(BR, this->digest, this->S);
if (xorBlock)
- xorbuf(outBlock, xorBlock, buffer, 2*S);
+ xorbuf(outBlock, xorBlock, this->buffer, 2*this->S);
else
- memcpy(outBlock, buffer, 2*S);
+ memcpy(outBlock, this->buffer, 2*this->S);
}
#undef KL
#undef KR
diff --git a/mdc.h b/mdc.h
index b587f15..ce12ca5 100644
--- a/mdc.h
+++ b/mdc.h
@@ -30,22 +30,22 @@ class MDC : public MDC_Info<T>
void UncheckedSetKey(CipherDir direction, const byte *userKey, unsigned int length)
{
assert(direction == ENCRYPTION);
- AssertValidKeyLength(length);
- memcpy(Key(), userKey, KEYLENGTH);
- T::CorrectEndianess(Key(), Key(), KEYLENGTH);
+ this->AssertValidKeyLength(length);
+ memcpy(Key(), userKey, this->KEYLENGTH);
+ T::CorrectEndianess(Key(), Key(), this->KEYLENGTH);
}
void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const
{
- T::CorrectEndianess(Buffer(), (HashWordType *)inBlock, BLOCKSIZE);
+ T::CorrectEndianess(Buffer(), (HashWordType *)inBlock, this->BLOCKSIZE);
T::Transform(Buffer(), Key());
if (xorBlock)
{
- T::CorrectEndianess(Buffer(), Buffer(), BLOCKSIZE);
- xorbuf(outBlock, xorBlock, m_buffer, BLOCKSIZE);
+ T::CorrectEndianess(Buffer(), Buffer(), this->BLOCKSIZE);
+ xorbuf(outBlock, xorBlock, m_buffer, this->BLOCKSIZE);
}
else
- T::CorrectEndianess((HashWordType *)outBlock, Buffer(), BLOCKSIZE);
+ T::CorrectEndianess((HashWordType *)outBlock, Buffer(), this->BLOCKSIZE);
}
bool IsPermutation() const {return false;}
diff --git a/misc.h b/misc.h
index d73d210..a3ba0b7 100644
--- a/misc.h
+++ b/misc.h
@@ -114,14 +114,14 @@ retry:
// ************** misc functions ***************
// can't use std::min or std::max in MSVC60 or Cygwin 1.1.0
-template <class _Tp> inline const _Tp& STDMIN(const _Tp& __a, const _Tp& __b)
+template <class T> inline const T& STDMIN(const T& a, const T& b)
{
- return __b < __a ? __b : __a;
+ return b < a ? b : a;
}
-template <class _Tp> inline const _Tp& STDMAX(const _Tp& __a, const _Tp& __b)
+template <class T> inline const T& STDMAX(const T& a, const T& b)
{
- return __a < __b ? __b : __a;
+ return a < b ? b : a;
}
#define RETURN_IF_NONZERO(x) unsigned int returnedValue = x; if (returnedValue) return returnedValue
diff --git a/modes.h b/modes.h
index 66b6638..a657eb0 100644
--- a/modes.h
+++ b/modes.h
@@ -255,23 +255,23 @@ class CipherModeFinalTemplate_CipherHolder : public ObjectHolder<CIPHER>, public
public:
CipherModeFinalTemplate_CipherHolder()
{
- m_cipher = &m_object;
- ResizeBuffers();
+ this->m_cipher = &this->m_object;
+ this->ResizeBuffers();
}
CipherModeFinalTemplate_CipherHolder(const byte *key, unsigned int length)
{
- m_cipher = &m_object;
- SetKey(key, length);
+ this->m_cipher = &this->m_object;
+ this->SetKey(key, length);
}
CipherModeFinalTemplate_CipherHolder(const byte *key, unsigned int length, const byte *iv)
{
- m_cipher = &m_object;
- SetKey(key, length, MakeParameters(Name::IV(), iv));
+ this->m_cipher = &this->m_object;
+ this->SetKey(key, length, MakeParameters(Name::IV(), iv));
}
CipherModeFinalTemplate_CipherHolder(const byte *key, unsigned int length, const byte *iv, int feedbackSize)
{
- m_cipher = &m_object;
- SetKey(key, length, MakeParameters(Name::IV(), iv)(Name::FeedbackSize(), feedbackSize));
+ this->m_cipher = &this->m_object;
+ this->SetKey(key, length, MakeParameters(Name::IV(), iv)(Name::FeedbackSize(), feedbackSize));
}
};
@@ -293,20 +293,20 @@ public:
template <class BASE>
void CipherModeFinalTemplate_ExternalCipher<BASE>::SetCipher(BlockCipher &cipher)
{
- ThrowIfResynchronizable();
- m_cipher = &cipher;
- ResizeBuffers();
+ this->ThrowIfResynchronizable();
+ this->m_cipher = &cipher;
+ this->ResizeBuffers();
}
template <class BASE>
void CipherModeFinalTemplate_ExternalCipher<BASE>::SetCipherWithIV(BlockCipher &cipher, const byte *iv, int feedbackSize)
{
- ThrowIfInvalidIV(iv);
- m_cipher = &cipher;
- ResizeBuffers();
- SetFeedbackSize(feedbackSize);
- if (IsResynchronizable())
- Resynchronize(iv);
+ this->ThrowIfInvalidIV(iv);
+ this->m_cipher = &cipher;
+ this->ResizeBuffers();
+ this->SetFeedbackSize(feedbackSize);
+ if (this->IsResynchronizable())
+ this->Resynchronize(iv);
}
CRYPTOPP_DLL_TEMPLATE_CLASS CFB_CipherTemplate<AbstractPolicyHolder<CFB_CipherAbstractPolicy, CFB_ModePolicy> >;
diff --git a/panama.cpp b/panama.cpp
index 7e39e06..62d5e19 100644
--- a/panama.cpp
+++ b/panama.cpp
@@ -53,7 +53,7 @@ void Panama<B>::Iterate(unsigned int count, const word32 *p, word32 *z, const wo
word32 *const b16 = b[(bstart+16) % STAGES];
word32 *const b4 = b[(bstart+4) % STAGES];
- bstart = (bstart + STAGES - 1) % STAGES;
+ bstart = (bstart + STAGES - 1) % STAGES;
word32 *const b0 = b[bstart];
word32 *const b25 = b[(bstart+25) % STAGES];
@@ -90,25 +90,25 @@ void Panama<B>::Iterate(unsigned int count, const word32 *p, word32 *z, const wo
template <class B>
unsigned int PanamaHash<B>::HashMultipleBlocks(const word32 *input, unsigned int length)
{
- Iterate(length / BLOCKSIZE, input);
- return length % BLOCKSIZE;
+ this->Iterate(length / this->BLOCKSIZE, input);
+ return length % this->BLOCKSIZE;
}
template <class B>
void PanamaHash<B>::TruncatedFinal(byte *hash, unsigned int size)
{
- ThrowIfInvalidTruncatedSize(size);
+ this->ThrowIfInvalidTruncatedSize(size);
- PadLastBlock(BLOCKSIZE, 0x01);
+ PadLastBlock(this->BLOCKSIZE, 0x01);
- HashEndianCorrectedBlock(m_data);
+ HashEndianCorrectedBlock(this->m_data);
- Iterate(32); // pull
+ this->Iterate(32); // pull
- ConditionalByteReverse(B::ToEnum(), m_state+9, m_state+9, DIGESTSIZE);
- memcpy(hash, m_state+9, size);
+ ConditionalByteReverse(B::ToEnum(), this->m_state+9, this->m_state+9, DIGESTSIZE);
+ memcpy(hash, this->m_state+9, size);
- Restart(); // reinit for next use
+ this->Restart(); // reinit for next use
}
template <class B>
@@ -116,22 +116,22 @@ void PanamaCipherPolicy<B>::CipherSetKey(const NameValuePairs &params, const byt
{
FixedSizeSecBlock<word32, 8> buf;
- Reset();
+ this->Reset();
memcpy(buf, key, 32);
- Iterate(1, buf);
+ this->Iterate(1, buf);
if (length == 64)
memcpy(buf, key+32, 32);
else
memset(buf, 0, 32);
- Iterate(1, buf);
+ this->Iterate(1, buf);
- Iterate(32);
+ this->Iterate(32);
}
template <class B>
void PanamaCipherPolicy<B>::OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, unsigned int iterationCount)
{
- Iterate(iterationCount, NULL, (word32 *)output, (const word32 *)input);
+ this->Iterate(iterationCount, NULL, (word32 *)output, (const word32 *)input);
}
template class Panama<BigEndian>;
diff --git a/panama.h b/panama.h
index 2544f3b..6bbe9b1 100644
--- a/panama.h
+++ b/panama.h
@@ -37,7 +37,7 @@ public:
protected:
void Init() {Panama<B>::Reset();}
- void HashEndianCorrectedBlock(const word32 *data) {Iterate(1, data);} // push
+ void HashEndianCorrectedBlock(const word32 *data) {this->Iterate(1, data);} // push
unsigned int HashMultipleBlocks(const word32 *input, unsigned int length);
};
@@ -52,7 +52,7 @@ public:
Restart();
}
- static const char * StaticAlgorithmName() {return B::ToEnum() == BIG_ENDIAN ? "Panama-BE" : "Panama-LE";}
+ static const char * StaticAlgorithmName() {return B::ToEnum() == BIG_ENDIAN_ORDER ? "Panama-BE" : "Panama-LE";}
protected:
void Init()
@@ -71,7 +71,7 @@ class PanamaMAC : public MessageAuthenticationCodeImpl<PanamaMAC_Base<B> >
public:
PanamaMAC() {}
PanamaMAC(const byte *key, unsigned int length=PanamaMAC_Base<B>::DEFAULT_KEYLENGTH)
- {SetKey(key, length);}
+ {this->SetKey(key, length);}
};
//! .
diff --git a/polynomi.h b/polynomi.h
index f90c513..cddadae 100644
--- a/polynomi.h
+++ b/polynomi.h
@@ -324,46 +324,46 @@ public:
{return a.Equals(b, m_ring);}
const Element& Identity() const
- {return result = m_ring.Identity();}
+ {return this->result = m_ring.Identity();}
const Element& Add(const Element &a, const Element &b) const
- {return result = a.Plus(b, m_ring);}
+ {return this->result = a.Plus(b, m_ring);}
Element& Accumulate(Element &a, const Element &b) const
{a.Accumulate(b, m_ring); return a;}
const Element& Inverse(const Element &a) const
- {return result = a.Inverse(m_ring);}
+ {return this->result = a.Inverse(m_ring);}
const Element& Subtract(const Element &a, const Element &b) const
- {return result = a.Minus(b, m_ring);}
+ {return this->result = a.Minus(b, m_ring);}
Element& Reduce(Element &a, const Element &b) const
{return a.Reduce(b, m_ring);}
const Element& Double(const Element &a) const
- {return result = a.Doubled(m_ring);}
+ {return this->result = a.Doubled(m_ring);}
const Element& MultiplicativeIdentity() const
- {return result = m_ring.MultiplicativeIdentity();}
+ {return this->result = m_ring.MultiplicativeIdentity();}
const Element& Multiply(const Element &a, const Element &b) const
- {return result = a.Times(b, m_ring);}
+ {return this->result = a.Times(b, m_ring);}
const Element& Square(const Element &a) const
- {return result = a.Squared(m_ring);}
+ {return this->result = a.Squared(m_ring);}
bool IsUnit(const Element &a) const
{return a.IsUnit(m_ring);}
const Element& MultiplicativeInverse(const Element &a) const
- {return result = a.MultiplicativeInverse(m_ring);}
+ {return this->result = a.MultiplicativeInverse(m_ring);}
const Element& Divide(const Element &a, const Element &b) const
- {return result = a.DividedBy(b, m_ring);}
+ {return this->result = a.DividedBy(b, m_ring);}
const Element& Mod(const Element &a, const Element &b) const
- {return result = a.Modulo(b, m_ring);}
+ {return this->result = a.Modulo(b, m_ring);}
void DivisionAlgorithm(Element &r, Element &q, const Element &a, const Element &d) const
{Element::Divide(r, q, a, d, m_ring);}
@@ -399,7 +399,7 @@ Element BulkPolynomialInterpolateAt(const Ring &ring, const Element y[], const E
//!
template <class T, int instance>
inline bool operator==(const CryptoPP::PolynomialOverFixedRing<T, instance> &a, const CryptoPP::PolynomialOverFixedRing<T, instance> &b)
- {return a.Equals(b, ms_fixedRing);}
+ {return a.Equals(b, a.ms_fixedRing);}
//!
template <class T, int instance>
inline bool operator!=(const CryptoPP::PolynomialOverFixedRing<T, instance> &a, const CryptoPP::PolynomialOverFixedRing<T, instance> &b)
@@ -425,23 +425,23 @@ inline bool operator<=(const CryptoPP::PolynomialOverFixedRing<T, instance> &a,
//!
template <class T, int instance>
inline CryptoPP::PolynomialOverFixedRing<T, instance> operator+(const CryptoPP::PolynomialOverFixedRing<T, instance> &a, const CryptoPP::PolynomialOverFixedRing<T, instance> &b)
- {return CryptoPP::PolynomialOverFixedRing<T, instance>(a.Plus(b, ms_fixedRing));}
+ {return CryptoPP::PolynomialOverFixedRing<T, instance>(a.Plus(b, a.ms_fixedRing));}
//!
template <class T, int instance>
inline CryptoPP::PolynomialOverFixedRing<T, instance> operator-(const CryptoPP::PolynomialOverFixedRing<T, instance> &a, const CryptoPP::PolynomialOverFixedRing<T, instance> &b)
- {return CryptoPP::PolynomialOverFixedRing<T, instance>(a.Minus(b, ms_fixedRing));}
+ {return CryptoPP::PolynomialOverFixedRing<T, instance>(a.Minus(b, a.ms_fixedRing));}
//!
template <class T, int instance>
inline CryptoPP::PolynomialOverFixedRing<T, instance> operator*(const CryptoPP::PolynomialOverFixedRing<T, instance> &a, const CryptoPP::PolynomialOverFixedRing<T, instance> &b)
- {return CryptoPP::PolynomialOverFixedRing<T, instance>(a.Times(b, ms_fixedRing));}
+ {return CryptoPP::PolynomialOverFixedRing<T, instance>(a.Times(b, a.ms_fixedRing));}
//!
template <class T, int instance>
inline CryptoPP::PolynomialOverFixedRing<T, instance> operator/(const CryptoPP::PolynomialOverFixedRing<T, instance> &a, const CryptoPP::PolynomialOverFixedRing<T, instance> &b)
- {return CryptoPP::PolynomialOverFixedRing<T, instance>(a.DividedBy(b, ms_fixedRing));}
+ {return CryptoPP::PolynomialOverFixedRing<T, instance>(a.DividedBy(b, a.ms_fixedRing));}
//!
template <class T, int instance>
inline CryptoPP::PolynomialOverFixedRing<T, instance> operator%(const CryptoPP::PolynomialOverFixedRing<T, instance> &a, const CryptoPP::PolynomialOverFixedRing<T, instance> &b)
- {return CryptoPP::PolynomialOverFixedRing<T, instance>(a.Modulo(b, ms_fixedRing));}
+ {return CryptoPP::PolynomialOverFixedRing<T, instance>(a.Modulo(b, a.ms_fixedRing));}
NAMESPACE_END
diff --git a/pubkey.h b/pubkey.h
index 1b7f047..cf3b0e1 100644
--- a/pubkey.h
+++ b/pubkey.h
@@ -32,7 +32,7 @@
The "DL_" prefix means an implementation using group operations (in groups where discrete log is hard).
*/
-#include "integer.h"
+#include "modarith.h"
#include "filters.h"
#include "eprecomp.h"
#include "fips140.h"
@@ -152,13 +152,13 @@ template <class INTERFACE, class BASE>
class CRYPTOPP_NO_VTABLE TF_CryptoSystemBase : public PK_FixedLengthCryptoSystemImpl<INTERFACE>, protected BASE
{
public:
- bool ParameterSupported(const char *name) const {return GetMessageEncodingInterface().ParameterSupported(name);}
- unsigned int FixedMaxPlaintextLength() const {return GetMessageEncodingInterface().MaxUnpaddedLength(PaddedBlockBitLength());}
- unsigned int FixedCiphertextLength() const {return GetTrapdoorFunctionBounds().MaxImage().ByteCount();}
+ bool ParameterSupported(const char *name) const {return this->GetMessageEncodingInterface().ParameterSupported(name);}
+ unsigned int FixedMaxPlaintextLength() const {return this->GetMessageEncodingInterface().MaxUnpaddedLength(PaddedBlockBitLength());}
+ unsigned int FixedCiphertextLength() const {return this->GetTrapdoorFunctionBounds().MaxImage().ByteCount();}
protected:
unsigned int PaddedBlockByteLength() const {return BitsToBytes(PaddedBlockBitLength());}
- unsigned int PaddedBlockBitLength() const {return GetTrapdoorFunctionBounds().PreimageBound().BitCount()-1;}
+ unsigned int PaddedBlockBitLength() const {return this->GetTrapdoorFunctionBounds().PreimageBound().BitCount()-1;}
};
//! .
@@ -299,7 +299,7 @@ template <class HASH_ALGORITHM>
class PK_MessageAccumulatorImpl : public PK_MessageAccumulatorBase, protected ObjectHolder<HASH_ALGORITHM>
{
public:
- HashTransformation & AccessHash() {return m_object;}
+ HashTransformation & AccessHash() {return this->m_object;}
};
//! .
@@ -308,22 +308,22 @@ class CRYPTOPP_NO_VTABLE TF_SignatureSchemeBase : public INTERFACE, protected BA
{
public:
unsigned int SignatureLength() const
- {return GetTrapdoorFunctionBounds().MaxPreimage().ByteCount();}
+ {return this->GetTrapdoorFunctionBounds().MaxPreimage().ByteCount();}
unsigned int MaxRecoverableLength() const
- {return GetMessageEncodingInterface().MaxRecoverableLength(MessageRepresentativeBitLength(), GetHashIdentifier().second, GetDigestSize());}
+ {return this->GetMessageEncodingInterface().MaxRecoverableLength(MessageRepresentativeBitLength(), GetHashIdentifier().second, GetDigestSize());}
unsigned int MaxRecoverableLengthFromSignatureLength(unsigned int signatureLength) const
- {return MaxRecoverableLength();}
+ {return this->MaxRecoverableLength();}
bool IsProbabilistic() const
- {return GetTrapdoorFunctionInterface().IsRandomized() || GetMessageEncodingInterface().IsProbabilistic();}
+ {return this->GetTrapdoorFunctionInterface().IsRandomized() || this->GetMessageEncodingInterface().IsProbabilistic();}
bool AllowNonrecoverablePart() const
- {return GetMessageEncodingInterface().AllowNonrecoverablePart();}
+ {return this->GetMessageEncodingInterface().AllowNonrecoverablePart();}
bool RecoverablePartFirst() const
- {return GetMessageEncodingInterface().RecoverablePartFirst();}
+ {return this->GetMessageEncodingInterface().RecoverablePartFirst();}
protected:
unsigned int MessageRepresentativeLength() const {return BitsToBytes(MessageRepresentativeBitLength());}
- unsigned int MessageRepresentativeBitLength() const {return GetTrapdoorFunctionBounds().ImageBound().BitCount()-1;}
+ unsigned int MessageRepresentativeBitLength() const {return this->GetTrapdoorFunctionBounds().ImageBound().BitCount()-1;}
virtual HashIdentifier GetHashIdentifier() const =0;
virtual unsigned int GetDigestSize() const =0;
};
@@ -423,8 +423,8 @@ protected:
// for signature scheme
HashIdentifier GetHashIdentifier() const
{
- typedef CPP_TYPENAME SchemeOptions::MessageEncodingMethod::HashIdentifierLookup::HashIdentifierLookup2<CPP_TYPENAME SchemeOptions::HashFunction> L;
- return L::Lookup();
+ typedef CPP_TYPENAME SchemeOptions::MessageEncodingMethod::HashIdentifierLookup::template HashIdentifierLookup2<CPP_TYPENAME SchemeOptions::HashFunction> L;
+ return L::Lookup();
}
unsigned int GetDigestSize() const
{
@@ -664,23 +664,23 @@ public:
bool GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const
{
- return GetValueHelper(this, name, valueType, pValue, &GetAbstractGroupParameters())
+ return GetValueHelper(this, name, valueType, pValue, &this->GetAbstractGroupParameters())
CRYPTOPP_GET_FUNCTION_ENTRY(PublicElement);
}
void AssignFrom(const NameValuePairs &source);
// non-inherited
- virtual const Element & GetPublicElement() const {return GetPublicPrecomputation().GetBase(GetAbstractGroupParameters().GetGroupPrecomputation());}
- virtual void SetPublicElement(const Element &y) {AccessPublicPrecomputation().SetBase(GetAbstractGroupParameters().GetGroupPrecomputation(), y);}
+ virtual const Element & GetPublicElement() const {return GetPublicPrecomputation().GetBase(this->GetAbstractGroupParameters().GetGroupPrecomputation());}
+ virtual void SetPublicElement(const Element &y) {AccessPublicPrecomputation().SetBase(this->GetAbstractGroupParameters().GetGroupPrecomputation(), y);}
virtual Element ExponentiatePublicElement(const Integer &exponent) const
{
- const DL_GroupParameters<T> &params = GetAbstractGroupParameters();
+ const DL_GroupParameters<T> &params = this->GetAbstractGroupParameters();
return GetPublicPrecomputation().Exponentiate(params.GetGroupPrecomputation(), exponent);
}
virtual Element CascadeExponentiateBaseAndPublicElement(const Integer &baseExp, const Integer &publicExp) const
{
- const DL_GroupParameters<T> &params = GetAbstractGroupParameters();
+ const DL_GroupParameters<T> &params = this->GetAbstractGroupParameters();
return params.GetBasePrecomputation().CascadeExponentiate(params.GetGroupPrecomputation(), baseExp, GetPublicPrecomputation(), publicExp);
}
@@ -699,19 +699,19 @@ public:
void MakePublicKey(DL_PublicKey<T> &pub) const
{
- pub.AccessAbstractGroupParameters().AssignFrom(GetAbstractGroupParameters());
- pub.SetPublicElement(GetAbstractGroupParameters().ExponentiateBase(GetPrivateExponent()));
+ pub.AccessAbstractGroupParameters().AssignFrom(this->GetAbstractGroupParameters());
+ pub.SetPublicElement(this->GetAbstractGroupParameters().ExponentiateBase(GetPrivateExponent()));
}
bool GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const
{
- return GetValueHelper(this, name, valueType, pValue, &GetAbstractGroupParameters())
+ return GetValueHelper(this, name, valueType, pValue, &this->GetAbstractGroupParameters())
CRYPTOPP_GET_FUNCTION_ENTRY(PrivateExponent);
}
void AssignFrom(const NameValuePairs &source)
{
- AccessAbstractGroupParameters().AssignFrom(source);
+ this->AccessAbstractGroupParameters().AssignFrom(source);
AssignFromHelper(this, source)
CRYPTOPP_SET_FUNCTION_ENTRY(PrivateExponent);
}
@@ -728,7 +728,7 @@ void DL_PublicKey<T>::AssignFrom(const NameValuePairs &source)
pPrivateKey->MakePublicKey(*this);
else
{
- AccessAbstractGroupParameters().AssignFrom(source);
+ this->AccessAbstractGroupParameters().AssignFrom(source);
AssignFromHelper(this, source)
CRYPTOPP_SET_FUNCTION_ENTRY(PublicElement);
}
@@ -796,8 +796,8 @@ public:
void GenerateRandom(RandomNumberGenerator &rng, const NameValuePairs &params)
{
- if (!params.GetThisObject(AccessGroupParameters()))
- AccessGroupParameters().GenerateRandom(rng, params);
+ if (!params.GetThisObject(this->AccessGroupParameters()))
+ this->AccessGroupParameters().GenerateRandom(rng, params);
// std::pair<const byte *, int> seed;
Integer x(rng, Integer::One(), GetAbstractGroupParameters().GetMaxExponent());
// Integer::ANY, Integer::Zero(), Integer::One(),
@@ -817,8 +817,8 @@ public:
{GetAbstractGroupParameters().SavePrecomputation(storedPrecomputation);}
// DL_Key
- const DL_GroupParameters<Element> & GetAbstractGroupParameters() const {return GetGroupParameters();}
- DL_GroupParameters<Element> & AccessAbstractGroupParameters() {return AccessGroupParameters();}
+ const DL_GroupParameters<Element> & GetAbstractGroupParameters() const {return this->GetGroupParameters();}
+ DL_GroupParameters<Element> & AccessAbstractGroupParameters() {return this->AccessGroupParameters();}
// DL_PrivateKey
const Integer & GetPrivateExponent() const {return m_x;}
@@ -863,7 +863,7 @@ public:
bool Validate(RandomNumberGenerator &rng, unsigned int level) const
{
bool pass = GetAbstractGroupParameters().Validate(rng, level);
- pass = pass && GetAbstractGroupParameters().ValidateElement(level, GetPublicElement(), &GetPublicPrecomputation());
+ pass = pass && GetAbstractGroupParameters().ValidateElement(level, this->GetPublicElement(), &GetPublicPrecomputation());
return pass;
}
@@ -898,8 +898,8 @@ public:
}
// DL_Key
- const DL_GroupParameters<Element> & GetAbstractGroupParameters() const {return GetGroupParameters();}
- DL_GroupParameters<Element> & AccessAbstractGroupParameters() {return AccessGroupParameters();}
+ const DL_GroupParameters<Element> & GetAbstractGroupParameters() const {return this->GetGroupParameters();}
+ DL_GroupParameters<Element> & AccessAbstractGroupParameters() {return this->AccessGroupParameters();}
// DL_PublicKey
const DL_FixedBasePrecomputation<Element> & GetPublicPrecomputation() const {return m_ypc;}
@@ -907,7 +907,7 @@ public:
// non-inherited
bool operator==(const DL_PublicKeyImpl<GP> &rhs) const
- {return GetGroupParameters() == rhs.GetGroupParameters() && GetPublicElement() == rhs.GetPublicElement();}
+ {return this->GetGroupParameters() == rhs.GetGroupParameters() && this->GetPublicElement() == rhs.GetPublicElement();}
private:
typename GP::BasePrecomputation m_ypc;
@@ -982,8 +982,8 @@ class CRYPTOPP_NO_VTABLE DL_SignatureSchemeBase : public INTERFACE, public DL_Ba
public:
unsigned int SignatureLength() const
{
- return GetSignatureAlgorithm().RLen(GetAbstractGroupParameters())
- + GetSignatureAlgorithm().SLen(GetAbstractGroupParameters());
+ return GetSignatureAlgorithm().RLen(this->GetAbstractGroupParameters())
+ + GetSignatureAlgorithm().SLen(this->GetAbstractGroupParameters());
}
unsigned int MaxRecoverableLength() const
{return GetMessageEncodingInterface().MaxRecoverableLength(0, GetHashIdentifier().second, GetDigestSize());}
@@ -999,7 +999,7 @@ public:
protected:
unsigned int MessageRepresentativeLength() const {return BitsToBytes(MessageRepresentativeBitLength());}
- unsigned int MessageRepresentativeBitLength() const {return GetAbstractGroupParameters().GetSubgroupOrder().BitCount();}
+ unsigned int MessageRepresentativeBitLength() const {return this->GetAbstractGroupParameters().GetSubgroupOrder().BitCount();}
virtual const DL_ElgamalLikeSignatureAlgorithm<CPP_TYPENAME KEY_INTERFACE::Element> & GetSignatureAlgorithm() const =0;
virtual const PK_SignatureMessageEncodingMethod & GetMessageEncodingInterface() const =0;
@@ -1015,9 +1015,9 @@ public:
// for validation testing
void RawSign(const Integer &k, const Integer &e, Integer &r, Integer &s) const
{
- const DL_ElgamalLikeSignatureAlgorithm<T> &alg = GetSignatureAlgorithm();
- const DL_GroupParameters<T> &params = GetAbstractGroupParameters();
- const DL_PrivateKey<T> &key = GetKeyInterface();
+ const DL_ElgamalLikeSignatureAlgorithm<T> &alg = this->GetSignatureAlgorithm();
+ const DL_GroupParameters<T> &params = this->GetAbstractGroupParameters();
+ const DL_PrivateKey<T> &key = this->GetKeyInterface();
r = params.ConvertElementToInteger(params.ExponentiateBase(k));
alg.Sign(params, key.GetPrivateExponent(), k, e, r, s);
@@ -1027,7 +1027,7 @@ public:
{
PK_MessageAccumulatorBase &ma = static_cast<PK_MessageAccumulatorBase &>(messageAccumulator);
ma.m_recoverableMessage.Assign(recoverableMessage, recoverableMessageLength);
- GetMessageEncodingInterface().ProcessRecoverableMessage(ma.AccessHash(),
+ this->GetMessageEncodingInterface().ProcessRecoverableMessage(ma.AccessHash(),
recoverableMessage, recoverableMessageLength,
ma.m_presignature, ma.m_presignature.size(),
ma.m_semisignature);
@@ -1035,24 +1035,24 @@ public:
unsigned int SignAndRestart(RandomNumberGenerator &rng, PK_MessageAccumulator &messageAccumulator, byte *signature, bool restart) const
{
- GetMaterial().DoQuickSanityCheck();
+ this->GetMaterial().DoQuickSanityCheck();
PK_MessageAccumulatorBase &ma = static_cast<PK_MessageAccumulatorBase &>(messageAccumulator);
- const DL_ElgamalLikeSignatureAlgorithm<T> &alg = GetSignatureAlgorithm();
- const DL_GroupParameters<T> &params = GetAbstractGroupParameters();
- const DL_PrivateKey<T> &key = GetKeyInterface();
+ const DL_ElgamalLikeSignatureAlgorithm<T> &alg = this->GetSignatureAlgorithm();
+ const DL_GroupParameters<T> &params = this->GetAbstractGroupParameters();
+ const DL_PrivateKey<T> &key = this->GetKeyInterface();
- SecByteBlock representative(MessageRepresentativeLength());
- GetMessageEncodingInterface().ComputeMessageRepresentative(
+ SecByteBlock representative(this->MessageRepresentativeLength());
+ this->GetMessageEncodingInterface().ComputeMessageRepresentative(
rng,
ma.m_recoverableMessage, ma.m_recoverableMessage.size(),
- ma.AccessHash(), GetHashIdentifier(), ma.m_empty,
- representative, MessageRepresentativeBitLength());
+ ma.AccessHash(), this->GetHashIdentifier(), ma.m_empty,
+ representative, this->MessageRepresentativeBitLength());
ma.m_empty = true;
Integer e(representative, representative.size());
Integer r;
- if (MaxRecoverableLength() > 0)
+ if (this->MaxRecoverableLength() > 0)
r.Decode(ma.m_semisignature, ma.m_semisignature.size());
else
r.Decode(ma.m_presignature, ma.m_presignature.size());
@@ -1066,14 +1066,14 @@ public:
if (restart)
RestartMessageAccumulator(rng, ma);
- return SignatureLength();
+ return this->SignatureLength();
}
protected:
void RestartMessageAccumulator(RandomNumberGenerator &rng, PK_MessageAccumulatorBase &ma) const
{
- const DL_ElgamalLikeSignatureAlgorithm<T> &alg = GetSignatureAlgorithm();
- const DL_GroupParameters<T> &params = GetAbstractGroupParameters();
+ const DL_ElgamalLikeSignatureAlgorithm<T> &alg = this->GetSignatureAlgorithm();
+ const DL_GroupParameters<T> &params = this->GetAbstractGroupParameters();
ma.m_k.Randomize(rng, 1, params.GetSubgroupOrder()-1);
ma.m_presignature.New(params.GetEncodedElementSize(false));
params.ConvertElementToInteger(params.ExponentiateBase(ma.m_k)).Encode(ma.m_presignature, ma.m_presignature.size());
@@ -1088,29 +1088,29 @@ public:
void InputSignature(PK_MessageAccumulator &messageAccumulator, const byte *signature, unsigned int signatureLength) const
{
PK_MessageAccumulatorBase &ma = static_cast<PK_MessageAccumulatorBase &>(messageAccumulator);
- const DL_ElgamalLikeSignatureAlgorithm<T> &alg = GetSignatureAlgorithm();
- const DL_GroupParameters<T> &params = GetAbstractGroupParameters();
+ const DL_ElgamalLikeSignatureAlgorithm<T> &alg = this->GetSignatureAlgorithm();
+ const DL_GroupParameters<T> &params = this->GetAbstractGroupParameters();
unsigned int rLen = alg.RLen(params);
ma.m_semisignature.Assign(signature, rLen);
ma.m_s.Decode(signature+rLen, alg.SLen(params));
- GetMessageEncodingInterface().ProcessSemisignature(ma.AccessHash(), ma.m_semisignature, ma.m_semisignature.size());
+ this->GetMessageEncodingInterface().ProcessSemisignature(ma.AccessHash(), ma.m_semisignature, ma.m_semisignature.size());
}
bool VerifyAndRestart(PK_MessageAccumulator &messageAccumulator) const
{
- GetMaterial().DoQuickSanityCheck();
+ this->GetMaterial().DoQuickSanityCheck();
PK_MessageAccumulatorBase &ma = static_cast<PK_MessageAccumulatorBase &>(messageAccumulator);
- const DL_ElgamalLikeSignatureAlgorithm<T> &alg = GetSignatureAlgorithm();
- const DL_GroupParameters<T> &params = GetAbstractGroupParameters();
- const DL_PublicKey<T> &key = GetKeyInterface();
-
- SecByteBlock representative(MessageRepresentativeLength());
- GetMessageEncodingInterface().ComputeMessageRepresentative(NullRNG(), ma.m_recoverableMessage, ma.m_recoverableMessage.size(),
- ma.AccessHash(), GetHashIdentifier(), ma.m_empty,
- representative, MessageRepresentativeBitLength());
+ const DL_ElgamalLikeSignatureAlgorithm<T> &alg = this->GetSignatureAlgorithm();
+ const DL_GroupParameters<T> &params = this->GetAbstractGroupParameters();
+ const DL_PublicKey<T> &key = this->GetKeyInterface();
+
+ SecByteBlock representative(this->MessageRepresentativeLength());
+ this->GetMessageEncodingInterface().ComputeMessageRepresentative(NullRNG(), ma.m_recoverableMessage, ma.m_recoverableMessage.size(),
+ ma.AccessHash(), this->GetHashIdentifier(), ma.m_empty,
+ representative, this->MessageRepresentativeBitLength());
ma.m_empty = true;
Integer e(representative, representative.size());
@@ -1120,19 +1120,19 @@ public:
DecodingResult RecoverAndRestart(byte *recoveredMessage, PK_MessageAccumulator &messageAccumulator) const
{
- GetMaterial().DoQuickSanityCheck();
+ this->GetMaterial().DoQuickSanityCheck();
PK_MessageAccumulatorBase &ma = static_cast<PK_MessageAccumulatorBase &>(messageAccumulator);
- const DL_ElgamalLikeSignatureAlgorithm<T> &alg = GetSignatureAlgorithm();
- const DL_GroupParameters<T> &params = GetAbstractGroupParameters();
- const DL_PublicKey<T> &key = GetKeyInterface();
+ const DL_ElgamalLikeSignatureAlgorithm<T> &alg = this->GetSignatureAlgorithm();
+ const DL_GroupParameters<T> &params = this->GetAbstractGroupParameters();
+ const DL_PublicKey<T> &key = this->GetKeyInterface();
- SecByteBlock representative(MessageRepresentativeLength());
- GetMessageEncodingInterface().ComputeMessageRepresentative(
+ SecByteBlock representative(this->MessageRepresentativeLength());
+ this->GetMessageEncodingInterface().ComputeMessageRepresentative(
NullRNG(),
ma.m_recoverableMessage, ma.m_recoverableMessage.size(),
- ma.AccessHash(), GetHashIdentifier(), ma.m_empty,
- representative, MessageRepresentativeBitLength());
+ ma.AccessHash(), this->GetHashIdentifier(), ma.m_empty,
+ representative, this->MessageRepresentativeBitLength());
ma.m_empty = true;
Integer e(representative, representative.size());
@@ -1140,8 +1140,8 @@ public:
Integer r(ma.m_semisignature, ma.m_semisignature.size());
alg.RecoverPresignature(params, key, r, ma.m_s).Encode(ma.m_presignature, ma.m_presignature.size());
- return GetMessageEncodingInterface().RecoverMessageFromSemisignature(
- ma.AccessHash(), GetHashIdentifier(),
+ return this->GetMessageEncodingInterface().RecoverMessageFromSemisignature(
+ ma.AccessHash(), this->GetHashIdentifier(),
ma.m_presignature, ma.m_presignature.size(),
ma.m_semisignature, ma.m_semisignature.size(),
recoveredMessage);
@@ -1157,14 +1157,14 @@ public:
unsigned int MaxPlaintextLength(unsigned int ciphertextLength) const
{
- unsigned int minLen = GetAbstractGroupParameters().GetEncodedElementSize(true);
+ unsigned int minLen = this->GetAbstractGroupParameters().GetEncodedElementSize(true);
return ciphertextLength < minLen ? 0 : GetSymmetricEncryptionAlgorithm().GetMaxSymmetricPlaintextLength(ciphertextLength - minLen);
}
unsigned int CiphertextLength(unsigned int plaintextLength) const
{
unsigned int len = GetSymmetricEncryptionAlgorithm().GetSymmetricCiphertextLength(plaintextLength);
- return len == 0 ? 0 : GetAbstractGroupParameters().GetEncodedElementSize(true) + len;
+ return len == 0 ? 0 : this->GetAbstractGroupParameters().GetEncodedElementSize(true) + len;
}
bool ParameterSupported(const char *name) const
@@ -1187,11 +1187,11 @@ public:
{
try
{
- const DL_KeyAgreementAlgorithm<T> &agreeAlg = GetKeyAgreementAlgorithm();
- const DL_KeyDerivationAlgorithm<T> &derivAlg = GetKeyDerivationAlgorithm();
- const DL_SymmetricEncryptionAlgorithm &encAlg = GetSymmetricEncryptionAlgorithm();
- const DL_GroupParameters<T> &params = GetAbstractGroupParameters();
- const DL_PrivateKey<T> &key = GetKeyInterface();
+ const DL_KeyAgreementAlgorithm<T> &agreeAlg = this->GetKeyAgreementAlgorithm();
+ const DL_KeyDerivationAlgorithm<T> &derivAlg = this->GetKeyDerivationAlgorithm();
+ const DL_SymmetricEncryptionAlgorithm &encAlg = this->GetSymmetricEncryptionAlgorithm();
+ const DL_GroupParameters<T> &params = this->GetAbstractGroupParameters();
+ const DL_PrivateKey<T> &key = this->GetKeyInterface();
Element q = params.DecodeElement(ciphertext, true);
unsigned int elementSize = params.GetEncodedElementSize(true);
@@ -1221,11 +1221,11 @@ public:
void Encrypt(RandomNumberGenerator &rng, const byte *plaintext, unsigned int plaintextLength, byte *ciphertext, const NameValuePairs &parameters = g_nullNameValuePairs) const
{
- const DL_KeyAgreementAlgorithm<T> &agreeAlg = GetKeyAgreementAlgorithm();
- const DL_KeyDerivationAlgorithm<T> &derivAlg = GetKeyDerivationAlgorithm();
- const DL_SymmetricEncryptionAlgorithm &encAlg = GetSymmetricEncryptionAlgorithm();
- const DL_GroupParameters<T> &params = GetAbstractGroupParameters();
- const DL_PublicKey<T> &key = GetKeyInterface();
+ const DL_KeyAgreementAlgorithm<T> &agreeAlg = this->GetKeyAgreementAlgorithm();
+ const DL_KeyDerivationAlgorithm<T> &derivAlg = this->GetKeyDerivationAlgorithm();
+ const DL_SymmetricEncryptionAlgorithm &encAlg = this->GetSymmetricEncryptionAlgorithm();
+ const DL_GroupParameters<T> &params = this->GetAbstractGroupParameters();
+ const DL_PublicKey<T> &key = this->GetKeyInterface();
Integer x(rng, Integer::One(), params.GetMaxExponent());
Element q = params.ExponentiateBase(x);
@@ -1300,8 +1300,8 @@ protected:
// for signature scheme
HashIdentifier GetHashIdentifier() const
{
- typedef CPP_TYPENAME SchemeOptions::MessageEncodingMethod::HashIdentifierLookup::HashIdentifierLookup2<CPP_TYPENAME SchemeOptions::HashFunction> L;
- return L::Lookup();
+ typedef typename SchemeOptions::MessageEncodingMethod::HashIdentifierLookup HashLookup;
+ return HashLookup::template HashIdentifierLookup2<CPP_TYPENAME SchemeOptions::HashFunction>::Lookup();
}
unsigned int GetDigestSize() const
{
@@ -1341,7 +1341,7 @@ class CRYPTOPP_NO_VTABLE DL_PublicObjectImpl : public DL_ObjectImpl<BASE, SCHEME
{
public:
void CopyKeyInto(typename SCHEME_OPTIONS::PublicKey &key) const
- {key = GetKey();}
+ {key = this->GetKey();}
};
//! .
@@ -1350,9 +1350,9 @@ class CRYPTOPP_NO_VTABLE DL_PrivateObjectImpl : public DL_ObjectImpl<BASE, SCHEM
{
public:
void CopyKeyInto(typename SCHEME_OPTIONS::PublicKey &key) const
- {GetKey().MakePublicKey(key);}
+ {this->GetKey().MakePublicKey(key);}
void CopyKeyInto(typename SCHEME_OPTIONS::PrivateKey &key) const
- {key = GetKey();}
+ {key = this->GetKey();}
};
//! .
@@ -1363,7 +1363,7 @@ public:
PK_MessageAccumulator * NewSignatureAccumulator(RandomNumberGenerator &rng) const
{
std::auto_ptr<PK_MessageAccumulatorBase> p(new PK_MessageAccumulatorImpl<CPP_TYPENAME SCHEME_OPTIONS::HashFunction>);
- RestartMessageAccumulator(rng, *p);
+ this->RestartMessageAccumulator(rng, *p);
return p.release();
}
};
@@ -1513,107 +1513,107 @@ public:
PK_FinalTemplate() {}
PK_FinalTemplate(const Integer &v1)
- {AccessKey().Initialize(v1);}
+ {this->AccessKey().Initialize(v1);}
- PK_FinalTemplate(const typename BASE::KeyClass &key) {AccessKey().operator=(key);}
+ PK_FinalTemplate(const typename BASE::KeyClass &key) {this->AccessKey().operator=(key);}
template <class T>
PK_FinalTemplate(const PublicKeyCopier<T> &key)
- {key.CopyKeyInto(AccessKey());}
+ {key.CopyKeyInto(this->AccessKey());}
template <class T>
PK_FinalTemplate(const PrivateKeyCopier<T> &key)
- {key.CopyKeyInto(AccessKey());}
+ {key.CopyKeyInto(this->AccessKey());}
- PK_FinalTemplate(BufferedTransformation &bt) {AccessKey().BERDecode(bt);}
+ PK_FinalTemplate(BufferedTransformation &bt) {this->AccessKey().BERDecode(bt);}
#if (defined(_MSC_VER) && _MSC_VER < 1300)
template <class T1, class T2>
PK_FinalTemplate(T1 &v1, T2 &v2)
- {AccessKey().Initialize(v1, v2);}
+ {this->AccessKey().Initialize(v1, v2);}
template <class T1, class T2, class T3>
PK_FinalTemplate(T1 &v1, T2 &v2, T3 &v3)
- {AccessKey().Initialize(v1, v2, v3);}
+ {this->AccessKey().Initialize(v1, v2, v3);}
template <class T1, class T2, class T3, class T4>
PK_FinalTemplate(T1 &v1, T2 &v2, T3 &v3, T4 &v4)
- {AccessKey().Initialize(v1, v2, v3, v4);}
+ {this->AccessKey().Initialize(v1, v2, v3, v4);}
template <class T1, class T2, class T3, class T4, class T5>
PK_FinalTemplate(T1 &v1, T2 &v2, T3 &v3, T4 &v4, T5 &v5)
- {AccessKey().Initialize(v1, v2, v3, v4, v5);}
+ {this->AccessKey().Initialize(v1, v2, v3, v4, v5);}
template <class T1, class T2, class T3, class T4, class T5, class T6>
PK_FinalTemplate(T1 &v1, T2 &v2, T3 &v3, T4 &v4, T5 &v5, T6 &v6)
- {AccessKey().Initialize(v1, v2, v3, v4, v5, v6);}
+ {this->AccessKey().Initialize(v1, v2, v3, v4, v5, v6);}
template <class T1, class T2, class T3, class T4, class T5, class T6, class T7>
PK_FinalTemplate(T1 &v1, T2 &v2, T3 &v3, T4 &v4, T5 &v5, T6 &v6, T7 &v7)
- {AccessKey().Initialize(v1, v2, v3, v4, v5, v6, v7);}
+ {this->AccessKey().Initialize(v1, v2, v3, v4, v5, v6, v7);}
template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class T8>
PK_FinalTemplate(T1 &v1, T2 &v2, T3 &v3, T4 &v4, T5 &v5, T6 &v6, T7 &v7, T8 &v8)
- {AccessKey().Initialize(v1, v2, v3, v4, v5, v6, v7, v8);}
+ {this->AccessKey().Initialize(v1, v2, v3, v4, v5, v6, v7, v8);}
#else
template <class T1, class T2>
PK_FinalTemplate(const T1 &v1, const T2 &v2)
- {AccessKey().Initialize(v1, v2);}
+ {this->AccessKey().Initialize(v1, v2);}
template <class T1, class T2, class T3>
PK_FinalTemplate(const T1 &v1, const T2 &v2, const T3 &v3)
- {AccessKey().Initialize(v1, v2, v3);}
+ {this->AccessKey().Initialize(v1, v2, v3);}
template <class T1, class T2, class T3, class T4>
PK_FinalTemplate(const T1 &v1, const T2 &v2, const T3 &v3, const T4 &v4)
- {AccessKey().Initialize(v1, v2, v3, v4);}
+ {this->AccessKey().Initialize(v1, v2, v3, v4);}
template <class T1, class T2, class T3, class T4, class T5>
PK_FinalTemplate(const T1 &v1, const T2 &v2, const T3 &v3, const T4 &v4, const T5 &v5)
- {AccessKey().Initialize(v1, v2, v3, v4, v5);}
+ {this->AccessKey().Initialize(v1, v2, v3, v4, v5);}
template <class T1, class T2, class T3, class T4, class T5, class T6>
PK_FinalTemplate(const T1 &v1, const T2 &v2, const T3 &v3, const T4 &v4, const T5 &v5, const T6 &v6)
- {AccessKey().Initialize(v1, v2, v3, v4, v5, v6);}
+ {this->AccessKey().Initialize(v1, v2, v3, v4, v5, v6);}
template <class T1, class T2, class T3, class T4, class T5, class T6, class T7>
PK_FinalTemplate(const T1 &v1, const T2 &v2, const T3 &v3, const T4 &v4, const T5 &v5, const T6 &v6, const T7 &v7)
- {AccessKey().Initialize(v1, v2, v3, v4, v5, v6, v7);}
+ {this->AccessKey().Initialize(v1, v2, v3, v4, v5, v6, v7);}
template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class T8>
PK_FinalTemplate(const T1 &v1, const T2 &v2, const T3 &v3, const T4 &v4, const T5 &v5, const T6 &v6, const T7 &v7, const T8 &v8)
- {AccessKey().Initialize(v1, v2, v3, v4, v5, v6, v7, v8);}
+ {this->AccessKey().Initialize(v1, v2, v3, v4, v5, v6, v7, v8);}
template <class T1, class T2>
PK_FinalTemplate(T1 &v1, const T2 &v2)
- {AccessKey().Initialize(v1, v2);}
+ {this->AccessKey().Initialize(v1, v2);}
template <class T1, class T2, class T3>
PK_FinalTemplate(T1 &v1, const T2 &v2, const T3 &v3)
- {AccessKey().Initialize(v1, v2, v3);}
+ {this->AccessKey().Initialize(v1, v2, v3);}
template <class T1, class T2, class T3, class T4>
PK_FinalTemplate(T1 &v1, const T2 &v2, const T3 &v3, const T4 &v4)
- {AccessKey().Initialize(v1, v2, v3, v4);}
+ {this->AccessKey().Initialize(v1, v2, v3, v4);}
template <class T1, class T2, class T3, class T4, class T5>
PK_FinalTemplate(T1 &v1, const T2 &v2, const T3 &v3, const T4 &v4, const T5 &v5)
- {AccessKey().Initialize(v1, v2, v3, v4, v5);}
+ {this->AccessKey().Initialize(v1, v2, v3, v4, v5);}
template <class T1, class T2, class T3, class T4, class T5, class T6>
PK_FinalTemplate(T1 &v1, const T2 &v2, const T3 &v3, const T4 &v4, const T5 &v5, const T6 &v6)
- {AccessKey().Initialize(v1, v2, v3, v4, v5, v6);}
+ {this->AccessKey().Initialize(v1, v2, v3, v4, v5, v6);}
template <class T1, class T2, class T3, class T4, class T5, class T6, class T7>
PK_FinalTemplate(T1 &v1, const T2 &v2, const T3 &v3, const T4 &v4, const T5 &v5, const T6 &v6, const T7 &v7)
- {AccessKey().Initialize(v1, v2, v3, v4, v5, v6, v7);}
+ {this->AccessKey().Initialize(v1, v2, v3, v4, v5, v6, v7);}
template <class T1, class T2, class T3, class T4, class T5, class T6, class T7, class T8>
PK_FinalTemplate(T1 &v1, const T2 &v2, const T3 &v3, const T4 &v4, const T5 &v5, const T6 &v6, const T7 &v7, const T8 &v8)
- {AccessKey().Initialize(v1, v2, v3, v4, v5, v6, v7, v8);}
+ {this->AccessKey().Initialize(v1, v2, v3, v4, v5, v6, v7, v8);}
#endif
};
diff --git a/rsa.h b/rsa.h
index cae0a5a..903d69a 100644
--- a/rsa.h
+++ b/rsa.h
@@ -94,9 +94,6 @@ public:
void SetMultiplicativeInverseOfPrime2ModPrime1(const Integer &u) {m_u = u;}
protected:
- virtual void DEREncodeOptionalAttributes(BufferedTransformation &bt) const {}
- virtual void BERDecodeOptionalAttributes(BufferedTransformation &bt) {}
-
Integer m_d, m_p, m_q, m_dp, m_dq, m_u;
};
diff --git a/secblock.h b/secblock.h
index 821f5f7..2a95cd2 100644
--- a/secblock.h
+++ b/secblock.h
@@ -197,7 +197,7 @@ template <class T, class A = AllocatorWithCleanup<T> >
class SecBlock
{
public:
- explicit SecBlock(unsigned int size=0)
+ explicit SecBlock(unsigned int size=0)
: m_size(size) {m_ptr = m_alloc.allocate(size, NULL);}
SecBlock(const SecBlock<T, A> &t)
: m_size(t.m_size) {m_ptr = m_alloc.allocate(m_size, NULL); memcpy(m_ptr, t.m_ptr, m_size*sizeof(T));}
@@ -214,25 +214,15 @@ public:
~SecBlock()
{m_alloc.deallocate(m_ptr, m_size);}
-#if defined(__GNUC__) || defined(__BCPLUSPLUS__)
operator const void *() const
{return m_ptr;}
operator void *()
{return m_ptr;}
-#endif
-#if defined(__GNUC__) // reduce warnings
- operator const void *()
- {return m_ptr;}
-#endif
operator const T *() const
{return m_ptr;}
operator T *()
{return m_ptr;}
-#if defined(__GNUC__) // reduce warnings
- operator const T *()
- {return m_ptr;}
-#endif
template <typename I>
T *operator +(I offset)
@@ -250,6 +240,7 @@ public:
const T& operator[](I index) const
{assert(index >= 0 && (unsigned int)index < m_size); return m_ptr[index];}
+ typedef typename A::value_type value_type;
typedef typename A::pointer iterator;
typedef typename A::const_pointer const_iterator;
typedef typename A::size_type size_type;
diff --git a/seckey.h b/seckey.h
index 0332d98..aa315a3 100644
--- a/seckey.h
+++ b/seckey.h
@@ -156,7 +156,7 @@ template <class INFO, class BASE = BlockCipher>
class CRYPTOPP_NO_VTABLE BlockCipherImpl : public AlgorithmImpl<SimpleKeyingInterfaceImpl<BASE, INFO>, INFO>, public INFO
{
public:
- unsigned int BlockSize() const {return BLOCKSIZE;}
+ unsigned int BlockSize() const {return this->BLOCKSIZE;}
};
//! .
@@ -166,11 +166,11 @@ class BlockCipherFinal : public ClonableImpl<BlockCipherFinal<DIR, BASE>, BASE>
public:
BlockCipherFinal() {}
BlockCipherFinal(const byte *key)
- {SetKey(key, DEFAULT_KEYLENGTH);}
+ {SetKey(key, this->DEFAULT_KEYLENGTH);}
BlockCipherFinal(const byte *key, unsigned int length)
{SetKey(key, length);}
BlockCipherFinal(const byte *key, unsigned int length, unsigned int rounds)
- {SetKeyWithRounds(key, length, rounds);}
+ {this->SetKeyWithRounds(key, length, rounds);}
bool IsForwardTransformation() const {return DIR == ENCRYPTION;}
@@ -203,9 +203,9 @@ class MessageAuthenticationCodeFinal : public ClonableImpl<MessageAuthentication
public:
MessageAuthenticationCodeFinal() {}
MessageAuthenticationCodeFinal(const byte *key)
- {SetKey(key, DEFAULT_KEYLENGTH);}
+ {SetKey(key, this->DEFAULT_KEYLENGTH);}
MessageAuthenticationCodeFinal(const byte *key, unsigned int length)
- {SetKey(key, length);}
+ {this->SetKey(key, length);}
};
// ************** documentation ***************
diff --git a/simple.h b/simple.h
index 1c3972e..0c0adc4 100644
--- a/simple.h
+++ b/simple.h
@@ -64,7 +64,7 @@ class CRYPTOPP_NO_VTABLE Unflushable : public T
{
public:
bool Flush(bool completeFlush, int propagation=-1, bool blocking=true)
- {return ChannelFlush(NULL_CHANNEL, completeFlush, propagation, blocking);}
+ {return ChannelFlush(this->NULL_CHANNEL, completeFlush, propagation, blocking);}
bool IsolatedFlush(bool hardFlush, bool blocking)
{assert(false); return false;}
bool ChannelFlush(const std::string &channel, bool hardFlush, int propagation=-1, bool blocking=true)
@@ -73,7 +73,7 @@ public:
throw CannotFlush("Unflushable<T>: this object has buffered input that cannot be flushed");
else
{
- BufferedTransformation *attached = AttachedTransformation();
+ BufferedTransformation *attached = this->AttachedTransformation();
return attached && propagation ? attached->ChannelFlush(channel, hardFlush, propagation-1, blocking) : false;
}
}
@@ -125,22 +125,22 @@ class CRYPTOPP_NO_VTABLE Multichannel : public CustomFlushPropagation<T>
{
public:
bool Flush(bool hardFlush, int propagation=-1, bool blocking=true)
- {return ChannelFlush(NULL_CHANNEL, hardFlush, propagation, blocking);}
+ {return ChannelFlush(this->NULL_CHANNEL, hardFlush, propagation, blocking);}
bool MessageSeriesEnd(int propagation=-1, bool blocking=true)
- {return ChannelMessageSeriesEnd(NULL_CHANNEL, propagation, blocking);}
+ {return ChannelMessageSeriesEnd(this->NULL_CHANNEL, propagation, blocking);}
byte * CreatePutSpace(unsigned int &size)
- {return ChannelCreatePutSpace(NULL_CHANNEL, size);}
+ {return ChannelCreatePutSpace(this->NULL_CHANNEL, size);}
unsigned int Put2(const byte *begin, unsigned int length, int messageEnd, bool blocking)
- {return ChannelPut2(NULL_CHANNEL, begin, length, messageEnd, blocking);}
+ {return ChannelPut2(this->NULL_CHANNEL, begin, length, messageEnd, blocking);}
unsigned int PutModifiable2(byte *inString, unsigned int length, int messageEnd, bool blocking)
- {return ChannelPutModifiable2(NULL_CHANNEL, inString, length, messageEnd, blocking);}
+ {return ChannelPutModifiable2(this->NULL_CHANNEL, inString, length, messageEnd, blocking);}
// void ChannelMessageSeriesEnd(const std::string &channel, int propagation=-1)
// {PropagateMessageSeriesEnd(propagation, channel);}
byte * ChannelCreatePutSpace(const std::string &channel, unsigned int &size)
{size = 0; return NULL;}
bool ChannelPutModifiable(const std::string &channel, byte *inString, unsigned int length)
- {ChannelPut(channel, inString, length); return false;}
+ {this->ChannelPut(channel, inString, length); return false;}
virtual unsigned int ChannelPut2(const std::string &channel, const byte *begin, unsigned int length, int messageEnd, bool blocking) =0;
unsigned int ChannelPutModifiable2(const std::string &channel, byte *begin, unsigned int length, int messageEnd, bool blocking)
diff --git a/smartptr.h b/smartptr.h
index c4f9575..f563001 100644
--- a/smartptr.h
+++ b/smartptr.h
@@ -6,7 +6,7 @@
NAMESPACE_BEGIN(CryptoPP)
-template<class T> class simple_ptr
+template <class T> class simple_ptr
{
public:
simple_ptr() : m_p(NULL) {}
@@ -14,7 +14,7 @@ public:
T *m_p;
};
-template<class T> class member_ptr
+template <class T> class member_ptr
{
public:
explicit member_ptr(T *p = NULL) : m_p(p) {}
@@ -62,14 +62,14 @@ public:
value_ptr<T>& operator=(const value_ptr<T>& rhs);
bool operator==(const value_ptr<T>& rhs)
{
- return (!m_p && !rhs.m_p) || (m_p && rhs.m_p && *m_p == *rhs.m_p);
+ return (!this->m_p && !rhs.m_p) || (this->m_p && rhs.m_p && *this->m_p == *rhs.m_p);
}
};
template <class T> value_ptr<T>& value_ptr<T>::operator=(const value_ptr<T>& rhs)
{
- T *old_p = m_p;
- m_p = rhs.m_p ? new T(*rhs.m_p) : NULL;
+ T *old_p = this->m_p;
+ this->m_p = rhs.m_p ? new T(*rhs.m_p) : NULL;
delete old_p;
return *this;
}
@@ -89,8 +89,8 @@ public:
template <class T> clonable_ptr<T>& clonable_ptr<T>::operator=(const clonable_ptr<T>& rhs)
{
- T *old_p = m_p;
- m_p = rhs.m_p ? rhs.m_p->Clone() : NULL;
+ T *old_p = this->m_p;
+ this->m_p = rhs.m_p ? rhs.m_p->Clone() : NULL;
delete old_p;
return *this;
}
@@ -190,32 +190,32 @@ template <class T> class vector_member_ptrs
{
public:
vector_member_ptrs(unsigned int size=0)
- : _size(size) {ptr = new member_ptr<T>[_size];}
+ : m_size(size), m_ptr(new member_ptr<T>[size]) {}
~vector_member_ptrs()
- {delete [] ptr;}
+ {delete [] this->m_ptr;}
member_ptr<T>& operator[](unsigned int index)
- {assert(index<_size); return ptr[index];}
+ {assert(index<this->m_size); return this->m_ptr[index];}
const member_ptr<T>& operator[](unsigned int index) const
- {assert(index<_size); return ptr[index];}
+ {assert(index<this->m_size); return this->m_ptr[index];}
- unsigned int size() const {return _size;}
+ unsigned int size() const {return this->m_size;}
void resize(unsigned int newSize)
{
member_ptr<T> *newPtr = new member_ptr<T>[newSize];
- for (unsigned int i=0; i<STDMIN(_size, newSize); i++)
- newPtr[i].reset(ptr[i].release());
- delete [] ptr;
- _size = newSize;
- ptr = newPtr;
+ for (unsigned int i=0; i<this->m_size && i<newSize; i++)
+ newPtr[i].reset(this->m_ptr[i].release());
+ delete [] this->m_ptr;
+ this->m_size = newSize;
+ this->m_ptr = newPtr;
}
private:
vector_member_ptrs(const vector_member_ptrs<T> &c); // copy not allowed
void operator=(const vector_member_ptrs<T> &x); // assignment not allowed
- unsigned int _size;
- member_ptr<T> *ptr;
+ unsigned int m_size;
+ member_ptr<T> *m_ptr;
};
NAMESPACE_END
diff --git a/strciphr.cpp b/strciphr.cpp
index 4cb71c6..ca44ece 100644
--- a/strciphr.cpp
+++ b/strciphr.cpp
@@ -11,7 +11,7 @@ NAMESPACE_BEGIN(CryptoPP)
template <class S>
byte AdditiveCipherTemplate<S>::GenerateByte()
{
- PolicyInterface &policy = AccessPolicy();
+ PolicyInterface &policy = this->AccessPolicy();
if (m_leftOver == 0)
{
@@ -40,7 +40,7 @@ inline void AdditiveCipherTemplate<S>::ProcessData(byte *outString, const byte *
assert(m_leftOver == 0);
- PolicyInterface &policy = AccessPolicy();
+ PolicyInterface &policy = this->AccessPolicy();
unsigned int bytesPerIteration = policy.GetBytesPerIteration();
unsigned int alignment = policy.GetAlignment();
@@ -84,7 +84,7 @@ inline void AdditiveCipherTemplate<S>::ProcessData(byte *outString, const byte *
template <class S>
void AdditiveCipherTemplate<S>::Resynchronize(const byte *iv)
{
- PolicyInterface &policy = AccessPolicy();
+ PolicyInterface &policy = this->AccessPolicy();
m_leftOver = 0;
m_buffer.New(GetBufferByteSize(policy));
policy.CipherResynchronize(m_buffer, iv);
@@ -93,7 +93,7 @@ void AdditiveCipherTemplate<S>::Resynchronize(const byte *iv)
template <class BASE>
void AdditiveCipherTemplate<BASE>::Seek(lword position)
{
- PolicyInterface &policy = AccessPolicy();
+ PolicyInterface &policy = this->AccessPolicy();
unsigned int bytesPerIteration = policy.GetBytesPerIteration();
policy.SeekToIteration(position / bytesPerIteration);
@@ -111,7 +111,7 @@ void AdditiveCipherTemplate<BASE>::Seek(lword position)
template <class BASE>
void CFB_CipherTemplate<BASE>::Resynchronize(const byte *iv)
{
- PolicyInterface &policy = AccessPolicy();
+ PolicyInterface &policy = this->AccessPolicy();
policy.CipherResynchronize(iv);
m_leftOver = policy.GetBytesPerIteration();
}
@@ -119,9 +119,9 @@ void CFB_CipherTemplate<BASE>::Resynchronize(const byte *iv)
template <class BASE>
void CFB_CipherTemplate<BASE>::ProcessData(byte *outString, const byte *inString, unsigned int length)
{
- assert(length % MandatoryBlockSize() == 0);
+ assert(length % this->MandatoryBlockSize() == 0);
- PolicyInterface &policy = AccessPolicy();
+ PolicyInterface &policy = this->AccessPolicy();
unsigned int bytesPerIteration = policy.GetBytesPerIteration();
unsigned int alignment = policy.GetAlignment();
byte *reg = policy.GetRegisterBegin();
diff --git a/strciphr.h b/strciphr.h
index 15d2bb3..944ac09 100644
--- a/strciphr.h
+++ b/strciphr.h
@@ -124,12 +124,12 @@ public:
byte GenerateByte();
void ProcessData(byte *outString, const byte *inString, unsigned int length);
void Resynchronize(const byte *iv);
- unsigned int OptimalBlockSize() const {return GetPolicy().GetBytesPerIteration();}
- unsigned int GetOptimalNextBlockSize() const {return m_leftOver;}
- unsigned int OptimalDataAlignment() const {return GetPolicy().GetAlignment();}
+ unsigned int OptimalBlockSize() const {return this->GetPolicy().GetBytesPerIteration();}
+ unsigned int GetOptimalNextBlockSize() const {return this->m_leftOver;}
+ unsigned int OptimalDataAlignment() const {return this->GetPolicy().GetAlignment();}
bool IsSelfInverting() const {return true;}
bool IsForwardTransformation() const {return true;}
- bool IsRandomAccess() const {return GetPolicy().IsRandomAccess();}
+ bool IsRandomAccess() const {return this->GetPolicy().IsRandomAccess();}
void Seek(lword position);
typedef typename BASE::PolicyInterface PolicyInterface;
@@ -139,8 +139,8 @@ protected:
unsigned int GetBufferByteSize(const PolicyInterface &policy) const {return policy.GetBytesPerIteration() * policy.GetIterationsToBuffer();}
- inline byte * KeystreamBufferBegin() {return m_buffer.data();}
- inline byte * KeystreamBufferEnd() {return (m_buffer.data() + m_buffer.size());}
+ inline byte * KeystreamBufferBegin() {return this->m_buffer.data();}
+ inline byte * KeystreamBufferEnd() {return (this->m_buffer.data() + this->m_buffer.size());}
SecByteBlock m_buffer;
unsigned int m_leftOver;
@@ -171,7 +171,7 @@ struct CRYPTOPP_NO_VTABLE CFB_CipherConcretePolicy : public BASE
unsigned int GetAlignment() const {return sizeof(WordType);}
unsigned int GetBytesPerIteration() const {return sizeof(WordType) * W;}
bool CanIterate() const {return true;}
- void TransformRegister() {Iterate(NULL, NULL, ENCRYPTION, 1);}
+ void TransformRegister() {this->Iterate(NULL, NULL, ENCRYPTION, 1);}
template <class B>
struct RegisterOutput
@@ -221,9 +221,9 @@ class CRYPTOPP_NO_VTABLE CFB_CipherTemplate : public BASE
public:
void ProcessData(byte *outString, const byte *inString, unsigned int length);
void Resynchronize(const byte *iv);
- unsigned int OptimalBlockSize() const {return GetPolicy().GetBytesPerIteration();}
+ unsigned int OptimalBlockSize() const {return this->GetPolicy().GetBytesPerIteration();}
unsigned int GetOptimalNextBlockSize() const {return m_leftOver;}
- unsigned int OptimalDataAlignment() const {return GetPolicy().GetAlignment();}
+ unsigned int OptimalDataAlignment() const {return this->GetPolicy().GetAlignment();}
bool IsRandomAccess() const {return false;}
bool IsSelfInverting() const {return false;}
@@ -255,7 +255,7 @@ template <class BASE>
class CFB_RequireFullDataBlocks : public BASE
{
public:
- unsigned int MandatoryBlockSize() const {return OptimalBlockSize();}
+ unsigned int MandatoryBlockSize() const {return this->OptimalBlockSize();}
};
/*
@@ -271,16 +271,16 @@ class SymmetricCipherFinal : public AlgorithmImpl<SimpleKeyingInterfaceImpl<BASE
public:
SymmetricCipherFinal() {}
SymmetricCipherFinal(const byte *key)
- {SetKey(key, DEFAULT_KEYLENGTH);}
+ {SetKey(key, this->DEFAULT_KEYLENGTH);}
SymmetricCipherFinal(const byte *key, unsigned int length)
{SetKey(key, length);}
SymmetricCipherFinal(const byte *key, unsigned int length, const byte *iv)
- {SetKeyWithIV(key, length, iv);}
+ {this->SetKeyWithIV(key, length, iv);}
void SetKey(const byte *key, unsigned int length, const NameValuePairs &params = g_nullNameValuePairs)
{
- ThrowIfInvalidKeyLength(length);
- UncheckedSetKey(params, key, length, GetIVAndThrowIfInvalid(params));
+ this->ThrowIfInvalidKeyLength(length);
+ this->UncheckedSetKey(params, key, length, this->GetIVAndThrowIfInvalid(params));
}
Clonable * Clone() const {return static_cast<SymmetricCipher *>(new SymmetricCipherFinal<BASE, INFO>(*this));}
@@ -289,22 +289,22 @@ public:
template <class S>
void AdditiveCipherTemplate<S>::UncheckedSetKey(const NameValuePairs &params, const byte *key, unsigned int length, const byte *iv)
{
- PolicyInterface &policy = AccessPolicy();
+ PolicyInterface &policy = this->AccessPolicy();
policy.CipherSetKey(params, key, length);
m_leftOver = 0;
m_buffer.New(GetBufferByteSize(policy));
- if (IsResynchronizable())
+ if (this->IsResynchronizable())
policy.CipherResynchronize(m_buffer, iv);
}
template <class BASE>
void CFB_CipherTemplate<BASE>::UncheckedSetKey(const NameValuePairs &params, const byte *key, unsigned int length, const byte *iv)
{
- PolicyInterface &policy = AccessPolicy();
+ PolicyInterface &policy = this->AccessPolicy();
policy.CipherSetKey(params, key, length);
- if (IsResynchronizable())
+ if (this->IsResynchronizable())
policy.CipherResynchronize(iv);
m_leftOver = policy.GetBytesPerIteration();
diff --git a/tea.h b/tea.h
index ed7687e..6dd8592 100644
--- a/tea.h
+++ b/tea.h
@@ -99,7 +99,7 @@ class BTEA : public BTEA_Info, public BlockCipherDocumentation
{
obj->ThrowIfInvalidKeyLength(length);
obj->m_blockSize = param.GetIntValueWithDefault("BlockSize", 60*4);
- GetUserKey(BIG_ENDIAN_ORDER, obj->m_k.begin(), 4, userKey, KEYLENGTH);
+ GetUserKey(BIG_ENDIAN_ORDER, obj->m_k.begin(), 4, key, KEYLENGTH);
}
unsigned int BlockSize() const {return m_blockSize;}
diff --git a/xormac.h b/xormac.h
index 3e555c2..01119bc 100644
--- a/xormac.h
+++ b/xormac.h
@@ -6,6 +6,7 @@
#include "seckey.h"
#include "iterhash.h"
#include "argnames.h"
+#include "algparam.h"
NAMESPACE_BEGIN(CryptoPP)
@@ -26,7 +27,7 @@ public:
void Resynchronize(const byte *IV)
{
GetWord(false, BIG_ENDIAN_ORDER, m_counter, IV);
- Restart();
+ this->Restart();
}
unsigned int IVSize() const
{return 4;}
@@ -66,26 +67,26 @@ class XMACC : public ClonableImpl<XMACC<T>, MessageAuthenticationCodeImpl<XMACC_
public:
XMACC() {}
XMACC(const byte *key, word32 counter = 0xffffffff)
- {SetKey(key, KEYLENGTH, MakeParameters(Name::XMACC_Counter(), counter));}
+ {this->SetKey(key, this->KEYLENGTH, MakeParameters(Name::XMACC_Counter(), counter));}
};
template <class T> void XMACC_Base<T>::CheckedSetKey(void *, Empty empty, const byte *key, unsigned int length, const NameValuePairs &params)
{
- ThrowIfInvalidKeyLength(length);
+ this->ThrowIfInvalidKeyLength(length);
m_counter = 0xffffffff;
const byte *iv = NULL;
if (params.GetValue(Name::IV(), iv))
GetWord(false, BIG_ENDIAN_ORDER, m_counter, iv);
else
params.GetValue(Name::XMACC_Counter(), m_counter);
- memcpy(m_key, key, KEYLENGTH);
+ memcpy(m_key, key, this->KEYLENGTH);
Init();
}
template <class T> void XMACC_Base<T>::Init()
{
m_index = 0x80000000;
- memset(m_digest, 0, T::DIGESTSIZE);
+ memset(this->m_digest, 0, T::DIGESTSIZE);
}
template <class T> inline void XMACC_Base<T>::WriteWord32(byte *output, word32 value)
@@ -104,65 +105,65 @@ template <class T> inline void XMACC_Base<T>::XorDigest(HashWordType *digest, co
template <class T> void XMACC_Base<T>::HashEndianCorrectedBlock(const HashWordType *input)
{
- memcpy(m_buffer, m_key, KEYLENGTH);
- WriteWord32((byte *)m_buffer.begin()+KEYLENGTH, ++m_index);
+ memcpy(m_buffer, m_key, this->KEYLENGTH);
+ WriteWord32((byte *)m_buffer.begin()+this->KEYLENGTH, ++m_index);
T::CorrectEndianess(m_buffer, m_buffer, T::DIGESTSIZE);
T::Transform(m_buffer, input);
- XorDigest(m_digest, m_buffer);
+ XorDigest(this->m_digest, m_buffer);
}
template <class T> void XMACC_Base<T>::TruncatedFinal(byte *mac, unsigned int size)
{
- ThrowIfInvalidTruncatedSize(size);
+ this->ThrowIfInvalidTruncatedSize(size);
if (size < 4)
throw InvalidArgument("XMACC: truncating the MAC to less than 4 bytes will cause it to be unverifiable");
if (m_counter == 0xffffffff)
throw InvalidArgument("XMACC: the counter must be initialized to a valid value for MAC generation");
- PadLastBlock(BLOCKSIZE - 2*sizeof(HashWordType));
- CorrectEndianess(m_data, m_data, BLOCKSIZE - 2*sizeof(HashWordType));
- m_data[m_data.size()-2] = ByteReverse(GetBitCountHi()); // byteReverse for backwards compatibility
- m_data[m_data.size()-1] = ByteReverse(GetBitCountLo());
- HashEndianCorrectedBlock(m_data);
+ PadLastBlock(this->BLOCKSIZE - 2*sizeof(HashWordType));
+ CorrectEndianess(this->m_data, this->m_data, this->BLOCKSIZE - 2*sizeof(HashWordType));
+ this->m_data[this->m_data.size()-2] = ByteReverse(this->GetBitCountHi()); // ByteReverse for backwards compatibility
+ this->m_data[this->m_data.size()-1] = ByteReverse(this->GetBitCountLo());
+ HashEndianCorrectedBlock(this->m_data);
- memcpy(m_buffer, m_key, KEYLENGTH);
- WriteWord32((byte *)m_buffer.begin()+KEYLENGTH, 0);
- memset(m_data, 0, BLOCKSIZE-4);
- WriteWord32((byte *)m_data.begin()+BLOCKSIZE-4, ++m_counter);
+ memcpy(m_buffer, m_key, this->KEYLENGTH);
+ WriteWord32((byte *)m_buffer.begin()+this->KEYLENGTH, 0);
+ memset(this->m_data, 0, this->BLOCKSIZE-4);
+ WriteWord32((byte *)this->m_data.begin()+this->BLOCKSIZE-4, ++m_counter);
T::CorrectEndianess(m_buffer, m_buffer, T::DIGESTSIZE);
- T::CorrectEndianess(m_data, m_data, BLOCKSIZE);
- T::Transform(m_buffer, m_data);
- XorDigest(m_digest, m_buffer);
+ T::CorrectEndianess(this->m_data, this->m_data, this->BLOCKSIZE);
+ T::Transform(m_buffer, this->m_data);
+ XorDigest(this->m_digest, m_buffer);
WriteWord32(mac, m_counter);
- T::CorrectEndianess(m_digest, m_digest, T::DIGESTSIZE);
- memcpy(mac+4, m_digest, size-4);
+ T::CorrectEndianess(this->m_digest, this->m_digest, T::DIGESTSIZE);
+ memcpy(mac+4, this->m_digest, size-4);
- Restart(); // reinit for next use
+ this->Restart(); // reinit for next use
}
template <class T> bool XMACC_Base<T>::TruncatedVerify(const byte *mac, unsigned int size)
{
assert(4 <= size && size <= DIGESTSIZE);
- PadLastBlock(BLOCKSIZE - 2*sizeof(HashWordType));
- CorrectEndianess(m_data, m_data, BLOCKSIZE - 2*sizeof(HashWordType));
- m_data[m_data.size()-2] = ByteReverse(GetBitCountHi()); // byteReverse for backwards compatibility
- m_data[m_data.size()-1] = ByteReverse(GetBitCountLo());
- HashEndianCorrectedBlock(m_data);
+ PadLastBlock(this->BLOCKSIZE - 2*sizeof(HashWordType));
+ CorrectEndianess(this->m_data, this->m_data, this->BLOCKSIZE - 2*sizeof(HashWordType));
+ this->m_data[this->m_data.size()-2] = ByteReverse(this->GetBitCountHi()); // ByteReverse for backwards compatibility
+ this->m_data[this->m_data.size()-1] = ByteReverse(this->GetBitCountLo());
+ HashEndianCorrectedBlock(this->m_data);
- memcpy(m_buffer, m_key, KEYLENGTH);
- WriteWord32((byte *)m_buffer.begin()+KEYLENGTH, 0);
- memset(m_data, 0, BLOCKSIZE-4);
- memcpy((byte *)m_data.begin()+BLOCKSIZE-4, mac, 4);
+ memcpy(m_buffer, m_key, this->KEYLENGTH);
+ WriteWord32((byte *)m_buffer.begin()+this->KEYLENGTH, 0);
+ memset(this->m_data, 0, this->BLOCKSIZE-4);
+ memcpy((byte *)this->m_data.begin()+this->BLOCKSIZE-4, mac, 4);
T::CorrectEndianess(m_buffer, m_buffer, T::DIGESTSIZE);
- T::CorrectEndianess(m_data, m_data, BLOCKSIZE);
- T::Transform(m_buffer, m_data);
- XorDigest(m_digest, m_buffer);
+ T::CorrectEndianess(this->m_data, this->m_data, this->BLOCKSIZE);
+ T::Transform(m_buffer, this->m_data);
+ XorDigest(this->m_digest, m_buffer);
- T::CorrectEndianess(m_digest, m_digest, T::DIGESTSIZE);
- bool macValid = (memcmp(mac+4, m_digest, size-4) == 0);
- Restart(); // reinit for next use
+ T::CorrectEndianess(this->m_digest, this->m_digest, T::DIGESTSIZE);
+ bool macValid = (memcmp(mac+4, this->m_digest, size-4) == 0);
+ this->Restart(); // reinit for next use
return macValid;
}