|
Botan 3.14.1
Crypto and TLS for C&
|
#include <bls12_381_fields.h>
Public Member Functions | |
| CT::Choice | _is_lexicographically_largest () const |
| constexpr const std::array< word, N > & | _words () const |
| FieldElement | add (const FieldElement &x) const |
| void | conditional_assign (CT::Choice cnd, const FieldElement &other) |
| constexpr | FieldElement () |
| FieldElement | invert () const |
| CT::Choice | is_zero () const |
| FieldElement | mul (const FieldElement &x) const |
| FieldElement | negate () const |
| CT::Choice | operator!= (const FieldElement &other) const |
| FieldElement & | operator*= (const FieldElement &x) |
| FieldElement & | operator+= (const FieldElement &x) |
| FieldElement & | operator-= (const FieldElement &x) |
| CT::Choice | operator== (const FieldElement &other) const |
| std::array< uint8_t, FieldElement::BYTES > | serialize () const |
| void | serialize_to (std::span< uint8_t, FieldElement::BYTES > bytes) const |
| CT::Option< FieldElement > | sqrt () const |
| FieldElement | square () const |
| FieldElement | sub (const FieldElement &x) const |
Static Public Member Functions | |
| static constexpr FieldElement | _unchecked_from_words (std::array< word, FieldElement::N > v) |
| static std::optional< FieldElement > | deserialize (std::span< const uint8_t > bytes) |
| static FieldElement | from_bytes_wide (std::span< const uint8_t, 96 > bytes) |
| static FieldElement | from_u32 (uint32_t v) |
| static FieldElement | one () |
| static FieldElement | zero () |
Static Public Attributes | |
| static constexpr size_t | BITS = 381 |
| static constexpr size_t | BYTES = (BITS + 7) / 8 |
| static constexpr size_t | N = (BYTES + sizeof(word) - 1) / sizeof(word) |
A BLS12-381 field element
Integer modulo 0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab
Definition at line 24 of file bls12_381_fields.h.
|
inlineconstexpr |
Default constructed as zero
Definition at line 33 of file bls12_381_fields.h.
Referenced by _unchecked_from_words(), add(), conditional_assign(), from_bytes_wide(), from_u32(), invert(), mul(), negate(), one(), operator!=(), operator*=(), operator+=(), operator-=(), operator==(), square(), sub(), and zero().
| CT::Choice Botan::BLS12_381::FieldElement::_is_lexicographically_largest | ( | ) | const |
Set iff this is larger than its negation
Ie set if this is > (p-1)/2
Definition at line 186 of file bls12_381_fe.cpp.
References Botan::bigint_ct_is_lt(), and N.
|
inlinestaticconstexpr |
The input is assumed to be valid and already in Montgomery representation
Definition at line 110 of file bls12_381_fields.h.
References FieldElement().
Referenced by Botan::BLS12_381::FieldElement2::_unchecked_from_words().
The Montgomery representation words
Definition at line 117 of file bls12_381_fields.h.
| FieldElement Botan::BLS12_381::FieldElement::add | ( | const FieldElement & | x | ) | const |
Definition at line 125 of file bls12_381_fe.cpp.
References Botan::bigint_monty_maybe_sub(), FieldElement(), N, and Botan::word_add().
Referenced by Botan::BLS12_381::operator+(), and operator+=().
| void Botan::BLS12_381::FieldElement::conditional_assign | ( | CT::Choice | cnd, |
| const FieldElement & | other ) |
If cnd is set assign other to this, in constant time
Definition at line 196 of file bls12_381_fe.cpp.
References Botan::CT::conditional_assign_mem(), FieldElement(), and N.
|
static |
Definition at line 101 of file bls12_381_fe.cpp.
References Botan::bigint_ct_is_lt(), BYTES, Botan::bytes_to_words(), and N.
Referenced by Botan::BLS12_381::FieldElement2::deserialize().
|
static |
Definition at line 115 of file bls12_381_fe.cpp.
References Botan::bytes_to_words(), and FieldElement().
|
static |
Definition at line 90 of file bls12_381_fe.cpp.
References FieldElement().
| FieldElement Botan::BLS12_381::FieldElement::invert | ( | ) | const |
Return the multiplicative inverse of this element, or zero for zero
Definition at line 206 of file bls12_381_fe.cpp.
References FieldElement(), and square().
| CT::Choice Botan::BLS12_381::FieldElement::is_zero | ( | ) | const |
Definition at line 182 of file bls12_381_fe.cpp.
References Botan::CT::all_zeros(), and N.
| FieldElement Botan::BLS12_381::FieldElement::mul | ( | const FieldElement & | x | ) | const |
Definition at line 153 of file bls12_381_fe.cpp.
References Botan::comba_mul(), and FieldElement().
Referenced by Botan::BLS12_381::operator*(), and operator*=().
| FieldElement Botan::BLS12_381::FieldElement::negate | ( | ) | const |
Definition at line 173 of file bls12_381_fe.cpp.
References Botan::CT::all_zeros(), Botan::bigint_sub3(), FieldElement(), and N.
|
static |
Definition at line 97 of file bls12_381_fe.cpp.
References FieldElement().
Referenced by Botan::BLS12_381::G1Projective::_unchecked_from_affine_coords(), Botan::BLS12_381::G1Projective::generator(), Botan::BLS12_381::G1Affine::identity(), and Botan::BLS12_381::FieldElement2::one().
|
inline |
Definition at line 98 of file bls12_381_fields.h.
References FieldElement().
|
inline |
Definition at line 71 of file bls12_381_fields.h.
References FieldElement(), and mul().
|
inline |
Definition at line 61 of file bls12_381_fields.h.
References add(), and FieldElement().
|
inline |
Definition at line 66 of file bls12_381_fields.h.
References FieldElement(), and sub().
| CT::Choice Botan::BLS12_381::FieldElement::operator== | ( | const FieldElement & | other | ) | const |
Constant time equality
Definition at line 191 of file bls12_381_fe.cpp.
References FieldElement(), Botan::CT::is_equal(), and N.
|
inline |
Definition at line 49 of file bls12_381_fields.h.
References serialize_to().
| void Botan::BLS12_381::FieldElement::serialize_to | ( | std::span< uint8_t, FieldElement::BYTES > | bytes | ) | const |
Definition at line 119 of file bls12_381_fe.cpp.
References Botan::store_be().
Referenced by serialize().
| CT::Option< FieldElement > Botan::BLS12_381::FieldElement::sqrt | ( | ) | const |
Return the square root of this element, if one exists
If x and -x are both square roots, which of the two is returned is unspecified.
Definition at line 200 of file bls12_381_fe.cpp.
References Botan::BLS12_381::pow_msb().
| FieldElement Botan::BLS12_381::FieldElement::square | ( | ) | const |
Definition at line 159 of file bls12_381_fe.cpp.
References Botan::comba_sqr(), and FieldElement().
Referenced by invert().
| FieldElement Botan::BLS12_381::FieldElement::sub | ( | const FieldElement & | x | ) | const |
Definition at line 137 of file bls12_381_fe.cpp.
References Botan::CT::Mask< T >::expand(), FieldElement(), N, Botan::word_add(), and Botan::word_sub().
Referenced by Botan::BLS12_381::operator-(), and operator-=().
|
inlinestatic |
Definition at line 37 of file bls12_381_fields.h.
References FieldElement().
Referenced by Botan::BLS12_381::G1Affine::identity(), and Botan::BLS12_381::FieldElement2::one().
|
staticconstexpr |
Definition at line 26 of file bls12_381_fields.h.
|
staticconstexpr |
Definition at line 27 of file bls12_381_fields.h.
Referenced by Botan::BLS12_381::FieldElement2::deserialize(), deserialize(), Botan::BLS12_381::FieldElement2::serialize_to(), and Botan::BLS12_381::Fp12::serialize_to().
|
staticconstexpr |
Definition at line 28 of file bls12_381_fields.h.
Referenced by _is_lexicographically_largest(), add(), conditional_assign(), deserialize(), is_zero(), negate(), operator==(), and sub().