Fix failed self test under Clang (GH #533)
This may cause GH #300, "Clang 3.9 and missing member definitions for template classes" or GH #294, "Fix clang warnings about undefined variable templates in pkcspad.h" to resurface. Man I hope not...pull/552/head
parent
b20a91f6b2
commit
4232cfd40b
|
|
@ -136,6 +136,7 @@ gost.cpp
|
|||
gost.h
|
||||
gzip.cpp
|
||||
gzip.h
|
||||
hashfwd.h
|
||||
hex.cpp
|
||||
hex.h
|
||||
hkdf.h
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ size_t BlockTransformation::AdvancedProcessBlocks(const byte *inBlocks, const by
|
|||
CRYPTOPP_ASSERT(outBlocks);
|
||||
CRYPTOPP_ASSERT(length);
|
||||
|
||||
const ptrdiff_t blockSize = static_cast<ptrdiff_t>(BlockSize());
|
||||
const size_t blockSize = BlockSize();
|
||||
ptrdiff_t inIncrement = (flags & (BT_InBlockIsCounter|BT_DontIncrementInOutPointers)) ? 0 : blockSize;
|
||||
ptrdiff_t xorIncrement = xorBlocks ? blockSize : 0;
|
||||
ptrdiff_t outIncrement = (flags & BT_DontIncrementInOutPointers) ? 0 : blockSize;
|
||||
|
|
|
|||
11
emsa2.h
11
emsa2.h
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
#include "cryptlib.h"
|
||||
#include "pubkey.h"
|
||||
#include "hashfwd.h"
|
||||
#include "misc.h"
|
||||
|
||||
#ifdef CRYPTOPP_IS_DLL
|
||||
|
|
@ -47,15 +48,7 @@ public:
|
|||
};
|
||||
|
||||
// EMSA2HashId can be instantiated with the following classes.
|
||||
class SHA1;
|
||||
class SHA224;
|
||||
class SHA256;
|
||||
class SHA384;
|
||||
class SHA512;
|
||||
class RIPEMD128;
|
||||
class RIPEMD160;
|
||||
class Whirlpool;
|
||||
// end of list
|
||||
// SHA1, SHA224, SHA256, SHA384, SHA512, RIPEMD128, RIPEMD160, Whirlpool
|
||||
|
||||
#ifdef CRYPTOPP_IS_DLL
|
||||
CRYPTOPP_DLL_TEMPLATE_CLASS EMSA2HashId<SHA1>;
|
||||
|
|
|
|||
|
|
@ -7,12 +7,13 @@
|
|||
|
||||
#include "pkcspad.h"
|
||||
#include "emsa2.h"
|
||||
#include "hashfwd.h"
|
||||
#include "misc.h"
|
||||
#include "trap.h"
|
||||
|
||||
NAMESPACE_BEGIN(CryptoPP)
|
||||
|
||||
// More in dll.cpp. Typedef/cast change due to Clang, http://github.com/weidai11/cryptopp/issues/300
|
||||
// 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 = (unsigned int)sizeof(PKCS_DigestDecoration<Weak1::MD2>::decoration);
|
||||
|
||||
|
|
|
|||
30
pkcspad.h
30
pkcspad.h
|
|
@ -2,13 +2,15 @@
|
|||
|
||||
/// \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.
|
||||
/// \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
|
||||
|
||||
#include "cryptlib.h"
|
||||
#include "pubkey.h"
|
||||
#include "hashfwd.h"
|
||||
|
||||
#ifdef CRYPTOPP_IS_DLL
|
||||
#include "sha.h"
|
||||
|
|
@ -40,24 +42,7 @@ public:
|
|||
|
||||
// PKCS_DigestDecoration can be instantiated with the following
|
||||
// classes as specified in PKCS #1 v2.0 and P1363a
|
||||
class SHA1;
|
||||
class SHA224;
|
||||
class SHA256;
|
||||
class SHA384;
|
||||
class SHA512;
|
||||
class Tiger;
|
||||
class RIPEMD160;
|
||||
|
||||
namespace Weak1 {
|
||||
class MD2;
|
||||
class MD5;
|
||||
}
|
||||
|
||||
// http://github.com/weidai11/cryptopp/issues/517
|
||||
class SHA3_256;
|
||||
class SHA3_384;
|
||||
class SHA3_512;
|
||||
// end of list
|
||||
// SHA1, SHA224, SHA256, SHA384, SHA512, Tiger, RIPEMD160, MD2, MD5
|
||||
|
||||
#if defined(CRYPTOPP_IS_DLL)
|
||||
CRYPTOPP_DLL_TEMPLATE_CLASS PKCS_DigestDecoration<SHA1>;
|
||||
|
|
@ -69,13 +54,6 @@ CRYPTOPP_DLL_TEMPLATE_CLASS PKCS_DigestDecoration<SHA512>;
|
|||
CRYPTOPP_DLL_TEMPLATE_CLASS PKCS_DigestDecoration<SHA3_256>;
|
||||
CRYPTOPP_DLL_TEMPLATE_CLASS PKCS_DigestDecoration<SHA3_384>;
|
||||
CRYPTOPP_DLL_TEMPLATE_CLASS PKCS_DigestDecoration<SHA3_512>;
|
||||
#elif defined(__clang__)
|
||||
// Provide a default definition to avoid Clang warnings. CRTP will provide a
|
||||
// real definition later. The single element is due to MSVC compile failures
|
||||
// after adding the default definition. However, GCC produces multiple
|
||||
// definitions which result in link failures. I give up...
|
||||
template <class H>
|
||||
const byte PKCS_DigestDecoration<H>::decoration[1] = {0x00};
|
||||
#endif
|
||||
|
||||
/// \class PKCS1v15_SignatureMessageEncodingMethod
|
||||
|
|
|
|||
4
pssr.cpp
4
pssr.cpp
|
|
@ -2,13 +2,15 @@
|
|||
|
||||
#include "pch.h"
|
||||
#include "pssr.h"
|
||||
#include "emsa2.h"
|
||||
#include "ripemd.h"
|
||||
#include "whrlpool.h"
|
||||
#include "misc.h"
|
||||
|
||||
#include <functional>
|
||||
|
||||
NAMESPACE_BEGIN(CryptoPP)
|
||||
|
||||
// more in dll.cpp
|
||||
template<> const byte EMSA2HashId<RIPEMD160>::id = 0x31;
|
||||
template<> const byte EMSA2HashId<RIPEMD128>::id = 0x32;
|
||||
template<> const byte EMSA2HashId<Whirlpool>::id = 0x37;
|
||||
|
|
|
|||
Loading…
Reference in New Issue