Initial fix for older Apple ld's non_lazy_ptr missing symbols (Issue 255)

pull/131/merge
Jeffrey Walton 2016-09-06 02:51:16 -04:00
parent 33522b39b1
commit 45323bddd8
25 changed files with 245 additions and 112 deletions

View File

@ -15,6 +15,11 @@ void ThreeWay_TestInstantiations()
} }
#endif #endif
// Hack for OS X 10.5 ld, http://github.com/weidai11/cryptopp/issues/255
static const size_t s_unused1 = ThreeWay::KEYLENGTH;
static const size_t s_unused2 = ThreeWayEncryption::KEYLENGTH;
static const size_t s_unused3 = ThreeWayDecryption::KEYLENGTH;
static const word32 START_E = 0x0b0b; // round constant of first encryption round static const word32 START_E = 0x0b0b; // round constant of first encryption round
static const word32 START_D = 0xb1b1; // round constant of first decryption round static const word32 START_D = 0xb1b1; // round constant of first decryption round
#ifdef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562 #ifdef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562

View File

@ -20,6 +20,12 @@
NAMESPACE_BEGIN(CryptoPP) NAMESPACE_BEGIN(CryptoPP)
// Hack for OS X 10.5 ld, http://github.com/weidai11/cryptopp/issues/255
static const size_t s_unused1 = DES::KEYLENGTH;
static const size_t s_unused2 = DES_EDE2::KEYLENGTH;
static const size_t s_unused3 = DES_EDE3::KEYLENGTH;
static const size_t s_unused4 = DES_XEX3::KEYLENGTH;
typedef BlockGetAndPut<word32, BigEndian> Block; typedef BlockGetAndPut<word32, BigEndian> Block;
// Richard Outerbridge's initial permutation algorithm // Richard Outerbridge's initial permutation algorithm

10
des.h
View File

