8#include <botan/stream_cipher.h>
10#include <botan/exceptn.h>
11#include <botan/mem_ops.h>
12#include <botan/internal/scan_name.h>
14#if defined(BOTAN_HAS_CHACHA)
15 #include <botan/internal/chacha.h>
18#if defined(BOTAN_HAS_SALSA20)
19 #include <botan/internal/salsa20.h>
22#if defined(BOTAN_HAS_SHAKE_CIPHER)
23 #include <botan/internal/shake_cipher.h>
26#if defined(BOTAN_HAS_CTR_BE)
27 #include <botan/internal/ctr.h>
30#if defined(BOTAN_HAS_OFB)
31 #include <botan/internal/ofb.h>
34#if defined(BOTAN_HAS_RC4)
35 #include <botan/internal/rc4.h>
41#if defined(BOTAN_HAS_SHAKE_CIPHER)
42 if(algo_spec ==
"SHAKE-128" || algo_spec ==
"SHAKE-128-XOF") {
44 return std::make_unique<SHAKE_128_Cipher>();
48 if(algo_spec ==
"SHAKE-256" || algo_spec ==
"SHAKE-256-XOF") {
50 return std::make_unique<SHAKE_256_Cipher>();
55#if defined(BOTAN_HAS_CHACHA)
56 if(algo_spec ==
"ChaCha20") {
58 return std::make_unique<ChaCha>(20);
63#if defined(BOTAN_HAS_SALSA20)
64 if(algo_spec ==
"Salsa20") {
66 return std::make_unique<Salsa20>();
73#if defined(BOTAN_HAS_CTR_BE)
79 return std::make_unique<CTR_BE>(std::move(
cipher), ctr_size);
85#if defined(BOTAN_HAS_CHACHA)
93#if defined(BOTAN_HAS_OFB)
97 return std::make_unique<OFB>(std::move(
cipher));
103#if defined(BOTAN_HAS_RC4)
109 return std::make_unique<RC4>(skip);
static std::unique_ptr< BlockCipher > create(std::string_view algo_spec, std::string_view provider="")
std::string arg(size_t i) const
const std::string & algo_name() const
size_t arg_as_integer(size_t i, size_t def_value) const
bool arg_count_between(size_t lower, size_t upper) const
void cipher1(uint8_t buf[], size_t len)
static std::unique_ptr< StreamCipher > create_or_throw(std::string_view algo_spec, std::string_view provider="")
static std::unique_ptr< StreamCipher > create(std::string_view algo_spec, std::string_view provider="")
virtual size_t default_iv_length() const
virtual void generate_keystream(uint8_t out[], size_t len)
static std::vector< std::string > providers(std::string_view algo_spec)
void cipher(const uint8_t in[], uint8_t out[], size_t len)
virtual std::string provider() const
std::vector< std::string > probe_providers_of(std::string_view algo_spec, const std::vector< std::string > &possible={"base"})
constexpr void clear_mem(T *ptr, size_t n)