diff --git a/trunk/c5/GNUmakefile b/trunk/c5/GNUmakefile index dd1e9196..3dff775a 100644 --- a/trunk/c5/GNUmakefile +++ b/trunk/c5/GNUmakefile @@ -11,9 +11,10 @@ ARFLAGS = -cr # ar needs the dash on OpenBSD RANLIB = ranlib CP = cp MKDIR = mkdir +EGREP = egrep UNAME = $(shell uname) -ISX86 = $(shell uname -m | egrep -c "i.86|x86") -ISMINGW = $(shell uname | egrep -c "MINGW32") +ISX86 = $(shell uname -m | $(EGREP) -c "i.86|x86|i86") +ISMINGW = $(shell uname | $(EGREP) -c "MINGW32") # Default prefix for make install ifeq ($(PREFIX),) @@ -26,8 +27,8 @@ endif ifeq ($(ISX86),1) -GCC33ORLATER = $(shell $(CXX) -v 2>&1 | egrep -c "gcc version (3.[3-9]|[4-9])") -GAS210ORLATER = $(shell echo "" | $(AS) -v 2>&1 | egrep -c "GNU assembler version (2.[1-9][0-9]|[3-9])") +GCC33ORLATER = $(shell $(CXX) -v 2>&1 | $(EGREP) -c "gcc version (3.[3-9]|[4-9])") +GAS210ORLATER = $(shell echo "" | $(AS) -v 2>&1 | $(EGREP) -c "GNU assembler version (2.[1-9][0-9]|[3-9])") ifeq ($(GCC33ORLATER) $(ISMINGW),1 0) # MINGW32 is missing the memalign function CXXFLAGS += -msse2 @@ -46,8 +47,10 @@ endif ifeq ($(UNAME),) # for DJGPP, where uname doesn't exist CXXFLAGS += -mbnu210 else +ifneq ($(CXX),CC) # don't use -pipe with CC (Solaris native C++ compiler) CXXFLAGS += -pipe endif +endif ifeq ($(UNAME),Linux) LDFLAGS += -pthread @@ -58,7 +61,7 @@ AR = libtool ARFLAGS = -static -o CXX = c++ CXXFLAGS += -D__pic__ -IS_GCC2 = $(shell $(CXX) -v 2>&1 | egrep -c gcc-932) +IS_GCC2 = $(shell $(CXX) -v 2>&1 | $(EGREP) -c gcc-932) ifeq ($(IS_GCC2),1) CXXFLAGS += -fno-coalesce-templates -fno-coalesce-static-vtables LDLIBS += -lstdc++ @@ -72,7 +75,7 @@ endif SRCS = $(wildcard *.cpp) ifeq ($(SRCS),) # workaround wildcard function bug in GNU Make 3.77 -SRCS = $(shell ls *.cpp) +SRCS = $(shell echo *.cpp) endif OBJS = $(SRCS:.cpp=.o) diff --git a/trunk/c5/Readme.txt b/trunk/c5/Readme.txt index 4ea278b2..f8096459 100644 --- a/trunk/c5/Readme.txt +++ b/trunk/c5/Readme.txt @@ -357,6 +357,6 @@ the mailing list. 5.4 - added Salsa20 - updated Whirlpool to version 3.0 - - ported to GCC 4.1 and Borland C++Builder 2006 + - ported to GCC 4.1, Sun C++ 5.8, and Borland C++Builder 2006 Written by Wei Dai diff --git a/trunk/c5/algebra.cpp b/trunk/c5/algebra.cpp index 810a32a9..758939e6 100644 --- a/trunk/c5/algebra.cpp +++ b/trunk/c5/algebra.cpp @@ -1,6 +1,10 @@ // algebra.cpp - written and placed in the public domain by Wei Dai #include "pch.h" + +// prevent Sun's CC compiler from including this file automatically +#if !defined(__SUNPRO_CC) || defined(CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES) + #include "algebra.h" #include "integer.h" @@ -201,8 +205,8 @@ template Element GeneralCascadeMultiplication(co struct WindowSlider { - WindowSlider(const Integer &exp, bool fastNegate, unsigned int windowSizeIn=0) - : exp(exp), windowModulus(Integer::One()), windowSize(windowSizeIn), windowBegin(0), fastNegate(fastNegate), firstTime(true), finished(false) + WindowSlider(const Integer &expIn, bool fastNegate, unsigned int windowSizeIn=0) + : exp(expIn), windowModulus(Integer::One()), windowSize(windowSizeIn), windowBegin(0), fastNegate(fastNegate), firstTime(true), finished(false) { if (windowSize == 0) { @@ -332,3 +336,5 @@ void AbstractRing::SimultaneousExponentiate(T *results, const T &base, const } NAMESPACE_END + +#endif diff --git a/trunk/c5/asn.cpp b/trunk/c5/asn.cpp index 9ba73248..91bae2fd 100644 --- a/trunk/c5/asn.cpp +++ b/trunk/c5/asn.cpp @@ -520,7 +520,7 @@ void X509PublicKey::BERDecode(BufferedTransformation &bt) BERGeneralDecoder subjectPublicKey(subjectPublicKeyInfo, BIT_STRING); subjectPublicKey.CheckByte(0); // unused bits - BERDecodeKey2(subjectPublicKey, parametersPresent, (size_t)subjectPublicKey.RemainingLength()); + BERDecodePublicKey(subjectPublicKey, parametersPresent, (size_t)subjectPublicKey.RemainingLength()); subjectPublicKey.MessageEnd(); subjectPublicKeyInfo.MessageEnd(); } @@ -536,7 +536,7 @@ void X509PublicKey::DEREncode(BufferedTransformation &bt) const DERGeneralEncoder subjectPublicKey(subjectPublicKeyInfo, BIT_STRING); subjectPublicKey.Put(0); // unused bits - DEREncodeKey(subjectPublicKey); + DEREncodePublicKey(subjectPublicKey); subjectPublicKey.MessageEnd(); subjectPublicKeyInfo.MessageEnd(); @@ -554,7 +554,7 @@ void PKCS8PrivateKey::BERDecode(BufferedTransformation &bt) algorithm.MessageEnd(); BERGeneralDecoder octetString(privateKeyInfo, OCTET_STRING); - BERDecodeKey2(octetString, parametersPresent, (size_t)privateKeyInfo.RemainingLength()); + BERDecodePrivateKey(octetString, parametersPresent, (size_t)privateKeyInfo.RemainingLength()); octetString.MessageEnd(); if (!privateKeyInfo.EndReached()) @@ -573,7 +573,7 @@ void PKCS8PrivateKey::DEREncode(BufferedTransformation &bt) const algorithm.MessageEnd(); DERGeneralEncoder octetString(privateKeyInfo, OCTET_STRING); - DEREncodeKey(octetString); + DEREncodePrivateKey(octetString); octetString.MessageEnd(); DEREncodeOptionalAttributes(privateKeyInfo); diff --git a/trunk/c5/asn.h b/trunk/c5/asn.h index 3d8907bc..ab929918 100644 --- a/trunk/c5/asn.h +++ b/trunk/c5/asn.h @@ -230,46 +230,61 @@ public: } }; -//! key that can be ASN.1 encoded -/** derived class should override either BERDecodeKey or BERDecodeKey2 */ -class CRYPTOPP_DLL ASN1Key : public ASN1CryptoMaterial +//! _ +template +class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE ASN1CryptoMaterial : public ASN1Object, public BASE { public: + void Save(BufferedTransformation &bt) const + {BEREncode(bt);} + void Load(BufferedTransformation &bt) + {BERDecode(bt);} +}; + +//! encodes/decodes subjectPublicKeyInfo +class CRYPTOPP_DLL X509PublicKey : public ASN1CryptoMaterial +{ +public: + void BERDecode(BufferedTransformation &bt); + void DEREncode(BufferedTransformation &bt) const; + virtual OID GetAlgorithmID() const =0; virtual bool BERDecodeAlgorithmParameters(BufferedTransformation &bt) {BERDecodeNull(bt); return false;} virtual bool DEREncodeAlgorithmParameters(BufferedTransformation &bt) const {DEREncodeNull(bt); return false;} // see RFC 2459, section 7.3.1 - //! decode subjectPublicKey part of subjectPublicKeyInfo, or privateKey part of privateKeyInfo, without the BIT STRING or OCTET STRING header - virtual void BERDecodeKey(BufferedTransformation &bt) {assert(false);} - virtual void BERDecodeKey2(BufferedTransformation &bt, bool parametersPresent, size_t size) - {BERDecodeKey(bt);} - //! encode subjectPublicKey part of subjectPublicKeyInfo, or privateKey part of privateKeyInfo, without the BIT STRING or OCTET STRING header - virtual void DEREncodeKey(BufferedTransformation &bt) const =0; -}; -//! encodes/decodes subjectPublicKeyInfo -class CRYPTOPP_DLL X509PublicKey : virtual public ASN1Key, public PublicKey -{ -public: - void BERDecode(BufferedTransformation &bt); - void DEREncode(BufferedTransformation &bt) const; + //! decode subjectPublicKey part of subjectPublicKeyInfo, without the BIT STRING header + virtual void BERDecodePublicKey(BufferedTransformation &bt, bool parametersPresent, size_t size) =0; + //! encode subjectPublicKey part of subjectPublicKeyInfo, without the BIT STRING header + virtual void DEREncodePublicKey(BufferedTransformation &bt) const =0; }; //! encodes/decodes privateKeyInfo -class CRYPTOPP_DLL PKCS8PrivateKey : virtual public ASN1Key, public PrivateKey +class CRYPTOPP_DLL PKCS8PrivateKey : public ASN1CryptoMaterial { public: void BERDecode(BufferedTransformation &bt); void DEREncode(BufferedTransformation &bt) const; + virtual OID GetAlgorithmID() const =0; + virtual bool BERDecodeAlgorithmParameters(BufferedTransformation &bt) + {BERDecodeNull(bt); return false;} + virtual bool DEREncodeAlgorithmParameters(BufferedTransformation &bt) const + {DEREncodeNull(bt); return false;} // see RFC 2459, section 7.3.1 + + //! decode privateKey part of privateKeyInfo, without the OCTET STRING header + virtual void BERDecodePrivateKey(BufferedTransformation &bt, bool parametersPresent, size_t size) =0; + //! encode privateKey part of privateKeyInfo, without the OCTET STRING header + virtual void DEREncodePrivateKey(BufferedTransformation &bt) const =0; + //! decode optional attributes including context-specific tag /*! /note default implementation stores attributes to be output in DEREncodeOptionalAttributes */ virtual void BERDecodeOptionalAttributes(BufferedTransformation &bt); //! encode optional attributes including context-specific tag virtual void DEREncodeOptionalAttributes(BufferedTransformation &bt) const; -private: +protected: ByteQueue m_optionalAttributes; }; diff --git a/trunk/c5/channels.h b/trunk/c5/channels.h index e8ce9bf5..83741561 100644 --- a/trunk/c5/channels.h +++ b/trunk/c5/channels.h @@ -53,8 +53,9 @@ public: typedef std::pair > DefaultRoute; typedef std::list DefaultRouteList; - typedef RouteMap::const_iterator MapIterator; - typedef DefaultRouteList::const_iterator ListIterator; + // SunCC workaround: can't use const_iterator here + typedef RouteMap::iterator MapIterator; + typedef DefaultRouteList::iterator ListIterator; }; class ChannelSwitch; diff --git a/trunk/c5/config.h b/trunk/c5/config.h index 947c6079..6112826e 100644 --- a/trunk/c5/config.h +++ b/trunk/c5/config.h @@ -104,7 +104,7 @@ NAMESPACE_BEGIN(CryptoPP) typedef unsigned short word16; typedef unsigned int word32; -#if defined(__GNUC__) || defined(__MWERKS__) +#if defined(__GNUC__) || defined(__MWERKS__) || defined(__SUNPRO_CC) #define WORD64_AVAILABLE typedef unsigned long long word64; #define W64LIT(x) x##LL @@ -238,6 +238,13 @@ NAMESPACE_END # define CRYPTOPP_CONSTANT(x) static const int x; #endif +// how to allocate 16-byte aligned memory (for SSE2) +#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) +# define CRYPTOPP_MALLOC_ALIGNMENT_IS_16 +#elif defined(__linux__) || defined(__sun__) || defined(__CYGWIN__) +# define CRYPTOPP_MEMALIGN_AVAILABLE +#endif + // ***************** determine availability of OS features ******************** #ifndef NO_OS_DEPENDENCE @@ -272,7 +279,7 @@ NAMESPACE_END # define USE_BERKELEY_STYLE_SOCKETS #endif -#if defined(CRYPTOPP_WIN32_AVAILABLE) && !defined(USE_BERKELEY_STYLE_SOCKETS) +#if defined(HIGHRES_TIMER_AVAILABLE) && defined(CRYPTOPP_WIN32_AVAILABLE) && !defined(USE_BERKELEY_STYLE_SOCKETS) # define WINDOWS_PIPES_AVAILABLE #endif @@ -294,14 +301,6 @@ NAMESPACE_END # define THREADS_AVAILABLE #endif -#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) -# define CRYPTOPP_MALLOC_ALIGNMENT_IS_16 -#endif - -#if defined(__linux__) || defined(__sun__) || defined(__CYGWIN__) -# define CRYPTOPP_MEMALIGN_AVAILABLE -#endif - #endif // NO_OS_DEPENDENCE // ***************** DLL related ******************** @@ -329,7 +328,7 @@ NAMESPACE_END #if defined(__MWERKS__) #define CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS extern class CRYPTOPP_DLL -#elif defined(__BORLANDC__) +#elif defined(__BORLANDC__) || defined(__SUNPRO_CC) #define CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS template class CRYPTOPP_DLL #else #define CRYPTOPP_EXTERN_DLL_TEMPLATE_CLASS extern template class CRYPTOPP_DLL @@ -343,7 +342,7 @@ NAMESPACE_END #if defined(__MWERKS__) #define CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS extern class -#elif defined(__BORLANDC__) +#elif defined(__BORLANDC__) || defined(__SUNPRO_CC) #define CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS template class #else #define CRYPTOPP_EXTERN_STATIC_TEMPLATE_CLASS extern template class diff --git a/trunk/c5/cryptlib.h b/trunk/c5/cryptlib.h index aaa8a31c..1b72ba68 100644 --- a/trunk/c5/cryptlib.h +++ b/trunk/c5/cryptlib.h @@ -4,7 +4,7 @@ classes that provide a uniform interface to this library. */ -/*! \mainpage Crypto++® Library 5.3 Reference Manual +/*! \mainpage Crypto++® Library 5.4 Reference Manual
Abstract Base Classes
cryptlib.h @@ -1156,7 +1156,7 @@ public: }; //! interface for public-key encryptors -class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE PK_Encryptor : virtual public PK_CryptoSystem, public PublicKeyAlgorithm +class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE PK_Encryptor : public PK_CryptoSystem, public PublicKeyAlgorithm { public: //! exception thrown when trying to encrypt plaintext of invalid length @@ -1184,7 +1184,7 @@ public: //! interface for public-key decryptors -class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE PK_Decryptor : virtual public PK_CryptoSystem, public PrivateKeyAlgorithm +class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE PK_Decryptor : public PK_CryptoSystem, public PrivateKeyAlgorithm { public: //! decrypt a byte string, and return the length of plaintext diff --git a/trunk/c5/cryptopp.rc b/trunk/c5/cryptopp.rc index fcd12028..5d7d560f 100644 --- a/trunk/c5/cryptopp.rc +++ b/trunk/c5/cryptopp.rc @@ -27,8 +27,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // VS_VERSION_INFO VERSIONINFO - FILEVERSION 5,3,0,0 - PRODUCTVERSION 5,3,0,0 + FILEVERSION 5,4,0,0 + PRODUCTVERSION 5,4,0,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -46,13 +46,13 @@ BEGIN VALUE "Comments", "free crypto library, more information available at www.cryptopp.com" VALUE "CompanyName", "Wei Dai" VALUE "FileDescription", "Crypto++® Library DLL" - VALUE "FileVersion", "5, 3, 0, 0" + VALUE "FileVersion", "5, 4, 0, 0" VALUE "InternalName", "cryptopp" VALUE "LegalCopyright", "Copyright © 1995-2006 by Wei Dai" VALUE "LegalTrademarks", "Crypto++®" VALUE "OriginalFilename", "cryptopp.dll" VALUE "ProductName", "Crypto++® Library" - VALUE "ProductVersion", "5, 3, 0, 0" + VALUE "ProductVersion", "5, 4, 0, 0" END END BLOCK "VarFileInfo" diff --git a/trunk/c5/eccrypto.cpp b/trunk/c5/eccrypto.cpp index 876ee798..91ec54f1 100644 --- a/trunk/c5/eccrypto.cpp +++ b/trunk/c5/eccrypto.cpp @@ -2,6 +2,9 @@ #include "pch.h" +// prevent Sun's CC compiler from including this file automatically +#if !defined(__SUNPRO_CC) || defined(CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES) + #ifndef CRYPTOPP_IMPORTS #include "eccrypto.h" @@ -571,7 +574,7 @@ OID DL_GroupParameters_EC::GetAlgorithmID() const // ****************************************************************** template -void DL_PublicKey_EC::BERDecodeKey2(BufferedTransformation &bt, bool parametersPresent, size_t size) +void DL_PublicKey_EC::BERDecodePublicKey(BufferedTransformation &bt, bool parametersPresent, size_t size) { typename EC::Point P; if (!this->GetGroupParameters().GetCurve().DecodePoint(P, bt, size)) @@ -580,7 +583,7 @@ void DL_PublicKey_EC::BERDecodeKey2(BufferedTransformation &bt, bool paramet } template -void DL_PublicKey_EC::DEREncodeKey(BufferedTransformation &bt) const +void DL_PublicKey_EC::DEREncodePublicKey(BufferedTransformation &bt) const { this->GetGroupParameters().GetCurve().EncodePoint(bt, this->GetPublicElement(), this->GetGroupParameters().GetPointCompression()); } @@ -588,7 +591,7 @@ void DL_PublicKey_EC::DEREncodeKey(BufferedTransformation &bt) const // ****************************************************************** template -void DL_PrivateKey_EC::BERDecodeKey2(BufferedTransformation &bt, bool parametersPresent, size_t size) +void DL_PrivateKey_EC::BERDecodePrivateKey(BufferedTransformation &bt, bool parametersPresent, size_t size) { BERSequenceDecoder seq(bt); word32 version; @@ -626,7 +629,7 @@ void DL_PrivateKey_EC::BERDecodeKey2(BufferedTransformation &bt, bool parame } template -void DL_PrivateKey_EC::DEREncodeKey(BufferedTransformation &bt) const +void DL_PrivateKey_EC::DEREncodePrivateKey(BufferedTransformation &bt) const { DERSequenceEncoder privateKey(bt); DEREncodeUnsigned(privateKey, 1); // version @@ -639,3 +642,5 @@ void DL_PrivateKey_EC::DEREncodeKey(BufferedTransformation &bt) const NAMESPACE_END #endif + +#endif diff --git a/trunk/c5/eccrypto.h b/trunk/c5/eccrypto.h index 340bf14b..8d95780c 100644 --- a/trunk/c5/eccrypto.h +++ b/trunk/c5/eccrypto.h @@ -150,8 +150,8 @@ public: {this->AccessGroupParameters().Initialize(ec, G, n); SetPublicElement(Q);} // X509PublicKey - void BERDecodeKey2(BufferedTransformation &bt, bool parametersPresent, size_t size); - void DEREncodeKey(BufferedTransformation &bt) const; + void BERDecodePublicKey(BufferedTransformation &bt, bool parametersPresent, size_t size); + void DEREncodePublicKey(BufferedTransformation &bt) const; }; //! EC private key @@ -171,8 +171,8 @@ public: {GenerateRandom(rng, DL_GroupParameters_EC(ec, G, n));} // PKCS8PrivateKey - void BERDecodeKey2(BufferedTransformation &bt, bool parametersPresent, size_t size); - void DEREncodeKey(BufferedTransformation &bt) const; + void BERDecodePrivateKey(BufferedTransformation &bt, bool parametersPresent, size_t size); + void DEREncodePrivateKey(BufferedTransformation &bt) const; }; //! Elliptic Curve Diffie-Hellman, AKA ECDH diff --git a/trunk/c5/eprecomp.cpp b/trunk/c5/eprecomp.cpp index a061cf6c..ce1b07fc 100644 --- a/trunk/c5/eprecomp.cpp +++ b/trunk/c5/eprecomp.cpp @@ -2,6 +2,9 @@ #include "pch.h" +// prevent Sun's CC compiler from including this file automatically +#if !defined(__SUNPRO_CC) || defined(CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES) + #ifndef CRYPTOPP_IMPORTS #include "eprecomp.h" @@ -110,3 +113,5 @@ template T NAMESPACE_END #endif + +#endif diff --git a/trunk/c5/esign.h b/trunk/c5/esign.h index 083ef9f9..8eecbc5a 100644 --- a/trunk/c5/esign.h +++ b/trunk/c5/esign.h @@ -8,11 +8,12 @@ #include "pubkey.h" #include "integer.h" +#include "asn.h" NAMESPACE_BEGIN(CryptoPP) //! _ -class ESIGNFunction : public TrapdoorFunction, public PublicKey, public ASN1CryptoMaterial +class ESIGNFunction : public TrapdoorFunction, public ASN1CryptoMaterial { typedef ESIGNFunction ThisClass; diff --git a/trunk/c5/fipstest.cpp b/trunk/c5/fipstest.cpp index 2248d10c..893267e3 100644 --- a/trunk/c5/fipstest.cpp +++ b/trunk/c5/fipstest.cpp @@ -497,6 +497,7 @@ void DoPowerUpSelfTest(const char *moduleFilename, const byte *expectedModuleMac "abc", "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad"); +#ifdef WORD64_AVAILABLE SecureHashKnownAnswerTest( "abc", "cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed8086072ba1e7cc2358baeca134c825a7"); @@ -504,6 +505,7 @@ void DoPowerUpSelfTest(const char *moduleFilename, const byte *expectedModuleMac SecureHashKnownAnswerTest( "abc", "ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f"); +#endif MAC_KnownAnswerTest >( "303132333435363738393a3b3c3d3e3f40414243", diff --git a/trunk/c5/gfpcrypt.h b/trunk/c5/gfpcrypt.h index 733b678c..787ab885 100644 --- a/trunk/c5/gfpcrypt.h +++ b/trunk/c5/gfpcrypt.h @@ -20,7 +20,7 @@ NAMESPACE_BEGIN(CryptoPP) CRYPTOPP_DLL_TEMPLATE_CLASS DL_GroupParameters; //! _ -class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE DL_GroupParameters_IntegerBased : public DL_GroupParameters, public ASN1CryptoMaterial +class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE DL_GroupParameters_IntegerBased : public ASN1CryptoMaterial > { typedef DL_GroupParameters_IntegerBased ThisClass; @@ -219,9 +219,9 @@ public: {this->AccessGroupParameters().Initialize(p, q, g); this->SetPublicElement(y);} // X509PublicKey - void BERDecodeKey(BufferedTransformation &bt) + void BERDecodePublicKey(BufferedTransformation &bt, bool, size_t) {this->SetPublicElement(Integer(bt));} - void DEREncodeKey(BufferedTransformation &bt) const + void DEREncodePublicKey(BufferedTransformation &bt) const {this->GetPublicElement().DEREncode(bt);} }; diff --git a/trunk/c5/hrtimer.cpp b/trunk/c5/hrtimer.cpp index c965ba09..6fe9b568 100644 --- a/trunk/c5/hrtimer.cpp +++ b/trunk/c5/hrtimer.cpp @@ -18,7 +18,7 @@ NAMESPACE_BEGIN(CryptoPP) -double TimerBase::ConvertTo(word64 t, Unit unit) +double TimerBase::ConvertTo(TimerWord t, Unit unit) { static unsigned long unitsPerSecondTable[] = {1, 1000, 1000*1000, 1000*1000*1000}; @@ -45,7 +45,7 @@ double TimerBase::ElapsedTimeAsDouble() if (m_started) { - word64 now = GetCurrentTimerValue(); + TimerWord now = GetCurrentTimerValue(); if (m_last < now) // protect against OS bugs where time goes backwards m_last = now; return ConvertTo(m_last - m_start, m_timerUnit); @@ -62,7 +62,7 @@ unsigned long TimerBase::ElapsedTime() return (unsigned long)elapsed; } -word64 ThreadUserTimer::GetCurrentTimerValue() +TimerWord ThreadUserTimer::GetCurrentTimerValue() { #if defined(CRYPTOPP_WIN32_AVAILABLE) static bool getCurrentThreadImplemented = true; @@ -79,10 +79,10 @@ word64 ThreadUserTimer::GetCurrentTimerValue() } throw Exception(Exception::OTHER_ERROR, "ThreadUserTimer: GetThreadTimes failed with error " + IntToString(lastError)); } - return now.dwLowDateTime + ((word64)now.dwHighDateTime << 32); + return now.dwLowDateTime + ((TimerWord)now.dwHighDateTime << 32); } GetCurrentThreadNotImplemented: - return (word64)clock() * (10*1000*1000 / CLOCKS_PER_SEC); + return (TimerWord)clock() * (10*1000*1000 / CLOCKS_PER_SEC); #elif defined(CRYPTOPP_UNIX_AVAILABLE) tms now; times(&now); @@ -92,7 +92,7 @@ GetCurrentThreadNotImplemented: #endif } -word64 ThreadUserTimer::TicksPerSecond() +TimerWord ThreadUserTimer::TicksPerSecond() { #if defined(CRYPTOPP_WIN32_AVAILABLE) return 10*1000*1000; @@ -106,7 +106,7 @@ word64 ThreadUserTimer::TicksPerSecond() #ifdef HIGHRES_TIMER_AVAILABLE -word64 Timer::GetCurrentTimerValue() +TimerWord Timer::GetCurrentTimerValue() { #if defined(CRYPTOPP_WIN32_AVAILABLE) LARGE_INTEGER now; @@ -116,11 +116,11 @@ word64 Timer::GetCurrentTimerValue() #elif defined(CRYPTOPP_UNIX_AVAILABLE) timeval now; gettimeofday(&now, NULL); - return (word64)now.tv_sec * 1000000 + now.tv_usec; + return (TimerWord)now.tv_sec * 1000000 + now.tv_usec; #endif } -word64 Timer::TicksPerSecond() +TimerWord Timer::TicksPerSecond() { #if defined(CRYPTOPP_WIN32_AVAILABLE) static LARGE_INTEGER freq = {0}; @@ -135,6 +135,6 @@ word64 Timer::TicksPerSecond() #endif } -#endif +#endif // HIGHRES_TIMER_AVAILABLE NAMESPACE_END diff --git a/trunk/c5/hrtimer.h b/trunk/c5/hrtimer.h index a6a96df3..03c43106 100644 --- a/trunk/c5/hrtimer.h +++ b/trunk/c5/hrtimer.h @@ -5,6 +5,12 @@ NAMESPACE_BEGIN(CryptoPP) +#ifdef WORD64_AVAILABLE + typedef word64 TimerWord; +#else + typedef word32 TimerWord; +#endif + //! _ class TimerBase { @@ -12,19 +18,19 @@ public: enum Unit {SECONDS = 0, MILLISECONDS, MICROSECONDS, NANOSECONDS}; TimerBase(Unit unit, bool stuckAtZero) : m_timerUnit(unit), m_stuckAtZero(stuckAtZero), m_started(false) {} - virtual word64 GetCurrentTimerValue() =0; // GetCurrentTime is a macro in MSVC 6.0 - virtual word64 TicksPerSecond() =0; // this is not the resolution, just a conversion factor into seconds + virtual TimerWord GetCurrentTimerValue() =0; // GetCurrentTime is a macro in MSVC 6.0 + virtual TimerWord TicksPerSecond() =0; // this is not the resolution, just a conversion factor into seconds void StartTimer(); double ElapsedTimeAsDouble(); unsigned long ElapsedTime(); private: - double ConvertTo(word64 t, Unit unit); + double ConvertTo(TimerWord t, Unit unit); Unit m_timerUnit; // HPUX workaround: m_unit is a system macro on HPUX bool m_stuckAtZero, m_started; - word64 m_start, m_last; + TimerWord m_start, m_last; }; //! measure CPU time spent executing instructions of this thread (if supported by OS) @@ -34,8 +40,8 @@ class ThreadUserTimer : public TimerBase { public: ThreadUserTimer(Unit unit = TimerBase::SECONDS, bool stuckAtZero = false) : TimerBase(unit, stuckAtZero) {} - word64 GetCurrentTimerValue(); - word64 TicksPerSecond(); + TimerWord GetCurrentTimerValue(); + TimerWord TicksPerSecond(); }; #ifdef HIGHRES_TIMER_AVAILABLE @@ -45,11 +51,11 @@ class Timer : public TimerBase { public: Timer(Unit unit = TimerBase::SECONDS, bool stuckAtZero = false) : TimerBase(unit, stuckAtZero) {} - word64 GetCurrentTimerValue(); - word64 TicksPerSecond(); + TimerWord GetCurrentTimerValue(); + TimerWord TicksPerSecond(); }; -#endif +#endif // HIGHRES_TIMER_AVAILABLE NAMESPACE_END diff --git a/trunk/c5/ida.cpp b/trunk/c5/ida.cpp index 92e24991..fa6a4b8a 100644 --- a/trunk/c5/ida.cpp +++ b/trunk/c5/ida.cpp @@ -395,6 +395,8 @@ size_t PaddingRemover::Put2(const byte *begin, size_t length, int messageEnd, bo #if defined(_MSC_VER) && !defined(__MWERKS__) && (_MSC_VER < 1300) // VC60 workaround: built-in reverse_iterator has two template parameters, Dinkumware only has one typedef reverse_bidirectional_iterator RevIt; +#elif defined(_RWSTD_NO_CLASS_PARTIAL_SPEC) + typedef reverse_iterator RevIt; #else typedef reverse_iterator RevIt; #endif diff --git a/trunk/c5/integer.cpp b/trunk/c5/integer.cpp index 4c092ac9..f287d4a9 100644 --- a/trunk/c5/integer.cpp +++ b/trunk/c5/integer.cpp @@ -3976,7 +3976,7 @@ Integer Integer::InverseMod(const Integer &m) const return r; } -word Integer::InverseMod(const word mod) const +word Integer::InverseMod(word mod) const { word g0 = mod, g1 = *this % mod; word v0 = 0, v1 = 1; diff --git a/trunk/c5/iterhash.cpp b/trunk/c5/iterhash.cpp index d6dd092a..eee0bfee 100644 --- a/trunk/c5/iterhash.cpp +++ b/trunk/c5/iterhash.cpp @@ -1,6 +1,10 @@ // iterhash.cpp - written and placed in the public domain by Wei Dai #include "pch.h" + +// prevent Sun's CC compiler from including this file automatically +#if !defined(__SUNPRO_CC) || defined(CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES) + #include "iterhash.h" #include "misc.h" @@ -133,3 +137,5 @@ template void IteratedHashBase::TruncatedFinal(by } NAMESPACE_END + +#endif diff --git a/trunk/c5/network.cpp b/trunk/c5/network.cpp index 841c2bf2..ead3a1c4 100644 --- a/trunk/c5/network.cpp +++ b/trunk/c5/network.cpp @@ -8,6 +8,8 @@ NAMESPACE_BEGIN(CryptoPP) +#ifdef HIGHRES_TIMER_AVAILABLE + lword LimitedBandwidth::ComputeCurrentTransceiveLimit() { if (!m_maxBytesPerSecond) @@ -223,8 +225,6 @@ bool NonblockingSink::IsolatedFlush(bool hardFlush, bool blocking) // ************************************************************* -#ifdef HIGHRES_TIMER_AVAILABLE - NetworkSource::NetworkSource(BufferedTransformation *attachment) : NonblockingSource(attachment), m_buf(1024*16) , m_waitingForResult(false), m_outputBlocked(false) diff --git a/trunk/c5/network.h b/trunk/c5/network.h index 99ab6fb6..96cd4567 100644 --- a/trunk/c5/network.h +++ b/trunk/c5/network.h @@ -1,6 +1,10 @@ #ifndef CRYPTOPP_NETWORK_H #define CRYPTOPP_NETWORK_H +#include "config.h" + +#ifdef HIGHRES_TIMER_AVAILABLE + #include "filters.h" #include "hrtimer.h" @@ -157,8 +161,6 @@ public: virtual bool EofSent() {return false;} // implement if MustWaitForEof() == true }; -#ifdef HIGHRES_TIMER_AVAILABLE - //! Network Source class CRYPTOPP_NO_VTABLE NetworkSource : public NonblockingSource { @@ -226,8 +228,8 @@ private: float m_byteCountSinceLastTimerReset, m_currentSpeed, m_maxObservedSpeed; }; -#endif // #ifdef HIGHRES_TIMER_AVAILABLE - NAMESPACE_END +#endif // #ifdef HIGHRES_TIMER_AVAILABLE + #endif diff --git a/trunk/c5/panama.h b/trunk/c5/panama.h index 1f24609b..bb0ed3ba 100644 --- a/trunk/c5/panama.h +++ b/trunk/c5/panama.h @@ -3,8 +3,8 @@ #include "seckey.h" #include "secblock.h" -#include "iterhash.h" #include "strciphr.h" +#include "iterhash.h" NAMESPACE_BEGIN(CryptoPP) diff --git a/trunk/c5/pkcspad.cpp b/trunk/c5/pkcspad.cpp index ff4dbf5b..d90e4aba 100644 --- a/trunk/c5/pkcspad.cpp +++ b/trunk/c5/pkcspad.cpp @@ -2,6 +2,9 @@ #include "pch.h" +// prevent Sun's CC compiler from including this file automatically +#if !defined(__SUNPRO_CC) || defined(CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES) + #include "pkcspad.h" #include @@ -117,3 +120,5 @@ void PKCS1v15_SignatureMessageEncodingMethod::ComputeMessageRepresentative(Rando #endif NAMESPACE_END + +#endif diff --git a/trunk/c5/pubkey.h b/trunk/c5/pubkey.h index 5cdafa90..0204ba6b 100644 --- a/trunk/c5/pubkey.h +++ b/trunk/c5/pubkey.h @@ -807,9 +807,9 @@ public: void SetPrivateExponent(const Integer &x) {m_x = x;} // PKCS8PrivateKey - void BERDecodeKey(BufferedTransformation &bt) + void BERDecodePrivateKey(BufferedTransformation &bt, bool, size_t) {m_x.BERDecode(bt);} - void DEREncodeKey(BufferedTransformation &bt) const + void DEREncodePrivateKey(BufferedTransformation &bt) const {m_x.DEREncode(bt);} private: diff --git a/trunk/c5/rsa.cpp b/trunk/c5/rsa.cpp index 1f29f363..f1e728a6 100644 --- a/trunk/c5/rsa.cpp +++ b/trunk/c5/rsa.cpp @@ -45,7 +45,7 @@ OID RSAFunction::GetAlgorithmID() const return ASN1::rsaEncryption(); } -void RSAFunction::BERDecodeKey(BufferedTransformation &bt) +void RSAFunction::BERDecodePublicKey(BufferedTransformation &bt, bool, size_t) { BERSequenceDecoder seq(bt); m_n.BERDecode(seq); @@ -53,7 +53,7 @@ void RSAFunction::BERDecodeKey(BufferedTransformation &bt) seq.MessageEnd(); } -void RSAFunction::DEREncodeKey(BufferedTransformation &bt) const +void RSAFunction::DEREncodePublicKey(BufferedTransformation &bt) const { DERSequenceEncoder seq(bt); m_n.DEREncode(seq); @@ -189,7 +189,7 @@ void InvertibleRSAFunction::Initialize(const Integer &n, const Integer &e, const } } -void InvertibleRSAFunction::BERDecodeKey(BufferedTransformation &bt) +void InvertibleRSAFunction::BERDecodePrivateKey(BufferedTransformation &bt, bool, size_t) { BERSequenceDecoder privateKey(bt); word32 version; @@ -205,7 +205,7 @@ void InvertibleRSAFunction::BERDecodeKey(BufferedTransformation &bt) privateKey.MessageEnd(); } -void InvertibleRSAFunction::DEREncodeKey(BufferedTransformation &bt) const +void InvertibleRSAFunction::DEREncodePrivateKey(BufferedTransformation &bt) const { DERSequenceEncoder privateKey(bt); DEREncodeUnsigned(privateKey, 0); // version diff --git a/trunk/c5/rsa.h b/trunk/c5/rsa.h index 72c41de0..420a7bb3 100644 --- a/trunk/c5/rsa.h +++ b/trunk/c5/rsa.h @@ -25,8 +25,8 @@ public: // X509PublicKey OID GetAlgorithmID() const; - void BERDecodeKey(BufferedTransformation &bt); - void DEREncodeKey(BufferedTransformation &bt) const; + void BERDecodePublicKey(BufferedTransformation &bt, bool parametersPresent, size_t size); + void DEREncodePublicKey(BufferedTransformation &bt) const; // CryptoMaterial bool Validate(RandomNumberGenerator &rng, unsigned int level) const; @@ -66,8 +66,13 @@ public: {PKCS8PrivateKey::BERDecode(bt);} void DEREncode(BufferedTransformation &bt) const {PKCS8PrivateKey::DEREncode(bt);} - void BERDecodeKey(BufferedTransformation &bt); - void DEREncodeKey(BufferedTransformation &bt) const; + void Load(BufferedTransformation &bt) + {PKCS8PrivateKey::BERDecode(bt);} + void Save(BufferedTransformation &bt) const + {PKCS8PrivateKey::DEREncode(bt);} + OID GetAlgorithmID() const {return RSAFunction::GetAlgorithmID();} + void BERDecodePrivateKey(BufferedTransformation &bt, bool parametersPresent, size_t size); + void DEREncodePrivateKey(BufferedTransformation &bt) const; // TrapdoorFunctionInverse Integer CalculateInverse(RandomNumberGenerator &rng, const Integer &x) const; diff --git a/trunk/c5/rw.h b/trunk/c5/rw.h index 0fb12b78..ec8b8507 100644 --- a/trunk/c5/rw.h +++ b/trunk/c5/rw.h @@ -11,7 +11,7 @@ NAMESPACE_BEGIN(CryptoPP) //! _ -class CRYPTOPP_DLL RWFunction : virtual public TrapdoorFunction, public PublicKey +class CRYPTOPP_DLL RWFunction : public TrapdoorFunction, public PublicKey { typedef RWFunction ThisClass; diff --git a/trunk/c5/seal.cpp b/trunk/c5/seal.cpp index 34d45c8a..f240b50a 100644 --- a/trunk/c5/seal.cpp +++ b/trunk/c5/seal.cpp @@ -2,12 +2,14 @@ // updated to SEAL 3.0 by Leonard Janke #include "pch.h" + +// prevent Sun's CC compiler from including this file automatically +#if !(defined(__SUNPRO_CC) && defined(CRYPTOPP_ITERHASH_H)) + #include "seal.h" #include "sha.h" #include "misc.h" -#include "strciphr.cpp" - NAMESPACE_BEGIN(CryptoPP) void SEAL_TestInstantiations() @@ -209,3 +211,5 @@ template class SEAL_Policy; template class SEAL_Policy; NAMESPACE_END + +#endif diff --git a/trunk/c5/simple.h b/trunk/c5/simple.h index a37c6d16..d450876a 100644 --- a/trunk/c5/simple.h +++ b/trunk/c5/simple.h @@ -42,17 +42,6 @@ public: explicit InvalidRounds(const std::string &algorithm, unsigned int rounds) : InvalidArgument(algorithm + ": " + IntToString(rounds) + " is not a valid number of rounds") {} }; -//! _ -// TODO: look into this virtual inheritance -class CRYPTOPP_DLL ASN1CryptoMaterial : virtual public ASN1Object, virtual public CryptoMaterial -{ -public: - void Save(BufferedTransformation &bt) const - {BEREncode(bt);} - void Load(BufferedTransformation &bt) - {BERDecode(bt);} -}; - // ***************************** //! _ diff --git a/trunk/c5/strciphr.cpp b/trunk/c5/strciphr.cpp index 8e53e0cd..b25017e8 100644 --- a/trunk/c5/strciphr.cpp +++ b/trunk/c5/strciphr.cpp @@ -2,12 +2,27 @@ #include "pch.h" +// prevent Sun's CC compiler from including this file automatically +#if !defined(__SUNPRO_CC) || defined(CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES) + #ifndef CRYPTOPP_IMPORTS #include "strciphr.h" NAMESPACE_BEGIN(CryptoPP) +template +void AdditiveCipherTemplate::UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs ¶ms) +{ + PolicyInterface &policy = this->AccessPolicy(); + policy.CipherSetKey(params, key, length); + m_leftOver = 0; + m_buffer.New(GetBufferByteSize(policy)); + + if (this->IsResynchronizable()) + policy.CipherResynchronize(m_buffer, this->GetIVAndThrowIfInvalid(params)); +} + template byte AdditiveCipherTemplate::GenerateByte() { @@ -108,6 +123,18 @@ void AdditiveCipherTemplate::Seek(lword position) m_leftOver = 0; } +template +void CFB_CipherTemplate::UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs ¶ms) +{ + PolicyInterface &policy = this->AccessPolicy(); + policy.CipherSetKey(params, key, length); + + if (this->IsResynchronizable()) + policy.CipherResynchronize(this->GetIVAndThrowIfInvalid(params)); + + m_leftOver = policy.GetBytesPerIteration(); +} + template void CFB_CipherTemplate::Resynchronize(const byte *iv) { @@ -193,3 +220,5 @@ void CFB_DecryptionTemplate::CombineMessageAndShiftRegister(byte *output, NAMESPACE_END #endif + +#endif diff --git a/trunk/c5/strciphr.h b/trunk/c5/strciphr.h index ee5ba5df..d46f9ebc 100644 --- a/trunk/c5/strciphr.h +++ b/trunk/c5/strciphr.h @@ -279,30 +279,6 @@ public: Clonable * Clone() const {return static_cast(new SymmetricCipherFinal(*this));} }; -template -void AdditiveCipherTemplate::UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs ¶ms) -{ - PolicyInterface &policy = this->AccessPolicy(); - policy.CipherSetKey(params, key, length); - m_leftOver = 0; - m_buffer.New(GetBufferByteSize(policy)); - - if (this->IsResynchronizable()) - policy.CipherResynchronize(m_buffer, this->GetIVAndThrowIfInvalid(params)); -} - -template -void CFB_CipherTemplate::UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs ¶ms) -{ - PolicyInterface &policy = this->AccessPolicy(); - policy.CipherSetKey(params, key, length); - - if (this->IsResynchronizable()) - policy.CipherResynchronize(this->GetIVAndThrowIfInvalid(params)); - - m_leftOver = policy.GetBytesPerIteration(); -} - NAMESPACE_END #ifdef CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES @@ -312,10 +288,10 @@ NAMESPACE_END NAMESPACE_BEGIN(CryptoPP) CRYPTOPP_DLL_TEMPLATE_CLASS TwoBases; CRYPTOPP_DLL_TEMPLATE_CLASS AbstractPolicyHolder >; -CRYPTOPP_DLL_TEMPLATE_CLASS AdditiveCipherTemplate<>; +CRYPTOPP_DLL_TEMPLATE_CLASS AdditiveCipherTemplate > >; CRYPTOPP_DLL_TEMPLATE_CLASS CFB_CipherTemplate >; -CRYPTOPP_DLL_TEMPLATE_CLASS CFB_EncryptionTemplate<>; -CRYPTOPP_DLL_TEMPLATE_CLASS CFB_DecryptionTemplate<>; +CRYPTOPP_DLL_TEMPLATE_CLASS CFB_EncryptionTemplate >; +CRYPTOPP_DLL_TEMPLATE_CLASS CFB_DecryptionTemplate >; NAMESPACE_END #endif diff --git a/trunk/c5/validat1.cpp b/trunk/c5/validat1.cpp index 361aa9a1..8074e5ac 100644 --- a/trunk/c5/validat1.cpp +++ b/trunk/c5/validat1.cpp @@ -189,7 +189,7 @@ bool TestSettings() pass = false; } cout << "sizeof(word64) == " << sizeof(word64) << endl; -#elif CRYPTOPP_NATIVE_DWORD_AVAILABLE +#elif defined(CRYPTOPP_NATIVE_DWORD_AVAILABLE) if (sizeof(dword) >= 8) { cout << "FAILED: sizeof(dword) >= 8, but WORD64_AVAILABLE not defined" << endl; diff --git a/trunk/c5/validat2.cpp b/trunk/c5/validat2.cpp index 91649c62..28f77c6a 100644 --- a/trunk/c5/validat2.cpp +++ b/trunk/c5/validat2.cpp @@ -318,7 +318,7 @@ bool ValidateRSA() FileSource privFile("rsa400pv.dat", true, new HexDecoder); FileSource pubFile("rsa400pb.dat", true, new HexDecoder); RSAES_OAEP_SHA_Decryptor rsaPriv; - rsaPriv.AccessKey().BERDecodeKey(privFile); + rsaPriv.AccessKey().BERDecodePrivateKey(privFile, false, 0); RSAES_OAEP_SHA_Encryptor rsaPub(pubFile); memset(out, 0, 50); diff --git a/trunk/c5/wake.cpp b/trunk/c5/wake.cpp index 3c0f5578..2ada966c 100644 --- a/trunk/c5/wake.cpp +++ b/trunk/c5/wake.cpp @@ -3,8 +3,6 @@ #include "pch.h" #include "wake.h" -#include "strciphr.cpp" - NAMESPACE_BEGIN(CryptoPP) void WAKE_TestInstantiations() diff --git a/trunk/c5/xormac.h b/trunk/c5/xormac.h index cbd590c5..604b5fdd 100644 --- a/trunk/c5/xormac.h +++ b/trunk/c5/xormac.h @@ -12,7 +12,7 @@ NAMESPACE_BEGIN(CryptoPP) template struct DigestSizeSubtract4Workaround // VC60 workaround { - CRYPTOPP_CONSTANT(RESULT = T::DIGESTSIZE-4); + CRYPTOPP_CONSTANT(RESULT = T::DIGESTSIZE-4) }; template @@ -54,7 +54,7 @@ private: void HashEndianCorrectedBlock(const HashWordType *data); FixedSizeSecBlock::RESULT> m_key; - CRYPTOPP_CONSTANT(BUFFER_SIZE = (T::DIGESTSIZE / sizeof(HashWordType))); // VC60 workaround + CRYPTOPP_CONSTANT(BUFFER_SIZE = (T::DIGESTSIZE / sizeof(HashWordType))) // VC60 workaround #ifdef __BORLANDC__ FixedSizeSecBlock m_buffer; #else diff --git a/trunk/c5/zdeflate.cpp b/trunk/c5/zdeflate.cpp index 102dc4d8..199439a5 100644 --- a/trunk/c5/zdeflate.cpp +++ b/trunk/c5/zdeflate.cpp @@ -639,6 +639,8 @@ void Deflator::EncodeBlock(bool eof, unsigned int blockType) #if defined(_MSC_VER) && !defined(__MWERKS__) && (_MSC_VER < 1300) // VC60 workaround: built-in reverse_iterator has two template parameters, Dinkumware only has one typedef reverse_bidirectional_iterator RevIt; +#elif defined(_RWSTD_NO_CLASS_PARTIAL_SPEC) + typedef reverse_iterator RevIt; #else typedef reverse_iterator RevIt; #endif