aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstate
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstate')
-rw-r--r--src/libstate/info.txt1
-rw-r--r--src/libstate/lookup.cpp14
-rw-r--r--src/libstate/lookup.h12
3 files changed, 27 insertions, 0 deletions
diff --git a/src/libstate/info.txt b/src/libstate/info.txt
index b0704cd96..9f36d7be8 100644
--- a/src/libstate/info.txt
+++ b/src/libstate/info.txt
@@ -24,6 +24,7 @@ scan_name.cpp
<requires>
aes
+aead
algo_factory
alloc
bigint
diff --git a/src/libstate/lookup.cpp b/src/libstate/lookup.cpp
index 24a46e3e9..1263c0897 100644
--- a/src/libstate/lookup.cpp
+++ b/src/libstate/lookup.cpp
@@ -108,4 +108,18 @@ Keyed_Filter* get_cipher(const std::string& algo_spec,
key, InitializationVector(), direction);
}
+AEAD_Mode* get_aead(const std::string& algo_spec,
+ Cipher_Dir direction)
+ {
+ std::unique_ptr<Keyed_Filter> c(get_cipher(algo_spec, direction));
+
+ if(AEAD_Mode* aead = dynamic_cast<AEAD_Mode*>(c.get()))
+ {
+ c.release();
+ return aead;
+ }
+
+ return nullptr;
+ }
+
}
diff --git a/src/libstate/lookup.h b/src/libstate/lookup.h
index 7387a3471..2a47c7f14 100644
--- a/src/libstate/lookup.h
+++ b/src/libstate/lookup.h
@@ -11,6 +11,7 @@
#include <botan/libstate.h>
#include <botan/engine.h>
#include <botan/filters.h>
+#include <botan/aead.h>
#include <botan/mode_pad.h>
#include <botan/kdf.h>
#include <botan/eme.h>
@@ -219,6 +220,17 @@ BOTAN_DLL Keyed_Filter* get_cipher(const std::string& algo_spec,
Cipher_Dir direction);
/**
+* Factory method for AEAD filters. No key will be set in the filter.
+*
+* @param algo_spec the name of the desired AEAD mode (eg "AES-128/OCB")
+* @param direction determines whether the filter will be an encrypting or
+* decrypting filter
+* @return pointer to the encryption or decryption filter
+*/
+BOTAN_DLL AEAD_Mode* get_aead(const std::string& algo_spec,
+ Cipher_Dir direction);
+
+/**
* Check if an algorithm exists.
* @param algo_spec the name of the algorithm to check for
* @return true if the algorithm exists, false otherwise