Botan 3.6.0
Crypto and TLS for C&
dilithium_keys.cpp
Go to the documentation of this file.
1/*
2 * Crystals Dilithium Internal Key Types
3 *
4 * (C) 2024 Jack Lloyd
5 * 2024 René Meusel - Rohde & Schwarz Cybersecurity
6 *
7 * Botan is released under the Simplified BSD License (see license.txt)
8 */
9
10#include <botan/internal/dilithium_keys.h>
11
12#if defined(BOTAN_HAS_DILITHIUM) || defined(BOTAN_HAS_DILITHIUM_AES)
13 #include <botan/internal/dilithium_round3_symmetric_primitives.h>
14#endif
15
16#if defined(BOTAN_HAS_ML_DSA)
17 #include <botan/internal/ml_dsa_impl.h>
18#endif
19
20namespace Botan {
21
22std::unique_ptr<Dilithium_Keypair_Codec> Dilithium_Keypair_Codec::create(DilithiumMode mode) {
23#if defined(BOTAN_HAS_DILITHIUM) || defined(BOTAN_HAS_DILITHIUM_AES)
24 if(mode.is_dilithium_round3()) {
25 return std::make_unique<Dilithium_Expanded_Keypair_Codec>();
26 }
27#endif
28
29#if defined(BOTAN_HAS_ML_DSA)
30 if(mode.is_ml_dsa()) {
31 return std::make_unique<ML_DSA_Expanding_Keypair_Codec>();
32 }
33#endif
34
35 throw Not_Implemented("requested ML-DSA/Dilithium mode is not implemented in this build");
36}
37
38} // namespace Botan
bool is_dilithium_round3() const
Definition dilithium.h:48
bool is_ml_dsa() const
static std::unique_ptr< Dilithium_Keypair_Codec > create(DilithiumMode mode)