Bitcoin Core  24.99.0
P2P Digital Currency
Functions | Variables
field_5x52_impl.h File Reference
#include "util.h"
#include "field.h"
#include "modinv64_impl.h"
#include "field_5x52_int128_impl.h"
Include dependency graph for field_5x52_impl.h:

Go to the source code of this file.

Functions

static void secp256k1_fe_get_bounds (secp256k1_fe *r, int m)
 Implements arithmetic modulo FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFE FFFFFC2F, represented as 5 uint64_t's in base 2^52, least significant first. More...
 
static void secp256k1_fe_normalize (secp256k1_fe *r)
 
static void secp256k1_fe_normalize_weak (secp256k1_fe *r)
 
static void secp256k1_fe_normalize_var (secp256k1_fe *r)
 
static int secp256k1_fe_normalizes_to_zero (const secp256k1_fe *r)
 
static int secp256k1_fe_normalizes_to_zero_var (const secp256k1_fe *r)
 
static SECP256K1_INLINE void secp256k1_fe_set_int (secp256k1_fe *r, int a)
 
static SECP256K1_INLINE int secp256k1_fe_is_zero (const secp256k1_fe *a)
 
static SECP256K1_INLINE int secp256k1_fe_is_odd (const secp256k1_fe *a)
 
static SECP256K1_INLINE void secp256k1_fe_clear (secp256k1_fe *a)
 
static int secp256k1_fe_cmp_var (const secp256k1_fe *a, const secp256k1_fe *b)
 
static int secp256k1_fe_set_b32 (secp256k1_fe *r, const unsigned char *a)
 
static void secp256k1_fe_get_b32 (unsigned char *r, const secp256k1_fe *a)
 Convert a field element to a 32-byte big endian value. More...
 
static SECP256K1_INLINE void secp256k1_fe_negate (secp256k1_fe *r, const secp256k1_fe *a, int m)
 
static SECP256K1_INLINE void secp256k1_fe_mul_int (secp256k1_fe *r, int a)
 
static SECP256K1_INLINE void secp256k1_fe_add (secp256k1_fe *r, const secp256k1_fe *a)
 
static void secp256k1_fe_mul (secp256k1_fe *r, const secp256k1_fe *a, const secp256k1_fe *SECP256K1_RESTRICT b)
 
static void secp256k1_fe_sqr (secp256k1_fe *r, const secp256k1_fe *a)
 
static SECP256K1_INLINE void secp256k1_fe_cmov (secp256k1_fe *r, const secp256k1_fe *a, int flag)
 
static SECP256K1_INLINE void secp256k1_fe_half (secp256k1_fe *r)
 
static SECP256K1_INLINE void secp256k1_fe_storage_cmov (secp256k1_fe_storage *r, const secp256k1_fe_storage *a, int flag)
 
static void secp256k1_fe_to_storage (secp256k1_fe_storage *r, const secp256k1_fe *a)
 
static SECP256K1_INLINE void secp256k1_fe_from_storage (secp256k1_fe *r, const secp256k1_fe_storage *a)
 
static void secp256k1_fe_from_signed62 (secp256k1_fe *r, const secp256k1_modinv64_signed62 *a)
 
static void secp256k1_fe_to_signed62 (secp256k1_modinv64_signed62 *r, const secp256k1_fe *a)
 
static void secp256k1_fe_inv (secp256k1_fe *r, const secp256k1_fe *x)
 
static void secp256k1_fe_inv_var (secp256k1_fe *r, const secp256k1_fe *x)
 

Variables

static const secp256k1_modinv64_modinfo secp256k1_const_modinfo_fe
 

Function Documentation

◆ secp256k1_fe_add()

static SECP256K1_INLINE void secp256k1_fe_add ( secp256k1_fe r,
const secp256k1_fe a 
)
static

Definition at line 431 of file field_5x52_impl.h.

◆ secp256k1_fe_clear()

static SECP256K1_INLINE void secp256k1_fe_clear ( secp256k1_fe a)
static

Definition at line 279 of file field_5x52_impl.h.

◆ secp256k1_fe_cmov()

static SECP256K1_INLINE void secp256k1_fe_cmov ( secp256k1_fe r,
const secp256k1_fe a,
int  flag 
)
static

Definition at line 477 of file field_5x52_impl.h.

◆ secp256k1_fe_cmp_var()

static int secp256k1_fe_cmp_var ( const secp256k1_fe a,
const secp256k1_fe b 
)
static

Definition at line 290 of file field_5x52_impl.h.

◆ secp256k1_fe_from_signed62()

static void secp256k1_fe_from_signed62 ( secp256k1_fe r,
const secp256k1_modinv64_signed62 a 
)
static

Definition at line 594 of file field_5x52_impl.h.

Here is the caller graph for this function:

◆ secp256k1_fe_from_storage()

static SECP256K1_INLINE void secp256k1_fe_from_storage ( secp256k1_fe r,
const secp256k1_fe_storage a 
)
static

Definition at line 581 of file field_5x52_impl.h.

◆ secp256k1_fe_get_b32()

static void secp256k1_fe_get_b32 ( unsigned char *  r,
const secp256k1_fe a 
)
static

Convert a field element to a 32-byte big endian value.

Requires the input to be normalized

Definition at line 359 of file field_5x52_impl.h.

◆ secp256k1_fe_get_bounds()

static void secp256k1_fe_get_bounds ( secp256k1_fe r,
int  m 
)
static

