From 3929c3594c1a084beb045afe22ec19d170a01c47 Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Sat, 18 Aug 2018 22:26:01 -0400 Subject: [PATCH] Add SHACAL2 cipher AlgorithmProvider() --- shacal2.cpp | 9 +++++++++ shacal2.h | 1 + whrlpool.h | 5 +++-- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/shacal2.cpp b/shacal2.cpp index bdaf644e..37ba9899 100644 --- a/shacal2.cpp +++ b/shacal2.cpp @@ -44,6 +44,15 @@ extern void SHACAL2_Enc_ProcessAndXorBlock_SHANI(const word32* subKeys, const byte *inBlock, const byte *xorBlock, byte *outBlock); #endif +std::string SHACAL2::Base::AlgorithmProvider() const +{ +#if CRYPTOPP_SHANI_AVAILABLE + if (HasSHA()) + return "SHANI"; +#endif + return "C++"; +} + void SHACAL2::Base::UncheckedSetKey(const byte *userKey, unsigned int keylen, const NameValuePairs &) { AssertValidKeyLength(keylen); diff --git a/shacal2.h b/shacal2.h index 7be2d279..ca0c482c 100644 --- a/shacal2.h +++ b/shacal2.h @@ -28,6 +28,7 @@ class SHACAL2 : public SHACAL2_Info, public BlockCipherDocumentation class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl { public: + std::string AlgorithmProvider() const; void UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs ¶ms); protected: diff --git a/whrlpool.h b/whrlpool.h index 47bb6c33..e6213f7e 100644 --- a/whrlpool.h +++ b/whrlpool.h @@ -29,11 +29,12 @@ NAMESPACE_BEGIN(CryptoPP) class Whirlpool : public IteratedHashWithStaticTransform { public: + CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() {return "Whirlpool";} + 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 "Whirlpool";} - std::string AlgorithmProvider() const; }; NAMESPACE_END