Botan 3.6.1
Crypto and TLS for C&
Botan::Kyber_PrivateKeyInternal Class Reference

#include <kyber_keys.h>

Public Member Functions

void _const_time_poison () const
 
void _const_time_unpoison () const
 
KyberMessage indcpa_decrypt (StrongSpan< const KyberCompressedCiphertext > ct) const
 
 Kyber_PrivateKeyInternal ()=delete
 
 Kyber_PrivateKeyInternal (KyberConstants mode, KyberPolyVecNTT s, KyberPrivateKeySeed seed)
 
const KyberConstantsmode () const
 
KyberPolyVecNTTs ()
 
const KyberPolyVecNTTs () const
 
const KyberPrivateKeySeedseed () const
 
const KyberImplicitRejectionValuez () const
 

Detailed Description

Definition at line 67 of file kyber_keys.h.

Constructor & Destructor Documentation

◆ Kyber_PrivateKeyInternal() [1/2]

Botan::Kyber_PrivateKeyInternal::Kyber_PrivateKeyInternal ( KyberConstants mode,
KyberPolyVecNTT s,
KyberPrivateKeySeed seed )
inline

Definition at line 69 of file kyber_keys.h.

69 :
70 m_mode(std::move(mode)), m_s(std::move(s)), m_seed(std::move(seed)) {}
const KyberConstants & mode() const
Definition kyber_keys.h:82
const KyberPrivateKeySeed & seed() const
Definition kyber_keys.h:78

◆ Kyber_PrivateKeyInternal() [2/2]

Botan::Kyber_PrivateKeyInternal::Kyber_PrivateKeyInternal ( )
delete

Member Function Documentation

◆ _const_time_poison()

void Botan::Kyber_PrivateKeyInternal::_const_time_poison ( ) const
inline

Definition at line 86 of file kyber_keys.h.

86{ CT::poison_all(m_s, m_seed.d, m_seed.z); }
constexpr void poison_all(Ts &&... ts)
Definition ct_utils.h:195
KyberImplicitRejectionValue z
Definition kyber_types.h:81
std::optional< KyberSeedRandomness > d
Definition kyber_types.h:80

References Botan::KyberPrivateKeySeed::d, Botan::CT::poison_all(), and Botan::KyberPrivateKeySeed::z.

◆ _const_time_unpoison()

void Botan::Kyber_PrivateKeyInternal::_const_time_unpoison ( ) const
inline

Definition at line 88 of file kyber_keys.h.

88{ CT::unpoison_all(m_s, m_seed.d, m_seed.z); }
constexpr void unpoison_all(Ts &&... ts)
Definition ct_utils.h:201

References Botan::KyberPrivateKeySeed::d, Botan::CT::unpoison_all(), and Botan::KyberPrivateKeySeed::z.

◆ indcpa_decrypt()

KyberMessage Botan::Kyber_PrivateKeyInternal::indcpa_decrypt ( StrongSpan< const KyberCompressedCiphertext > ct) const

NIST FIPS 203, Algorithm 15 (K-PKE.Decrypt)

s^T is already decoded and available as a member variable. This allows to reuse the structure for multiple decryptions.

Definition at line 84 of file kyber_keys.cpp.

84 {
85 auto [u, v] = Kyber_Algos::decompress_ciphertext(ct, m_mode);
86 v -= inverse_ntt(m_s * ntt(std::move(u)));
87 v.reduce();
89}
Polynomial< Trait, Domain::NTT > ntt(Polynomial< Trait, Domain::Normal > p)
Definition pqcrystals.h:557
Polynomial< Trait, Domain::Normal > inverse_ntt(Polynomial< Trait, Domain::NTT > p_ntt)
Definition pqcrystals.h:564
KyberMessage polynomial_to_message(const KyberPoly &p)
std::pair< KyberPolyVec, KyberPoly > decompress_ciphertext(StrongSpan< const KyberCompressedCiphertext > ct, const KyberConstants &mode)

References Botan::Kyber_Algos::decompress_ciphertext(), and Botan::Kyber_Algos::polynomial_to_message().

◆ mode()

const KyberConstants & Botan::Kyber_PrivateKeyInternal::mode ( ) const
inline

Definition at line 82 of file kyber_keys.h.

82{ return m_mode; }

◆ s() [1/2]

KyberPolyVecNTT & Botan::Kyber_PrivateKeyInternal::s ( )
inline

Definition at line 74 of file kyber_keys.h.

74{ return m_s; }

◆ s() [2/2]

const KyberPolyVecNTT & Botan::Kyber_PrivateKeyInternal::s ( ) const
inline

Definition at line 76 of file kyber_keys.h.

76{ return m_s; }

◆ seed()

const KyberPrivateKeySeed & Botan::Kyber_PrivateKeyInternal::seed ( ) const
inline

Definition at line 78 of file kyber_keys.h.

78{ return m_seed; }

◆ z()

const KyberImplicitRejectionValue & Botan::Kyber_PrivateKeyInternal::z ( ) const
inline

Definition at line 80 of file kyber_keys.h.

80{ return m_seed.z; }

References Botan::KyberPrivateKeySeed::z.


The documentation for this class was generated from the following files: