Botan 3.5.0
Crypto and TLS for C&
Botan::PolynomialMatrix Class Reference

#include <kyber_structures.h>

Public Member Functions

PolynomialVector pointwise_acc_montgomery (const PolynomialVector &vec, const bool with_mont=false) const
 
 PolynomialMatrix ()=delete
 

Static Public Member Functions

static PolynomialMatrix generate (StrongSpan< const KyberSeedRho > seed, const bool transposed, const KyberConstants &mode)
 

Detailed Description

Definition at line 513 of file kyber_structures.h.

Constructor & Destructor Documentation

◆ PolynomialMatrix()

Botan::PolynomialMatrix::PolynomialMatrix ( )
delete

Member Function Documentation

◆ generate()

static PolynomialMatrix Botan::PolynomialMatrix::generate ( StrongSpan< const KyberSeedRho > seed,
const bool transposed,
const KyberConstants & mode )
inlinestatic

Definition at line 517 of file kyber_structures.h.

519 {
520 BOTAN_ASSERT(seed.size() == KyberConstants::kSymBytes, "unexpected seed size");
521
522 PolynomialMatrix matrix(mode);
523
524 for(uint8_t i = 0; i < mode.k(); ++i) {
525 for(uint8_t j = 0; j < mode.k(); ++j) {
526 const auto pos = (transposed) ? std::tuple(i, j) : std::tuple(j, i);
527 matrix.m_mat[i][j] = Polynomial::sample_rej_uniform(mode.symmetric_primitives().XOF(seed, pos));
528 }
529 }
530
531 return matrix;
532 }
#define BOTAN_ASSERT(expr, assertion_made)
Definition assert.h:50
static constexpr size_t kSymBytes
static Polynomial sample_rej_uniform(std::unique_ptr< XOF > xof)

References BOTAN_ASSERT, Botan::KyberConstants::k(), Botan::KyberConstants::kSymBytes, Botan::Polynomial::sample_rej_uniform(), Botan::StrongSpan< T >::size(), Botan::KyberConstants::symmetric_primitives(), and Botan::Kyber_Symmetric_Primitives::XOF().

Referenced by Botan::Kyber_PublicKeyInternal::indcpa_encrypt(), and Botan::Kyber_PrivateKey::Kyber_PrivateKey().

◆ pointwise_acc_montgomery()

PolynomialVector Botan::PolynomialMatrix::pointwise_acc_montgomery ( const PolynomialVector & vec,
const bool with_mont = false ) const
inline

Definition at line 534 of file kyber_structures.h.

534 {
535 PolynomialVector result(m_mat.size());
536
537 for(size_t i = 0; i < m_mat.size(); ++i) {
538 result[i] = PolynomialVector::pointwise_acc_montgomery(m_mat[i], vec);
539 if(with_mont) {
540 result[i].tomont();
541 }
542 }
543
544 return result;
545 }
static Polynomial pointwise_acc_montgomery(const PolynomialVector &a, const PolynomialVector &b)

References Botan::PolynomialVector::pointwise_acc_montgomery().


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