From e0d32e0688c1bddbfba63f46e486c5ec6b79a9e6 Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Sun, 7 Oct 2012 08:38:33 +0000 Subject: [PATCH] CryptoPP compilation fixes for gcc 4.7 ( http://forum.mc-server.org/showthread.php?tid=520&pid=4829#pid4829 ) git-svn-id: http://mc-server.googlecode.com/svn/trunk@941 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- CryptoPP/algebra.cpp | 2 +- CryptoPP/eccrypto.cpp | 6 +++--- CryptoPP/eccrypto.h | 10 +++++----- CryptoPP/hrtimer.cpp | 1 - CryptoPP/secblock.h | 2 +- 5 files changed, 10 insertions(+), 11 deletions(-) diff --git a/CryptoPP/algebra.cpp b/CryptoPP/algebra.cpp index 78c3947b3..b8818e6af 100644 --- a/CryptoPP/algebra.cpp +++ b/CryptoPP/algebra.cpp @@ -58,7 +58,7 @@ template const T& AbstractEuclideanDomain::Gcd(const Element &a, co Element g[3]={b, a}; unsigned int i0=0, i1=1, i2=2; - while (!Equal(g[i1], this->Identity())) + while (!this->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/CryptoPP/eccrypto.cpp b/CryptoPP/eccrypto.cpp index fd8462fd5..922104c4d 100644 --- a/CryptoPP/eccrypto.cpp +++ b/CryptoPP/eccrypto.cpp @@ -435,7 +435,7 @@ template void DL_GroupParameters_EC::Initialize(const OID &oid) StringSource ssG(param.g, true, new HexDecoder); Element G; bool result = GetCurve().DecodePoint(G, ssG, (size_t)ssG.MaxRetrievable()); - SetSubgroupGenerator(G); + this->SetSubgroupGenerator(G); assert(result); StringSource ssN(param.n, true, new HexDecoder); @@ -591,7 +591,7 @@ bool DL_GroupParameters_EC::ValidateElement(unsigned int level, const Elemen if (level >= 2 && pass) { const Integer &q = GetSubgroupOrder(); - Element gq = gpc ? gpc->Exponentiate(this->GetGroupPrecomputation(), q) : ExponentiateElement(g, q); + Element gq = gpc ? gpc->Exponentiate(this->GetGroupPrecomputation(), q) : this->ExponentiateElement(g, q); pass = pass && IsIdentity(gq); } return pass; @@ -629,7 +629,7 @@ void DL_PublicKey_EC::BERDecodePublicKey(BufferedTransformation &bt, bool pa typename EC::Point P; if (!this->GetGroupParameters().GetCurve().DecodePoint(P, bt, size)) BERDecodeError(); - SetPublicElement(P); + this->SetPublicElement(P); } template diff --git a/CryptoPP/eccrypto.h b/CryptoPP/eccrypto.h index b359e033e..3530455a3 100644 --- a/CryptoPP/eccrypto.h +++ b/CryptoPP/eccrypto.h @@ -43,7 +43,7 @@ public: void Initialize(const EllipticCurve &ec, const Point &G, const Integer &n, const Integer &k = Integer::Zero()) { this->m_groupPrecomputation.SetCurve(ec); - SetSubgroupGenerator(G); + this->SetSubgroupGenerator(G); m_n = n; m_k = k; } @@ -145,9 +145,9 @@ public: typedef typename EC::Point Element; void Initialize(const DL_GroupParameters_EC ¶ms, const Element &Q) - {this->AccessGroupParameters() = params; SetPublicElement(Q);} + {this->AccessGroupParameters() = params; this->SetPublicElement(Q);} void Initialize(const EC &ec, const Element &G, const Integer &n, const Element &Q) - {this->AccessGroupParameters().Initialize(ec, G, n); SetPublicElement(Q);} + {this->AccessGroupParameters().Initialize(ec, G, n); this->SetPublicElement(Q);} // X509PublicKey void BERDecodePublicKey(BufferedTransformation &bt, bool parametersPresent, size_t size); @@ -166,9 +166,9 @@ public: void Initialize(const EC &ec, const Element &G, const Integer &n, const Integer &x) {this->AccessGroupParameters().Initialize(ec, G, n); this->SetPrivateExponent(x);} void Initialize(RandomNumberGenerator &rng, const DL_GroupParameters_EC ¶ms) - {GenerateRandom(rng, params);} + {this->GenerateRandom(rng, params);} void Initialize(RandomNumberGenerator &rng, const EC &ec, const Element &G, const Integer &n) - {GenerateRandom(rng, DL_GroupParameters_EC(ec, G, n));} + {this->GenerateRandom(rng, DL_GroupParameters_EC(ec, G, n));} // PKCS8PrivateKey void BERDecodePrivateKey(BufferedTransformation &bt, bool parametersPresent, size_t size); diff --git a/CryptoPP/hrtimer.cpp b/CryptoPP/hrtimer.cpp index 906ec4a06..6871a15dc 100644 --- a/CryptoPP/hrtimer.cpp +++ b/CryptoPP/hrtimer.cpp @@ -70,7 +70,6 @@ TimerWord Timer::GetCurrentTimerValue() gettimeofday(&now, NULL); return (TimerWord)now.tv_sec * 1000000 + now.tv_usec; #else - clock_t now; return clock(); #endif } diff --git a/CryptoPP/secblock.h b/CryptoPP/secblock.h index 24b9fc09b..40cce3341 100644 --- a/CryptoPP/secblock.h +++ b/CryptoPP/secblock.h @@ -88,7 +88,7 @@ public: pointer allocate(size_type n, const void * = NULL) { - CheckSize(n); + this->CheckSize(n); if (n == 0) return NULL;