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/rc4 | |
parent | 710229be83cdbc061949c61942896b5af9e134d8 (diff) |
Use registry for streams and MACs. Start updating callers.
Diffstat (limited to 'src/lib/stream/rc4')
-rw-r--r-- | src/lib/stream/rc4/rc4.cpp | 13 | ||||
-rw-r--r-- | src/lib/stream/rc4/rc4.h | 2 |
2 files changed, 14 insertions, 1 deletions
diff --git a/src/lib/stream/rc4/rc4.cpp b/src/lib/stream/rc4/rc4.cpp index 1a5ad80e9..dcf4af241 100644 --- a/src/lib/stream/rc4/rc4.cpp +++ b/src/lib/stream/rc4/rc4.cpp @@ -5,12 +5,23 @@ * Botan is released under the Simplified BSD License (see license.txt) */ +#include <botan/internal/stream_utils.h> #include <botan/rc4.h> -#include <botan/internal/xor_buf.h> #include <botan/internal/rounding.h> namespace Botan { +BOTAN_REGISTER_NAMED_T(StreamCipher, "RC4", RC4, RC4::make); + +RC4* RC4::make(const Spec& spec) + { + if(spec.algo_name() == "RC4") + return new RC4(spec.arg_as_integer(0, 0)); + if(spec.algo_name() == "RC4_drop") + return new RC4(768); + return nullptr; + } + /* * Combine cipher stream with message */ diff --git a/src/lib/stream/rc4/rc4.h b/src/lib/stream/rc4/rc4.h index f72e2e75d..b2006fec5 100644 --- a/src/lib/stream/rc4/rc4.h +++ b/src/lib/stream/rc4/rc4.h @@ -31,6 +31,8 @@ class BOTAN_DLL RC4 : public StreamCipher return Key_Length_Specification(1, 256); } + static RC4* make(const Spec& spec); + /** * @param skip skip this many initial bytes in the keystream */ |