12#include <botan/internal/cmce_gf.h>
21 if(mod == 0b0010000000011011) {
22 uint32_t t = x & 0x1FF0000;
23 x ^= (t >> 9) ^ (t >> 10) ^ (t >> 12) ^ (t >> 13);
26 x ^= (t >> 9) ^ (t >> 10) ^ (t >> 12) ^ (t >> 13);
29 }
else if(mod == 0b0001000000001001) {
30 uint32_t t = x & 0x7FC000;
40 return CmceGfElem(
static_cast<uint16_t
>(x & 0xfff));
50 uint32_t a = m_elem.
get();
51 uint32_t
b = other.m_elem.
get();
55 for(
size_t i = 1; i <
log_q(); i++) {
56 acc ^= (a * (
b & (1 << i)));
66 size_t exponent = (size_t(1) <<
log_q()) - 2;
72 if(exponent % 2 == 1) {
74 result = (result * base);
#define BOTAN_ASSERT_NOMSG(expr)
#define BOTAN_ASSERT_UNREACHABLE()
Represents an element of the finite field GF(q) for q = 2^m.
Classic_McEliece_GF inv() const
Invert the element. Constant time.
Classic_McEliece_GF(CmceGfElem elem, CmceGfMod modulus)
Creates an element of GF(q) from a uint16_t.
Classic_McEliece_GF operator*(Classic_McEliece_GF other) const
Multiply the element by other in GF(q). Constant time.
size_t log_q() const
Get m, the degree of the element's modulus.
Classic_McEliece_GF square() const
Square the element. Constant time.
constexpr T value_barrier(T x)
Strong< uint16_t, struct CmceGfMod_ > CmceGfMod
Represents a GF(q) modulus.
Strong< uint16_t, struct CmceGfElem_ > CmceGfElem
Represents a GF(q) element.