Botan 3.9.0
Crypto and TLS for C&
|
#include <curve448_gf.h>
Public Member Functions | |
void | ct_cond_assign (bool b, const Gf448Elem &other) |
Set this to other if b is true. Constant time for any b. | |
void | ct_cond_swap (bool b, Gf448Elem &other) |
Swap this and other if b == true. Constant time for any b. | |
Gf448Elem (std::span< const uint64_t, WORDS_448 > data) | |
Construct a GF element from a 448-bit integer gives as 7 uint64_t words x in little-endian order. | |
Gf448Elem (std::span< const uint8_t, BYTES_448 > x) | |
Construct a GF element from a 448-bit integer gives as 56 bytes x in little-endian order. | |
Gf448Elem (uint64_t least_sig_word) | |
Construct a GF element by passing the least significant 64 bits as a word. All other become zero. | |
bool | is_odd () const |
Return true iff this element is odd. Constant time. | |
bool | is_zero () const |
Return true iff this element is zero. Constant time. | |
bool | operator!= (const Gf448Elem &other) const =default |
Gf448Elem | operator* (const Gf448Elem &other) const |
Gf448Elem | operator+ (const Gf448Elem &other) const |
Gf448Elem | operator- () const |
Gf448Elem | operator- (const Gf448Elem &other) const |
Gf448Elem | operator/ (const Gf448Elem &other) const |
bool | operator== (const Gf448Elem &other) const |
std::array< uint8_t, BYTES_448 > | to_bytes () const |
Return the canonical representation of the GF element as 56 bytes in little-endian order. | |
void | to_bytes (std::span< uint8_t, BYTES_448 > out) const |
Store the canonical representation of the GF element as 56 bytes in little-endian order. | |
std::span< uint64_t, WORDS_448 > | words () |
Accessor to the internal words of the GF element. | |
std::span< const uint64_t, WORDS_448 > | words () const |
Constant accessor to the internal words of the GF element. |
Static Public Member Functions | |
static bool | bytes_are_canonical_representation (std::span< const uint8_t, BYTES_448 > x) |
Given 56 bytes, checks that the (little endian) number from this bytes is a valid GF element, i.e. is smaller than the prime modulus. | |
static Gf448Elem | one () |
static Gf448Elem | zero () |
This class represents a GF element in the field GF(2^448 - 2^224 - 1). Computations are performed using optimized operations as defined in the paper: "Reduction Modulo 2^448 - 2^224 - 1" by Kaushik Nath and Palash Sarkar (https://eprint.iacr.org/2019/1304).
The representation of the field element is a 448-bit uint, stored in little-endian order as 7*64bit words. Note that the internal representation is not necessarily canonical, i.e. the value might be larger than the prime modulus. When calling the to_bytes() method, the canonical representation is returned.
Definition at line 35 of file curve448_gf.h.
|
explicit |
Construct a GF element from a 448-bit integer gives as 56 bytes x
in little-endian order.
Definition at line 228 of file curve448_gf.cpp.
References Botan::load_le().
Referenced by ct_cond_assign(), ct_cond_swap(), one(), operator!=(), operator*(), operator+(), operator-(), operator-(), operator/(), operator==(), and zero().
|
inlineexplicit |
Construct a GF element from a 448-bit integer gives as 7 uint64_t words x
in little-endian order.
Definition at line 47 of file curve448_gf.h.
References Botan::copy_mem().
|
explicit |
Construct a GF element by passing the least significant 64 bits as a word. All other become zero.
Definition at line 232 of file curve448_gf.cpp.
References Botan::clear_mem().
|
static |
Given 56 bytes, checks that the (little endian) number from this bytes is a valid GF element, i.e. is smaller than the prime modulus.
Definition at line 305 of file curve448_gf.cpp.
References Botan::CT::is_equal(), Botan::load_le(), and Botan::WORDS_448.
Referenced by Botan::Ed448Point::decode().
void Botan::Gf448Elem::ct_cond_assign | ( | bool | b, |
const Gf448Elem & | other ) |
Set this to other
if b is true. Constant time for any b.
Definition at line 253 of file curve448_gf.cpp.
References Botan::CT::conditional_assign_mem(), Gf448Elem(), and Botan::WORDS_448.
void Botan::Gf448Elem::ct_cond_swap | ( | bool | b, |
Gf448Elem & | other ) |
Swap this and other if b == true. Constant time for any b.
Definition at line 247 of file curve448_gf.cpp.
References Botan::CT::conditional_swap(), Gf448Elem(), and Botan::WORDS_448.
Referenced by Botan::x448().
bool Botan::Gf448Elem::is_odd | ( | ) | const |
Return true iff this element is odd. Constant time.
Definition at line 300 of file curve448_gf.cpp.
Referenced by Botan::Ed448Point::decode(), and Botan::Ed448Point::encode().
bool Botan::Gf448Elem::is_zero | ( | ) | const |
Return true iff this element is zero. Constant time.
Definition at line 294 of file curve448_gf.cpp.
References Botan::CT::all_zeros(), and Botan::WORDS_448.
|
inlinestatic |
Return the constant value one
Definition at line 63 of file curve448_gf.h.
References Gf448Elem().
Referenced by Botan::Ed448Point::decode(), Botan::Ed448Point::identity(), and Botan::x448().
|
default |
References Gf448Elem().
Definition at line 275 of file curve448_gf.cpp.
References Gf448Elem().
Definition at line 257 of file curve448_gf.cpp.
References Gf448Elem().
Gf448Elem Botan::Gf448Elem::operator- | ( | ) | const |
Definition at line 269 of file curve448_gf.cpp.
References Gf448Elem().
Definition at line 263 of file curve448_gf.cpp.
References Gf448Elem().
Definition at line 281 of file curve448_gf.cpp.
References Gf448Elem().
bool Botan::Gf448Elem::operator== | ( | const Gf448Elem & | other | ) | const |
Definition at line 288 of file curve448_gf.cpp.
References Gf448Elem(), Botan::CT::is_equal(), and Botan::WORDS_448.
std::array< uint8_t, BYTES_448 > Botan::Gf448Elem::to_bytes | ( | ) | const |
Return the canonical representation of the GF element as 56 bytes in little-endian order.
Definition at line 241 of file curve448_gf.cpp.
References to_bytes().
Referenced by to_bytes().
void Botan::Gf448Elem::to_bytes | ( | std::span< uint8_t, BYTES_448 > | out | ) | const |
Store the canonical representation of the GF element as 56 bytes in little-endian order.
out | The 56 byte output buffer. |
Definition at line 237 of file curve448_gf.cpp.
References Botan::store_le().
Referenced by Botan::Ed448Point::encode().
|
inline |
Accessor to the internal words of the GF element.
Note that the internal representation is not necessarily canonical, i.e. the value might be larger than the prime modulus.
Definition at line 119 of file curve448_gf.h.
Referenced by Botan::root(), and Botan::square().
|
inline |
Constant accessor to the internal words of the GF element.
Note that the internal representation is not necessarily canonical, i.e. the value might be larger than the prime modulus.
Definition at line 127 of file curve448_gf.h.
|
inlinestatic |
Return the constant value zero
Definition at line 58 of file curve448_gf.h.
References Gf448Elem().
Referenced by Botan::Ed448Point::identity(), and Botan::x448().