aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/block/threefish
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2016-09-15 09:16:46 -0400
committerJack Lloyd <[email protected]>2016-09-15 09:25:49 -0400
commit04bf8dc51861bab37d6260de8b318dc71ea4bba7 (patch)
tree03cf4b8d607607444049bc2b9880abc4c1fc6a8e /src/lib/block/threefish
parenta7eba3629cc0d76444f5241fb4b9e8793ddb61cd (diff)
Add T::provider() to allow user to inquire about implementation used
For block ciphers, stream ciphers, hashes, MACs, and cipher modes. Cipher_Mode already had it, with a slightly different usage.
Diffstat (limited to 'src/lib/block/threefish')
-rw-r--r--src/lib/block/threefish/threefish.cpp12
-rw-r--r--src/lib/block/threefish/threefish.h1
2 files changed, 13 insertions, 0 deletions
diff --git a/src/lib/block/threefish/threefish.cpp b/src/lib/block/threefish/threefish.cpp
index 33b3e25c8..4ba834c94 100644
--- a/src/lib/block/threefish/threefish.cpp
+++ b/src/lib/block/threefish/threefish.cpp
@@ -98,6 +98,18 @@ void Threefish_512::skein_feedfwd(const secure_vector<u64bit>& M,
m_K[4] ^ m_K[5] ^ m_K[6] ^ m_K[7] ^ 0x1BD11BDAA9FC1A22;
}
+const char* Threefish_512::provider() const
+ {
+#if defined(BOTAN_HAS_THREEFISH_512_AVX2)
+ if(CPUID::has_avx2())
+ {
+ return "avx2";
+ }
+#endif
+
+ return "base";
+ }
+
void Threefish_512::encrypt_n(const byte in[], byte out[], size_t blocks) const
{
BOTAN_ASSERT(m_K.size() == 9, "Key was set");
diff --git a/src/lib/block/threefish/threefish.h b/src/lib/block/threefish/threefish.h
index 270e71354..230c742f3 100644
--- a/src/lib/block/threefish/threefish.h
+++ b/src/lib/block/threefish/threefish.h
@@ -24,6 +24,7 @@ class BOTAN_DLL Threefish_512 final : public Block_Cipher_Fixed_Params<64, 64>
void set_tweak(const byte tweak[], size_t len);
void clear() override;
+ const char* provider() const override;
std::string name() const override { return "Threefish-512"; }
BlockCipher* clone() const override { return new Threefish_512; }
protected: