Clang 3.9 and missing member definitions for template classes (Issue 300)
parent
e0651b458f
commit
15855226fa
4
dll.cpp
4
dll.cpp
|
|
@ -23,6 +23,8 @@
|
|||
|
||||
NAMESPACE_BEGIN(CryptoPP)
|
||||
|
||||
// Guarding based on DLL due to Clang, http://github.com/weidai11/cryptopp/issues/300
|
||||
#if defined(CRYPTOPP_IS_DLL)
|
||||
template<> const byte PKCS_DigestDecoration<SHA1>::decoration[] = {0x30,0x21,0x30,0x09,0x06,0x05,0x2B,0x0E,0x03,0x02,0x1A,0x05,0x00,0x04,0x14};
|
||||
template<> const unsigned int PKCS_DigestDecoration<SHA1>::length = sizeof(PKCS_DigestDecoration<SHA1>::decoration);
|
||||
|
||||
|
|
@ -44,6 +46,8 @@ template<> const byte EMSA2HashId<SHA256>::id = 0x34;
|
|||
template<> const byte EMSA2HashId<SHA384>::id = 0x36;
|
||||
template<> const byte EMSA2HashId<SHA512>::id = 0x35;
|
||||
|
||||
#endif // CRYPTOPP_IS_DLL
|
||||
|
||||
NAMESPACE_END
|
||||
|
||||
#endif
|
||||
|
|
|
|||
8
emsa2.h
8
emsa2.h
|
|
@ -11,7 +11,7 @@
|
|||
#include "misc.h"
|
||||
|
||||
#ifdef CRYPTOPP_IS_DLL
|
||||
#include "sha.h"
|
||||
# include "sha.h"
|
||||
#endif
|
||||
|
||||
NAMESPACE_BEGIN(CryptoPP)
|
||||
|
|
@ -40,13 +40,13 @@ public:
|
|||
|
||||
// EMSA2HashId can be instantiated with the following classes.
|
||||
class SHA1;
|
||||
class RIPEMD160;
|
||||
class RIPEMD128;
|
||||
class SHA224;
|
||||
class SHA256;
|
||||
class SHA384;
|
||||
class SHA512;
|
||||
class RIPEMD128;
|
||||
class RIPEMD160;
|
||||
class Whirlpool;
|
||||
class SHA224;
|
||||
// end of list
|
||||
|
||||
#ifdef CRYPTOPP_IS_DLL
|
||||
|
|
|
|||
35
pkcspad.cpp
35
pkcspad.cpp
|
|
@ -6,23 +6,48 @@
|
|||
#define CRYPTOPP_PKCSPAD_CPP
|
||||
|
||||
#include "pkcspad.h"
|
||||
#include "emsa2.h"
|
||||
#include "misc.h"
|
||||
#include "trap.h"
|
||||
|
||||
NAMESPACE_BEGIN(CryptoPP)
|
||||
|
||||
// more in dll.cpp
|
||||
// More in dll.cpp. Typedef/cast change due to Clang, http://github.com/weidai11/cryptopp/issues/300
|
||||
template<> const byte PKCS_DigestDecoration<Weak1::MD2>::decoration[] = {0x30,0x20,0x30,0x0c,0x06,0x08,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x02,0x02,0x05,0x00,0x04,0x10};
|
||||
template<> const unsigned int PKCS_DigestDecoration<Weak1::MD2>::length = sizeof(PKCS_DigestDecoration<Weak1::MD2>::decoration);
|
||||
template<> const unsigned int PKCS_DigestDecoration<Weak1::MD2>::length = (unsigned int)sizeof(PKCS_DigestDecoration<Weak1::MD2>::decoration);
|
||||
|
||||
template<> const byte PKCS_DigestDecoration<Weak1::MD5>::decoration[] = {0x30,0x20,0x30,0x0c,0x06,0x08,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x02,0x05,0x05,0x00,0x04,0x10};
|
||||
template<> const unsigned int PKCS_DigestDecoration<Weak1::MD5>::length = sizeof(PKCS_DigestDecoration<Weak1::MD5>::decoration);
|
||||
template<> const unsigned int PKCS_DigestDecoration<Weak1::MD5>::length = (unsigned int)sizeof(PKCS_DigestDecoration<Weak1::MD5>::decoration);
|
||||
|
||||
template<> const byte PKCS_DigestDecoration<RIPEMD160>::decoration[] = {0x30,0x21,0x30,0x09,0x06,0x05,0x2b,0x24,0x03,0x02,0x01,0x05,0x00,0x04,0x14};
|
||||
template<> const unsigned int PKCS_DigestDecoration<RIPEMD160>::length = sizeof(PKCS_DigestDecoration<RIPEMD160>::decoration);
|
||||
template<> const unsigned int PKCS_DigestDecoration<RIPEMD160>::length = (unsigned int)sizeof(PKCS_DigestDecoration<RIPEMD160>::decoration);
|
||||
|
||||
template<> const byte PKCS_DigestDecoration<Tiger>::decoration[] = {0x30,0x29,0x30,0x0D,0x06,0x09,0x2B,0x06,0x01,0x04,0x01,0xDA,0x47,0x0C,0x02,0x05,0x00,0x04,0x18};
|
||||
template<> const unsigned int PKCS_DigestDecoration<Tiger>::length = sizeof(PKCS_DigestDecoration<Tiger>::decoration);
|
||||
template<> const unsigned int PKCS_DigestDecoration<Tiger>::length = (unsigned int)sizeof(PKCS_DigestDecoration<Tiger>::decoration);
|
||||
|
||||
// Inclusion based on DLL due to Clang, http://github.com/weidai11/cryptopp/issues/300
|
||||
#ifndef CRYPTOPP_IS_DLL
|
||||
template<> const byte PKCS_DigestDecoration<SHA1>::decoration[] = {0x30,0x21,0x30,0x09,0x06,0x05,0x2B,0x0E,0x03,0x02,0x1A,0x05,0x00,0x04,0x14};
|
||||
template<> const unsigned int PKCS_DigestDecoration<SHA1>::length = (unsigned int)sizeof(PKCS_DigestDecoration<SHA1>::decoration);
|
||||
|
||||
template<> const byte PKCS_DigestDecoration<SHA224>::decoration[] = {0x30,0x2d,0x30,0x0d,0x06,0x09,0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x04,0x05,0x00,0x04,0x1c};
|
||||
template<> const unsigned int PKCS_DigestDecoration<SHA224>::length = (unsigned int)sizeof(PKCS_DigestDecoration<SHA224>::decoration);
|
||||
|
||||
template<> const byte PKCS_DigestDecoration<SHA256>::decoration[] = {0x30,0x31,0x30,0x0d,0x06,0x09,0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x01,0x05,0x00,0x04,0x20};
|
||||
template<> const unsigned int PKCS_DigestDecoration<SHA256>::length = (unsigned int)sizeof(PKCS_DigestDecoration<SHA256>::decoration);
|
||||
|
||||
template<> const byte PKCS_DigestDecoration<SHA384>::decoration[] = {0x30,0x41,0x30,0x0d,0x06,0x09,0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x02,0x05,0x00,0x04,0x30};
|
||||
template<> const unsigned int PKCS_DigestDecoration<SHA384>::length = (unsigned int)sizeof(PKCS_DigestDecoration<SHA384>::decoration);
|
||||
|
||||
template<> const byte PKCS_DigestDecoration<SHA512>::decoration[] = {0x30,0x51,0x30,0x0d,0x06,0x09,0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x03,0x05,0x00,0x04,0x40};
|
||||
template<> const unsigned int PKCS_DigestDecoration<SHA512>::length = (unsigned int)sizeof(PKCS_DigestDecoration<SHA512>::decoration);
|
||||
|
||||
template<> const byte EMSA2HashId<SHA1>::id = 0x33;
|
||||
template<> const byte EMSA2HashId<SHA224>::id = 0x38;
|
||||
template<> const byte EMSA2HashId<SHA256>::id = 0x34;
|
||||
template<> const byte EMSA2HashId<SHA384>::id = 0x36;
|
||||
template<> const byte EMSA2HashId<SHA512>::id = 0x35;
|
||||
#endif
|
||||
|
||||
size_t PKCS_EncryptionPaddingScheme::MaxUnpaddedLength(size_t paddedLength) const
|
||||
{
|
||||
|
|
|
|||
19
pkcspad.h
19
pkcspad.h
|
|
@ -1,7 +1,8 @@
|
|||
// pkcspad.h - written and placed in the public domain by Wei Dai
|
||||
|
||||
//! \headerfile pkcspad.h
|
||||
//! \file pkcspad.h
|
||||
//! \brief Classes for PKCS padding schemes
|
||||
//! \details PKCS#1 v1.5, v2.0 and P1363a allow MD2, MD5, SHA1, SHA224, SHA256, SHA384, SHA512, Tiger and RipeMd-160 to be instantiated.
|
||||
|
||||
#ifndef CRYPTOPP_PKCSPAD_H
|
||||
#define CRYPTOPP_PKCSPAD_H
|
||||
|
|
@ -15,7 +16,9 @@
|
|||
|
||||
NAMESPACE_BEGIN(CryptoPP)
|
||||
|
||||
//! <a href="http://www.weidai.com/scan-mirror/ca.html#cem_PKCS1-1.5">EME-PKCS1-v1_5</a>
|
||||
//! \class PKCS_EncryptionPaddingScheme
|
||||
//! \brief PKCS#1 v1.5 Encryption Padding Scheme
|
||||
//! \sa <a href="http://www.weidai.com/scan-mirror/ca.html#cem_PKCS1-1.5">EME-PKCS1-v1_5</a>
|
||||
class PKCS_EncryptionPaddingScheme : public PK_EncryptionMessageEncodingMethod
|
||||
{
|
||||
public:
|
||||
|
|
@ -26,6 +29,8 @@ public:
|
|||
DecodingResult Unpad(const byte *padded, size_t paddedLength, byte *raw, const NameValuePairs ¶meters) const;
|
||||
};
|
||||
|
||||
//! \class PKCS_DigestDecoration
|
||||
//! \brief PKCS#1 decoration data structure
|
||||
template <class H> class PKCS_DigestDecoration
|
||||
{
|
||||
public:
|
||||
|
|
@ -36,12 +41,12 @@ public:
|
|||
// PKCS_DigestDecoration can be instantiated with the following
|
||||
// classes as specified in PKCS#1 v2.0 and P1363a
|
||||
class SHA1;
|
||||
class RIPEMD160;
|
||||
class Tiger;
|
||||
class SHA224;
|
||||
class SHA256;
|
||||
class SHA384;
|
||||
class SHA512;
|
||||
class Tiger;
|
||||
class RIPEMD160;
|
||||
namespace Weak1 {
|
||||
class MD2;
|
||||
class MD5;
|
||||
|
|
@ -56,7 +61,9 @@ CRYPTOPP_DLL_TEMPLATE_CLASS PKCS_DigestDecoration<SHA384>;
|
|||
CRYPTOPP_DLL_TEMPLATE_CLASS PKCS_DigestDecoration<SHA512>;
|
||||
#endif
|
||||
|
||||
//! <a href="http://www.weidai.com/scan-mirror/sig.html#sem_PKCS1-1.5">EMSA-PKCS1-v1_5</a>
|
||||
//! \class PKCS1v15_SignatureMessageEncodingMethod
|
||||
//! \brief PKCS#1 v1.5 Signature Encoding Scheme
|
||||
//! \sa <a href="http://www.weidai.com/scan-mirror/sig.html#sem_PKCS1-1.5">EMSA-PKCS1-v1_5</a>
|
||||
class CRYPTOPP_DLL PKCS1v15_SignatureMessageEncodingMethod : public PK_DeterministicSignatureMessageEncodingMethod
|
||||
{
|
||||
public:
|
||||
|
|
@ -76,7 +83,7 @@ public:
|
|||
{
|
||||
static HashIdentifier Lookup()
|
||||
{
|
||||
return HashIdentifier(PKCS_DigestDecoration<H>::decoration, (size_t)PKCS_DigestDecoration<H>::length);
|
||||
return HashIdentifier(PKCS_DigestDecoration<H>::decoration, PKCS_DigestDecoration<H>::length);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
|
|
|||
3
pubkey.h
3
pubkey.h
|
|
@ -327,7 +327,8 @@ public:
|
|||
|
||||
// ********************************************************
|
||||
|
||||
typedef std::pair<const byte *, size_t> HashIdentifier;
|
||||
// Typedef change due to Clang, http://github.com/weidai11/cryptopp/issues/300
|
||||
typedef std::pair<const byte *, unsigned int> HashIdentifier;
|
||||
|
||||
//! \class PK_SignatureMessageEncodingMethod
|
||||
//! \brief Interface for message encoding method for public key signature schemes.
|
||||
|
|
|
|||
Loading…
Reference in New Issue