aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/stream/ofb/ofb.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2015-01-31 15:30:49 +0000
committerlloyd <[email protected]>2015-01-31 15:30:49 +0000
commit00c9b3f4834603946065c15b9b2e9fa5e973b979 (patch)
treeb0f82333a1eeab624409db9515e511838f6fa2d6 /src/lib/stream/ofb/ofb.cpp
parent710229be83cdbc061949c61942896b5af9e134d8 (diff)
Use registry for streams and MACs. Start updating callers.
Diffstat (limited to 'src/lib/stream/ofb/ofb.cpp')
-rw-r--r--src/lib/stream/ofb/ofb.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/lib/stream/ofb/ofb.cpp b/src/lib/stream/ofb/ofb.cpp
index 986e6bf71..37429cd38 100644
--- a/src/lib/stream/ofb/ofb.cpp
+++ b/src/lib/stream/ofb/ofb.cpp
@@ -5,11 +5,23 @@
* Botan is released under the Simplified BSD License (see license.txt)
*/
+#include <botan/internal/stream_utils.h>
#include <botan/ofb.h>
-#include <botan/internal/xor_buf.h>
namespace Botan {
+BOTAN_REGISTER_NAMED_T(StreamCipher, "OFB", OFB, OFB::make);
+
+OFB* OFB::make(const Spec& spec)
+ {
+ if(spec.algo_name() == "OFB" && spec.arg_count() == 1)
+ {
+ if(BlockCipher* c = Algo_Registry<BlockCipher>::global_registry().make(spec.arg(0)))
+ return new OFB(c);
+ }
+ return nullptr;
+ }
+
OFB::OFB(BlockCipher* cipher) :
m_cipher(cipher),
m_buffer(m_cipher->block_size()),