8#include <botan/block_cipher.h>
10#include <botan/exceptn.h>
11#include <botan/internal/scan_name.h>
13#if defined(BOTAN_HAS_AES)
14 #include <botan/internal/aes.h>
17#if defined(BOTAN_HAS_ARIA)
18 #include <botan/internal/aria.h>
21#if defined(BOTAN_HAS_BLOWFISH)
22 #include <botan/internal/blowfish.h>
25#if defined(BOTAN_HAS_CAMELLIA)
26 #include <botan/internal/camellia.h>
29#if defined(BOTAN_HAS_CAST_128)
30 #include <botan/internal/cast128.h>
33#if defined(BOTAN_HAS_CASCADE)
34 #include <botan/internal/cascade.h>
37#if defined(BOTAN_HAS_DES)
38 #include <botan/internal/des.h>
41#if defined(BOTAN_HAS_GOST_28147_89)
42 #include <botan/internal/gost_28147.h>
45#if defined(BOTAN_HAS_IDEA)
46 #include <botan/internal/idea.h>
49#if defined(BOTAN_HAS_LION)
50 #include <botan/internal/lion.h>
53#if defined(BOTAN_HAS_NOEKEON)
54 #include <botan/internal/noekeon.h>
57#if defined(BOTAN_HAS_SEED)
58 #include <botan/internal/seed.h>
61#if defined(BOTAN_HAS_SERPENT)
62 #include <botan/internal/serpent.h>
65#if defined(BOTAN_HAS_SHACAL2)
66 #include <botan/internal/shacal2.h>
69#if defined(BOTAN_HAS_SM4)
70 #include <botan/internal/sm4.h>
73#if defined(BOTAN_HAS_TWOFISH)
74 #include <botan/internal/twofish.h>
77#if defined(BOTAN_HAS_THREEFISH_512)
78 #include <botan/internal/threefish_512.h>
81#if defined(BOTAN_HAS_COMMONCRYPTO)
82 #include <botan/internal/commoncrypto.h>
88#if defined(BOTAN_HAS_COMMONCRYPTO)
106#if defined(BOTAN_HAS_AES)
107 if(algo ==
"AES-128") {
108 return std::make_unique<AES_128>();
111 if(algo ==
"AES-192") {
112 return std::make_unique<AES_192>();
115 if(algo ==
"AES-256") {
116 return std::make_unique<AES_256>();
120#if defined(BOTAN_HAS_ARIA)
121 if(algo ==
"ARIA-128") {
122 return std::make_unique<ARIA_128>();
125 if(algo ==
"ARIA-192") {
126 return std::make_unique<ARIA_192>();
129 if(algo ==
"ARIA-256") {
130 return std::make_unique<ARIA_256>();
134#if defined(BOTAN_HAS_SERPENT)
135 if(algo ==
"Serpent") {
136 return std::make_unique<Serpent>();
140#if defined(BOTAN_HAS_SHACAL2)
141 if(algo ==
"SHACAL2") {
142 return std::make_unique<SHACAL2>();
146#if defined(BOTAN_HAS_TWOFISH)
147 if(algo ==
"Twofish") {
148 return std::make_unique<Twofish>();
152#if defined(BOTAN_HAS_THREEFISH_512)
153 if(algo ==
"Threefish-512") {
154 return std::make_unique<Threefish_512>();
158#if defined(BOTAN_HAS_BLOWFISH)
159 if(algo ==
"Blowfish") {
160 return std::make_unique<Blowfish>();
164#if defined(BOTAN_HAS_CAMELLIA)
165 if(algo ==
"Camellia-128") {
166 return std::make_unique<Camellia_128>();
169 if(algo ==
"Camellia-192") {
170 return std::make_unique<Camellia_192>();
173 if(algo ==
"Camellia-256") {
174 return std::make_unique<Camellia_256>();
178#if defined(BOTAN_HAS_DES)
180 return std::make_unique<DES>();
183 if(algo ==
"TripleDES" || algo ==
"3DES" || algo ==
"DES-EDE") {
184 return std::make_unique<TripleDES>();
188#if defined(BOTAN_HAS_NOEKEON)
189 if(algo ==
"Noekeon") {
190 return std::make_unique<Noekeon>();
194#if defined(BOTAN_HAS_CAST_128)
195 if(algo ==
"CAST-128" || algo ==
"CAST5") {
196 return std::make_unique<CAST_128>();
200#if defined(BOTAN_HAS_IDEA)
202 return std::make_unique<IDEA>();
206#if defined(BOTAN_HAS_SEED)
208 return std::make_unique<SEED>();
212#if defined(BOTAN_HAS_SM4)
214 return std::make_unique<SM4>();
220#if defined(BOTAN_HAS_GOST_28147_89)
222 return std::make_unique<GOST_28147_89>(req.
arg(0,
"R3411_94_TestParam"));
226#if defined(BOTAN_HAS_CASCADE)
232 return std::make_unique<Cascade_Cipher>(std::move(c1), std::move(c2));
237#if defined(BOTAN_HAS_LION)
244 return std::make_unique<Lion>(std::move(hash), std::move(stream),
block_size);
264 return probe_providers_of<BlockCipher>(algo, {
"base",
"commoncrypto"});
static std::unique_ptr< BlockCipher > create_or_throw(std::string_view algo_spec, std::string_view provider="")
static std::vector< std::string > providers(std::string_view algo_spec)
static std::unique_ptr< BlockCipher > create(std::string_view algo_spec, std::string_view provider="")
virtual size_t block_size() const =0
virtual std::string provider() const
static std::unique_ptr< HashFunction > 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
static std::unique_ptr< StreamCipher > create(std::string_view algo_spec, std::string_view provider="")
std::unique_ptr< BlockCipher > make_commoncrypto_block_cipher(std::string_view name)