diff -u ../crypto++-old/algebra.cpp ./algebra.cpp --- ../crypto++-old/algebra.cpp 2004-01-10 01:47:14.000000000 +0200 +++ ./algebra.cpp 2004-01-24 15:35:28.000000000 +0200 @@ -54,7 +54,7 @@ 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 -u ../crypto++-old/algparam.h ./algparam.h --- ../crypto++-old/algparam.h 2004-01-10 01:47:14.000000000 +0200 +++ ./algparam.h 2004-01-24 15:35:28.000000000 +0200 @@ -23,7 +23,7 @@ } template ConstByteArrayParameter(const T &string, bool deepCopy = false) { - CRYPTOPP_COMPILE_ASSERT(sizeof(string[0])==1); + CRYPTOPP_COMPILE_ASSERT(sizeof(typename T::value_type) == 1); Assign((const byte *)string.data(), string.size(), deepCopy); } diff -u ../crypto++-old/asn.h ./asn.h --- ../crypto++-old/asn.h 2004-01-10 01:47:14.000000000 +0200 +++ ./asn.h 2004-01-24 15:35:28.000000000 +0200 @@ -221,8 +221,8 @@ } void DEREncode(BufferedTransformation &out) { - if (get() != NULL) - get()->DEREncode(out); + if (this->get() != NULL) + this->get()->DEREncode(out); } }; diff -u ../crypto++-old/cbcmac.h ./cbcmac.h --- ../crypto++-old/cbcmac.h 2004-01-10 01:47:15.000000000 +0200 +++ ./cbcmac.h 2004-01-24 15:35:28.000000000 +0200 @@ -37,7 +37,7 @@ public: CBC_MAC() {} CBC_MAC(const byte *key, unsigned int length=CBC_MAC_Base::DEFAULT_KEYLENGTH) - {SetKey(key, length);} + {this->SetKey(key, length);} }; template diff -u ../crypto++-old/dh.h ./dh.h --- ../crypto++-old/dh.h 2004-01-10 01:47:15.000000000 +0200 +++ ./dh.h 2004-01-24 15:35:28.000000000 +0200 @@ -61,18 +61,18 @@ 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 -u ../crypto++-old/dmac.h ./dmac.h --- ../crypto++-old/dmac.h 2004-01-10 01:47:15.000000000 +0200 +++ ./dmac.h 2004-01-24 15:35:28.000000000 +0200 @@ -40,7 +40,7 @@ public: DMAC() {} DMAC(const byte *key, unsigned int length=DMAC_Base::DEFAULT_KEYLENGTH) - {SetKey(key, length);} + {this->SetKey(key, length);} }; template diff -u ../crypto++-old/eccrypto.cpp ./eccrypto.cpp --- ../crypto++-old/eccrypto.cpp 2004-01-10 01:47:15.000000000 +0200 +++ ./eccrypto.cpp 2004-01-24 15:35:28.000000000 +0200 @@ -369,7 +369,7 @@ const EcRecommendedParameters ¶m = *it; m_oid = oid; std::auto_ptr ec(param.NewEC()); - m_groupPrecomputation.SetCurve(*ec); + this->m_groupPrecomputation.SetCurve(*ec); StringSource ssG(param.g, true, new HexDecoder); Element G; @@ -390,7 +390,7 @@ if (m_oid.m_values.empty()) return false; - ThrowIfTypeMismatch(name, typeid(OID), valueType); + this->ThrowIfTypeMismatch(name, typeid(OID), valueType); *reinterpret_cast(pValue) = m_oid; return true; } @@ -471,7 +471,7 @@ DERSequenceEncoder seq(bt); DEREncodeUnsigned(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); @@ -525,12 +525,12 @@ 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; } @@ -565,7 +565,7 @@ void DL_PublicKey_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); } @@ -573,7 +573,7 @@ template void DL_PublicKey_EC::DEREncodeKey(BufferedTransformation &bt) const { - GetGroupParameters().GetCurve().EncodePoint(bt, GetPublicElement(), GetGroupParameters().GetPointCompression()); + this->GetGroupParameters().GetCurve().EncodePoint(bt, this->GetPublicElement(), this->GetGroupParameters().GetPointCompression()); } // ****************************************************************** @@ -596,7 +596,7 @@ 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()) @@ -608,12 +608,12 @@ 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 @@ -623,7 +623,7 @@ DEREncodeUnsigned(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 -u ../crypto++-old/eccrypto.h ./eccrypto.h --- ../crypto++-old/eccrypto.h 2004-01-10 01:47:15.000000000 +0200 +++ ./eccrypto.h 2004-01-24 15:35:28.000000000 +0200 @@ -42,7 +42,7 @@ 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 @@ void GenerateRandom(RandomNumberGenerator &rng, const NameValuePairs &alg); // DL_GroupParameters - const DL_FixedBasePrecomputation & GetBasePrecomputation() const {return m_gpc;} - DL_FixedBasePrecomputation & AccessBasePrecomputation() {return m_gpc;} + const DL_FixedBasePrecomputation & GetBasePrecomputation() const {return this->m_gpc;} + DL_FixedBasePrecomputation & AccessBasePrecomputation() {return this->m_gpc;} const Integer & GetSubgroupOrder() const {return m_n;} Integer GetCofactor() const; bool ValidateGroup(RandomNumberGenerator &rng, unsigned int level) const; @@ -115,7 +115,7 @@ 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();} #ifdef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY const Point& GetBasePoint() const {return GetSubgroupGenerator();} @@ -141,9 +141,9 @@ typedef typename EC::Point Element; void Initialize(const DL_GroupParameters_EC ¶ms, 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); @@ -158,9 +158,9 @@ typedef typename EC::Point Element; void Initialize(const DL_GroupParameters_EC ¶ms, 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 ¶ms) {GenerateRandom(rng, params);} void Initialize(RandomNumberGenerator &rng, const EC &ec, const Element &G, const Integer &n) diff -u ../crypto++-old/elgamal.h ./elgamal.h --- ../crypto++-old/elgamal.h 2004-01-10 01:47:15.000000000 +0200 +++ ./elgamal.h 2004-01-24 15:35:28.000000000 +0200 @@ -79,9 +79,9 @@ { 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 -u ../crypto++-old/files.cpp ./files.cpp --- ../crypto++-old/files.cpp 2004-01-10 01:47:15.000000000 +0200 +++ ./files.cpp 2004-01-24 15:35:28.000000000 +0200 @@ -106,7 +106,8 @@ streampos endPosition = m_stream->seekg(0, ios::end).tellg(); streampos newPosition = current + (streamoff)begin; - if (newPosition >= endPosition) +// if (newPosition >= endPosition) + if (std::streamoff(newPosition) >= std::streamoff(endPosition)) { m_stream->seekg(current); return 0; // don't try to seek beyond the end of file Only in .: fix_diff diff -u ../crypto++-old/gfpcrypt.h ./gfpcrypt.h --- ../crypto++-old/gfpcrypt.h 2004-01-10 01:47:15.000000000 +0200 +++ ./gfpcrypt.h 2004-03-05 20:15:39.000000000 +0200 @@ -93,19 +93,19 @@ {AssignFromHelper(this, source);} // DL_GroupParameters - const DL_FixedBasePrecomputation & GetBasePrecomputation() const {return m_gpc;} - DL_FixedBasePrecomputation & AccessBasePrecomputation() {return m_gpc;} + const DL_FixedBasePrecomputation & GetBasePrecomputation() const {return this->m_gpc;} + DL_FixedBasePrecomputation & 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 &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 &rhs) const {return !operator==(rhs);} }; @@ -210,17 +210,17 @@ { public: void Initialize(const DL_GroupParameters_IntegerBased ¶ms, 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);} }; //! . @@ -229,17 +229,17 @@ { 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 ¶ms, 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);} }; //! . @@ -272,14 +272,14 @@ 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(); @@ -288,11 +288,11 @@ 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(); } }; @@ -312,14 +312,14 @@ 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(); @@ -328,12 +328,12 @@ 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(); } }; Only in .: gfpcrypt.h~ diff -u ../crypto++-old/hmac.h ./hmac.h --- ../crypto++-old/hmac.h 2004-01-10 01:47:15.000000000 +0200 +++ ./hmac.h 2004-01-24 15:35:28.000000000 +0200 @@ -44,7 +44,7 @@ public: HMAC() {} HMAC(const byte *key, unsigned int length=HMAC_Base::DEFAULT_KEYLENGTH) - {SetKey(key, length);} + {this->SetKey(key, length);} }; template diff -u ../crypto++-old/iterhash.h ./iterhash.h --- ../crypto++-old/iterhash.h 2004-01-10 01:47:15.000000000 +0200 +++ ./iterhash.h 2004-01-24 15:35:28.000000000 +0200 @@ -82,7 +82,7 @@ { protected: IteratedHashWithStaticTransform(unsigned int digestSize) : IteratedHash(digestSize) {} - void vTransform(const T *data) {M::Transform(m_digest, data);} + void vTransform(const T *data) {M::Transform(this->m_digest, data);} std::string AlgorithmName() const {return M::StaticAlgorithmName();} }; @@ -90,19 +90,19 @@ template void IteratedHashBase2::TruncatedFinal(byte *hash, 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(); - vTransform(m_data); - CorrectEndianess(m_digest, m_digest, DigestSize()); - memcpy(hash, m_digest, size); + vTransform(this->m_data); + CorrectEndianess(this->m_digest, this->m_digest, this->DigestSize()); + memcpy(hash, this->m_digest, size); - Restart(); // reinit for next use + this->Restart(); // reinit for next use } template void IteratedHashBase2::HashBlock(const HashWordType *input) @@ -111,8 +111,8 @@ vTransform(input); else { - ByteReverse(m_data.begin(), input, BlockSize()); - vTransform(m_data); + ByteReverse(this->m_data.begin(), input, this->BlockSize()); + vTransform(this->m_data); } } diff -u ../crypto++-old/lubyrack.h ./lubyrack.h --- ../crypto++-old/lubyrack.h 2004-01-10 01:47:15.000000000 +0200 +++ ./lubyrack.h 2004-01-24 15:35:28.000000000 +0200 @@ -29,7 +29,7 @@ // 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 @@ { 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 @@ 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 -u ../crypto++-old/mdc.h ./mdc.h --- ../crypto++-old/mdc.h 2004-01-10 01:47:15.000000000 +0200 +++ ./mdc.h 2004-01-24 15:35:28.000000000 +0200 @@ -30,22 +30,22 @@ 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 -u ../crypto++-old/modes.h ./modes.h --- ../crypto++-old/modes.h 2004-01-10 01:47:15.000000000 +0200 +++ ./modes.h 2004-01-24 15:35:28.000000000 +0200 @@ -239,18 +239,18 @@ 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, int feedbackSize = 0) { - m_cipher = &m_object; - SetKey(key, length, MakeParameters("IV", iv)("FeedbackSize", feedbackSize)); + this->m_cipher = &this->m_object; + this->SetKey(key, length, MakeParameters("IV", iv)("FeedbackSize", feedbackSize)); } }; @@ -261,10 +261,10 @@ public: CipherModeFinalTemplate_ExternalCipher(BlockCipher &cipher, const byte *iv = NULL, int feedbackSize = 0) { - m_cipher = &cipher; - ResizeBuffers(); - SetFeedbackSize(feedbackSize); - SetIV(iv); + this->m_cipher = &cipher; + this->ResizeBuffers(); + this->SetFeedbackSize(feedbackSize); + this->SetIV(iv); } }; diff -u ../crypto++-old/osrng.h ./osrng.h --- ../crypto++-old/osrng.h 2004-01-10 01:47:15.000000000 +0200 +++ ./osrng.h 2004-01-24 15:35:28.000000000 +0200 @@ -8,6 +8,9 @@ #include "randpool.h" #include "rng.h" +//added +#include "fips140.h" + NAMESPACE_BEGIN(CryptoPP) //! Exception class for Operating-System Random Number Generator. diff -u ../crypto++-old/panama.cpp ./panama.cpp --- ../crypto++-old/panama.cpp 2004-01-10 01:47:15.000000000 +0200 +++ ./panama.cpp 2004-01-24 15:35:28.000000000 +0200 @@ -53,9 +53,16 @@ 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]; + //bstart = (bstart + STAGES - 1) % STAGES; + + //changed for g++3.4 (internal compiler error) + //word32 *const b0 = *(Stage*)(a+34 + sizeof(Stage)*bstart/sizeof(a)); + //word32 *const b25 = b[(bstart+25) % STAGES]; + + if (p) @@ -90,7 +97,7 @@ template unsigned int PanamaHash::HashMultipleBlocks(const word32 *input, unsigned int length) { - Iterate(length / BLOCKSIZE, input); + this->Iterate(length / BLOCKSIZE, input); return length % BLOCKSIZE; } @@ -103,10 +110,10 @@ vTransform(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 } @@ -116,22 +123,22 @@ { FixedSizeSecBlock 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 void PanamaCipherPolicy::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; diff -u ../crypto++-old/panama.h ./panama.h --- ../crypto++-old/panama.h 2004-01-10 01:47:15.000000000 +0200 +++ ./panama.h 2004-01-24 15:35:28.000000000 +0200 @@ -36,7 +36,7 @@ protected: void Init() {Panama::Reset();} - void vTransform(const word32 *data) {Iterate(1, data);} // push + void vTransform(const word32 *data) {this->Iterate(1, data);} // push unsigned int HashMultipleBlocks(const word32 *input, unsigned int length); }; @@ -70,7 +70,7 @@ public: PanamaMAC() {} PanamaMAC(const byte *key, unsigned int length=PanamaMAC_Base::DEFAULT_KEYLENGTH) - {SetKey(key, length);} + {this->SetKey(key, length);} }; //! . diff -u ../crypto++-old/polynomi.h ./polynomi.h --- ../crypto++-old/polynomi.h 2004-01-10 01:47:15.000000000 +0200 +++ ./polynomi.h 2004-01-24 15:35:28.000000000 +0200 @@ -294,7 +294,8 @@ {return a.Output(out, fixedRing);} //@} -private: +//changed +//private: static const Ring fixedRing; }; @@ -316,46 +317,46 @@ {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);} @@ -391,7 +392,7 @@ //! template inline bool operator==(const CryptoPP::PolynomialOverFixedRing &a, const CryptoPP::PolynomialOverFixedRing &b) - {return a.Equals(b, fixedRing);} + {return a.Equals(b, CryptoPP::PolynomialOverFixedRing::fixedRing);} //! template inline bool operator!=(const CryptoPP::PolynomialOverFixedRing &a, const CryptoPP::PolynomialOverFixedRing &b) @@ -417,23 +418,23 @@ //! template inline CryptoPP::PolynomialOverFixedRing operator+(const CryptoPP::PolynomialOverFixedRing &a, const CryptoPP::PolynomialOverFixedRing &b) - {return CryptoPP::PolynomialOverFixedRing(a.Plus(b, fixedRing));} + {return CryptoPP::PolynomialOverFixedRing(a.Plus(b, CryptoPP::PolynomialOverFixedRing::fixedRing));} //! template inline CryptoPP::PolynomialOverFixedRing operator-(const CryptoPP::PolynomialOverFixedRing &a, const CryptoPP::PolynomialOverFixedRing &b) - {return CryptoPP::PolynomialOverFixedRing(a.Minus(b, fixedRing));} + {return CryptoPP::PolynomialOverFixedRing(a.Minus(b, CryptoPP::PolynomialOverFixedRing::fixedRing));} //! template inline CryptoPP::PolynomialOverFixedRing operator*(const CryptoPP::PolynomialOverFixedRing &a, const CryptoPP::PolynomialOverFixedRing &b) - {return CryptoPP::PolynomialOverFixedRing(a.Times(b, fixedRing));} + {return CryptoPP::PolynomialOverFixedRing(a.Times(b, CryptoPP::PolynomialOverFixedRing::fixedRing));} //! template inline CryptoPP::PolynomialOverFixedRing operator/(const CryptoPP::PolynomialOverFixedRing &a, const CryptoPP::PolynomialOverFixedRing &b) - {return CryptoPP::PolynomialOverFixedRing(a.DividedBy(b, fixedRing));} + {return CryptoPP::PolynomialOverFixedRing(a.DividedBy(b, CryptoPP::PolynomialOverFixedRing::fixedRing));} //! template inline CryptoPP::PolynomialOverFixedRing operator%(const CryptoPP::PolynomialOverFixedRing &a, const CryptoPP::PolynomialOverFixedRing &b) - {return CryptoPP::PolynomialOverFixedRing(a.Modulo(b, fixedRing));} + {return CryptoPP::PolynomialOverFixedRing(a.Modulo(b, CryptoPP::PolynomialOverFixedRing::fixedRing));} NAMESPACE_END diff -u ../crypto++-old/pubkey.h ./pubkey.h --- ../crypto++-old/pubkey.h 2004-01-10 01:47:15.000000000 +0200 +++ ./pubkey.h 2004-01-24 15:35:28.000000000 +0200 @@ -39,6 +39,8 @@ #include "argnames.h" #include +#include "modarith.h" + // VC60 workaround: this macro is defined in shlobj.h and conflicts with a template parameter used in this file #undef INTERFACE @@ -142,12 +144,12 @@ class TF_CryptoSystemBase : public INTERFACE, protected BASE { public: - unsigned int FixedMaxPlaintextLength() const {return GetMessageEncodingInterface().MaxUnpaddedLength(PaddedBlockBitLength());} - unsigned int FixedCiphertextLength() const {return GetTrapdoorFunctionBounds().MaxImage().ByteCount();} + 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;} }; //! . @@ -288,7 +290,7 @@ class PK_MessageAccumulatorImpl : public PK_MessageAccumulatorBase, protected ObjectHolder { public: - HashTransformation & AccessHash() {return m_object;} + HashTransformation & AccessHash() {return this->m_object;} }; //! . @@ -297,22 +299,22 @@ { 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; }; @@ -401,8 +403,12 @@ // for signature scheme HashIdentifier GetHashIdentifier() const { - typedef CPP_TYPENAME SchemeOptions::MessageEncodingMethod::HashIdentifierLookup::HashIdentifierLookup2 L; - return L::Lookup(); + typedef CPP_TYPENAME SchemeOptions::MessageEncodingMethod::HashIdentifierLookup::template HashIdentifierLookup2 L; + return L::Lookup(); +/* typedef typename SchemeOptions::MessageEncodingMethod MEnMeth; + typedef typename MEnMeth::HashIdentifierLookup HLookup; + typedef typename SchemeOptions::HashFunction HashF; + return HLookup::template HashIdentifierLookup2::Lookup(); */ } unsigned int GetDigestSize() const { @@ -446,7 +452,7 @@ class TF_PublicObjectImpl : public TF_ObjectImpl, public PublicKeyCopier { public: - void CopyKeyInto(typename SCHEME_OPTIONS::PublicKey &key) const {key = GetKey();} + void CopyKeyInto(typename SCHEME_OPTIONS::PublicKey &key) const {key = this->GetKey();} }; //! . @@ -454,8 +460,8 @@ class TF_PrivateObjectImpl : public TF_ObjectImpl, public PrivateKeyCopier { public: - void CopyKeyInto(typename SCHEME_OPTIONS::PrivateKey &key) const {key = GetKey();} - void CopyKeyInto(typename SCHEME_OPTIONS::PublicKey &key) const {key = GetKey();} + void CopyKeyInto(typename SCHEME_OPTIONS::PrivateKey &key) const {key = this->GetKey();} + void CopyKeyInto(typename SCHEME_OPTIONS::PublicKey &key) const {key = this->GetKey();} }; //! . @@ -674,23 +680,23 @@ 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 ¶ms = GetAbstractGroupParameters(); + const DL_GroupParameters ¶ms = this->GetAbstractGroupParameters(); return GetPublicPrecomputation().Exponentiate(params.GetGroupPrecomputation(), exponent); } virtual Element CascadeExponentiateBaseAndPublicElement(const Integer &baseExp, const Integer &publicExp) const { - const DL_GroupParameters ¶ms = GetAbstractGroupParameters(); + const DL_GroupParameters ¶ms = this->GetAbstractGroupParameters(); return params.GetBasePrecomputation().CascadeExponentiate(params.GetGroupPrecomputation(), baseExp, GetPublicPrecomputation(), publicExp); } @@ -709,19 +715,19 @@ void MakePublicKey(DL_PublicKey &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); } @@ -738,7 +744,7 @@ pPrivateKey->MakePublicKey(*this); else { - AccessAbstractGroupParameters().AssignFrom(source); + this->AccessAbstractGroupParameters().AssignFrom(source); AssignFromHelper(this, source) CRYPTOPP_SET_FUNCTION_ENTRY(PublicElement); } @@ -806,8 +812,8 @@ void GenerateRandom(RandomNumberGenerator &rng, const NameValuePairs ¶ms) { - if (!params.GetThisObject(AccessGroupParameters())) - AccessGroupParameters().GenerateRandom(rng, params); + if (!params.GetThisObject(this->AccessGroupParameters())) + this->AccessGroupParameters().GenerateRandom(rng, params); // std::pair seed; Integer x(rng, Integer::One(), GetAbstractGroupParameters().GetMaxExponent()); // Integer::ANY, Integer::Zero(), Integer::One(), @@ -827,8 +833,8 @@ {GetAbstractGroupParameters().SavePrecomputation(storedPrecomputation);} // DL_Key - const DL_GroupParameters & GetAbstractGroupParameters() const {return GetGroupParameters();} - DL_GroupParameters & AccessAbstractGroupParameters() {return AccessGroupParameters();} + const DL_GroupParameters & GetAbstractGroupParameters() const {return this->GetGroupParameters();} + DL_GroupParameters & AccessAbstractGroupParameters() {return this->AccessGroupParameters();} // DL_PrivateKey const Integer & GetPrivateExponent() const {return m_x;} @@ -873,7 +879,7 @@ 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; } @@ -908,8 +914,8 @@ } // DL_Key - const DL_GroupParameters & GetAbstractGroupParameters() const {return GetGroupParameters();} - DL_GroupParameters & AccessAbstractGroupParameters() {return AccessGroupParameters();} + const DL_GroupParameters & GetAbstractGroupParameters() const {return this->GetGroupParameters();} + DL_GroupParameters & AccessAbstractGroupParameters() {return this->AccessGroupParameters();} // DL_PublicKey const DL_FixedBasePrecomputation & GetPublicPrecomputation() const {return m_ypc;} @@ -917,7 +923,7 @@ // non-inherited bool operator==(const DL_PublicKeyImpl &rhs) const - {return GetGroupParameters() == rhs.GetGroupParameters() && GetPublicElement() == rhs.GetPublicElement();} + {return this->GetGroupParameters() == rhs.GetGroupParameters() && this->GetPublicElement() == rhs.GetPublicElement();} private: typename GP::BasePrecomputation m_ypc; @@ -991,8 +997,8 @@ 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());} @@ -1008,7 +1014,7 @@ 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 & GetSignatureAlgorithm() const =0; virtual const PK_SignatureMessageEncodingMethod & GetMessageEncodingInterface() const =0; @@ -1024,9 +1030,9 @@ // for validation testing void RawSign(const Integer &k, const Integer &e, Integer &r, Integer &s) const { - const DL_ElgamalLikeSignatureAlgorithm &alg = GetSignatureAlgorithm(); - const DL_GroupParameters ¶ms = GetAbstractGroupParameters(); - const DL_PrivateKey &key = GetKeyInterface(); + const DL_ElgamalLikeSignatureAlgorithm &alg = this->GetSignatureAlgorithm(); + const DL_GroupParameters ¶ms = this->GetAbstractGroupParameters(); + const DL_PrivateKey &key = this->GetKeyInterface(); r = params.ConvertElementToInteger(params.ExponentiateBase(k)); alg.Sign(params, key.GetPrivateExponent(), k, e, r, s); @@ -1036,7 +1042,7 @@ { PK_MessageAccumulatorBase &ma = static_cast(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); @@ -1044,24 +1050,24 @@ unsigned int SignAndRestart(RandomNumberGenerator &rng, PK_MessageAccumulator &messageAccumulator, byte *signature, bool restart) const { - GetMaterial().DoQuickSanityCheck(); + this->GetMaterial().DoQuickSanityCheck(); PK_MessageAccumulatorBase &ma = static_cast(messageAccumulator); - const DL_ElgamalLikeSignatureAlgorithm &alg = GetSignatureAlgorithm(); - const DL_GroupParameters ¶ms = GetAbstractGroupParameters(); - const DL_PrivateKey &key = GetKeyInterface(); + const DL_ElgamalLikeSignatureAlgorithm &alg = this->GetSignatureAlgorithm(); + const DL_GroupParameters ¶ms = this->GetAbstractGroupParameters(); + const DL_PrivateKey &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()); @@ -1075,14 +1081,14 @@ if (restart) RestartMessageAccumulator(rng, ma); - return SignatureLength(); + return this->SignatureLength(); } protected: void RestartMessageAccumulator(RandomNumberGenerator &rng, PK_MessageAccumulatorBase &ma) const { - const DL_ElgamalLikeSignatureAlgorithm &alg = GetSignatureAlgorithm(); - const DL_GroupParameters ¶ms = GetAbstractGroupParameters(); + const DL_ElgamalLikeSignatureAlgorithm &alg = this->GetSignatureAlgorithm(); + const DL_GroupParameters ¶ms = 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()); @@ -1097,29 +1103,29 @@ void InputSignature(PK_MessageAccumulator &messageAccumulator, const byte *signature, unsigned int signatureLength) const { PK_MessageAccumulatorBase &ma = static_cast(messageAccumulator); - const DL_ElgamalLikeSignatureAlgorithm &alg = GetSignatureAlgorithm(); - const DL_GroupParameters ¶ms = GetAbstractGroupParameters(); + const DL_ElgamalLikeSignatureAlgorithm &alg = this->GetSignatureAlgorithm(); + const DL_GroupParameters ¶ms = 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(messageAccumulator); - const DL_ElgamalLikeSignatureAlgorithm &alg = GetSignatureAlgorithm(); - const DL_GroupParameters ¶ms = GetAbstractGroupParameters(); - const DL_PublicKey &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 &alg = this->GetSignatureAlgorithm(); + const DL_GroupParameters ¶ms = this->GetAbstractGroupParameters(); + const DL_PublicKey &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()); @@ -1129,19 +1135,19 @@ DecodingResult RecoverAndRestart(byte *recoveredMessage, PK_MessageAccumulator &messageAccumulator) const { - GetMaterial().DoQuickSanityCheck(); + this->GetMaterial().DoQuickSanityCheck(); PK_MessageAccumulatorBase &ma = static_cast(messageAccumulator); - const DL_ElgamalLikeSignatureAlgorithm &alg = GetSignatureAlgorithm(); - const DL_GroupParameters ¶ms = GetAbstractGroupParameters(); - const DL_PublicKey &key = GetKeyInterface(); + const DL_ElgamalLikeSignatureAlgorithm &alg = this->GetSignatureAlgorithm(); + const DL_GroupParameters ¶ms = this->GetAbstractGroupParameters(); + const DL_PublicKey &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()); @@ -1149,8 +1155,8 @@ 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); @@ -1166,14 +1172,14 @@ 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; } protected: @@ -1193,11 +1199,11 @@ { try { - const DL_KeyAgreementAlgorithm &agreeAlg = GetKeyAgreementAlgorithm(); - const DL_KeyDerivationAlgorithm &derivAlg = GetKeyDerivationAlgorithm(); - const DL_SymmetricEncryptionAlgorithm &encAlg = GetSymmetricEncryptionAlgorithm(); - const DL_GroupParameters ¶ms = GetAbstractGroupParameters(); - const DL_PrivateKey &key = GetKeyInterface(); + const DL_KeyAgreementAlgorithm &agreeAlg = this->GetKeyAgreementAlgorithm(); + const DL_KeyDerivationAlgorithm &derivAlg = this->GetKeyDerivationAlgorithm(); + const DL_SymmetricEncryptionAlgorithm &encAlg = this->GetSymmetricEncryptionAlgorithm(); + const DL_GroupParameters ¶ms = this->GetAbstractGroupParameters(); + const DL_PrivateKey &key = this->GetKeyInterface(); Element q = params.DecodeElement(cipherText, true); unsigned int elementSize = params.GetEncodedElementSize(true); @@ -1227,11 +1233,11 @@ void Encrypt(RandomNumberGenerator &rng, const byte *plainText, unsigned int plainTextLength, byte *cipherText) const { - const DL_KeyAgreementAlgorithm &agreeAlg = GetKeyAgreementAlgorithm(); - const DL_KeyDerivationAlgorithm &derivAlg = GetKeyDerivationAlgorithm(); - const DL_SymmetricEncryptionAlgorithm &encAlg = GetSymmetricEncryptionAlgorithm(); - const DL_GroupParameters ¶ms = GetAbstractGroupParameters(); - const DL_PublicKey &key = GetKeyInterface(); + const DL_KeyAgreementAlgorithm &agreeAlg = this->GetKeyAgreementAlgorithm(); + const DL_KeyDerivationAlgorithm &derivAlg = this->GetKeyDerivationAlgorithm(); + const DL_SymmetricEncryptionAlgorithm &encAlg = this->GetSymmetricEncryptionAlgorithm(); + const DL_GroupParameters ¶ms = this->GetAbstractGroupParameters(); + const DL_PublicKey &key = this->GetKeyInterface(); Integer x(rng, Integer::One(), params.GetMaxExponent()); Element q = params.ExponentiateBase(x); @@ -1307,8 +1313,8 @@ // for signature scheme HashIdentifier GetHashIdentifier() const { - typedef CPP_TYPENAME SchemeOptions::MessageEncodingMethod::HashIdentifierLookup::HashIdentifierLookup2 L; - return L::Lookup(); + typedef typename SchemeOptions::MessageEncodingMethod::HashIdentifierLookup HashLookup; + return HashLookup::template HashIdentifierLookup2::Lookup(); } unsigned int GetDigestSize() const { @@ -1348,7 +1354,7 @@ { public: void CopyKeyInto(typename SCHEME_OPTIONS::PublicKey &key) const - {key = GetKey();} + {key = this->GetKey();} }; //! . @@ -1357,9 +1363,9 @@ { 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();} }; //! . @@ -1369,7 +1375,7 @@ PK_MessageAccumulator * NewSignatureAccumulator(RandomNumberGenerator &rng = NullRNG()) const { std::auto_ptr p(new PK_MessageAccumulatorImpl); - RestartMessageAccumulator(rng, *p); + this->RestartMessageAccumulator(rng, *p); return p.release(); } }; @@ -1518,107 +1524,107 @@ 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 PK_FinalTemplate(const PublicKeyCopier &key) - {key.CopyKeyInto(AccessKey());} + {key.CopyKeyInto(this->AccessKey());} template PK_FinalTemplate(const PrivateKeyCopier &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 PK_FinalTemplate(T1 &v1, T2 &v2) - {AccessKey().Initialize(v1, v2);} + {this->AccessKey().Initialize(v1, v2);} template PK_FinalTemplate(T1 &v1, T2 &v2, T3 &v3) - {AccessKey().Initialize(v1, v2, v3);} + {this->AccessKey().Initialize(v1, v2, v3);} template PK_FinalTemplate(T1 &v1, T2 &v2, T3 &v3, T4 &v4) - {AccessKey().Initialize(v1, v2, v3, v4);} + {this->AccessKey().Initialize(v1, v2, v3, v4);} template 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 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 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 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 PK_FinalTemplate(const T1 &v1, const T2 &v2) - {AccessKey().Initialize(v1, v2);} + {this->AccessKey().Initialize(v1, v2);} template PK_FinalTemplate(const T1 &v1, const T2 &v2, const T3 &v3) - {AccessKey().Initialize(v1, v2, v3);} + {this->AccessKey().Initialize(v1, v2, v3);} template 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 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 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 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 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 PK_FinalTemplate(T1 &v1, const T2 &v2) - {AccessKey().Initialize(v1, v2);} + {this->AccessKey().Initialize(v1, v2);} template PK_FinalTemplate(T1 &v1, const T2 &v2, const T3 &v3) - {AccessKey().Initialize(v1, v2, v3);} + {this->AccessKey().Initialize(v1, v2, v3);} template 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 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 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 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 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 -u ../crypto++-old/pwdbased.h ./pwdbased.h --- ../crypto++-old/pwdbased.h 2004-01-10 01:47:15.000000000 +0200 +++ ./pwdbased.h 2004-01-24 15:35:28.000000000 +0200 @@ -51,7 +51,7 @@ template void PKCS5_PBKDF1::DeriveKey(byte *derived, unsigned int derivedLen, const byte *password, unsigned int passwordLen, const byte *salt, unsigned int saltLen, unsigned int iterations) const { - assert(derivedLen <= MaxDerivedLength()); + assert(derivedLen <= this->MaxDerivedLength()); assert(iterations > 0); T hash; diff -u ../crypto++-old/secblock.h ./secblock.h --- ../crypto++-old/secblock.h 2004-01-10 01:47:15.000000000 +0200 +++ ./secblock.h 2004-01-24 15:35:28.000000000 +0200 @@ -188,7 +188,10 @@ class SecBlock { public: - explicit SecBlock(unsigned int size=0) + //added + typedef T value_type; + + explicit SecBlock(unsigned int size=0) : m_size(size) {m_ptr = m_alloc.allocate(size, NULL);} SecBlock(const SecBlock &t) : m_size(t.m_size) {m_ptr = m_alloc.allocate(m_size, NULL); memcpy(m_ptr, t.m_ptr, m_size*sizeof(T));} @@ -205,26 +208,26 @@ ~SecBlock() {m_alloc.deallocate(m_ptr, m_size);} -#if defined(__GNUC__) || defined(__BCPLUSPLUS__) +//#if defined(__GNUC__) || defined(__BCPLUSPLUS__) operator const void *() const {return m_ptr;} operator void *() {return m_ptr;} -#endif +/*#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 +/*#if defined(__GNUC__) // reduce warnings operator const T *() {return m_ptr;} #endif - +*/ template T *operator +(I offset) {return m_ptr+offset;} diff -u ../crypto++-old/seckey.h ./seckey.h --- ../crypto++-old/seckey.h 2004-01-10 01:47:15.000000000 +0200 +++ ./seckey.h 2004-01-24 15:35:28.000000000 +0200 @@ -156,7 +156,7 @@ class BlockCipherBaseTemplate : public AlgorithmImpl > > { public: - unsigned int BlockSize() const {return BLOCKSIZE;} + unsigned int BlockSize() const {return this->BLOCKSIZE;} }; //! . @@ -166,11 +166,11 @@ public: BlockCipherTemplate() {} BlockCipherTemplate(const byte *key) - {SetKey(key, DEFAULT_KEYLENGTH);} + {SetKey(key, this->DEFAULT_KEYLENGTH);} BlockCipherTemplate(const byte *key, unsigned int length) {SetKey(key, length);} BlockCipherTemplate(const byte *key, unsigned int length, unsigned int rounds) - {SetKeyWithRounds(key, length, rounds);} + {this->SetKeyWithRounds(key, length, rounds);} bool IsForwardTransformation() const {return DIR == ENCRYPTION;} @@ -194,11 +194,11 @@ public: MessageAuthenticationCodeTemplate() {} MessageAuthenticationCodeTemplate(const byte *key) - {SetKey(key, DEFAULT_KEYLENGTH);} + {SetKey(key, this->DEFAULT_KEYLENGTH);} MessageAuthenticationCodeTemplate(const byte *key, unsigned int length) {SetKey(key, length);} - std::string AlgorithmName() const {return StaticAlgorithmName();} + std::string AlgorithmName() const {return this->StaticAlgorithmName();} void SetKey(const byte *key, unsigned int length, const NameValuePairs ¶m = g_nullNameValuePairs) { diff -u ../crypto++-old/simple.h ./simple.h --- ../crypto++-old/simple.h 2004-01-10 01:47:15.000000000 +0200 +++ ./simple.h 2004-01-24 15:35:28.000000000 +0200 @@ -65,6 +65,8 @@ class Unflushable : public T { public: + using T::NULL_CHANNEL; + Unflushable() {} Unflushable(BufferedTransformation *q) : T(q) {} bool Flush(bool completeFlush, int propagation=-1, bool blocking=true) @@ -77,7 +79,7 @@ throw CannotFlush("Unflushable: 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; } } @@ -127,6 +129,7 @@ class Multichannel : public CustomSignalPropagation { public: + using CustomSignalPropagation::NULL_CHANNEL; Multichannel() {} Multichannel(BufferedTransformation *q) : CustomSignalPropagation(q) {} @@ -148,7 +151,7 @@ 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 -u ../crypto++-old/smartptr.h ./smartptr.h --- ../crypto++-old/smartptr.h 2004-01-10 01:47:15.000000000 +0200 +++ ./smartptr.h 2004-01-24 15:35:28.000000000 +0200 @@ -2,6 +2,7 @@ #define CRYPTOPP_SMARTPTR_H #include "config.h" +#include "misc.h" #include NAMESPACE_BEGIN(CryptoPP) @@ -54,14 +55,14 @@ value_ptr& operator=(const value_ptr& rhs); bool operator==(const value_ptr& 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 value_ptr& value_ptr::operator=(const value_ptr& 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; } @@ -81,8 +82,8 @@ template clonable_ptr& clonable_ptr::operator=(const clonable_ptr& 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; } diff -u ../crypto++-old/strciphr.cpp ./strciphr.cpp --- ../crypto++-old/strciphr.cpp 2004-01-10 01:47:15.000000000 +0200 +++ ./strciphr.cpp 2004-01-24 15:35:28.000000000 +0200 @@ -8,7 +8,7 @@ template byte AdditiveCipherTemplate::GenerateByte() { - PolicyInterface &policy = AccessPolicy(); + PolicyInterface &policy = this->AccessPolicy(); if (m_leftOver == 0) { @@ -37,7 +37,7 @@ assert(m_leftOver == 0); - PolicyInterface &policy = AccessPolicy(); + PolicyInterface &policy = this->AccessPolicy(); unsigned int bytesPerIteration = policy.GetBytesPerIteration(); unsigned int alignment = policy.GetAlignment(); @@ -81,7 +81,7 @@ template void AdditiveCipherTemplate::Resynchronize(const byte *iv) { - PolicyInterface &policy = AccessPolicy(); + PolicyInterface &policy = this->AccessPolicy(); m_leftOver = 0; m_buffer.New(GetBufferByteSize(policy)); policy.CipherResynchronize(m_buffer, iv); @@ -90,7 +90,7 @@ template void AdditiveCipherTemplate::Seek(dword position) { - PolicyInterface &policy = AccessPolicy(); + PolicyInterface &policy = this->AccessPolicy(); unsigned int bytesPerIteration = policy.GetBytesPerIteration(); policy.SeekToIteration(position / bytesPerIteration); @@ -108,7 +108,7 @@ template void CFB_CipherTemplate::Resynchronize(const byte *iv) { - PolicyInterface &policy = AccessPolicy(); + PolicyInterface &policy = this->AccessPolicy(); policy.CipherResynchronize(iv); m_leftOver = policy.GetBytesPerIteration(); } @@ -116,7 +116,7 @@ template void CFB_CipherTemplate::ProcessData(byte *outString, const byte *inString, unsigned int length) { - PolicyInterface &policy = AccessPolicy(); + PolicyInterface &policy = this->AccessPolicy(); unsigned int bytesPerIteration = policy.GetBytesPerIteration(); unsigned int alignment = policy.GetAlignment(); byte *reg = policy.GetRegisterBegin(); diff -u ../crypto++-old/strciphr.h ./strciphr.h --- ../crypto++-old/strciphr.h 2004-01-10 01:47:15.000000000 +0200 +++ ./strciphr.h 2004-01-24 15:35:28.000000000 +0200 @@ -123,12 +123,12 @@ 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 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 IsSelfInverting() const {return true;} bool IsForwardTransformation() const {return true;} - bool IsRandomAccess() const {return GetPolicy().IsRandomAccess();} + bool IsRandomAccess() const {return this->GetPolicy().IsRandomAccess();} void Seek(dword position); typedef typename BASE::PolicyInterface PolicyInterface; @@ -165,7 +165,7 @@ 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 struct RegisterOutput @@ -215,9 +215,9 @@ 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;} @@ -251,16 +251,16 @@ public: SymmetricCipherFinalTemplate() {} SymmetricCipherFinalTemplate(const byte *key) - {SetKey(key, DEFAULT_KEYLENGTH);} + {SetKey(key, this->DEFAULT_KEYLENGTH);} SymmetricCipherFinalTemplate(const byte *key, unsigned int length) {SetKey(key, length);} SymmetricCipherFinalTemplate(const byte *key, unsigned int length, const byte *iv) - {SetKey(key, length); Resynchronize(iv);} + {SetKey(key, length); this->Resynchronize(iv);} void SetKey(const byte *key, unsigned int length, const NameValuePairs ¶ms = g_nullNameValuePairs) { - ThrowIfInvalidKeyLength(length); - UncheckedSetKey(params, key, length); + this->ThrowIfInvalidKeyLength(length); + this->UncheckedSetKey(params, key, length); } Clonable * Clone() const {return static_cast(new SymmetricCipherFinalTemplate(*this));} @@ -269,7 +269,7 @@ template void AdditiveCipherTemplate::UncheckedSetKey(const NameValuePairs ¶ms, const byte *key, unsigned int length) { - PolicyInterface &policy = AccessPolicy(); + PolicyInterface &policy = this->AccessPolicy(); policy.CipherSetKey(params, key, length); m_buffer.New(GetBufferByteSize(policy)); m_leftOver = 0; @@ -278,7 +278,7 @@ template void CFB_CipherTemplate::UncheckedSetKey(const NameValuePairs ¶ms, const byte *key, unsigned int length) { - PolicyInterface &policy = AccessPolicy(); + PolicyInterface &policy = this->AccessPolicy(); policy.CipherSetKey(params, key, length); m_leftOver = policy.GetBytesPerIteration(); } Common subdirectories: ../crypto++-old/TestVectors and ./TestVectors diff -u ../crypto++-old/xormac.h ./xormac.h --- ../crypto++-old/xormac.h 2004-01-10 01:47:15.000000000 +0200 +++ ./xormac.h 2004-01-24 15:35:28.000000000 +0200 @@ -6,6 +6,9 @@ #include "iterhash.h" #include "argnames.h" +//added +#include "algparam.h" + NAMESPACE_BEGIN(CryptoPP) template struct DigestSizeSubtract4Workaround {enum {RESULT = T::DIGESTSIZE-4};}; // VC60 workaround @@ -25,7 +28,7 @@ void Resynchronize(const byte *IV) { GetWord(false, BIG_ENDIAN_ORDER, m_counter, IV); - Restart(); + this->Restart(); } unsigned int IVSize() const {return 4;} @@ -65,26 +68,26 @@ 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 void XMACC_Base::CheckedSetKey(void *, Empty empty, const byte *key, unsigned int length, const NameValuePairs ¶ms) { - 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 void XMACC_Base::Init() { m_index = 0x80000000; - memset(m_digest, 0, T::DIGESTSIZE); + memset(this->m_digest, 0, T::DIGESTSIZE); } template inline void XMACC_Base::WriteWord32(byte *output, word32 value) @@ -103,65 +106,65 @@ template void XMACC_Base::vTransform(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 void XMACC_Base::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()); - vTransform(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); + PadLastBlock(this->BLOCKSIZE - 2*sizeof(HashWordType)); + this->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()); + vTransform(this->m_data); + + 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 bool XMACC_Base::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()); - vTransform(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); + this->PadLastBlock(this->BLOCKSIZE - 2*sizeof(HashWordType)); + this->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()); + vTransform(this->m_data); + + 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(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_data, this->m_data, this->BLOCKSIZE); + T::Transform(m_buffer, this->m_data); + XorDigest(this->m_digest, m_buffer); + + 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; }