53 std::string_view provider) {
54#if defined(BOTAN_HAS_COMMONCRYPTO)
64#if defined(BOTAN_HAS_STREAM_CIPHER)
66 return std::make_unique<Stream_Cipher_Mode>(std::move(sc));
70#if defined(BOTAN_HAS_AEAD_MODES)
76 if(algo.find(
'/') != std::string::npos) {
77 const std::vector<std::string> algo_parts =
split_on(algo,
'/');
78 std::string_view cipher_name = algo_parts[0];
81 if(mode_info.empty()) {
82 return std::unique_ptr<Cipher_Mode>();
85 std::ostringstream mode_name;
87 mode_name << mode_info[0] <<
'(' << cipher_name;
88 for(
size_t i = 1; i < mode_info.size(); ++i) {
89 mode_name <<
',' << mode_info[i];
91 for(
size_t i = 2; i < algo_parts.size(); ++i) {
92 mode_name <<
',' << algo_parts[i];
99#if defined(BOTAN_HAS_BLOCK_CIPHER)
104 return std::unique_ptr<Cipher_Mode>();
110 return std::unique_ptr<Cipher_Mode>();
113 #if defined(BOTAN_HAS_MODE_CBC)
115 const std::string padding = spec.
arg(1,
"PKCS7");
117 if(padding ==
"CTS") {
119 return std::make_unique<CTS_Encryption>(std::move(bc));
121 return std::make_unique<CTS_Decryption>(std::move(bc));
128 return std::make_unique<CBC_Encryption>(std::move(bc), std::move(pad));
130 return std::make_unique<CBC_Decryption>(std::move(bc), std::move(pad));
137 #if defined(BOTAN_HAS_MODE_XTS)
140 return std::make_unique<XTS_Encryption>(std::move(bc));
142 return std::make_unique<XTS_Decryption>(std::move(bc));
147 #if defined(BOTAN_HAS_MODE_CFB)
149 const size_t feedback_bits = spec.
arg_as_integer(1, 8 * bc->block_size());
151 return std::make_unique<CFB_Encryption>(std::move(bc), feedback_bits);
153 return std::make_unique<CFB_Decryption>(std::move(bc), feedback_bits);
160 return std::unique_ptr<Cipher_Mode>();