diff options
author | lloyd <[email protected]> | 2015-01-31 15:30:49 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2015-01-31 15:30:49 +0000 |
commit | 00c9b3f4834603946065c15b9b2e9fa5e973b979 (patch) | |
tree | b0f82333a1eeab624409db9515e511838f6fa2d6 /src/lib/stream/ofb | |
parent | 710229be83cdbc061949c61942896b5af9e134d8 (diff) |
Use registry for streams and MACs. Start updating callers.
Diffstat (limited to 'src/lib/stream/ofb')
-rw-r--r-- | src/lib/stream/ofb/ofb.cpp | 14 | ||||
-rw-r--r-- | src/lib/stream/ofb/ofb.h | 2 |
2 files changed, 15 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()), diff --git a/src/lib/stream/ofb/ofb.h b/src/lib/stream/ofb/ofb.h index 925e7a773..09e11644a 100644 --- a/src/lib/stream/ofb/ofb.h +++ b/src/lib/stream/ofb/ofb.h @@ -38,6 +38,8 @@ class BOTAN_DLL OFB : public StreamCipher void clear(); + static OFB* make(const Spec& spec); + /** * @param cipher the underlying block cipher to use */ |