diff options
author | lloyd <[email protected]> | 2014-01-31 22:30:50 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2014-01-31 22:30:50 +0000 |
commit | e11024f26113189f45ca1759f6a045ca6989849e (patch) | |
tree | 33ea9eb4c4faabc899fa03aff5132e00a21f5d84 /src/lib/engine | |
parent | 9332870c160d7a02f1bef6f249fa1baae196dc51 (diff) |
Add ChaCha
Diffstat (limited to 'src/lib/engine')
-rw-r--r-- | src/lib/engine/core_engine/lookup_stream.cpp | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/src/lib/engine/core_engine/lookup_stream.cpp b/src/lib/engine/core_engine/lookup_stream.cpp index b26bbedcd..8461fadc9 100644 --- a/src/lib/engine/core_engine/lookup_stream.cpp +++ b/src/lib/engine/core_engine/lookup_stream.cpp @@ -7,11 +7,24 @@ #include <botan/internal/core_engine.h> #include <botan/scan_name.h> +#include <botan/algo_factory.h> + +#if defined(BOTAN_HAS_OFB) + #include <botan/ofb.h> +#endif + +#if defined(BOTAN_HAS_CTR_BE) + #include <botan/ctr.h> +#endif #if defined(BOTAN_HAS_RC4) #include <botan/rc4.h> #endif +#if defined(BOTAN_HAS_CHACHA) + #include <botan/chacha.h> +#endif + #if defined(BOTAN_HAS_SALSA20) #include <botan/salsa20.h> #endif @@ -23,8 +36,24 @@ namespace Botan { */ StreamCipher* Core_Engine::find_stream_cipher(const SCAN_Name& request, - Algorithm_Factory&) const + Algorithm_Factory& af) const { +#if defined(BOTAN_HAS_OFB) + if(request.algo_name() == "OFB" && request.arg_count() == 1) + { + const BlockCipher* proto = af.prototype_block_cipher(request.arg(0)); + return new OFB(proto->clone()); + } +#endif + +#if defined(BOTAN_HAS_CTR_BE) + if(request.algo_name() == "CTR-BE" && request.arg_count() == 1) + { + const BlockCipher* proto = af.prototype_block_cipher(request.arg(0)); + return new CTR_BE(proto->clone()); + } +#endif + #if defined(BOTAN_HAS_RC4) if(request.algo_name() == "RC4") return new RC4(request.arg_as_integer(0, 0)); @@ -32,6 +61,11 @@ Core_Engine::find_stream_cipher(const SCAN_Name& request, return new RC4(768); #endif +#if defined(BOTAN_HAS_CHACHA) + if(request.algo_name() == "ChaCha") + return new ChaCha; +#endif + #if defined(BOTAN_HAS_SALSA20) if(request.algo_name() == "Salsa20") return new Salsa20; |