Add Tiger cipher AlgorithmProvider()

pull/709/head
Jeffrey Walton 2018-08-18 21:41:55 -04:00
parent 92163356db
commit 1f5d0d85cf
No known key found for this signature in database
GPG Key ID: B36AB348921B1838
4 changed files with 18 additions and 4 deletions

View File

@ -21,9 +21,11 @@ NAMESPACE_BEGIN(CryptoPP)
std::string SosemanukPolicy::AlgorithmProvider() const
{
#if CRYPTOPP_SSE2_ASM_AVAILABLE
#ifndef CRYPTOPP_DISABLE_SOSEMANUK_ASM
# if CRYPTOPP_SSE2_ASM_AVAILABLE
if (HasSSE2())
return "SSE2";
# endif
#endif
return "C++";
}

View File

@ -30,6 +30,7 @@ struct SosemanukInfo : public VariableKeyLength<16, 1, 32, 1, SimpleKeyingInterf
class SosemanukPolicy : public AdditiveCipherConcretePolicy<word32, 20>, public SosemanukInfo
{
protected:
std::string AlgorithmProvider() const;
void CipherSetKey(const NameValuePairs &params, const byte *key, size_t length);
void OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, size_t iterationCount);
void CipherResynchronize(byte *keystreamBuffer, const byte *iv, size_t length);
@ -39,8 +40,6 @@ protected:
unsigned int GetOptimalBlockSize() const;
#endif
std::string AlgorithmProvider() const;
FixedSizeSecBlock<word32, 25*4> m_key;
FixedSizeAlignedSecBlock<word32, 12> m_state;
};

View File

@ -16,6 +16,17 @@
NAMESPACE_BEGIN(CryptoPP)
std::string Tiger::AlgorithmProvider() const
{
#ifndef CRYPTOPP_DISABLE_TIGER_ASM
# if CRYPTOPP_SSE2_ASM_AVAILABLE
if (HasSSE2())
return "SSE2";
# endif
#endif
return "C++";
}
void Tiger::InitState(HashWordType *state)
{
state[0] = W64LIT(0x0123456789ABCDEF);

View File

@ -24,10 +24,12 @@ NAMESPACE_BEGIN(CryptoPP)
class Tiger : public IteratedHashWithStaticTransform<word64, LittleEndian, 64, 24, Tiger>
{
public:
CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() {return "Tiger";}
std::string AlgorithmProvider() const;
static void InitState(HashWordType *state);
static void Transform(word64 *digest, const word64 *data);
void TruncatedFinal(byte *hash, size_t size);
CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() {return "Tiger";}
protected:
static const word64 table[4*256+3];