57#if defined(BOTAN_HAS_COMMONCRYPTO)
71#if defined(BOTAN_HAS_STREAM_CIPHER)
73 return std::make_unique<Stream_Cipher_Mode>(std::move(sc));
77#if defined(BOTAN_HAS_AEAD_MODES)
83 if(algo.find(
'/') != std::string::npos) {
84 const std::vector<std::string> algo_parts =
split_on(algo,
'/');
85 if(algo_parts.size() < 2) {
86 return std::unique_ptr<Cipher_Mode>();
88 const std::string_view cipher_name = algo_parts[0];
91 if(mode_info.empty()) {
92 return std::unique_ptr<Cipher_Mode>();
95 std::ostringstream mode_name;
97 mode_name << mode_info[0] <<
'(' << cipher_name;
98 for(
size_t i = 1; i < mode_info.size(); ++i) {
99 mode_name <<
',' << mode_info[i];
101 for(
size_t i = 2; i < algo_parts.size(); ++i) {
102 mode_name <<
',' << algo_parts[i];
109#if defined(BOTAN_HAS_BLOCK_CIPHER)
114 return std::unique_ptr<Cipher_Mode>();
120 return std::unique_ptr<Cipher_Mode>();
123 #if defined(BOTAN_HAS_MODE_CBC)
125 const std::string padding = spec.
arg(1,
"PKCS7");
127 if(padding ==
"CTS") {
129 return std::make_unique<CTS_Encryption>(std::move(bc));
131 return std::make_unique<CTS_Decryption>(std::move(bc));
138 return std::make_unique<CBC_Encryption>(std::move(bc), std::move(pad));
140 return std::make_unique<CBC_Decryption>(std::move(bc), std::move(pad));
147 #if defined(BOTAN_HAS_MODE_XTS)
150 return std::make_unique<XTS_Encryption>(std::move(bc));
152 return std::make_unique<XTS_Decryption>(std::move(bc));
157 #if defined(BOTAN_HAS_MODE_CFB)
159 const size_t feedback_bits = spec.
arg_as_integer(1, 8 * bc->block_size());
161 return std::make_unique<CFB_Encryption>(std::move(bc), feedback_bits);
163 return std::make_unique<CFB_Decryption>(std::move(bc), feedback_bits);
170 return std::unique_ptr<Cipher_Mode>();