From 715099fc5b852426d1886a06204beddc0c902dfe Mon Sep 17 00:00:00 2001 From: Ben Anderson Date: Sat, 23 Oct 2004 00:57:40 +0000 Subject: [PATCH] Applied GCC 3.4 patch from Crypto++ website, with slight workaround to avoid adding fips140.h. Now compiles on Linux with GCC 3.4. --- stepmania/src/crypto51/algebra.cpp | 2 +- stepmania/src/crypto51/asn.h | 4 +- stepmania/src/crypto51/files.cpp | 3 +- stepmania/src/crypto51/iterhash.h | 24 ++++---- stepmania/src/crypto51/mdc.h | 14 ++--- stepmania/src/crypto51/modes.h | 12 ++-- stepmania/src/crypto51/osrng.h | 9 ++- stepmania/src/crypto51/pubkey.h | 90 +++++++++++++++-------------- stepmania/src/crypto51/secblock.h | 15 +++-- stepmania/src/crypto51/seckey.h | 10 ++-- stepmania/src/crypto51/simple.h | 4 +- stepmania/src/crypto51/strciphr.cpp | 12 ++-- stepmania/src/crypto51/strciphr.h | 24 ++++---- 13 files changed, 121 insertions(+), 102 deletions(-) diff --git a/stepmania/src/crypto51/algebra.cpp b/stepmania/src/crypto51/algebra.cpp index 222109aa28..6b20bf4761 100644 --- a/stepmania/src/crypto51/algebra.cpp +++ b/stepmania/src/crypto51/algebra.cpp @@ -54,7 +54,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], 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/stepmania/src/crypto51/asn.h b/stepmania/src/crypto51/asn.h index b3fba6acee..6442846ddb 100644 --- a/stepmania/src/crypto51/asn.h +++ b/stepmania/src/crypto51/asn.h @@ -221,8 +221,8 @@ public: } void DEREncode(BufferedTransformation &out) { - if (get() != NULL) - get()->DEREncode(out); + if (this->get() != NULL) + this->get()->DEREncode(out); } }; diff --git a/stepmania/src/crypto51/files.cpp b/stepmania/src/crypto51/files.cpp index c58c2c42e3..4618313e7e 100644 --- a/stepmania/src/crypto51/files.cpp +++ b/stepmania/src/crypto51/files.cpp @@ -106,7 +106,8 @@ unsigned int FileStore::CopyRangeTo2(BufferedTransformation &target, unsigned lo 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 diff --git a/stepmania/src/crypto51/iterhash.h b/stepmania/src/crypto51/iterhash.h index 7945cec6b3..366917ef7e 100644 --- a/stepmania/src/crypto51/iterhash.h +++ b/stepmania/src/crypto51/iterhash.h @@ -82,7 +82,7 @@ class IteratedHashWithStaticTransform : public IteratedHash { 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 @@ protected: 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 @@ template void IteratedHashBase2::Hash 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 --git a/stepmania/src/crypto51/mdc.h b/stepmania/src/crypto51/mdc.h index 8c76aafd21..6f045ebb7b 100644 --- a/stepmania/src/crypto51/mdc.h +++ b/stepmania/src/crypto51/mdc.h @@ -30,22 +30,22 @@ class MDC : public MDC_Info 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/stepmania/src/crypto51/modes.h b/stepmania/src/crypto51/modes.h index 347e422c6e..5905de283d 100644 --- a/stepmania/src/crypto51/modes.h +++ b/stepmania/src/crypto51/modes.h @@ -188,18 +188,18 @@ class CipherModeFinalTemplate_CipherHolder : public ObjectHolder, 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, 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)); } }; diff --git a/stepmania/src/crypto51/osrng.h b/stepmania/src/crypto51/osrng.h index 902b2eeecf..b6b1c39fef 100644 --- a/stepmania/src/crypto51/osrng.h +++ b/stepmania/src/crypto51/osrng.h @@ -8,6 +8,9 @@ #include "randpool.h" #include "rng.h" +//added +#include "cryptlib.h" + NAMESPACE_BEGIN(CryptoPP) //! Exception class for Operating-System Random Number Generator. @@ -147,7 +150,11 @@ byte AutoSeededX917RNG::GenerateByte() if (m_counter == m_lastBlock.size()) { if (!m_isDifferent) - throw SelfTestFailure("AutoSeededX917RNG: Continuous random number generator test failed."); + // This originally threw a SelfTestFailure, which is + // only available from fips140.h, which I figure + // probably was excluded for a good reason. Here's + // my workaround. + throw Exception(Exception::OTHER_ERROR, "AutoSeededX917RNG: Continuous random number generator test failed."); m_counter = 0; m_isDifferent = false; } diff --git a/stepmania/src/crypto51/pubkey.h b/stepmania/src/crypto51/pubkey.h index d14586aad7..0cab6e5383 100644 --- a/stepmania/src/crypto51/pubkey.h +++ b/stepmania/src/crypto51/pubkey.h @@ -37,6 +37,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 @@ -140,12 +142,12 @@ template 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;} }; //! . @@ -286,7 +288,7 @@ template class PK_MessageAccumulatorImpl : public PK_MessageAccumulatorBase, protected ObjectHolder { public: - HashTransformation & AccessHash() {return m_object;} + HashTransformation & AccessHash() {return this->m_object;} }; //! . @@ -295,22 +297,22 @@ class TF_SignatureSchemeBase : public INTERFACE, protected BASE { 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; }; @@ -399,8 +401,12 @@ protected: // 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 { @@ -444,7 +450,7 @@ template 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();} }; //! . @@ -452,8 +458,8 @@ template 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();} }; //! . @@ -542,107 +548,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 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 --git a/stepmania/src/crypto51/secblock.h b/stepmania/src/crypto51/secblock.h index e07c6a213e..d0675a5cc8 100644 --- a/stepmania/src/crypto51/secblock.h +++ b/stepmania/src/crypto51/secblock.h @@ -188,7 +188,10 @@ template > 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 @@ public: ~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 --git a/stepmania/src/crypto51/seckey.h b/stepmania/src/crypto51/seckey.h index 36ecd36a96..56f589975e 100644 --- a/stepmania/src/crypto51/seckey.h +++ b/stepmania/src/crypto51/seckey.h @@ -156,7 +156,7 @@ template class BlockCipherBaseTemplate : public AlgorithmImpl > > { public: - unsigned int BlockSize() const {return BLOCKSIZE;} + unsigned int BlockSize() const {return this->BLOCKSIZE;} }; //! . @@ -166,11 +166,11 @@ class BlockCipherTemplate : public BASE 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 @@ class MessageAuthenticationCodeTemplate : public 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 --git a/stepmania/src/crypto51/simple.h b/stepmania/src/crypto51/simple.h index afcbda5546..55169cb9ae 100644 --- a/stepmania/src/crypto51/simple.h +++ b/stepmania/src/crypto51/simple.h @@ -58,6 +58,8 @@ template 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) @@ -70,7 +72,7 @@ public: 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; } } diff --git a/stepmania/src/crypto51/strciphr.cpp b/stepmania/src/crypto51/strciphr.cpp index d948c57920..d8496a9cd6 100644 --- a/stepmania/src/crypto51/strciphr.cpp +++ b/stepmania/src/crypto51/strciphr.cpp @@ -8,7 +8,7 @@ NAMESPACE_BEGIN(CryptoPP) template byte AdditiveCipherTemplate::GenerateByte() { - PolicyInterface &policy = AccessPolicy(); + PolicyInterface &policy = this->AccessPolicy(); if (m_leftOver == 0) { @@ -37,7 +37,7 @@ inline void AdditiveCipherTemplate::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(); @@ -81,7 +81,7 @@ inline void AdditiveCipherTemplate::ProcessData(byte *outString, const byte * 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 @@ void AdditiveCipherTemplate::Resynchronize(const byte *iv) 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 @@ void AdditiveCipherTemplate::Seek(dword position) 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 @@ void CFB_CipherTemplate::Resynchronize(const byte *iv) 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 --git a/stepmania/src/crypto51/strciphr.h b/stepmania/src/crypto51/strciphr.h index 2a297bba68..d72441f3b5 100644 --- a/stepmania/src/crypto51/strciphr.h +++ b/stepmania/src/crypto51/strciphr.h @@ -123,12 +123,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 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 @@ struct 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 struct RegisterOutput @@ -215,9 +215,9 @@ class 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;} @@ -251,16 +251,16 @@ class SymmetricCipherFinalTemplate : public AlgorithmImplDEFAULT_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 @@ public: 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 @@ void AdditiveCipherTemplate::UncheckedSetKey(const NameValuePairs ¶ms, co 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(); }