From f957eeb93b3dede5f52dcd73f32f3816e85b3c14 Mon Sep 17 00:00:00 2001 From: Xin LI Date: Mon, 2 Oct 2006 05:35:32 +0000 Subject: [PATCH] Add a patch from vendor which will hopefully fix gcc 4.1 build. Spotted by: pointyhat via portsmon --- security/cryptopp/Makefile | 4 +- .../cryptopp/files/patch-vendor-521-gcc41 | 392 ++++++++++++++++++ 2 files changed, 394 insertions(+), 2 deletions(-) create mode 100644 security/cryptopp/files/patch-vendor-521-gcc41 diff --git a/security/cryptopp/Makefile b/security/cryptopp/Makefile index 6257ce828ccf..14899f83e222 100644 --- a/security/cryptopp/Makefile +++ b/security/cryptopp/Makefile @@ -7,7 +7,7 @@ PORTNAME= cryptopp PORTVERSION= 5.2.1 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= security MASTER_SITES= ${MASTER_SITE_SOURCEFORGE} \ http://www.eskimo.com/~weidai/ \ @@ -30,7 +30,7 @@ CXXFLAGS+= -fPIC -O0 .include .if ${ARCH} == "alpha" && ${OSVERSION} < 500000 -BROKEN= "Internal compiler error on alpha 4.x" +BROKEN= Internal compiler error on alpha 4.x .endif pre-install: diff --git a/security/cryptopp/files/patch-vendor-521-gcc41 b/security/cryptopp/files/patch-vendor-521-gcc41 new file mode 100644 index 000000000000..398a4f704b8d --- /dev/null +++ b/security/cryptopp/files/patch-vendor-521-gcc41 @@ -0,0 +1,392 @@ +diff -u camellia.h camellia.h +--- camellia.h 2004-07-21 19:09:46.000000000 +0200 ++++ camellia.h 2006-04-02 17:43:42.000000000 +0200 +@@ -22,7 +22,7 @@ + /// Camellia + class Camellia : public Camellia_Info, public BlockCipherDocumentation + { +- class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl ++ class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl, public SimpledKeyed_Helper + { + public: + void UncheckedSetKey(CipherDir dir, const byte *key, unsigned int keylen); +diff -u cast.h cast.h +--- cast.h 2004-07-21 19:09:46.000000000 +0200 ++++ cast.h 2006-04-02 17:44:18.000000000 +0200 +@@ -24,7 +24,7 @@ + /// CAST-128 + class CAST128 : public CAST128_Info, public BlockCipherDocumentation + { +- class CRYPTOPP_NO_VTABLE Base : public CAST, public BlockCipherImpl ++ class CRYPTOPP_NO_VTABLE Base : public CAST, public BlockCipherImpl, public SimpledKeyed_Helper + { + public: + void UncheckedSetKey(CipherDir direction, const byte *userKey, unsigned int length); +@@ -60,7 +60,7 @@ + //! CAST-256 + class CAST256 : public CAST256_Info, public BlockCipherDocumentation + { +- class CRYPTOPP_NO_VTABLE Base : public CAST, public BlockCipherImpl ++ class CRYPTOPP_NO_VTABLE Base : public CAST, public BlockCipherImpl, public SimpledKeyed_Helper + { + public: + void UncheckedSetKey(CipherDir direction, const byte *userKey, unsigned int length = 8); +diff -u des.h des.h +--- des.h 2004-07-21 19:09:46.000000000 +0200 ++++ des.h 2006-04-02 17:45:11.000000000 +0200 +@@ -35,7 +35,7 @@ + check or correct the parity bits if you wish. */ + class DES : public DES_Info, public BlockCipherDocumentation + { +- class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl, public RawDES ++ class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl, public RawDES, public SimpledKeyed_Helper + { + public: + void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; +@@ -60,7 +60,7 @@ + /// DES-EDE2 + class DES_EDE2 : public DES_EDE2_Info, public BlockCipherDocumentation + { +- class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl ++ class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl, public SimpledKeyed_Helper + { + public: + void UncheckedSetKey(CipherDir direction, const byte *userKey, unsigned int length); +@@ -84,7 +84,7 @@ + /// DES-EDE3 + class DES_EDE3 : public DES_EDE3_Info, public BlockCipherDocumentation + { +- class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl ++ class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl, public SimpledKeyed_Helper + { + public: + void UncheckedSetKey(CipherDir dir, const byte *key, unsigned int length); +@@ -108,7 +108,7 @@ + /// DES-XEX3, AKA DESX + class DES_XEX3 : public DES_XEX3_Info, public BlockCipherDocumentation + { +- class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl ++ class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl, public SimpledKeyed_Helper + { + public: + void UncheckedSetKey(CipherDir dir, const byte *key, unsigned int length); +diff -u dll.cpp dll.cpp +--- dll.cpp 2004-06-20 11:22:24.000000000 +0200 ++++ dll.cpp 2006-04-02 17:42:50.000000000 +0200 +@@ -1,6 +1,10 @@ + // dll.cpp - written and placed in the public domain by Wei Dai + +-#define CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES ++#if defined( __GNUC__ ) && __GNUC__ > 3 ++# undef CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES ++#else ++# define CRYPTOPP_MANUALLY_INSTANTIATE_TEMPLATES ++#endif + #define CRYPTOPP_DEFAULT_NO_DLL + + #include "dll.h" +@@ -37,6 +41,79 @@ + CRYPTOPP_DLL_TEMPLATE_CLASS AbstractEuclideanDomain; + #endif + ++#if defined(__GNUC__) && __GNUC__ > 3 ++template class CRYPTOPP_DLL AbstractEuclideanDomain; ++template class CRYPTOPP_DLL AbstractEuclideanDomain; ++template class CRYPTOPP_DLL AbstractGroup; ++template class CRYPTOPP_DLL AbstractGroup; ++template class CRYPTOPP_DLL AbstractGroup; ++template class CRYPTOPP_DLL AbstractGroup; ++template class CRYPTOPP_DLL AbstractPolicyHolder, RandomNumberGenerator> >; ++template class CRYPTOPP_DLL AbstractRing; ++template class CRYPTOPP_DLL AbstractRing; ++template class CRYPTOPP_DLL AdditiveCipherTemplate<>; ++template class CRYPTOPP_DLL AdditiveCipherTemplate >; ++template class CRYPTOPP_DLL AdditiveCipherTemplate >; ++template class CRYPTOPP_DLL AllocatorWithCleanup; ++template class CRYPTOPP_DLL AllocatorWithCleanup; ++template class CRYPTOPP_DLL AllocatorWithCleanup; ++template class CRYPTOPP_DLL AutoSeededX917RNG; ++template class CRYPTOPP_DLL CFB_CipherTemplate >; ++template class CRYPTOPP_DLL CFB_CipherTemplate >; ++template class CRYPTOPP_DLL CFB_DecryptionTemplate<>; ++template class CRYPTOPP_DLL CFB_DecryptionTemplate >; ++template class CRYPTOPP_DLL CFB_EncryptionTemplate<>; ++template class CRYPTOPP_DLL CFB_EncryptionTemplate >; ++template class CRYPTOPP_DLL CipherModeFinalTemplate_ExternalCipher; ++template class CRYPTOPP_DLL CipherModeFinalTemplate_ExternalCipher; ++template class CRYPTOPP_DLL CipherModeFinalTemplate_ExternalCipher; ++template class CRYPTOPP_DLL CipherModeFinalTemplate_ExternalCipher; ++template class CRYPTOPP_DLL CipherModeFinalTemplate_ExternalCipher; ++template class CRYPTOPP_DLL DH_Domain; ++template class CRYPTOPP_DLL DL_Algorithm_GDSA; ++template class CRYPTOPP_DLL DL_Algorithm_GDSA; ++template class CRYPTOPP_DLL DL_Algorithm_GDSA; ++template class CRYPTOPP_DLL DL_FixedBasePrecomputationImpl; ++template class CRYPTOPP_DLL DL_FixedBasePrecomputationImpl; ++template class CRYPTOPP_DLL DL_FixedBasePrecomputationImpl; ++template class CRYPTOPP_DLL DL_GroupParameters; ++template class CRYPTOPP_DLL DL_GroupParameters_EC; ++template class CRYPTOPP_DLL DL_GroupParameters_EC; ++template class CRYPTOPP_DLL DL_GroupParameters_IntegerBasedImpl; ++template class CRYPTOPP_DLL DL_GroupPrecomputation; ++template class CRYPTOPP_DLL DL_GroupPrecomputation; ++template class CRYPTOPP_DLL DL_PrivateKeyImpl >; ++template class CRYPTOPP_DLL DL_PrivateKeyImpl >; ++template class CRYPTOPP_DLL DL_PrivateKey_EC; ++template class CRYPTOPP_DLL DL_PrivateKey_EC; ++template class CRYPTOPP_DLL DL_PrivateKey_GFP; ++template class CRYPTOPP_DLL DL_PrivateKey_WithSignaturePairwiseConsistencyTest, ECDSA >; ++template class CRYPTOPP_DLL DL_PrivateKey_WithSignaturePairwiseConsistencyTest, ECDSA >; ++template class CRYPTOPP_DLL DL_PrivateKey_WithSignaturePairwiseConsistencyTest, DSA>; ++template class CRYPTOPP_DLL DL_PublicKeyImpl >; ++template class CRYPTOPP_DLL DL_PublicKeyImpl >; ++template class CRYPTOPP_DLL DL_PublicKey_EC; ++template class CRYPTOPP_DLL DL_PublicKey_EC; ++template class CRYPTOPP_DLL DL_PublicKey_GFP; ++template class CRYPTOPP_DLL EuclideanDomainOf; ++template class CRYPTOPP_DLL IteratedHashBase; ++template class CRYPTOPP_DLL IteratedHashBase; ++#ifdef WORD64_AVAILABLE ++template class CRYPTOPP_DLL IteratedHashBase; ++template class CRYPTOPP_DLL IteratedHashBase; ++#endif ++template class CRYPTOPP_DLL OAEP; ++#ifdef CRYPTOPP_IS_DLL ++template class CRYPTOPP_DLL PKCS_DigestDecoration; ++#endif ++template class CRYPTOPP_DLL QuotientRing >; ++template class CRYPTOPP_DLL SimpleKeyedTransformation; ++template class CRYPTOPP_DLL SimpleKeyedTransformation; ++template class CRYPTOPP_DLL SimpleKeyedTransformation; ++template class CRYPTOPP_DLL StringSinkTemplate; ++template class CRYPTOPP_DLL TwoBases; ++#endif // __GNUC__ > 3 ++ + template<> const byte PKCS_DigestDecoration::decoration[] = {0x30,0x21,0x30,0x09,0x06,0x05,0x2B,0x0E,0x03,0x02,0x1A,0x05,0x00,0x04,0x14}; + template<> const unsigned int PKCS_DigestDecoration::length = sizeof(PKCS_DigestDecoration::decoration); + +diff -u gost.h gost.h +--- gost.h 2004-07-21 19:09:48.000000000 +0200 ++++ gost.h 2006-04-02 17:45:28.000000000 +0200 +@@ -18,7 +18,7 @@ + /// GOST + class GOST : public GOST_Info, public BlockCipherDocumentation + { +- class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl ++ class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl, public SimpledKeyed_Helper + { + public: + void UncheckedSetKey(CipherDir direction, const byte *userKey, unsigned int length); +diff -u hmac.h hmac.h +--- hmac.h 2004-07-21 19:09:48.000000000 +0200 ++++ hmac.h 2006-04-02 17:46:12.000000000 +0200 +@@ -9,7 +9,7 @@ + NAMESPACE_BEGIN(CryptoPP) + + //! _ +-class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE HMAC_Base : public VariableKeyLength<16, 0, UINT_MAX>, public MessageAuthenticationCode ++class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE HMAC_Base : public VariableKeyLength<16, 0, UINT_MAX>, public MessageAuthenticationCode, public SimpledKeyed_Helper + { + public: + HMAC_Base() : m_innerHashKeyed(false) {} +diff -u iterhash.h iterhash.h +--- iterhash.h 2004-07-21 19:09:48.000000000 +0200 ++++ iterhash.h 2006-04-02 17:35:27.000000000 +0200 +@@ -75,7 +75,7 @@ + class CRYPTOPP_NO_VTABLE IteratedHash : public IteratedHashBase2 + { + public: +- enum {BLOCKSIZE = T_BlockSize}; ++ enum GCC4FIX2 {BLOCKSIZE = T_BlockSize}; + CRYPTOPP_COMPILE_ASSERT((BLOCKSIZE & (BLOCKSIZE - 1)) == 0); // blockSize is a power of 2 + + protected: +@@ -88,7 +88,7 @@ + : public ClonableImpl, T_Transform> > + { + public: +- enum {DIGESTSIZE = T_DigestSize}; ++ enum GCC4FIX4 {DIGESTSIZE = T_DigestSize}; + unsigned int DigestSize() const {return DIGESTSIZE;}; + + protected: +diff -u lubyrack.h lubyrack.h +--- lubyrack.h 2004-07-21 19:09:48.000000000 +0200 ++++ lubyrack.h 2006-04-02 17:46:39.000000000 +0200 +@@ -23,7 +23,7 @@ + template + class LR : public LR_Info, public BlockCipherDocumentation + { +- class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl > ++ class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl >, public SimpledKeyed_Helper + { + public: + // VC60 workaround: have to define these functions within class definition +diff -u mars.h mars.h +--- mars.h 2004-07-21 19:09:48.000000000 +0200 ++++ mars.h 2006-04-02 17:47:09.000000000 +0200 +@@ -18,7 +18,7 @@ + /// MARS + class MARS : public MARS_Info, public BlockCipherDocumentation + { +- class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl ++ class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl, public SimpledKeyed_Helper + { + public: + void UncheckedSetKey(CipherDir direction, const byte *userKey, unsigned int length); +diff -u md5mac.h md5mac.h +--- md5mac.h 2004-07-21 19:09:48.000000000 +0200 ++++ md5mac.h 2006-04-02 17:47:30.000000000 +0200 +@@ -9,7 +9,7 @@ + + NAMESPACE_BEGIN(CryptoPP) + +-class CRYPTOPP_NO_VTABLE MD5MAC_Base : public FixedKeyLength<16>, public IteratedHash ++class CRYPTOPP_NO_VTABLE MD5MAC_Base : public FixedKeyLength<16>, public IteratedHash, public SimpledKeyed_Helper + { + public: + static std::string StaticAlgorithmName() {return "MD5-MAC";} +diff -u mdc.h mdc.h +--- mdc.h 2004-07-21 19:09:48.000000000 +0200 ++++ mdc.h 2006-04-02 17:47:53.000000000 +0200 +@@ -23,7 +23,7 @@ + template + class MDC : public MDC_Info + { +- class CRYPTOPP_NO_VTABLE Enc : public BlockCipherImpl > ++ class CRYPTOPP_NO_VTABLE Enc : public BlockCipherImpl >, public SimpledKeyed_Helper + { + typedef typename T::HashWordType HashWordType; + +diff -u rijndael.h rijndael.h +--- rijndael.h 2004-07-21 19:09:50.000000000 +0200 ++++ rijndael.h 2006-04-02 17:48:11.000000000 +0200 +@@ -18,7 +18,7 @@ + /// Rijndael + class CRYPTOPP_DLL Rijndael : public Rijndael_Info, public BlockCipherDocumentation + { +- class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl ++ class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl, public SimpledKeyed_Helper + { + public: + void UncheckedSetKey(CipherDir direction, const byte *userKey, unsigned int length); +diff -u seckey.h seckey.h +--- seckey.h 2004-07-21 19:09:50.000000000 +0200 ++++ seckey.h 2006-04-02 17:50:16.000000000 +0200 +@@ -21,7 +21,7 @@ + class FixedBlockSize + { + public: +- enum {BLOCKSIZE = N}; ++ enum GCC4FIX0 {BLOCKSIZE = N}; + }; + + // ************** rounds *************** +@@ -31,7 +31,7 @@ + class FixedRounds + { + public: +- enum {ROUNDS = R}; ++ enum GCC4FIX1 {ROUNDS = R}; + + protected: + template +@@ -50,7 +50,7 @@ + class VariableRounds + { + public: +- enum {DEFAULT_ROUNDS = D, MIN_ROUNDS = N, MAX_ROUNDS = M}; ++ enum GCC4FIX3 {DEFAULT_ROUNDS = D, MIN_ROUNDS = N, MAX_ROUNDS = M}; + static unsigned int StaticGetDefaultRounds(unsigned int keylength) {return DEFAULT_ROUNDS;} + + protected: +@@ -123,19 +123,21 @@ + + // ************** implementation helper for SimpledKeyed *************** + +-template +-static inline void CheckedSetKey(T *obj, Empty empty, const byte *key, unsigned int length, const NameValuePairs ¶m) +-{ +- obj->ThrowIfInvalidKeyLength(length); +- obj->UncheckedSetKey(key, length); +-} +- +-template +-static inline void CheckedSetKey(T *obj, CipherDir dir, const byte *key, unsigned int length, const NameValuePairs ¶m) +-{ +- obj->ThrowIfInvalidKeyLength(length); +- obj->UncheckedSetKey(dir, key, length); +-} ++struct SimpledKeyed_Helper { ++ template ++ static inline void CheckedSetKey(T *obj, Empty empty, const byte *key, unsigned int length, const NameValuePairs ¶m) ++ { ++ obj->ThrowIfInvalidKeyLength(length); ++ obj->UncheckedSetKey(key, length); ++ } ++ ++ template ++ static inline void CheckedSetKey(T *obj, CipherDir dir, const byte *key, unsigned int length, const NameValuePairs ¶m) ++ { ++ obj->ThrowIfInvalidKeyLength(length); ++ obj->UncheckedSetKey(dir, key, length); ++ } ++}; + + //! _ + template +@@ -176,7 +178,7 @@ + + void SetKey(const byte *key, unsigned int length, const NameValuePairs ¶m = g_nullNameValuePairs) + { +- CheckedSetKey(this, DIR, key, length, param); ++ BASE::CheckedSetKey(this, DIR, key, length, param); + } + }; + +@@ -187,7 +189,7 @@ + public: + void SetKey(const byte *key, unsigned int length, const NameValuePairs ¶ms = g_nullNameValuePairs) + { +- CheckedSetKey(this, Empty(), key, length, params); ++ BASE::CheckedSetKey(this, Empty(), key, length, params); + } + }; + +diff -u shacal2.h shacal2.h +--- shacal2.h 2004-07-21 19:09:50.000000000 +0200 ++++ shacal2.h 2006-04-02 18:01:39.000000000 +0200 +@@ -18,7 +18,7 @@ + /// SHACAL-2 + class SHACAL2 : public SHACAL2_Info, public BlockCipherDocumentation + { +- class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl ++ class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl, public SimpledKeyed_Helper + { + public: + void UncheckedSetKey(CipherDir direction, const byte *userKey, unsigned int length); +diff -u skipjack.h skipjack.h +--- skipjack.h 2004-07-21 19:09:50.000000000 +0200 ++++ skipjack.h 2006-04-02 18:01:57.000000000 +0200 +@@ -18,7 +18,7 @@ + /// SKIPJACK + class SKIPJACK : public SKIPJACK_Info, public BlockCipherDocumentation + { +- class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl ++ class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl, public SimpledKeyed_Helper + { + public: + void UncheckedSetKey(CipherDir direction, const byte *userKey, unsigned int length); +Common subdirectories: TestVectors and TestVectors +diff -u ttmac.h ttmac.h +--- ttmac.h 2004-07-21 19:09:50.000000000 +0200 ++++ ttmac.h 2006-04-02 18:02:12.000000000 +0200 +@@ -9,7 +9,7 @@ + NAMESPACE_BEGIN(CryptoPP) + + //! _ +-class CRYPTOPP_NO_VTABLE TTMAC_Base : public FixedKeyLength<20>, public IteratedHash ++class CRYPTOPP_NO_VTABLE TTMAC_Base : public FixedKeyLength<20>, public IteratedHash, public SimpledKeyed_Helper + { + public: + static std::string StaticAlgorithmName() {return std::string("Two-Track-MAC");}