Botan 3.13.0
Crypto and TLS for C&
Botan::GF_Mask Class Referencefinal

Constant time mask wrapper for GF(q) elements. More...

#include <cmce_gf.h>

Public Member Functions

CT::Choice as_choice () const
CT::Mask< uint16_t > & elem_mask ()
 GF_Mask (CT::Mask< uint16_t > underlying_mask)
Classic_McEliece_GF if_set_return (const Classic_McEliece_GF x) const
GF_Maskoperator&= (const GF_Mask &o)
Classic_McEliece_GF select (const Classic_McEliece_GF x, CmceGfElem y) const
Classic_McEliece_GF select (const Classic_McEliece_GF x, const Classic_McEliece_GF y) const
uint16_t select (uint16_t x, uint16_t y) const

Static Public Member Functions

static GF_Mask expand (Classic_McEliece_GF v)
static GF_Mask expand (CT::Choice v)
template<std::unsigned_integral T>
static GF_Mask expand (T v)
static GF_Mask is_equal (Classic_McEliece_GF a, Classic_McEliece_GF b)
static GF_Mask is_lte (Classic_McEliece_GF a, Classic_McEliece_GF b)
static GF_Mask is_zero (Classic_McEliece_GF v)
static GF_Mask set ()

Detailed Description

Constant time mask wrapper for GF(q) elements.

Definition at line 152 of file cmce_gf.h.

Constructor & Destructor Documentation

◆ GF_Mask()

Botan::GF_Mask::GF_Mask ( CT::Mask< uint16_t > underlying_mask)
inlineexplicit

Definition at line 175 of file cmce_gf.h.

175: m_mask(underlying_mask) {}

Referenced by expand(), expand(), expand(), is_equal(), is_lte(), is_zero(), operator&=(), and set().

Member Function Documentation

◆ as_choice()

CT::Choice Botan::GF_Mask::as_choice ( ) const
inline

Definition at line 196 of file cmce_gf.h.

196{ return m_mask.as_choice(); }

◆ elem_mask()

CT::Mask< uint16_t > & Botan::GF_Mask::elem_mask ( )
inline

Definition at line 198 of file cmce_gf.h.

198{ return m_mask; }

◆ expand() [1/3]

GF_Mask Botan::GF_Mask::expand ( Classic_McEliece_GF v)
inlinestatic

Definition at line 161 of file cmce_gf.h.

161{ return expand(v.elem().get()); }
static GF_Mask expand(T v)
Definition cmce_gf.h:155

References Botan::Classic_McEliece_GF::elem(), expand(), Botan::detail::Strong_Base< T >::get(), and GF_Mask().

Referenced by expand().

◆ expand() [2/3]

GF_Mask Botan::GF_Mask::expand ( CT::Choice v)
inlinestatic

Definition at line 159 of file cmce_gf.h.

static constexpr Mask< T > from_choice(Choice c)
Definition ct_utils.h:402
GF_Mask(CT::Mask< uint16_t > underlying_mask)
Definition cmce_gf.h:175

References Botan::CT::Mask< T >::from_choice(), and GF_Mask().

◆ expand() [3/3]

template<std::unsigned_integral T>
GF_Mask Botan::GF_Mask::expand ( T v)
inlinestatic

Definition at line 155 of file cmce_gf.h.

155 {
157 }
static constexpr Mask< T > expand(T v)
Definition ct_utils.h:392

References Botan::CT::Mask< T >::expand(), and GF_Mask().

◆ if_set_return()

Classic_McEliece_GF Botan::GF_Mask::if_set_return ( const Classic_McEliece_GF x) const
inline

Definition at line 177 of file cmce_gf.h.

177 {
178 return Classic_McEliece_GF(CmceGfElem(m_mask.if_set_return(x.elem().get())), x.modulus());
179 }
Strong< uint16_t, struct CmceGfElem_ > CmceGfElem
Represents a GF(q) element.
Definition cmce_types.h:19

References Botan::Classic_McEliece_GF::elem(), Botan::detail::Strong_Base< T >::get(), and Botan::Classic_McEliece_GF::modulus().

◆ is_equal()

GF_Mask Botan::GF_Mask::is_equal ( Classic_McEliece_GF a,
Classic_McEliece_GF b )
inlinestatic

Definition at line 169 of file cmce_gf.h.

169 {
170 return GF_Mask(CT::Mask<uint16_t>::is_equal(a.elem().get(), b.elem().get()));
171 }
static constexpr Mask< T > is_equal(T x, T y)
Definition ct_utils.h:442

References Botan::Classic_McEliece_GF::elem(), Botan::detail::Strong_Base< T >::get(), GF_Mask(), and Botan::CT::Mask< T >::is_equal().

Referenced by Botan::Classic_McEliece_PrivateKeyInternal::check_key().

◆ is_lte()

GF_Mask Botan::GF_Mask::is_lte ( Classic_McEliece_GF a,
Classic_McEliece_GF b )
inlinestatic

Definition at line 165 of file cmce_gf.h.

165 {
166 return GF_Mask(CT::Mask<uint16_t>::is_lte(a.elem().get(), b.elem().get()));
167 }
static constexpr Mask< T > is_lte(T x, T y)
Definition ct_utils.h:463

References Botan::Classic_McEliece_GF::elem(), Botan::detail::Strong_Base< T >::get(), GF_Mask(), and Botan::CT::Mask< T >::is_lte().

◆ is_zero()

GF_Mask Botan::GF_Mask::is_zero ( Classic_McEliece_GF v)
inlinestatic

◆ operator&=()

GF_Mask & Botan::GF_Mask::operator&= ( const GF_Mask & o)
inline

Definition at line 191 of file cmce_gf.h.

191 {
192 m_mask &= o.m_mask;
193 return (*this);
194 }

References GF_Mask().

◆ select() [1/3]

Classic_McEliece_GF Botan::GF_Mask::select ( const Classic_McEliece_GF x,
CmceGfElem y ) const
inline

Definition at line 185 of file cmce_gf.h.

185 {
186 return Classic_McEliece_GF(CmceGfElem(m_mask.select(x.elem().get(), y.get())), x.modulus());
187 }

References Botan::Classic_McEliece_GF::elem(), Botan::detail::Strong_Base< T >::get(), and Botan::Classic_McEliece_GF::modulus().

◆ select() [2/3]

Classic_McEliece_GF Botan::GF_Mask::select ( const Classic_McEliece_GF x,
const Classic_McEliece_GF y ) const
inline

Definition at line 181 of file cmce_gf.h.

181 {
182 return Classic_McEliece_GF(CmceGfElem(m_mask.select(x.elem().get(), y.elem().get())), x.modulus());
183 }

References Botan::Classic_McEliece_GF::elem(), Botan::detail::Strong_Base< T >::get(), and Botan::Classic_McEliece_GF::modulus().

◆ select() [3/3]

uint16_t Botan::GF_Mask::select ( uint16_t x,
uint16_t y ) const
inline

Definition at line 189 of file cmce_gf.h.

189{ return m_mask.select(x, y); }

◆ set()

GF_Mask Botan::GF_Mask::set ( )
inlinestatic

Definition at line 173 of file cmce_gf.h.

173{ return GF_Mask(CT::Mask<uint16_t>::set()); }
static constexpr Mask< T > set()
Definition ct_utils.h:382

References GF_Mask(), and Botan::CT::Mask< T >::set().


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