From b74a6f444568e59a7766d1e286f82d2ce3086dcd Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Fri, 6 Jul 2018 09:23:37 -0400 Subject: Add algorithm provider member function to Algorithm class --- blake2.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'blake2.cpp') diff --git a/blake2.cpp b/blake2.cpp index 1af13fdb..eb7fc726 100644 --- a/blake2.cpp +++ b/blake2.cpp @@ -284,6 +284,25 @@ void BLAKE2_Base::UncheckedSetKey(const byte *key, unsigned int leng } } +std::string BLAKE2_Base_AlgorithmProvider() +{ +#if defined(CRYPTOPP_SSE41_AVAILABLE) + if (HasSSE41()) + return "SSE4.1"; +#endif +#if (CRYPTOPP_ARM_NEON_AVAILABLE) + if (HasNEON()) + return "NEON"; +#endif + return "C++"; +} + +template +std::string BLAKE2_Base::AlgorithmProvider() const +{ + return BLAKE2_Base_AlgorithmProvider(); +} + template BLAKE2_Base::BLAKE2_Base() : m_state(1), m_block(1), m_digestSize(DIGESTSIZE), m_treeMode(false) { -- cgit v1.2.1