9#ifndef BOTAN_ML_DSA_SYM_PRIMITIVES_H_
10#define BOTAN_ML_DSA_SYM_PRIMITIVES_H_
12#include <botan/internal/dilithium_symmetric_primitives.h>
15#include <botan/internal/dilithium_keys.h>
16#include <botan/internal/dilithium_shake_xof.h>
17#include <botan/internal/int_utils.h>
33 return user_context.size() <= 255;
36 void start(std::span<const uint8_t> user_context)
final {
47 constexpr uint8_t domain_separator = 0x00;
49 update(std::array{domain_separator, context_length});
66 m_seed_expansion_domain_separator({mode.
k(), mode.
l()}) {}
71 std::optional<std::reference_wrapper<RandomNumberGenerator>> rng)
const override {
73 const auto rnd = [&] {
76 rng->get().randomize(optional_randomness);
78 return optional_randomness;
89 return std::make_unique<ML_DSA_MessageHash>(std::move(tr));
93 return m_seed_expansion_domain_separator;
97 std::array<uint8_t, 2> m_seed_expansion_domain_separator;
uint8_t l() const
dimensions of the expanded matrix A
static constexpr size_t OPTIONAL_RANDOMNESS_BYTES
static constexpr size_t SEED_RHOPRIME_BYTES
uint8_t k() const
dimensions of the expanded matrix A
virtual void start(std::span< const uint8_t > user_context)
DilithiumMessageHash(DilithiumHashedPublicKey tr)
OutT H_256(size_t outbytes, InTs &&... ins) 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
void start(std::span< const uint8_t > user_context) final
bool is_valid_user_context(std::span< const uint8_t > user_context) const final
StrongSpan< const DilithiumCommitmentHash > truncate_commitment_hash(StrongSpan< const DilithiumCommitmentHash > seed) const override
std::optional< std::array< uint8_t, 2 > > seed_expansion_domain_separator() const override
ML_DSA_Symmetric_Primitives(const DilithiumConstants &mode)
DilithiumSeedRhoPrime H_maybe_randomized(StrongSpan< const DilithiumSigningSeedK > k, StrongSpan< const DilithiumMessageRepresentative > mu, std::optional< std::reference_wrapper< RandomNumberGenerator > > rng) const override
std::unique_ptr< DilithiumMessageHash > get_message_hash(DilithiumHashedPublicKey tr) const override
int(* update)(CTX *, const void *, CC_LONG len)
int(* final)(unsigned char *, CTX *)
constexpr RT checked_cast_to(AT i)
std::vector< T, secure_allocator< T > > secure_vector
std::pair< std::shared_ptr< Dilithium_PublicKeyInternal >, std::shared_ptr< Dilithium_PrivateKeyInternal > > DilithiumInternalKeypair
Internal representation of a Dilithium key pair.