Hi Everyone,
We had some problems with Clang warnings at Clang 3.8. A sample is shown below. We cleared them at
https://github.com/weidai11/cryptopp/pull/294 and
https://github.com/weidai11/cryptopp/issues/300 .
Later we found we broke a couple of platforms at
https://github.com/weidai11/cryptopp/issues/533. Two runtime tests failed on some lesser used platforms.
We had to effectively back-out the fixes for #294 and #300 because we can't produce incorrect results like #533.
We are looking for a fix that does not break things. Until we find one we will have to tolerate a noisy Clang compile.
Jeff
****************************************
Conceptually here is what we want to do in a header file:
template <class H> class PKCS_DigestDecoration |
static const byte decoration[]; |
static const unsigned int length; |
};
template<>
PKCS_DigestDecoration<SHA1>::decoration[] = {...}template<>
PKCS_DigestDecoration<SHA256>::decoration[] = {...}
The problem is, it violates the One Definition Rule (ODR) and leads to duplicate symbols in several object files. And wrapping the definition in an unnamed namespace fails to compile (though it precisely expresses what we want to do):
namespace {
template<>
PKCS_DigestDecoration<SHA1>::decoration[] = {...}
template<>
PKCS_DigestDecoration<SHA256>::decoration[] = {...}
};
****************************************
In file included from rsa.cpp:4:
In file included from ./rsa.h:14:
./pkcspad.h:81:53: warning: instantiation of variable
'CryptoPP::PKCS_DigestDecoration<CryptoPP::SHA1>::decoration' required
here, but no definition is available [-Wundefined-var-template]
...return HashIdentifier(PKCS_DigestDecoration<H>::decoration, PKCS_DigestD...
^
./pubkey.h:627:19: note: in instantiation of member function
'CryptoPP::PKCS1v15_SignatureMessageEncodingMethod::HashIdentifierLookup::HashIdentifierLookup2<CryptoPP::SHA1>::Lookup'
requested here
return L::Lookup();
^
./pubkey.h:2108:26: note: in instantiation of member function
'CryptoPP::TF_ObjectImplBase<CryptoPP::TF_SignerBase,
CryptoPP::TF_SignatureSchemeOptions<CryptoPP::TF_SS<CryptoPP::RSA,
CryptoPP::PKCS1v15, CryptoPP::SHA1, int>, CryptoPP::RSA,
CryptoPP::PKCS1v15_SignatureMessageEncodingMethod, CryptoPP::SHA1>,
CryptoPP::InvertibleRSAFunction>::GetHashIdentifier' requested here
class CRYPTOPP_NO_VTABLE PK_FinalTemplate : public BASE
^
./pkcspad.h:39:20: note: forward declaration of template entity is here
static const byte decoration[];
^