Botan 3.6.0
Crypto and TLS for C&
ml_dsa_impl.cpp
Go to the documentation of this file.
1/*
2* Asymmetric primitives for ML-DSA
3* (C) 2024 Jack Lloyd
4* (C) 2024 Fabian Albert, René Meusel - Rohde & Schwarz Cybersecurity
5*
6* Botan is released under the Simplified BSD License (see license.txt)
7*/
8
9#include <botan/internal/ml_dsa_impl.h>
10
11#include <botan/internal/dilithium_algos.h>
12
13namespace Botan {
14
16 BOTAN_ASSERT_NONNULL(keypair.second);
17 const auto& seed = keypair.second->seed();
18 BOTAN_ARG_CHECK(seed.has_value(), "Cannot encode keypair without the private seed");
19 return seed.value().get();
20}
21
23 DilithiumConstants mode) const {
24 return Dilithium_Algos::expand_keypair(DilithiumSeedRandomness(private_key_seed), std::move(mode));
25}
26
27} // namespace Botan
#define BOTAN_ASSERT_NONNULL(ptr)
Definition assert.h:86
#define BOTAN_ARG_CHECK(expr, msg)
Definition assert.h:29
secure_vector< uint8_t > encode_keypair(DilithiumInternalKeypair keypair) const override
DilithiumInternalKeypair decode_keypair(std::span< const uint8_t > private_key, DilithiumConstants mode) const override
DilithiumInternalKeypair expand_keypair(DilithiumSeedRandomness xi, DilithiumConstants mode)
Strong< secure_vector< uint8_t >, struct DilithiumSeedRandomness_ > DilithiumSeedRandomness
Principal seed used to generate Dilithium key pairs.
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.