aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/modes/ecb/ecb.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/modes/ecb/ecb.cpp')
-rw-r--r--src/lib/modes/ecb/ecb.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/lib/modes/ecb/ecb.cpp b/src/lib/modes/ecb/ecb.cpp
index 53f54da99..1db272d12 100644
--- a/src/lib/modes/ecb/ecb.cpp
+++ b/src/lib/modes/ecb/ecb.cpp
@@ -5,13 +5,25 @@
* Botan is released under the Simplified BSD License (see license.txt)
*/
+#include <botan/internal/mode_utils.h>
#include <botan/ecb.h>
-#include <botan/loadstor.h>
-#include <botan/internal/xor_buf.h>
-#include <botan/internal/rounding.h>
namespace Botan {
+template<typename T>
+Transform* make_ecb_mode(const Transform::Spec& spec)
+ {
+ Algorithm_Factory& af = global_state().algorithm_factory();
+ const BlockCipher* bc = af.prototype_block_cipher(spec.arg(0));
+ BlockCipherModePaddingMethod* pad = get_bc_pad(spec.arg(1, "NoPadding"));
+ if(bc && pad)
+ return new T(bc->clone(), pad);
+ return nullptr;
+ }
+
+BOTAN_REGISTER_TRANSFORM(ECB_Encryption, make_ecb_mode<ECB_Encryption>);
+BOTAN_REGISTER_TRANSFORM(ECB_Decryption, make_ecb_mode<ECB_Decryption>);
+
ECB_Mode::ECB_Mode(BlockCipher* cipher, BlockCipherModePaddingMethod* padding) :
m_cipher(cipher),
m_padding(padding)