12#ifndef BOTAN_POLYN_GF2M_H_
13#define BOTAN_POLYN_GF2M_H_
15#include <botan/secmem.h>
24class RandomNumberGenerator;
31 explicit polyn_gf2m(
const std::shared_ptr<GF2m_Field>& sp_field);
42 polyn_gf2m(
int d,
const std::shared_ptr<GF2m_Field>& sp_field);
52 polyn_gf2m(
const uint8_t* mem, uint32_t mem_len,
const std::shared_ptr<GF2m_Field>& sp_field);
57 polyn_gf2m(
int degree,
const uint8_t* mem,
size_t mem_byte_len,
const std::shared_ptr<GF2m_Field>& sp_field);
76 std::shared_ptr<GF2m_Field>
get_sp_field()
const {
return m_sp_field; }
90 void encode(uint32_t min_numo_coeffs, uint8_t* mem, uint32_t mem_len)
const;
118 void set_degree(
int d) { m_deg = d; }
121 void realloc(uint32_t new_size);
134 std::shared_ptr<GF2m_Field> m_sp_field;
140std::vector<polyn_gf2m>
syndrome_init(
const polyn_gf2m& generator,
const std::vector<gf2m>& support,
int n);
polyn_gf2m(const polyn_gf2m &other)
secure_vector< uint8_t > encode() const
std::shared_ptr< GF2m_Field > get_sp_field() const
bool operator!=(const polyn_gf2m &other) const
static std::pair< polyn_gf2m, polyn_gf2m > eea_with_coefficients(const polyn_gf2m &p, const polyn_gf2m &g, int break_deg)
void set_coef(size_t i, gf2m v)
gf2m get_coef(size_t i) const
void swap(polyn_gf2m &other) noexcept
gf2m get_lead_coef() const
void patchup_deg_secure(uint32_t trgt_deg, gf2m patch_elem)
polyn_gf2m & operator=(const polyn_gf2m &)=default
static std::vector< polyn_gf2m > sqmod_init(const polyn_gf2m &g)
static std::vector< polyn_gf2m > sqrt_mod_init(const polyn_gf2m &g)
void encode(uint32_t min_numo_coeffs, uint8_t *mem, uint32_t mem_len) const
polyn_gf2m & operator=(polyn_gf2m &&other) noexcept
gf2m operator[](size_t i) const
void add_to_coef(size_t i, gf2m v)
int calc_degree_secure() const
bool operator==(const polyn_gf2m &other) const
polyn_gf2m(polyn_gf2m &&other) noexcept
gf2m & operator[](size_t i)
polyn_gf2m sqmod(const std::vector< polyn_gf2m > &sq, int d)
static size_t degppf(const polyn_gf2m &g)
gf2m random_code_element(uint16_t code_length, RandomNumberGenerator &rng)
std::vector< polyn_gf2m > syndrome_init(const polyn_gf2m &generator, const std::vector< gf2m > &support, int n)
gf2m random_gf2m(RandomNumberGenerator &rng)
std::vector< T, secure_allocator< T > > secure_vector
secure_vector< gf2m > find_roots_gf2m_decomp(const polyn_gf2m &polyn, size_t code_length)