Botan 3.6.0
Crypto and TLS for C&
dilithium_round3_symmetric_primitives.cpp
Go to the documentation of this file.
1/*
2* Asymmetric primitives for Dilithium round 3
3* (C) 2021-2024 Jack Lloyd
4* 2021-2022 Manuel Glaser and Michael Boric, Rohde & Schwarz Cybersecurity
5* 2021-2022 René Meusel and Hannes Rantzsch, neXenio GmbH
6* 2024 Fabian Albert and René Meusel, Rohde & Schwarz Cybersecurity
7*
8* Botan is released under the Simplified BSD License (see license.txt)
9*/
10
11#include <botan/internal/dilithium_round3_symmetric_primitives.h>
12
13#include <botan/rng.h>
14#include <botan/internal/dilithium_algos.h>
15
16namespace Botan {
17
19 return Dilithium_Algos::encode_keypair(keypair).get();
20}
21
23 DilithiumConstants mode) const {
24 BOTAN_ARG_CHECK(mode.mode().is_available(), "Dilithium/ML-DSA mode is not available in this build");
25 BOTAN_ARG_CHECK(private_key.size() == mode.private_key_bytes(),
26 "dilithium private key does not have the correct byte count");
27 return Dilithium_Algos::decode_keypair(StrongSpan<const DilithiumSerializedPrivateKey>(private_key),
28 std::move(mode));
29}
30
31} // namespace Botan
#define BOTAN_ARG_CHECK(expr, msg)
Definition assert.h:29
size_t private_key_bytes() const
byte length of the encoded private key
bool is_available() const
secure_vector< uint8_t > encode_keypair(DilithiumInternalKeypair keypair) const override
DilithiumInternalKeypair decode_keypair(std::span< const uint8_t > private_key, DilithiumConstants mode) const override
std::vector< T, secure_allocator< T > > secure_vector
Definition secmem.h:61
std::pair< std::shared_ptr< Dilithium_PublicKeyInternal >, std::shared_ptr< Dilithium_PrivateKeyInternal > > DilithiumInternalKeypair
Internal representation of a Dilithium key pair.