|
Botan 3.14.1
Crypto and TLS for C&
|
#include <x25519_fe.h>
Public Member Functions | |
| BOTAN_FORCE_INLINE void | encode (std::span< uint8_t, 32 > out) const |
| BOTAN_FORCE_INLINE X25519_FE | invert () const |
| BOTAN_FORCE_INLINE X25519_FE | mul_a24 () const |
| BOTAN_FORCE_INLINE X25519_FE | sqr () const |
| BOTAN_FORCE_INLINE X25519_FE | sqr_n (size_t n) const |
| constexpr | X25519_FE () |
| The zero element. | |
Static Public Member Functions | |
| static BOTAN_FORCE_INLINE void | conditional_swap (CT::Mask< uint64_t > swap, X25519_FE &a, X25519_FE &b) |
| static BOTAN_FORCE_INLINE X25519_FE | decode (std::span< const uint8_t, 32 > in) |
| static constexpr X25519_FE | one () |
Friends | |
| BOTAN_FORCE_INLINE friend X25519_FE | operator* (const X25519_FE &a, const X25519_FE &b) |
| BOTAN_FORCE_INLINE friend X25519_FE | operator+ (const X25519_FE &a, const X25519_FE &b) |
| BOTAN_FORCE_INLINE friend X25519_FE | operator- (const X25519_FE &a, const X25519_FE &b) |
An element of GF(2^255 - 19) in radix 2^51
The value is sum(limb[i] * 2^(51*i)) over the five limbs. Limbs are not reduced below 2^51 between operations; instead the bounds from the original donna analysis are maintained:
The ladder never chains an addition or subtraction into another addition or subtraction without a multiplication or squaring in between.
Definition at line 56 of file x25519_fe.h.
|
inlineconstexpr |
|
inlinestatic |
Swap a and b if the mask is set
Definition at line 298 of file x25519_fe.h.
References BOTAN_FORCE_INLINE, Botan::CT::Mask< T >::if_set_return(), and X25519_FE().
Referenced by Botan::x25519_ladder().
|
inlinestatic |
Decode 32 little endian bytes
The high bit of the final byte is ignored (RFC 7748 Section 5); the value is not reduced, which is fine since the inputs are only used as multiplication operands.
Definition at line 74 of file x25519_fe.h.
References BOTAN_FORCE_INLINE, Botan::load_le(), and X25519_FE().
Referenced by Botan::x25519_ladder().
|
inline |
Encode the canonical value in [0,p) as 32 little endian bytes
Definition at line 87 of file x25519_fe.h.
References BOTAN_FORCE_INLINE, Botan::combine_lower(), and Botan::store_le().
|
inline |
Inversion via FLT
Returns zero for a zero input, which is what the ladder relies on for the identity (and the all-zero shared secret for low order points).
Definition at line 268 of file x25519_fe.h.
References BOTAN_FORCE_INLINE, sqr(), sqr_n(), and X25519_FE().
|
inline |
Multiply by a24 = (A - 2) / 4 = 121665, the ladder constant
Definition at line 237 of file x25519_fe.h.
References BOTAN_FORCE_INLINE, Botan::carry_shift(), and X25519_FE().
|
inlinestaticconstexpr |
Definition at line 61 of file x25519_fe.h.
References X25519_FE().
Referenced by Botan::x25519_ladder().
|
inline |
Definition at line 203 of file x25519_fe.h.
References BOTAN_FORCE_INLINE, and X25519_FE().
|
inline |
Definition at line 226 of file x25519_fe.h.
References BOTAN_FORCE_INLINE, sqr(), and X25519_FE().
Referenced by invert().
|
friend |
Definition at line 175 of file x25519_fe.h.
References BOTAN_FORCE_INLINE, and X25519_FE().
|
friend |
Definition at line 150 of file x25519_fe.h.
References BOTAN_FORCE_INLINE, and X25519_FE().
|
friend |
Subtraction, computed as a + 8p - b so that no limb underflows
Definition at line 161 of file x25519_fe.h.
References BOTAN_FORCE_INLINE, and X25519_FE().