From 7097546cfcf742cfd7b60af6bbe95173f9238f40 Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Sun, 17 Sep 2017 07:08:14 -0400 Subject: [PATCH] Fix "X causes a section type conflict with Y" for GCC on AIX (GH #499) These surfaced during testing with cryptest.sh --- eccrypto.h | 6 +++++- pubkey.h | 24 ++++++++++++++++++------ 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/eccrypto.h b/eccrypto.h index 1952e081..ae2688bf 100644 --- a/eccrypto.h +++ b/eccrypto.h @@ -215,7 +215,7 @@ class DL_PrivateKey_EC : public DL_PrivateKeyImpl > public: typedef typename EC::Point Element; - virtual ~DL_PrivateKey_EC() {} + virtual ~DL_PrivateKey_EC(); //! \brief Initialize an EC Private Key using {GP,x} //! \param params group parameters @@ -258,6 +258,10 @@ public: void DEREncodePrivateKey(BufferedTransformation &bt) const; }; +// Out-of-line dtor due to AIX and GCC, http://github.com/weidai11/cryptopp/issues/499 +template +DL_PrivateKey_EC::~DL_PrivateKey_EC() {} + //! \class ECDH //! \brief Elliptic Curve Diffie-Hellman //! \tparam EC elliptic curve field diff --git a/pubkey.h b/pubkey.h index b6dd75a2..d24d67d9 100644 --- a/pubkey.h +++ b/pubkey.h @@ -996,7 +996,7 @@ class CRYPTOPP_NO_VTABLE DL_PublicKey : public DL_Key public: typedef T Element; - virtual ~DL_PublicKey() {} + virtual ~DL_PublicKey(); bool GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const { @@ -1024,6 +1024,10 @@ public: virtual DL_FixedBasePrecomputation & AccessPublicPrecomputation() =0; }; +// Out-of-line dtor due to AIX and GCC, http://github.com/weidai11/cryptopp/issues/499 +template +DL_PublicKey::~DL_PublicKey() {} + //! \brief Interface for Discrete Log (DL) private keys template class CRYPTOPP_NO_VTABLE DL_PrivateKey : public DL_Key @@ -1033,7 +1037,7 @@ class CRYPTOPP_NO_VTABLE DL_PrivateKey : public DL_Key public: typedef T Element; - virtual ~DL_PrivateKey() {} + virtual ~DL_PrivateKey(); void MakePublicKey(DL_PublicKey &pub) const { @@ -1058,6 +1062,10 @@ public: virtual void SetPrivateExponent(const Integer &x) =0; }; +// Out-of-line dtor due to AIX and GCC, http://github.com/weidai11/cryptopp/issues/499 +template +DL_PrivateKey::~DL_PrivateKey() {} + template void DL_PublicKey::AssignFrom(const NameValuePairs &source) { @@ -1074,7 +1082,7 @@ void DL_PublicKey::AssignFrom(const NameValuePairs &source) class OID; -//! _ +//! \brief Discrete Log (DL) key base implementation template class DL_KeyImpl : public PK { @@ -1099,7 +1107,7 @@ private: class X509PublicKey; class PKCS8PrivateKey; -//! _ +//! \brief Discrete Log (DL) private key base implementation template class DL_PrivateKeyImpl : public DL_PrivateKey, public DL_KeyImpl { @@ -1189,14 +1197,14 @@ public: } }; -//! _ +//! \brief Discrete Log (DL) public key base implementation template class DL_PublicKeyImpl : public DL_PublicKey, public DL_KeyImpl { public: typedef typename GP::Element Element; - virtual ~DL_PublicKeyImpl() {} + virtual ~DL_PublicKeyImpl(); // CryptoMaterial bool Validate(RandomNumberGenerator &rng, unsigned int level) const @@ -1252,6 +1260,10 @@ private: typename GP::BasePrecomputation m_ypc; }; +// Out-of-line dtor due to AIX and GCC, http://github.com/weidai11/cryptopp/issues/499 +template +DL_PublicKeyImpl::~DL_PublicKeyImpl() {} + //! \brief Interface for Elgamal-like signature algorithms template class CRYPTOPP_NO_VTABLE DL_ElgamalLikeSignatureAlgorithm