10#include <botan/internal/ml_kem_impl.h>
12#include <botan/internal/ct_utils.h>
13#include <botan/internal/kyber_algos.h>
14#include <botan/internal/kyber_constants.h>
15#include <botan/internal/kyber_types.h>
28 const auto& sym = m_public_key->mode().symmetric_primitives();
33 const auto [K, r] = sym.G(m, m_public_key->H_public_key_bits_raw());
52 const auto& sym = m_public_key->mode().symmetric_primitives();
54 const auto& h = m_public_key->H_public_key_bits_raw();
55 const auto& z = m_private_key->z();
57 const auto m_prime = m_private_key->indcpa_decrypt(c);
58 const auto [K_prime, r_prime] = sym.G(m_prime, h);
60 const auto K_bar = sym.J(z, c);
84 const auto& seed = keypair.second->seed();
85 BOTAN_ARG_CHECK(seed.d.has_value(),
"Cannot encode keypair without the full private seed");
#define BOTAN_ASSERT_NOMSG(expr)
#define BOTAN_ASSERT_NONNULL(ptr)
#define BOTAN_ARG_CHECK(expr, msg)
auto copy(const size_t count)
static constexpr size_t SEED_BYTES
const KyberPolyMat & precomputed_matrix_At() const
void decapsulate(StrongSpan< KyberSharedSecret > out_shared_key, StrongSpan< const KyberCompressedCiphertext > encapsulated_key) override
void encapsulate(StrongSpan< KyberCompressedCiphertext > out_encapsulated_key, StrongSpan< KyberSharedSecret > out_shared_key, RandomNumberGenerator &rng) override
KyberInternalKeypair decode_keypair(std::span< const uint8_t > buffer, KyberConstants mode) const override
secure_vector< uint8_t > encode_keypair(KyberInternalKeypair keypair) const override
void random_vec(std::span< uint8_t > v)
decltype(auto) data() noexcept(noexcept(this->m_span.data()))
decltype(auto) size() const noexcept(noexcept(this->m_span.size()))
constexpr void unpoison_all(Ts &&... ts)
constexpr auto scoped_poison(const Ts &... xs)
constexpr Mask< T > conditional_copy_mem(Mask< T > mask, T *to, const T *from0, const T *from1, size_t elems)
constexpr CT::Mask< T > is_equal(const T x[], const T y[], size_t len)
constexpr void unpoison(const T *p, size_t n)
KyberInternalKeypair expand_keypair(KyberPrivateKeySeed seed, KyberConstants mode)
constexpr auto concat(Rs &&... ranges)
std::pair< std::shared_ptr< Kyber_PublicKeyInternal >, std::shared_ptr< Kyber_PrivateKeyInternal > > KyberInternalKeypair
std::vector< T, secure_allocator< T > > secure_vector
constexpr void copy_mem(T *out, const T *in, size_t n)