12#include <botan/internal/kyber_keys.h>
14#include <botan/internal/kyber_symmetric_primitives.h>
15#include <botan/internal/stl_util.h>
22 if(public_key.size() != expected_length) {
23 throw Invalid_Argument(
"Public key does not have the correct byte count");
31 m_mode(std::move(mode)),
32 m_public_key_bits_raw(validate_public_key_length(std::move(public_key), m_mode.public_key_bytes())),
33 m_H_public_key_bits_raw(m_mode.symmetric_primitives().H(m_public_key_bits_raw)),
34 m_t(Kyber_Algos::decode_polynomial_vector(
35 std::span{m_public_key_bits_raw}.first(m_mode.polynomial_vector_bytes()), m_mode)),
39 m_mode(std::move(mode)),
40 m_public_key_bits_raw(
concat(Kyber_Algos::encode_polynomial_vector<std::vector<uint8_t>>(t, m_mode),
rho)),
41 m_H_public_key_bits_raw(m_mode.symmetric_primitives().H(m_public_key_bits_raw)),
43 m_rho(std::move(
rho)) {}
65 auto u = inverse_ntt(At * y);
70 auto v = inverse_ntt(m_t * y);
86 v -= inverse_ntt(m_s * ntt(std::move(u)));
KyberPoly sample_polynomial_cbd_eta2()
KyberPolyVec sample_polynomial_vector_cbd_eta1()
KyberPolyVec sample_polynomial_vector_cbd_eta2()
KyberMessage indcpa_decrypt(StrongSpan< const KyberCompressedCiphertext > ct) const
void indcpa_encrypt(StrongSpan< KyberCompressedCiphertext > out_ct, StrongSpan< const KyberMessage > m, StrongSpan< const KyberEncryptionRandomness > r, const KyberPolyMat &At) const
Kyber_PublicKeyInternal()=delete
KyberMessage polynomial_to_message(const KyberPoly &p)
void compress_ciphertext(StrongSpan< KyberCompressedCiphertext > out, const KyberPolyVec &u, const KyberPoly &v, const KyberConstants &m_mode)
KyberPoly polynomial_from_message(StrongSpan< const KyberMessage > msg)
std::pair< KyberPolyVec, KyberPoly > decompress_ciphertext(StrongSpan< const KyberCompressedCiphertext > ct, const KyberConstants &mode)
constexpr auto concat(Rs &&... ranges)
Strong< std::vector< uint8_t >, struct KyberSerializedPublicKey_ > KyberSerializedPublicKey
Public key in serialized form (t || rho)