Botan 3.6.1
Crypto and TLS for C&
dilithium_symmetric_primitives.cpp
Go to the documentation of this file.
1/**
2 * Symmetric primitives for dilithium
3 *
4 * (C) 2022-2023 Jack Lloyd
5 * (C) 2022-2023 Michael Boric, René Meusel - Rohde & Schwarz Cybersecurity
6 * (C) 2022 Manuel Glaser - Rohde & Schwarz Cybersecurity
7 * (C) 2024 Fabian Albert, René Meusel - Rohde & Schwarz Cybersecurity
8 *
9 * Botan is released under the Simplified BSD License (see license.txt)
10 */
11
12#include <botan/internal/dilithium_symmetric_primitives.h>
13
14#if defined(BOTAN_HAS_DILITHIUM)
15 #include <botan/internal/dilithium_round3.h>
16#endif
17
18#if defined(BOTAN_HAS_DILITHIUM_AES)
19 #include <botan/internal/dilithium_aes.h>
20#endif
21
22#if defined(BOTAN_HAS_ML_DSA)
23 #include <botan/internal/ml_dsa_impl.h>
24#endif
25
26namespace Botan {
27
28std::unique_ptr<Dilithium_Symmetric_Primitives_Base> Dilithium_Symmetric_Primitives_Base::create(
29 const DilithiumConstants& mode) {
30#if defined(BOTAN_HAS_DILITHIUM)
31 if(mode.is_modern() && !mode.is_ml_dsa()) {
32 return std::make_unique<Dilithium_Symmetric_Primitives>(mode);
33 }
34#endif
35
36#if defined(BOTAN_HAS_DILITHIUM_AES)
37 if(mode.is_aes()) {
38 return std::make_unique<Dilithium_AES_Symmetric_Primitives>(mode);
39 }
40#endif
41
42#if defined(BOTAN_HAS_ML_DSA)
43 if(mode.is_ml_dsa()) {
44 return std::make_unique<ML_DSA_Symmetric_Primitives>(mode);
45 }
46#endif
47
48 throw Not_Implemented("requested ML-DSA/Dilithium mode is not implemented in this build");
49}
50
51} // namespace Botan
static std::unique_ptr< Dilithium_Symmetric_Primitives_Base > create(const DilithiumConstants &mode)