Botan 3.7.1
Crypto and TLS for C&
|
Represents a field ordering for the Classic McEliece cryptosystem. More...
#include <cmce_field_ordering.h>
Public Member Functions | |
void | _const_time_poison () const |
void | _const_time_unpoison () const |
std::vector< Classic_McEliece_GF > | alphas (size_t n) const |
Returns the field ordering as a vector of all alphas from alpha_0 to alpha_{n-1}. | |
secure_bitvector | alphas_control_bits () const |
Generates the control bits of the benes network corresponding to the field ordering. | |
CT::Mask< uint16_t > | ct_is_equal (const Classic_McEliece_Field_Ordering &other) const |
Constant time comparison of two field orderings. | |
void | permute_with_pivots (const Classic_McEliece_Parameters ¶ms, const CmceColumnSelection &pivots) |
Permute the field ordering with the given pivots. | |
CmcePermutation & | pi_ref () |
The pi values representing the field ordering. | |
const CmcePermutation & | pi_ref () const |
The pi values representing the field ordering. | |
Static Public Member Functions | |
static std::optional< Classic_McEliece_Field_Ordering > | create_field_ordering (const Classic_McEliece_Parameters ¶ms, StrongSpan< const CmceOrderingBits > random_bits) |
Creates a field ordering from a random bit sequence. Corresponds to the algorithm described in Classic McEliece ISO Sec. 8.2. | |
static Classic_McEliece_Field_Ordering | create_from_control_bits (const Classic_McEliece_Parameters ¶ms, const secure_bitvector &control_bits) |
Create the field ordering from the control bits of a benes network. | |
Represents a field ordering for the Classic McEliece cryptosystem.
Field ordering corresponds to the permutation pi defining the alpha sequence in the Classic McEliece specification (see Classic McEliece ISO Sec. 8.2.).
Definition at line 25 of file cmce_field_ordering.h.
|
inline |
Definition at line 102 of file cmce_field_ordering.h.
|
inline |
Definition at line 104 of file cmce_field_ordering.h.
std::vector< Classic_McEliece_GF > Botan::Classic_McEliece_Field_Ordering::alphas | ( | size_t | n | ) | const |
Returns the field ordering as a vector of all alphas from alpha_0 to alpha_{n-1}.
n | The number of alphas to return. |
Definition at line 272 of file cmce_field_ordering.cpp.
References BOTAN_ASSERT_NOMSG, and Botan::detail::Strong_Base< T >::get().
secure_bitvector Botan::Classic_McEliece_Field_Ordering::alphas_control_bits | ( | ) | const |
Generates the control bits of the benes network corresponding to the field ordering.
Definition at line 285 of file cmce_field_ordering.cpp.
References Botan::detail::Strong_Base< T >::get().
Referenced by Botan::Classic_McEliece_PrivateKeyInternal::serialize().
|
static |
Creates a field ordering from a random bit sequence. Corresponds to the algorithm described in Classic McEliece ISO Sec. 8.2.
params | The McEliece parameters. |
random_bits | The random bit sequence. |
Definition at line 259 of file cmce_field_ordering.cpp.
References BOTAN_ARG_CHECK, Botan::load_le(), Botan::Classic_McEliece_Parameters::poly_f(), Botan::Classic_McEliece_Parameters::q(), Botan::Classic_McEliece_Parameters::sigma2(), and Botan::StrongSpan< T >::size().
Referenced by Botan::Classic_McEliece_PrivateKeyInternal::check_key().
|
static |
Create the field ordering from the control bits of a benes network.
params | The McEliece parameters. |
control_bits | The control bits of the benes network. |
Definition at line 298 of file cmce_field_ordering.cpp.
References BOTAN_ASSERT_NOMSG, Botan::CT::Mask< T >::expand(), Botan::Classic_McEliece_Parameters::m(), Botan::Classic_McEliece_Parameters::poly_f(), and Botan::bitvector_base< AllocatorT >::size().
Referenced by Botan::Classic_McEliece_PrivateKeyInternal::from_bytes(), and Botan::Classic_McEliece_PrivateKeyInternal::serialize().
|
inline |
Constant time comparison of two field orderings.
other | The other field ordering. |
Definition at line 83 of file cmce_field_ordering.h.
References BOTAN_ARG_CHECK, and pi_ref().
void Botan::Classic_McEliece_Field_Ordering::permute_with_pivots | ( | const Classic_McEliece_Parameters & | params, |
const CmceColumnSelection & | pivots ) |
Permute the field ordering with the given pivots.
For example: If the pivot vector is 10101, the first, third and fifth element of the field ordering are permuted to positions 0, 1 and 2, respectively. The remaining elements are put at the end.
The permutation is done for the elements from position m*t - mu,..., m*t + mu (excl.). This function implements Classic McEliece ISO Sec. 7.2.3 Steps 4-5.
params | The McEliece parameters. |
pivots | The pivot vector. |
Definition at line 316 of file cmce_field_ordering.cpp.
References Botan::CT::Mask< T >::expand(), Botan::detail::Strong_Base< T >::get(), Botan::CT::Mask< T >::is_equal(), Botan::Classic_McEliece_Parameters::mu(), Botan::Classic_McEliece_Parameters::nu(), and Botan::Classic_McEliece_Parameters::pk_no_rows().
Referenced by Botan::Classic_McEliece_Matrix::create_matrix_and_apply_pivots().
|
inline |
The pi values representing the field ordering.
Definition at line 68 of file cmce_field_ordering.h.
Referenced by ct_is_equal().
|
inline |
The pi values representing the field ordering.
Definition at line 75 of file cmce_field_ordering.h.