Botan: src/engine/core_engine/lookup_stream.cpp Source File

Botan 1.10.17

lookup_stream.cpp
Go to the documentation of this file.
1 /*
2 * Stream Cipher Lookup
3 * (C) 1999-2007 Jack Lloyd
4 *
5 * Distributed under the terms of the Botan license
6 */
7
8 #include <botan/internal/core_engine.h>
9 #include <botan/scan_name.h>
10
11 #if defined(BOTAN_HAS_ARC4)
12 #include <botan/arc4.h>
13 #endif
14
15 #if defined(BOTAN_HAS_SALSA20)
16 #include <botan/salsa20.h>
17 #endif
18
19 #if defined(BOTAN_HAS_TURING)
20 #include <botan/turing.h>
21 #endif
22
23 #if defined(BOTAN_HAS_WID_WAKE)
24 #include <botan/wid_wake.h>
25 #endif
26
27 namespace Botan {
28
29 /*
30 * Look for an algorithm with this name
31 */
32 StreamCipher*
33 Core_Engine::find_stream_cipher(const SCAN_Name& request,
34 Algorithm_Factory&) const
35 {
36 #if defined(BOTAN_HAS_ARC4)
37 if(request.algo_name() == "ARC4")
38 return new ARC4(request.arg_as_integer(0, 0));
39 if(request.algo_name() == "RC4_drop")
40 return new ARC4(768);
41 #endif
42
43 #if defined(BOTAN_HAS_SALSA20)
44 if(request.algo_name() == "Salsa20")
45 return new Salsa20;
46 #endif
47
48 #if defined(BOTAN_HAS_TURING)
49 if(request.algo_name() == "Turing")
50 return new Turing;
51 #endif
52
53 #if defined(BOTAN_HAS_WID_WAKE)
54 if(request.algo_name() == "WiderWake4+1-BE")
55 return new WiderWake_41_BE;
56 #endif
57
58 return 0;
59 }
60
61 }
Botan::WiderWake_41_BE
Definition: wid_wake.h:21
Botan::Algorithm_Factory
Definition: algo_factory.h:34
Botan::Core_Engine::find_stream_cipher
StreamCipher * find_stream_cipher(const SCAN_Name &, Algorithm_Factory &) const
Definition: lookup_stream.cpp:33
Botan::Turing
Definition: turing.h:18
Botan::SCAN_Name::arg_as_integer
size_t arg_as_integer(size_t i, size_t def_value) const
Definition: scan_name.cpp:167
Botan::ARC4
Definition: arc4.h:19
Botan
Definition: algo_base.h:14
Botan::SCAN_Name
Definition: scan_name.h:21
Botan::Salsa20
Definition: salsa20.h:18
Botan::SCAN_Name::algo_name
std::string algo_name() const
Definition: scan_name.h:37