@ -35,12 +35,14 @@ struct DES_Info : public FixedBlockSize<8>, public FixedKeyLength<8>
//! \class DES //! \class DES
//! \brief DES block cipher //! \brief DES block cipher
//! \details The DES implementation in Crypto++ ignores the parity bits //! \details The DES implementation in Crypto++ ignores the parity bits
//! (the least significant bits of each byte) in the key. However you can use CheckKeyParityBits() //! (the least significant bits of each byte) in the key. However you can use CheckKeyParityBits()
//! and CorrectKeyParityBits() to check or correct the parity bits if you wish. //! and CorrectKeyParityBits() to check or correct the parity bits if you wish.
//! \sa <a href="http://www.weidai.com/scan-mirror/cs.html#DES">DES</a> //! \sa <a href="http://www.weidai.com/scan-mirror/cs.html#DES">DES</a>
class DES : public DES_Info, public BlockCipherDocumentation class DES : public DES_Info, public BlockCipherDocumentation
{ {
//! \class Base
//! \brief DES block cipher default operation
class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<DES_Info>, public RawDES class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<DES_Info>, public RawDES
{ {
public: public:
@ -70,6 +72,8 @@ struct DES_EDE2_Info : public FixedBlockSize<8>, public FixedKeyLength<16>
/// \sa <a href="http://www.weidai.com/scan-mirror/cs.html#DESede">DES-EDE2</a> /// \sa <a href="http://www.weidai.com/scan-mirror/cs.html#DESede">DES-EDE2</a>
class DES_EDE2 : public DES_EDE2_Info, public BlockCipherDocumentation class DES_EDE2 : public DES_EDE2_Info, public BlockCipherDocumentation
{ {
//! \class Base
//! \brief DES_EDE2 block cipher default operation
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<DES_EDE2_Info> class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<DES_EDE2_Info>
{ {
public: public:
@ -97,6 +101,8 @@ struct DES_EDE3_Info : public FixedBlockSize<8>, public FixedKeyLength<24>
//! \sa <a href="http://www.weidai.com/scan-mirror/cs.html#DESede">DES-EDE3</a> //! \sa <a href="http://www.weidai.com/scan-mirror/cs.html#DESede">DES-EDE3</a>
class DES_EDE3 : public DES_EDE3_Info, public BlockCipherDocumentation class DES_EDE3 : public DES_EDE3_Info, public BlockCipherDocumentation
{ {
//! \class Base
//! \brief DES_EDE3 block cipher default operation
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<DES_EDE3_Info> class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<DES_EDE3_Info>
{ {
public: public:
@ -124,6 +130,8 @@ struct DES_XEX3_Info : public FixedBlockSize<8>, public FixedKeyLength<24>
//! \sa <a href="http://www.weidai.com/scan-mirror/cs.html#DESX">DES-XEX3</a>, AKA DESX //! \sa <a href="http://www.weidai.com/scan-mirror/cs.html#DESX">DES-XEX3</a>, AKA DESX
class DES_XEX3 : public DES_XEX3_Info, public BlockCipherDocumentation class DES_XEX3 : public DES_XEX3_Info, public BlockCipherDocumentation
{ {
//! \class Base
//! \brief DES_XEX3 block cipher default operation
class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<DES_XEX3_Info> class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<DES_XEX3_Info>
{ {
public: public:

View File

@ -4,6 +4,9 @@
NAMESPACE_BEGIN(CryptoPP) NAMESPACE_BEGIN(CryptoPP)
// Hack for OS X 10.5 ld, http://github.com/weidai11/cryptopp/issues/255
static const size_t s_unused = GOST::KEYLENGTH;
// these are the S-boxes given in Applied Cryptography 2nd Ed., p. 333 // these are the S-boxes given in Applied Cryptography 2nd Ed., p. 333
const byte GOST::Base::sBox[8][16]={ const byte GOST::Base::sBox[8][16]={
{4, 10, 9, 2, 13, 8, 0, 14, 6, 11, 1, 12, 7, 15, 5, 3}, {4, 10, 9, 2, 13, 8, 0, 14, 6, 11, 1, 12, 7, 15, 5, 3},

6
gost.h
View File

@ -23,6 +23,8 @@ struct GOST_Info : public FixedBlockSize<8>, public FixedKeyLength<32>
//! \sa <a href="http://www.weidai.com/scan-mirror/cs.html#GOST">GOST</a> //! \sa <a href="http://www.weidai.com/scan-mirror/cs.html#GOST">GOST</a>
class GOST : public GOST_Info, public BlockCipherDocumentation class GOST : public GOST_Info, public BlockCipherDocumentation
{ {
//! \class Base
//! \brief GOST block cipher default operation
class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<GOST_Info> class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<GOST_Info>
{ {
public: public:
@ -38,12 +40,16 @@ class GOST : public GOST_Info, public BlockCipherDocumentation
FixedSizeSecBlock<word32, 8> key; FixedSizeSecBlock<word32, 8> key;
}; };
//! \class Enc
//! \brief GOST block cipher encryption operation
class CRYPTOPP_NO_VTABLE Enc : public Base class CRYPTOPP_NO_VTABLE Enc : public Base
{ {
public: public:
void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
}; };
//! \class Dec
//! \brief GOST block cipher decryption operation
class CRYPTOPP_NO_VTABLE Dec : public Base class CRYPTOPP_NO_VTABLE Dec : public Base
{ {
public: public:

View File

@ -7,6 +7,9 @@
NAMESPACE_BEGIN(CryptoPP) NAMESPACE_BEGIN(CryptoPP)
// Hack for OS X 10.5 ld, http://github.com/weidai11/cryptopp/issues/255
static const size_t s_unused = IDEA::KEYLENGTH;
static const int IDEA_KEYLEN=(6*IDEA::ROUNDS+4); // key schedule length in # of word16s static const int IDEA_KEYLEN=(6*IDEA::ROUNDS+4); // key schedule length in # of word16s
#define low16(x) ((x)&0xffff) // compiler should be able to optimize this away if word is 16 bits #define low16(x) ((x)&0xffff) // compiler should be able to optimize this away if word is 16 bits

18
mdc.h
View File

@ -1,10 +1,10 @@
// mdc.h - written and placed in the public domain by Wei Dai // mdc.h - written and placed in the public domain by Wei Dai
#ifndef CRYPTOPP_MDC_H #ifndef CRYPTOPP_MDC_H
#define CRYPTOPP_MDC_H #define CRYPTOPP_MDC_H
/** \file //! \file mdc.h
*/ //! \brief Classes for the MDC message digest
#include "seckey.h" #include "seckey.h"
#include "secblock.h" #include "secblock.h"
@ -12,18 +12,24 @@
NAMESPACE_BEGIN(CryptoPP) NAMESPACE_BEGIN(CryptoPP)
//! _ //! \class MDC_Info
//! \brief MDC_Info cipher information
template <class T> template <class T>
struct MDC_Info : public FixedBlockSize<T::DIGESTSIZE>, public FixedKeyLength<T::BLOCKSIZE> struct MDC_Info : public FixedBlockSize<T::DIGESTSIZE>, public FixedKeyLength<T::BLOCKSIZE>
{ {
static std::string StaticAlgorithmName() {return std::string("MDC/")+T::StaticAlgorithmName();} static std::string StaticAlgorithmName() {return std::string("MDC/")+T::StaticAlgorithmName();}
}; };
//! <a href="http://www.weidai.com/scan-mirror/cs.html#MDC">MDC</a>
/*! a construction by Peter Gutmann to turn an iterated hash function into a PRF */ //! \class MDC
//! \brief MDC cipher
//! \details MDC() is a construction by Peter Gutmann to turn an iterated hash function into a PRF
//! \sa <a href="http://www.weidai.com/scan-mirror/cs.html#MDC">MDC</a>
template <class T> template <class T>
class MDC : public MDC_Info<T> class MDC : public MDC_Info<T>
{ {
//! \class Enc
//! \brief MDC cipher encryption operation
class CRYPTOPP_NO_VTABLE Enc : public BlockCipherImpl<MDC_Info<T> > class CRYPTOPP_NO_VTABLE Enc : public BlockCipherImpl<MDC_Info<T> >
{ {
typedef typename T::HashWordType HashWordType; typedef typename T::HashWordType HashWordType;

View File

@ -17,6 +17,9 @@ NAMESPACE_BEGIN(CryptoPP)
# pragma warning(disable: 4731) # pragma warning(disable: 4731)
#endif #endif
// Hack for OS X 10.5 ld, http://github.com/weidai11/cryptopp/issues/255
static const size_t s_unused = PanamaCipher<>::KEYLENGTH;
template <class B> template <class B>
void Panama<B>::Reset() void Panama<B>::Reset()
{ {

View File

@ -1,7 +1,7 @@
// panama.h - written and placed in the public domain by Wei Dai // panama.h - written and placed in the public domain by Wei Dai
//! \file panama.h //! \file panama.h
//! \brief Classes for Panama stream cipher //! \brief Classes for Panama hash and stream cipher
#ifndef CRYPTOPP_PANAMA_H #ifndef CRYPTOPP_PANAMA_H
#define CRYPTOPP_PANAMA_H #define CRYPTOPP_PANAMA_H
@ -17,7 +17,7 @@
NAMESPACE_BEGIN(CryptoPP) NAMESPACE_BEGIN(CryptoPP)
/// base class, do not use directly // Base class, do not use directly
template <class B> template <class B>
class CRYPTOPP_NO_VTABLE Panama class CRYPTOPP_NO_VTABLE Panama
{ {
@ -33,7 +33,9 @@ protected:
}; };
namespace Weak { namespace Weak {
/// <a href="http://www.weidai.com/scan-mirror/md.html#Panama">Panama Hash</a> //! \class PanamaHash
//! \brief Panama hash
//! \sa <a href="http://www.weidai.com/scan-mirror/md.html#Panama">Panama Hash</a>
template <class B = LittleEndian> template <class B = LittleEndian>
class PanamaHash : protected Panama<B>, public AlgorithmImpl<IteratedHash<word32, NativeByteOrder, 32>, PanamaHash<B> > class PanamaHash : protected Panama<B>, public AlgorithmImpl<IteratedHash<word32, NativeByteOrder, 32>, PanamaHash<B> >
{ {
@ -52,7 +54,8 @@ protected:
}; };
} }
//! MAC construction using a hermetic hash function //! \class HermeticHashFunctionMAC
//! \brief MAC construction using a hermetic hash function
template <class T_Hash, class T_Info = T_Hash> template <class T_Hash, class T_Info = T_Hash>
class HermeticHashFunctionMAC : public AlgorithmImpl<SimpleKeyingInterfaceImpl<TwoBases<MessageAuthenticationCode, VariableKeyLength<32, 0, INT_MAX> > >, T_Info> class HermeticHashFunctionMAC : public AlgorithmImpl<SimpleKeyingInterfaceImpl<TwoBases<MessageAuthenticationCode, VariableKeyLength<32, 0, INT_MAX> > >, T_Info>
{ {
@ -108,7 +111,8 @@ protected:
}; };
namespace Weak { namespace Weak {
/// Panama MAC //! \class PanamaMAC
//! \brief Panama message authentication code
template <class B = LittleEndian> template <class B = LittleEndian>
class PanamaMAC : public HermeticHashFunctionMAC<PanamaHash<B> > class PanamaMAC : public HermeticHashFunctionMAC<PanamaHash<B> >
{ {
@ -119,14 +123,16 @@ public:
}; };
} }
//! algorithm info //! \class PanamaCipherInfo
//! \brief Panama stream cipher information
template <class B> template <class B>
struct PanamaCipherInfo : public FixedKeyLength<32, SimpleKeyingInterface::UNIQUE_IV, 32> struct PanamaCipherInfo : public FixedKeyLength<32, SimpleKeyingInterface::UNIQUE_IV, 32>
{ {
static const char * StaticAlgorithmName() {return B::ToEnum() == BIG_ENDIAN_ORDER ? "Panama-BE" : "Panama-LE";} static const char * StaticAlgorithmName() {return B::ToEnum() == BIG_ENDIAN_ORDER ? "Panama-BE" : "Panama-LE";}
}; };
//! _ //! \class PanamaCipherPolicy
//! \brief Panama stream cipher operation
template <class B> template <class B>
class PanamaCipherPolicy : public AdditiveCipherConcretePolicy<word32, 8>, class PanamaCipherPolicy : public AdditiveCipherConcretePolicy<word32, 8>,
public PanamaCipherInfo<B>, public PanamaCipherInfo<B>,
@ -142,7 +148,9 @@ protected:
FixedSizeSecBlock<word32, 8> m_key; FixedSizeSecBlock<word32, 8> m_key;
}; };
//! <a href="http://www.cryptolounge.org/wiki/PANAMA">Panama Stream Cipher</a> //! \class PanamaCipher
//! \brief Panama stream cipher
//! \sa <a href="http://www.cryptolounge.org/wiki/PANAMA">Panama Stream Cipher</a>
template <class B = LittleEndian> template <class B = LittleEndian>
struct PanamaCipher : public PanamaCipherInfo<B>, public SymmetricCipherDocumentation struct PanamaCipher : public PanamaCipherInfo<B>, public SymmetricCipherDocumentation
{ {

View File

@ -35,10 +35,15 @@ NAMESPACE_BEGIN(CryptoPP)
#if !defined(NDEBUG) && !defined(CRYPTOPP_DOXYGEN_PROCESSING) #if !defined(NDEBUG) && !defined(CRYPTOPP_DOXYGEN_PROCESSING)
void Salsa20_TestInstantiations() void Salsa20_TestInstantiations()
{ {
Salsa20::Encryption x; Salsa20::Encryption x1;
XSalsa20::Encryption x2;
} }
#endif #endif
// Hack for OS X 10.5 ld, http://github.com/weidai11/cryptopp/issues/255
// static const size_t s_unused1 = Salsa20::KEYLENGTH;
static const size_t s_unused2 = XSalsa20::KEYLENGTH;
void Salsa20_Policy::CipherSetKey(const NameValuePairs &params, const byte *key, size_t length) void Salsa20_Policy::CipherSetKey(const NameValuePairs &params, const byte *key, size_t length)
{ {
m_rounds = params.GetIntValueWithDefault(Name::Rounds(), 20); m_rounds = params.GetIntValueWithDefault(Name::Rounds(), 20);

10
salsa.h
View File

@ -19,12 +19,14 @@
NAMESPACE_BEGIN(CryptoPP) NAMESPACE_BEGIN(CryptoPP)
//! \class Salsa20_Info //! \class Salsa20_Info
//! \brief Salsa stream cipher information //! \brief Salsa20 stream cipher information
struct Salsa20_Info : public VariableKeyLength<32, 16, 32, 16, SimpleKeyingInterface::UNIQUE_IV, 8> struct Salsa20_Info : public VariableKeyLength<32, 16, 32, 16, SimpleKeyingInterface::UNIQUE_IV, 8>
{ {
static const char *StaticAlgorithmName() {return "Salsa20";} static const char *StaticAlgorithmName() {return "Salsa20";}
}; };
//! \class Salsa20_Policy
//! \brief Salsa20 stream cipher operation
class CRYPTOPP_NO_VTABLE Salsa20_Policy : public AdditiveCipherConcretePolicy<word32, 16> class CRYPTOPP_NO_VTABLE Salsa20_Policy : public AdditiveCipherConcretePolicy<word32, 16>
{ {
protected: protected:
@ -43,7 +45,7 @@ protected:
}; };
//! \class Salsa20 //! \class Salsa20
//! \brief Salsa20 stream cipher information //! \brief Salsa20 stream cipher
//! \details Salsa20 provides a variable number of rounds: 8, 12 or 20. The default number of rounds is 20. //! \details Salsa20 provides a variable number of rounds: 8, 12 or 20. The default number of rounds is 20.
//! \sa <a href="http://www.cryptolounge.org/wiki/XSalsa20">XSalsa20</a> //! \sa <a href="http://www.cryptolounge.org/wiki/XSalsa20">XSalsa20</a>
struct Salsa20 : public Salsa20_Info, public SymmetricCipherDocumentation struct Salsa20 : public Salsa20_Info, public SymmetricCipherDocumentation
@ -59,6 +61,8 @@ struct XSalsa20_Info : public FixedKeyLength<32, SimpleKeyingInterface::UNIQUE_I
static const char *StaticAlgorithmName() {return "XSalsa20";} static const char *StaticAlgorithmName() {return "XSalsa20";}
}; };
//! \class XSalsa20_Policy
//! \brief XSalsa20 stream cipher operation
class CRYPTOPP_NO_VTABLE XSalsa20_Policy : public Salsa20_Policy class CRYPTOPP_NO_VTABLE XSalsa20_Policy : public Salsa20_Policy
{ {
public: public:
@ -70,7 +74,7 @@ protected:
}; };
//! \class XSalsa20 //! \class XSalsa20
//! \brief XSalsa20 stream cipher information //! \brief XSalsa20 stream cipher
//! \details XSalsa20 provides a variable number of rounds: 8, 12 or 20. The default number of rounds is 20. //! \details XSalsa20 provides a variable number of rounds: 8, 12 or 20. The default number of rounds is 20.
//! \sa <a href="http://www.cryptolounge.org/wiki/XSalsa20">XSalsa20</a> //! \sa <a href="http://www.cryptolounge.org/wiki/XSalsa20">XSalsa20</a>
struct XSalsa20 : public XSalsa20_Info, public SymmetricCipherDocumentation struct XSalsa20 : public XSalsa20_Info, public SymmetricCipherDocumentation

View File

@ -17,6 +17,9 @@ void SEAL_TestInstantiations()
} }
#endif #endif
// Hack for OS X 10.5 ld, http://github.com/weidai11/cryptopp/issues/255
static const size_t s_unused = SEAL<>::KEYLENGTH;
struct SEAL_Gamma struct SEAL_Gamma
{ {
SEAL_Gamma(const byte *key) SEAL_Gamma(const byte *key)

12
seal.h
View File

@ -11,13 +11,18 @@
NAMESPACE_BEGIN(CryptoPP) NAMESPACE_BEGIN(CryptoPP)
//! _ //! \class SEAL_Info
//! \brief SEAL stream cipher information
//! \tparam B Endianess of the stream cipher
template <class B = BigEndian> template <class B = BigEndian>
struct SEAL_Info : public FixedKeyLength<20, SimpleKeyingInterface::INTERNALLY_GENERATED_IV, 4> struct SEAL_Info : public FixedKeyLength<20, SimpleKeyingInterface::INTERNALLY_GENERATED_IV, 4>
{ {
static const char *StaticAlgorithmName() {return B::ToEnum() == LITTLE_ENDIAN_ORDER ? "SEAL-3.0-LE" : "SEAL-3.0-BE";} static const char *StaticAlgorithmName() {return B::ToEnum() == LITTLE_ENDIAN_ORDER ? "SEAL-3.0-LE" : "SEAL-3.0-BE";}
}; };
//! \class SEAL_Policy
//! \brief SEAL stream cipher operation
//! \tparam B Endianess of the stream cipher
template <class B = BigEndian> template <class B = BigEndian>
class CRYPTOPP_NO_VTABLE SEAL_Policy : public AdditiveCipherConcretePolicy<word32, 256>, public SEAL_Info<B> class CRYPTOPP_NO_VTABLE SEAL_Policy : public AdditiveCipherConcretePolicy<word32, 256>, public SEAL_Info<B>
{ {
@ -37,7 +42,10 @@ private:
word32 m_outsideCounter, m_insideCounter; word32 m_outsideCounter, m_insideCounter;
}; };
//! <a href="http://www.weidai.com/scan-mirror/cs.html#SEAL-3.0-BE">SEAL</a> //! \class SEAL
//! \brief SEAL stream cipher
//! \tparam B Endianess of the stream cipher
//! \sa <a href="http://www.weidai.com/scan-mirror/cs.html#SEAL-3.0-BE">SEAL</a>
template <class B = BigEndian> template <class B = BigEndian>
struct SEAL : public SEAL_Info<B>, public SymmetricCipherDocumentation struct SEAL : public SEAL_Info<B>, public SymmetricCipherDocumentation
{ {

View File

@ -6,6 +6,9 @@
NAMESPACE_BEGIN(CryptoPP) NAMESPACE_BEGIN(CryptoPP)
// Hack for OS X 10.5 ld, http://github.com/weidai11/cryptopp/issues/255
static const size_t s_unused = SEED::KEYLENGTH;
static const word32 s_kc[16] = { static const word32 s_kc[16] = {
0x9e3779b9, 0x3c6ef373, 0x78dde6e6, 0xf1bbcdcc, 0xe3779b99, 0xc6ef3733, 0x8dde6e67, 0x1bbcdccf, 0x9e3779b9, 0x3c6ef373, 0x78dde6e6, 0xf1bbcdcc, 0xe3779b99, 0xc6ef3733, 0x8dde6e67, 0x1bbcdccf,
0x3779b99e, 0x6ef3733c, 0xdde6e678, 0xbbcdccf1, 0x779b99e3, 0xef3733c6, 0xde6e678d, 0xbcdccf1b}; 0x3779b99e, 0x6ef3733c, 0xdde6e678, 0xbbcdccf1, 0x779b99e3, 0xef3733c6, 0xde6e678d, 0xbcdccf1b};

View File

@ -12,6 +12,9 @@
NAMESPACE_BEGIN(CryptoPP) NAMESPACE_BEGIN(CryptoPP)
// Hack for OS X 10.5 ld, http://github.com/weidai11/cryptopp/issues/255
static const size_t s_unused = SHARK::KEYLENGTH;
static word64 SHARKTransform(word64 a) static word64 SHARKTransform(word64 a)
{ {
static const byte iG[8][8] = { static const byte iG[8][8] = {

View File

@ -24,6 +24,8 @@ struct SHARK_Info : public FixedBlockSize<8>, public FixedKeyLength<16>, public
/// <a href="http://www.weidai.com/scan-mirror/cs.html#SHARK-E">SHARK-E</a> /// <a href="http://www.weidai.com/scan-mirror/cs.html#SHARK-E">SHARK-E</a>
class SHARK : public SHARK_Info, public BlockCipherDocumentation class SHARK : public SHARK_Info, public BlockCipherDocumentation
{ {
//! \class Base
//! \brief SHARK block cipher default operation
class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<SHARK_Info> class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<SHARK_Info>
{ {
public: public:
@ -34,6 +36,8 @@ class SHARK : public SHARK_Info, public BlockCipherDocumentation
SecBlock<word64> m_roundKeys; SecBlock<word64> m_roundKeys;
}; };
//! \class Enc
//! \brief SHARK block cipher encryption operation
class CRYPTOPP_NO_VTABLE Enc : public Base class CRYPTOPP_NO_VTABLE Enc : public Base
{ {
public: public:
@ -47,6 +51,8 @@ class SHARK : public SHARK_Info, public BlockCipherDocumentation
static const word64 cbox[8][256]; static const word64 cbox[8][256];
}; };
//! \class Dec
//! \brief SHARK block cipher decryption operation
class CRYPTOPP_NO_VTABLE Dec : public Base class CRYPTOPP_NO_VTABLE Dec : public Base
{ {
public: public:

View File

@ -17,6 +17,9 @@
NAMESPACE_BEGIN(CryptoPP) NAMESPACE_BEGIN(CryptoPP)
// Hack for OS X 10.5 ld, http://github.com/weidai11/cryptopp/issues/255
static const size_t s_unused = SKIPJACK::KEYLENGTH;
/** /**
* The F-table byte permutation (see description of the G-box permutation) * The F-table byte permutation (see description of the G-box permutation)
*/ */

View File

@ -23,6 +23,8 @@ struct SKIPJACK_Info : public FixedBlockSize<8>, public FixedKeyLength<10>
//! \sa <a href="http://www.weidai.com/scan-mirror/cs.html#SKIPJACK">SKIPJACK</a> //! \sa <a href="http://www.weidai.com/scan-mirror/cs.html#SKIPJACK">SKIPJACK</a>
class SKIPJACK : public SKIPJACK_Info, public BlockCipherDocumentation class SKIPJACK : public SKIPJACK_Info, public BlockCipherDocumentation
{ {
//! \class Base
//! \brief SKIPJACK block cipher default operation
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<SKIPJACK_Info> class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<SKIPJACK_Info>
{ {
public: public:
@ -35,6 +37,8 @@ class SKIPJACK : public SKIPJACK_Info, public BlockCipherDocumentation
FixedSizeSecBlock<byte, 10*256> tab; FixedSizeSecBlock<byte, 10*256> tab;
}; };
//! \class Enc
//! \brief SKIPJACK block cipher encryption operation
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Enc : public Base class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Enc : public Base
{ {
public: public:
@ -44,6 +48,8 @@ class SKIPJACK : public SKIPJACK_Info, public BlockCipherDocumentation
static const word32 Te[4][256]; static const word32 Te[4][256];
}; };
//! \class Dec
//! \brief SKIPJACK block cipher decryption operation
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Dec : public Base class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Dec : public Base
{ {
public: public:

View File

@ -18,6 +18,9 @@
NAMESPACE_BEGIN(CryptoPP) NAMESPACE_BEGIN(CryptoPP)
// Hack for OS X 10.5 ld, http://github.com/weidai11/cryptopp/issues/255
static const size_t s_unused = Square::KEYLENGTH;
// apply theta to a roundkey // apply theta to a roundkey
static void SquareTransform (word32 in[4], word32 out[4]) static void SquareTransform (word32 in[4], word32 out[4])
{ {

View File

@ -6,6 +6,9 @@
NAMESPACE_BEGIN(CryptoPP) NAMESPACE_BEGIN(CryptoPP)
// Hack for OS X 10.5 ld, http://github.com/weidai11/cryptopp/issues/255
static const size_t s_unused = TEA::KEYLENGTH;
static const word32 DELTA = 0x9e3779b9; static const word32 DELTA = 0x9e3779b9;
typedef BlockGetAndPut<word32, BigEndian> Block; typedef BlockGetAndPut<word32, BigEndian> Block;

18
tea.h
View File

@ -24,6 +24,8 @@ struct TEA_Info : public FixedBlockSize<8>, public FixedKeyLength<16>, public Va
//! \sa <a href="http://www.weidai.com/scan-mirror/cs.html#TEA">TEA</a> //! \sa <a href="http://www.weidai.com/scan-mirror/cs.html#TEA">TEA</a>
class TEA : public TEA_Info, public BlockCipherDocumentation class TEA : public TEA_Info, public BlockCipherDocumentation
{ {
//! \class Base
//! \brief TEA block cipher default operation
class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<TEA_Info> class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<TEA_Info>
{ {
public: public:
@ -34,12 +36,16 @@ class TEA : public TEA_Info, public BlockCipherDocumentation
word32 m_limit; word32 m_limit;
}; };
//! \class Enc
//! \brief TEA block cipher encryption operation
class CRYPTOPP_NO_VTABLE Enc : public Base class CRYPTOPP_NO_VTABLE Enc : public Base
{ {
public: public:
void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
}; };
//! \class Dec
//! \brief TEA block cipher decryption operation
class CRYPTOPP_NO_VTABLE Dec : public Base class CRYPTOPP_NO_VTABLE Dec : public Base
{ {
public: public:
@ -66,6 +72,8 @@ struct XTEA_Info : public FixedBlockSize<8>, public FixedKeyLength<16>, public V
//! \sa <a href="http://www.weidai.com/scan-mirror/cs.html#TEA">XTEA</a> //! \sa <a href="http://www.weidai.com/scan-mirror/cs.html#TEA">XTEA</a>
class XTEA : public XTEA_Info, public BlockCipherDocumentation class XTEA : public XTEA_Info, public BlockCipherDocumentation
{ {
//! \class Base
//! \brief XTEA block cipher default operation
class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<XTEA_Info> class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<XTEA_Info>
{ {
public: public:
@ -76,12 +84,16 @@ class XTEA : public XTEA_Info, public BlockCipherDocumentation
word32 m_limit; word32 m_limit;
}; };
//! \class Enc
//! \brief XTEA block cipher encryption operation
class CRYPTOPP_NO_VTABLE Enc : public Base class CRYPTOPP_NO_VTABLE Enc : public Base
{ {
public: public:
void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
}; };
//! \class Dec
//! \brief XTEA block cipher decryption operation
class CRYPTOPP_NO_VTABLE Dec : public Base class CRYPTOPP_NO_VTABLE Dec : public Base
{ {
public: public:
@ -106,6 +118,8 @@ struct BTEA_Info : public FixedKeyLength<16>
//! \sa <a href="http://www.weidai.com/scan-mirror/cs.html#TEA">Corrected Block TEA</a>. //! \sa <a href="http://www.weidai.com/scan-mirror/cs.html#TEA">Corrected Block TEA</a>.
class BTEA : public BTEA_Info, public BlockCipherDocumentation class BTEA : public BTEA_Info, public BlockCipherDocumentation
{ {
//! \class Base
//! \brief BTEA block cipher default operation
class CRYPTOPP_NO_VTABLE Base : public AlgorithmImpl<SimpleKeyingInterfaceImpl<BlockCipher, BTEA_Info>, BTEA_Info>, public BTEA_Info class CRYPTOPP_NO_VTABLE Base : public AlgorithmImpl<SimpleKeyingInterfaceImpl<BlockCipher, BTEA_Info>, BTEA_Info>, public BTEA_Info
{ {
public: public:
@ -123,12 +137,16 @@ class BTEA : public BTEA_Info, public BlockCipherDocumentation
unsigned int m_blockSize; unsigned int m_blockSize;
}; };
//! \class Enc
//! \brief BTEA block cipher encryption operation
class CRYPTOPP_NO_VTABLE Enc : public Base class CRYPTOPP_NO_VTABLE Enc : public Base
{ {
public: public:
void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
}; };
//! \class Dec
//! \brief BTEA block cipher decryption operation
class CRYPTOPP_NO_VTABLE Dec : public Base class CRYPTOPP_NO_VTABLE Dec : public Base
{ {
public: public:

View File

@ -6,6 +6,9 @@
NAMESPACE_BEGIN(CryptoPP) NAMESPACE_BEGIN(CryptoPP)
// Hack for OS X 10.5 ld, http://github.com/weidai11/cryptopp/issues/255
static const size_t s_unused = TTMAC::KEYLENGTH;
void TTMAC_Base::UncheckedSetKey(const byte *userKey, unsigned int keylength, const NameValuePairs &) void TTMAC_Base::UncheckedSetKey(const byte *userKey, unsigned int keylength, const NameValuePairs &)
{ {
AssertValidKeyLength(keylength); AssertValidKeyLength(keylength);

13
ttmac.h
View File

@ -1,5 +1,8 @@
// ttmac.h - written and placed in the public domain by Kevin Springle // ttmac.h - written and placed in the public domain by Kevin Springle
//! \file ttmac.h
//! \brief Classes for the TTMAC message authentication code
#ifndef CRYPTOPP_TTMAC_H #ifndef CRYPTOPP_TTMAC_H
#define CRYPTOPP_TTMAC_H #define CRYPTOPP_TTMAC_H
@ -9,7 +12,8 @@
NAMESPACE_BEGIN(CryptoPP) NAMESPACE_BEGIN(CryptoPP)
//! _ //! \class TTMAC_Base
//! \brief TTMAC message authentication code information
class CRYPTOPP_NO_VTABLE TTMAC_Base : public FixedKeyLength<20>, public IteratedHash<word32, LittleEndian, 64, MessageAuthenticationCode> class CRYPTOPP_NO_VTABLE TTMAC_Base : public FixedKeyLength<20>, public IteratedHash<word32, LittleEndian, 64, MessageAuthenticationCode>
{ {
public: public:
@ -30,8 +34,11 @@ protected:
FixedSizeSecBlock<word32, 5> m_key; FixedSizeSecBlock<word32, 5> m_key;
}; };
//! <a href="http://www.weidai.com/scan-mirror/mac.html#TTMAC">Two-Track-MAC</a> //! \class TTMAC
/*! 160 Bit MAC with 160 Bit Key */ //! \brief Two-Track-MAC message authentication code
//! \tparam T HashTransformation class
//! \details 160-bit MAC with 160-bit key
//! \sa MessageAuthenticationCode(), <a href="http://www.weidai.com/scan-mirror/mac.html#TTMAC">Two-Track-MAC</a>
DOCUMENTED_TYPEDEF(MessageAuthenticationCodeFinal<TTMAC_Base>, TTMAC) DOCUMENTED_TYPEDEF(MessageAuthenticationCodeFinal<TTMAC_Base>, TTMAC)
NAMESPACE_END NAMESPACE_END

View File

@ -15,6 +15,9 @@ void WAKE_TestInstantiations()
} }
#endif #endif
// Hack for OS X 10.5 ld, http://github.com/weidai11/cryptopp/issues/255
static const size_t s_unused = WAKE_OFB<>::KEYLENGTH;
inline word32 WAKE_Base::M(word32 x, word32 y) inline word32 WAKE_Base::M(word32 x, word32 y)
{ {
word32 w = x+y; word32 w = x+y;

11
wake.h
View File

@ -12,7 +12,9 @@
NAMESPACE_BEGIN(CryptoPP) NAMESPACE_BEGIN(CryptoPP)
//! _ //! \class WAKE_OFB_Info
//! \brief WAKE stream cipher information
//! \tparam B Endianess of the stream cipher
template <class B = BigEndian> template <class B = BigEndian>
struct WAKE_OFB_Info : public FixedKeyLength<32> struct WAKE_OFB_Info : public FixedKeyLength<32>
{ {
@ -29,6 +31,9 @@ protected:
word32 r3, r4, r5, r6; word32 r3, r4, r5, r6;
}; };
//! \class WAKE_Policy
//! \brief WAKE stream cipher operation
//! \tparam B Endianess of the stream cipher
template <class B = BigEndian> template <class B = BigEndian>
class CRYPTOPP_NO_VTABLE WAKE_Policy : public AdditiveCipherConcretePolicy<word32, 1, 64>, protected WAKE_Base class CRYPTOPP_NO_VTABLE WAKE_Policy : public AdditiveCipherConcretePolicy<word32, 1, 64>, protected WAKE_Base
{ {
@ -39,7 +44,9 @@ protected:
bool CipherIsRandomAccess() const {return false;} bool CipherIsRandomAccess() const {return false;}
}; };
//! WAKE-OFB //! \class WAKE_OFB
//! \brief WAKE stream cipher
//! \tparam B Endianess of the stream cipher
template <class B = BigEndian> template <class B = BigEndian>
struct WAKE_OFB : public WAKE_OFB_Info<B>, public SymmetricCipherDocumentation struct WAKE_OFB : public WAKE_OFB_Info<B>, public SymmetricCipherDocumentation
{ {