Skip to content

Commit

Permalink
Fix "X causes a section type conflict with Y" for GCC on AIX (GH #499)
Browse files Browse the repository at this point in the history
These surfaced during testing with cryptest.sh
  • Loading branch information
noloader committed Sep 17, 2017
1 parent 3e23754 commit 7097546
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 deletions.
6 changes: 5 additions & 1 deletion eccrypto.h
Expand Up @@ -215,7 +215,7 @@ class DL_PrivateKey_EC : public DL_PrivateKeyImpl<DL_GroupParameters_EC<EC> >
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
Expand Down Expand Up @@ -258,6 +258,10 @@ class DL_PrivateKey_EC : public DL_PrivateKeyImpl<DL_GroupParameters_EC<EC> >
void DEREncodePrivateKey(BufferedTransformation &bt) const;
};

// Out-of-line dtor due to AIX and GCC, http://github.com/weidai11/cryptopp/issues/499
template<class EC>
DL_PrivateKey_EC<EC>::~DL_PrivateKey_EC() {}

//! \class ECDH
//! \brief Elliptic Curve Diffie-Hellman
//! \tparam EC elliptic curve field
Expand Down
24 changes: 18 additions & 6 deletions pubkey.h
Expand Up @@ -996,7 +996,7 @@ class CRYPTOPP_NO_VTABLE DL_PublicKey : public DL_Key<T>
public:
typedef T Element;

virtual ~DL_PublicKey() {}
virtual ~DL_PublicKey();

bool GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const
{
Expand Down Expand Up @@ -1024,6 +1024,10 @@ class CRYPTOPP_NO_VTABLE DL_PublicKey : public DL_Key<T>
virtual DL_FixedBasePrecomputation<T> & AccessPublicPrecomputation() =0;
};

// Out-of-line dtor due to AIX and GCC, http://github.com/weidai11/cryptopp/issues/499
template<class T>
DL_PublicKey<T>::~DL_PublicKey() {}

//! \brief Interface for Discrete Log (DL) private keys
template <class T>
class CRYPTOPP_NO_VTABLE DL_PrivateKey : public DL_Key<T>
Expand All @@ -1033,7 +1037,7 @@ class CRYPTOPP_NO_VTABLE DL_PrivateKey : public DL_Key<T>
public:
typedef T Element;

virtual ~DL_PrivateKey() {}
virtual ~DL_PrivateKey();

void MakePublicKey(DL_PublicKey<T> &pub) const
{
Expand All @@ -1058,6 +1062,10 @@ class CRYPTOPP_NO_VTABLE DL_PrivateKey : public DL_Key<T>
virtual void SetPrivateExponent(const Integer &x) =0;
};

// Out-of-line dtor due to AIX and GCC, http://github.com/weidai11/cryptopp/issues/499
template<class T>
DL_PrivateKey<T>::~DL_PrivateKey() {}

template <class T>
void DL_PublicKey<T>::AssignFrom(const NameValuePairs &source)
{
Expand All @@ -1074,7 +1082,7 @@ void DL_PublicKey<T>::AssignFrom(const NameValuePairs &source)

class OID;

//! _
//! \brief Discrete Log (DL) key base implementation
template <class PK, class GP, class O = OID>
class DL_KeyImpl : public PK
{
Expand All @@ -1099,7 +1107,7 @@ class DL_KeyImpl : public PK
class X509PublicKey;
class PKCS8PrivateKey;

//! _
//! \brief Discrete Log (DL) private key base implementation
template <class GP>
class DL_PrivateKeyImpl : public DL_PrivateKey<typename GP::Element>, public DL_KeyImpl<PKCS8PrivateKey, GP>
{
Expand Down Expand Up @@ -1189,14 +1197,14 @@ class DL_PrivateKey_WithSignaturePairwiseConsistencyTest : public BASE
}
};

//! _
//! \brief Discrete Log (DL) public key base implementation
template <class GP>
class DL_PublicKeyImpl : public DL_PublicKey<typename GP::Element>, public DL_KeyImpl<X509PublicKey, GP>
{
public:
typedef typename GP::Element Element;

virtual ~DL_PublicKeyImpl() {}
virtual ~DL_PublicKeyImpl();

// CryptoMaterial
bool Validate(RandomNumberGenerator &rng, unsigned int level) const
Expand Down Expand Up @@ -1252,6 +1260,10 @@ class DL_PublicKeyImpl : public DL_PublicKey<typename GP::Element>, public DL_Ke
typename GP::BasePrecomputation m_ypc;
};

// Out-of-line dtor due to AIX and GCC, http://github.com/weidai11/cryptopp/issues/499
template<class GP>
DL_PublicKeyImpl<GP>::~DL_PublicKeyImpl() {}

//! \brief Interface for Elgamal-like signature algorithms
template <class T>
class CRYPTOPP_NO_VTABLE DL_ElgamalLikeSignatureAlgorithm
Expand Down

0 comments on commit 7097546

Please sign in to comment.