65#if defined(BOTAN_HAS_AEAD_CHACHA20_POLY1305)
66 if(algo ==
"ChaCha20Poly1305") {
68 return std::make_unique<ChaCha20Poly1305_Encryption>();
70 return std::make_unique<ChaCha20Poly1305_Decryption>();
75#if defined(BOTAN_HAS_ASCON_AEAD128)
76 if(algo ==
"Ascon-AEAD128") {
78 return std::make_unique<Ascon_AEAD128_Encryption>();
80 return std::make_unique<Ascon_AEAD128_Decryption>();
85 if(algo.find(
'/') != std::string::npos) {
86 const std::vector<std::string> algo_parts =
split_on(algo,
'/');
87 if(algo_parts.size() < 2) {
88 return std::unique_ptr<AEAD_Mode>();
90 const std::string_view cipher_name = algo_parts[0];
93 if(mode_info.empty()) {
94 return std::unique_ptr<AEAD_Mode>();
97 std::ostringstream mode_name;
99 mode_name << mode_info[0] <<
'(' << cipher_name;
100 for(
size_t i = 1; i < mode_info.size(); ++i) {
101 mode_name <<
',' << mode_info[i];
103 for(
size_t i = 2; i < algo_parts.size(); ++i) {
104 mode_name <<
',' << algo_parts[i];
111#if defined(BOTAN_HAS_BLOCK_CIPHER)
116 return std::unique_ptr<AEAD_Mode>();
122 return std::unique_ptr<AEAD_Mode>();
125 #if defined(BOTAN_HAS_AEAD_CCM)
130 return std::make_unique<CCM_Encryption>(std::move(bc), tag_len, L_len);
132 return std::make_unique<CCM_Decryption>(std::move(bc), tag_len, L_len);
137 #if defined(BOTAN_HAS_AEAD_GCM)
141 return std::make_unique<GCM_Encryption>(std::move(bc), tag_len);
143 return std::make_unique<GCM_Decryption>(std::move(bc), tag_len);
148 #if defined(BOTAN_HAS_AEAD_GCM_SIV)
152 return std::unique_ptr<AEAD_Mode>();
155 return std::make_unique<GCM_SIV_Encryption>(std::move(bc));
157 return std::make_unique<GCM_SIV_Decryption>(std::move(bc));
162 #if defined(BOTAN_HAS_AEAD_OCB)
166 return std::make_unique<OCB_Encryption>(std::move(bc), tag_len);
168 return std::make_unique<OCB_Decryption>(std::move(bc), tag_len);
173 #if defined(BOTAN_HAS_AEAD_EAX)
177 return std::make_unique<EAX_Encryption>(std::move(bc), tag_len);
179 return std::make_unique<EAX_Decryption>(std::move(bc), tag_len);
184 #if defined(BOTAN_HAS_AEAD_SIV)
187 return std::make_unique<SIV_Encryption>(std::move(bc));
189 return std::make_unique<SIV_Decryption>(std::move(bc));
196 return std::unique_ptr<AEAD_Mode>();