aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/modes
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/modes')
-rw-r--r--src/lib/modes/aead/gcm/gcm.cpp10
-rw-r--r--src/lib/modes/aead/gcm/gcm.h2
-rw-r--r--src/lib/modes/cipher_mode.h14
3 files changed, 18 insertions, 8 deletions
diff --git a/src/lib/modes/aead/gcm/gcm.cpp b/src/lib/modes/aead/gcm/gcm.cpp
index e23551cb4..e4a07af82 100644
--- a/src/lib/modes/aead/gcm/gcm.cpp
+++ b/src/lib/modes/aead/gcm/gcm.cpp
@@ -185,6 +185,16 @@ std::string GCM_Mode::name() const
return (m_cipher_name + "/GCM");
}
+std::string GCM_Mode::provider() const
+ {
+#if defined(BOTAN_HAS_GCM_CLMUL)
+ if(CPUID::has_clmul())
+ return "clmul";
+#endif
+
+ return "base";
+ }
+
size_t GCM_Mode::update_granularity() const
{
return m_BS;
diff --git a/src/lib/modes/aead/gcm/gcm.h b/src/lib/modes/aead/gcm/gcm.h
index ba0d6cad8..3c8bdea3f 100644
--- a/src/lib/modes/aead/gcm/gcm.h
+++ b/src/lib/modes/aead/gcm/gcm.h
@@ -36,6 +36,8 @@ class BOTAN_DLL GCM_Mode : public AEAD_Mode
size_t tag_size() const override { return m_tag_size; }
void clear() override;
+
+ std::string provider() const override;
protected:
GCM_Mode(BlockCipher* cipher, size_t tag_size);
diff --git a/src/lib/modes/cipher_mode.h b/src/lib/modes/cipher_mode.h
index 73a5f7d96..e98f014b7 100644
--- a/src/lib/modes/cipher_mode.h
+++ b/src/lib/modes/cipher_mode.h
@@ -113,14 +113,6 @@ class BOTAN_DLL Cipher_Mode
*/
virtual bool valid_nonce_length(size_t nonce_len) const = 0;
- /**
- * Return some short name describing the provider of this tranformation.
- * Useful in cases where multiple implementations are available (eg,
- * different implementations of AES). Default "core" is used for the
- * 'standard' implementation included in the library.
- */
- virtual std::string provider() const { return "core"; }
-
virtual std::string name() const = 0;
virtual void clear() = 0;
@@ -174,6 +166,12 @@ class BOTAN_DLL Cipher_Mode
key_schedule(key, length);
}
+ /**
+ * @return provider information about this implementation. Default is "base",
+ * might also return "sse2", "avx2", "openssl", or some other arbitrary string.
+ */
+ virtual std::string provider() const { return "base"; }
+
private:
virtual void key_schedule(const byte key[], size_t length) = 0;
};