Botan
3.6.1
Crypto and TLS for C&
src
lib
pubkey
dilithium
dilithium_common
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
20
namespace
Botan
{
21
22
std::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
Botan::DilithiumMode
Definition
dilithium.h:21
Botan::DilithiumMode::is_dilithium_round3
bool is_dilithium_round3() const
Definition
dilithium.h:48
Botan::DilithiumMode::is_ml_dsa
bool is_ml_dsa() const
Definition
dilithium.cpp:106
Botan::Dilithium_Keypair_Codec::create
static std::unique_ptr< Dilithium_Keypair_Codec > create(DilithiumMode mode)
Definition
dilithium_keys.cpp:22
Botan::Not_Implemented
Definition
exceptn.h:334
Botan
Definition
alg_id.cpp:13
Generated by
1.12.0