53 std::string_view provider) {
54#if defined(BOTAN_HAS_COMMONCRYPTO)
68#if defined(BOTAN_HAS_STREAM_CIPHER)
70 return std::make_unique<Stream_Cipher_Mode>(std::move(sc));
74#if defined(BOTAN_HAS_AEAD_MODES)
80 if(algo.find(
'/') != std::string::npos) {
81 const std::vector<std::string> algo_parts =
split_on(algo,
'/');
82 std::string_view cipher_name = algo_parts[0];
85 if(mode_info.empty()) {
86 return std::unique_ptr<Cipher_Mode>();
89 std::ostringstream mode_name;
91 mode_name << mode_info[0] <<
'(' << cipher_name;
92 for(
size_t i = 1; i < mode_info.size(); ++i) {
93 mode_name <<
',' << mode_info[i];
95 for(
size_t i = 2; i < algo_parts.size(); ++i) {
96 mode_name <<
',' << algo_parts[i];
103#if defined(BOTAN_HAS_BLOCK_CIPHER)
108 return std::unique_ptr<Cipher_Mode>();
114 return std::unique_ptr<Cipher_Mode>();
117 #if defined(BOTAN_HAS_MODE_CBC)
119 const std::string padding = spec.
arg(1,
"PKCS7");
121 if(padding ==
"CTS") {
123 return std::make_unique<CTS_Encryption>(std::move(bc));
125 return std::make_unique<CTS_Decryption>(std::move(bc));
132 return std::make_unique<CBC_Encryption>(std::move(bc), std::move(pad));
134 return std::make_unique<CBC_Decryption>(std::move(bc), std::move(pad));
141 #if defined(BOTAN_HAS_MODE_XTS)
144 return std::make_unique<XTS_Encryption>(std::move(bc));
146 return std::make_unique<XTS_Decryption>(std::move(bc));
151 #if defined(BOTAN_HAS_MODE_CFB)
153 const size_t feedback_bits = spec.
arg_as_integer(1, 8 * bc->block_size());
155 return std::make_unique<CFB_Encryption>(std::move(bc), feedback_bits);
157 return std::make_unique<CFB_Decryption>(std::move(bc), feedback_bits);
164 return std::unique_ptr<Cipher_Mode>();