13#ifndef BOTAN_DILITHIUM_INTERNAL_KEYS_H_
14#define BOTAN_DILITHIUM_INTERNAL_KEYS_H_
16#include <botan/internal/dilithium_types.h>
18#include <botan/internal/dilithium_algos.h>
19#include <botan/internal/dilithium_symmetric_primitives.h>
35 static std::shared_ptr<Dilithium_PublicKeyInternal>
decode(
38 return std::make_shared<Dilithium_PublicKeyInternal>(std::move(
mode), std::move(
rho), std::move(
t1));
42 m_mode(std::move(
mode)),
43 m_rho(std::move(
rho)),
45 m_tr(m_mode.symmetric_primitives().H(
raw_pk())) {
71 std::optional<DilithiumSeedRandomness>
seed,
76 m_mode(std::move(
mode)),
77 m_seed(std::move(
seed)),
81 m_s2(std::move(
s2)) {}
86 const std::optional<DilithiumSeedRandomness>&
seed()
const {
return m_seed; }
99 if(m_seed.has_value()) {
106 if(m_seed.has_value()) {
113 std::optional<DilithiumSeedRandomness> m_seed;
#define BOTAN_ASSERT_NOMSG(expr)
virtual secure_vector< uint8_t > encode_keypair(DilithiumInternalKeypair keypair) const =0
virtual DilithiumInternalKeypair decode_keypair(std::span< const uint8_t > private_key, DilithiumConstants mode) const =0
virtual ~Dilithium_Keypair_Codec()=default
static std::unique_ptr< Dilithium_Keypair_Codec > create(DilithiumMode mode)
const std::optional< DilithiumSeedRandomness > & seed() const
const DilithiumPolyVec & s1() const
const DilithiumPolyVec & s2() const
Dilithium_PrivateKeyInternal(DilithiumConstants mode, std::optional< DilithiumSeedRandomness > seed, DilithiumSigningSeedK signing_seed, DilithiumPolyVec s1, DilithiumPolyVec s2, DilithiumPolyVec t0)
const DilithiumConstants & mode() const
const DilithiumPolyVec & t0() const
void _const_time_unpoison() const
void _const_time_poison() const
const DilithiumSigningSeedK & signing_seed() const
static std::shared_ptr< Dilithium_PublicKeyInternal > decode(DilithiumConstants mode, StrongSpan< const DilithiumSerializedPublicKey > raw_pk)
Dilithium_PublicKeyInternal(DilithiumConstants mode, DilithiumSeedRho rho, DilithiumPolyVec t1)
const DilithiumSeedRho & rho() const
const DilithiumPolyVec & t1() const
const DilithiumConstants & mode() const
const DilithiumHashedPublicKey & tr() const
DilithiumSerializedPublicKey raw_pk() const
constexpr void unpoison_all(Ts &&... ts)
constexpr void poison_all(Ts &&... ts)
constexpr void unpoison(const T *p, size_t n)
constexpr void poison(const T *p, size_t n)
DilithiumSerializedPublicKey encode_public_key(StrongSpan< const DilithiumSeedRho > rho, const DilithiumPolyVec &t1, const DilithiumConstants &mode)
std::pair< DilithiumSeedRho, DilithiumPolyVec > decode_public_key(StrongSpan< const DilithiumSerializedPublicKey > pk, const DilithiumConstants &mode)
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.