Implements arithmetic modulo FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFE FFFFFC2F, represented as 5 uint64_t's in base 2^52, least significant first.

Note that the limbs are allowed to contain >52 bits each.

Each field element has a 'magnitude' associated with it. Internally, a magnitude M means:

  • 2*M*(2^48-1) is the max (inclusive) of the most significant limb
  • 2*M*(2^52-1) is the max (inclusive) of the remaining limbs

Operations have different rules for propagating magnitude to their outputs. If an operation takes a magnitude M as a parameter, that means the magnitude of input field elements can be at most M (inclusive).

Each field element also has a 'normalized' flag. A field element is normalized if its magnitude is either 0 or 1, and its value is already reduced modulo the order of the field.

Definition at line 61 of file field_5x52_impl.h.

◆ secp256k1_fe_half()

static SECP256K1_INLINE void secp256k1_fe_half ( secp256k1_fe r)
static

Definition at line 495 of file field_5x52_impl.h.

◆ secp256k1_fe_inv()

static void secp256k1_fe_inv ( secp256k1_fe r,
const secp256k1_fe x 
)
static

Definition at line 640 of file field_5x52_impl.h.

Here is the call graph for this function:

◆ secp256k1_fe_inv_var()

static void secp256k1_fe_inv_var ( secp256k1_fe r,
const secp256k1_fe x 
)
static

Definition at line 655 of file field_5x52_impl.h.

Here is the call graph for this function:

◆ secp256k1_fe_is_odd()

static SECP256K1_INLINE int secp256k1_fe_is_odd ( const secp256k1_fe a)
static

Definition at line 271 of file field_5x52_impl.h.

◆ secp256k1_fe_is_zero()

static SECP256K1_INLINE int secp256k1_fe_is_zero ( const secp256k1_fe a)
static

Definition at line 262 of file field_5x52_impl.h.

◆ secp256k1_fe_mul()

static void secp256k1_fe_mul ( secp256k1_fe r,
const secp256k1_fe a,
const secp256k1_fe *SECP256K1_RESTRICT  b 
)
static

Definition at line 447 of file field_5x52_impl.h.

Here is the call graph for this function:

◆ secp256k1_fe_mul_int()

static SECP256K1_INLINE void secp256k1_fe_mul_int ( secp256k1_fe r,
int  a 
)
static

Definition at line 418 of file field_5x52_impl.h.

◆ secp256k1_fe_negate()

static SECP256K1_INLINE void secp256k1_fe_negate ( secp256k1_fe r,
const secp256k1_fe a,
int  m 
)
static

Definition at line 398 of file field_5x52_impl.h.

◆ secp256k1_fe_normalize()

static void secp256k1_fe_normalize ( secp256k1_fe r)
static

Definition at line 76 of file field_5x52_impl.h.

Here is the caller graph for this function:

◆ secp256k1_fe_normalize_var()

static void secp256k1_fe_normalize_var ( secp256k1_fe r)
static

Definition at line 143 of file field_5x52_impl.h.

Here is the caller graph for this function:

◆ secp256k1_fe_normalize_weak()

static void secp256k1_fe_normalize_weak ( secp256k1_fe r)
static

Definition at line 119 of file field_5x52_impl.h.

◆ secp256k1_fe_normalizes_to_zero()

static int secp256k1_fe_normalizes_to_zero ( const secp256k1_fe r)
static

Definition at line 187 of file field_5x52_impl.h.

Here is the caller graph for this function:

◆ secp256k1_fe_normalizes_to_zero_var()

static int secp256k1_fe_normalizes_to_zero_var ( const secp256k1_fe r)
static

Definition at line 210 of file field_5x52_impl.h.

◆ secp256k1_fe_set_b32()

static int secp256k1_fe_set_b32 ( secp256k1_fe r,
const unsigned char *  a 
)
static

Definition at line 309 of file field_5x52_impl.h.

◆ secp256k1_fe_set_int()

static SECP256K1_INLINE void secp256k1_fe_set_int ( secp256k1_fe r,
int  a 
)
static

Definition at line 251 of file field_5x52_impl.h.

◆ secp256k1_fe_sqr()

static void secp256k1_fe_sqr ( secp256k1_fe r,
const secp256k1_fe a 
)
static

Definition at line 464 of file field_5x52_impl.h.

Here is the call graph for this function:

◆ secp256k1_fe_storage_cmov()

static SECP256K1_INLINE void secp256k1_fe_storage_cmov ( secp256k1_fe_storage r,
const secp256k1_fe_storage a,
int  flag 
)
static

Definition at line 560 of file field_5x52_impl.h.

◆ secp256k1_fe_to_signed62()

static void secp256k1_fe_to_signed62 ( secp256k1_modinv64_signed62 r,
const secp256k1_fe a 
)
static

Definition at line 620 of file field_5x52_impl.h.

Here is the caller graph for this function:

◆ secp256k1_fe_to_storage()

static void secp256k1_fe_to_storage ( secp256k1_fe_storage r,
const secp256k1_fe a 
)
static

Definition at line 571 of file field_5x52_impl.h.

Variable Documentation

◆ secp256k1_const_modinfo_fe

const secp256k1_modinv64_modinfo secp256k1_const_modinfo_fe
static
Initial value:
= {
{{-0x1000003D1LL, 0, 0, 0, 256}},
0x27C7F6E22DDACACFLL
}

Definition at line 635 of file field_5x52_impl.h.