/src/botan/src/lib/pubkey/dilithium/dilithium_common/dilithium_keys.cpp
Line | Count | Source (jump to first uncovered line) |
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 | 3 | std::unique_ptr<Dilithium_Keypair_Codec> Dilithium_Keypair_Codec::create(DilithiumMode mode) { |
23 | 3 | #if defined(BOTAN_HAS_DILITHIUM) || defined(BOTAN_HAS_DILITHIUM_AES) |
24 | 3 | if(mode.is_dilithium_round3()) { |
25 | 0 | return std::make_unique<Dilithium_Expanded_Keypair_Codec>(); |
26 | 0 | } |
27 | 3 | #endif |
28 | | |
29 | 3 | #if defined(BOTAN_HAS_ML_DSA) |
30 | 3 | if(mode.is_ml_dsa()) { |
31 | 3 | return std::make_unique<ML_DSA_Expanding_Keypair_Codec>(); |
32 | 3 | } |
33 | 0 | #endif |
34 | | |
35 | 0 | throw Not_Implemented("requested ML-DSA/Dilithium mode is not implemented in this build"); |
36 | 3 | } |
37 | | |
38 | | } // namespace Botan |