8 #include <botan/stream_cipher.h>
9 #include <botan/scan_name.h>
10 #include <botan/exceptn.h>
12 #if defined(BOTAN_HAS_CHACHA)
13 #include <botan/chacha.h>
16 #if defined(BOTAN_HAS_SALSA20)
17 #include <botan/salsa20.h>
20 #if defined(BOTAN_HAS_SHAKE_CIPHER)
21 #include <botan/shake_cipher.h>
24 #if defined(BOTAN_HAS_CTR_BE)
25 #include <botan/ctr.h>
28 #if defined(BOTAN_HAS_OFB)
29 #include <botan/ofb.h>
32 #if defined(BOTAN_HAS_RC4)
33 #include <botan/rc4.h>
36 #if defined(BOTAN_HAS_OPENSSL)
37 #include <botan/internal/openssl.h>
43 const std::string& provider)
47 #if defined(BOTAN_HAS_CTR_BE)
50 if(provider.empty() || provider ==
"base")
56 return std::unique_ptr<StreamCipher>(
new CTR_BE(
cipher.release(), ctr_size));
62 #if defined(BOTAN_HAS_CHACHA)
65 if(provider.empty() || provider ==
"base")
71 if(provider.empty() || provider ==
"base")
72 return std::unique_ptr<StreamCipher>(
new ChaCha(20));
76 #if defined(BOTAN_HAS_SALSA20)
79 if(provider.empty() || provider ==
"base")
80 return std::unique_ptr<StreamCipher>(
new Salsa20);
84 #if defined(BOTAN_HAS_SHAKE_CIPHER)
87 if(provider.empty() || provider ==
"base")
92 #if defined(BOTAN_HAS_OFB)
95 if(provider.empty() || provider ==
"base")
98 return std::unique_ptr<StreamCipher>(
new OFB(c.release()));
103 #if defined(BOTAN_HAS_RC4)
111 #if defined(BOTAN_HAS_OPENSSL)
112 if(provider.empty() || provider ==
"openssl")
114 return std::unique_ptr<StreamCipher>(make_openssl_rc4(skip));
118 if(provider.empty() || provider ==
"base")
120 return std::unique_ptr<StreamCipher>(
new RC4(skip));
133 std::unique_ptr<StreamCipher>
135 const std::string& provider)
146 return probe_providers_of<StreamCipher>(algo_spec, {
"base",
"openssl"});
std::string arg(size_t i) const
static std::unique_ptr< StreamCipher > create_or_throw(const std::string &algo_spec, const std::string &provider="")
virtual void cipher(const uint8_t in[], uint8_t out[], size_t len)=0
bool arg_count_between(size_t lower, size_t upper) const
size_t arg_as_integer(size_t i, size_t def_value) const
static std::vector< std::string > providers(const std::string &algo_spec)
#define BOTAN_UNUSED(...)
static std::unique_ptr< BlockCipher > create(const std::string &algo_spec, const std::string &provider="")
const std::string & algo_name() const
static std::unique_ptr< StreamCipher > create(const std::string &algo_spec, const std::string &provider="")