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/ctr | |
parent | 710229be83cdbc061949c61942896b5af9e134d8 (diff) |
Use registry for streams and MACs. Start updating callers.
Diffstat (limited to 'src/lib/stream/ctr')
-rw-r--r-- | src/lib/stream/ctr/ctr.cpp | 14 | ||||
-rw-r--r-- | src/lib/stream/ctr/ctr.h | 2 |
2 files changed, 15 insertions, 1 deletions
diff --git a/src/lib/stream/ctr/ctr.cpp b/src/lib/stream/ctr/ctr.cpp index 27118ee64..b6057a2a8 100644 --- a/src/lib/stream/ctr/ctr.cpp +++ b/src/lib/stream/ctr/ctr.cpp @@ -5,11 +5,23 @@ * Botan is released under the Simplified BSD License (see license.txt) */ +#include <botan/internal/stream_utils.h> #include <botan/ctr.h> -#include <botan/internal/xor_buf.h> namespace Botan { +BOTAN_REGISTER_NAMED_T(StreamCipher, "CTR-BE", CTR_BE, CTR_BE::make); + +CTR_BE* CTR_BE::make(const Spec& spec) + { + if(spec.algo_name() == "CTR-BE" && spec.arg_count() == 1) + { + if(BlockCipher* c = Algo_Registry<BlockCipher>::global_registry().make(spec.arg(0))) + return new CTR_BE(c); + } + return nullptr; + } + CTR_BE::CTR_BE(BlockCipher* ciph) : m_cipher(ciph), m_counter(256 * m_cipher->block_size()), diff --git a/src/lib/stream/ctr/ctr.h b/src/lib/stream/ctr/ctr.h index 52b6b66fa..1515b0e82 100644 --- a/src/lib/stream/ctr/ctr.h +++ b/src/lib/stream/ctr/ctr.h @@ -38,6 +38,8 @@ class BOTAN_DLL CTR_BE : public StreamCipher void clear(); + static CTR_BE* make(const Spec& spec); + /** * @param cipher the underlying block cipher to use */ |