Bitcoin Core  27.99.0
P2P Digital Currency
Macros | Functions | Variables
field.h File Reference
#include "util.h"
#include "field_10x26.h"
Include dependency graph for field.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define SECP256K1_FE_VERIFY_FIELDS
 
#define SECP256K1_FE_VERIFY_CONST(d7, d6, d5, d4, d3, d2, d1, d0)
 
#define SECP256K1_FE_CONST(d7, d6, d5, d4, d3, d2, d1, d0)   {SECP256K1_FE_CONST_INNER((d7), (d6), (d5), (d4), (d3), (d2), (d1), (d0)) SECP256K1_FE_VERIFY_CONST((d7), (d6), (d5), (d4), (d3), (d2), (d1), (d0)) }
 This expands to an initializer for a secp256k1_fe valued sum((i*32) * d_i, i=0..7) mod p. More...
 
#define secp256k1_fe_normalize   secp256k1_fe_impl_normalize
 
#define secp256k1_fe_normalize_weak   secp256k1_fe_impl_normalize_weak
 
#define secp256k1_fe_normalize_var   secp256k1_fe_impl_normalize_var
 
#define secp256k1_fe_normalizes_to_zero   secp256k1_fe_impl_normalizes_to_zero
 
#define secp256k1_fe_normalizes_to_zero_var   secp256k1_fe_impl_normalizes_to_zero_var
 
#define secp256k1_fe_set_int   secp256k1_fe_impl_set_int
 
#define secp256k1_fe_clear   secp256k1_fe_impl_clear
 
#define secp256k1_fe_is_zero   secp256k1_fe_impl_is_zero
 
#define secp256k1_fe_is_odd   secp256k1_fe_impl_is_odd
 
#define secp256k1_fe_cmp_var   secp256k1_fe_impl_cmp_var
 
#define secp256k1_fe_set_b32_mod   secp256k1_fe_impl_set_b32_mod
 
#define secp256k1_fe_set_b32_limit   secp256k1_fe_impl_set_b32_limit
 
#define secp256k1_fe_get_b32   secp256k1_fe_impl_get_b32
 
#define secp256k1_fe_negate_unchecked   secp256k1_fe_impl_negate_unchecked
 
#define secp256k1_fe_mul_int_unchecked   secp256k1_fe_impl_mul_int_unchecked
 
#define secp256k1_fe_add   secp256k1_fe_impl_add
 
#define secp256k1_fe_mul   secp256k1_fe_impl_mul
 
#define secp256k1_fe_sqr   secp256k1_fe_impl_sqr
 
#define secp256k1_fe_cmov   secp256k1_fe_impl_cmov
 
#define secp256k1_fe_to_storage   secp256k1_fe_impl_to_storage
 
#define secp256k1_fe_from_storage   secp256k1_fe_impl_from_storage
 
#define secp256k1_fe_inv   secp256k1_fe_impl_inv
 
#define secp256k1_fe_inv_var   secp256k1_fe_impl_inv_var
 
#define secp256k1_fe_get_bounds   secp256k1_fe_impl_get_bounds
 
#define secp256k1_fe_half   secp256k1_fe_impl_half
 
#define secp256k1_fe_add_int   secp256k1_fe_impl_add_int
 
#define secp256k1_fe_is_square_var   secp256k1_fe_impl_is_square_var
 
#define secp256k1_fe_negate(r, a, m)   ASSERT_INT_CONST_AND_DO(m, secp256k1_fe_negate_unchecked(r, a, m))
 Negate a field element. More...
 
#define secp256k1_fe_mul_int(r, a)   ASSERT_INT_CONST_AND_DO(a, secp256k1_fe_mul_int_unchecked(r, a))
 Multiply a field element with a small integer. More...
 
#define SECP256K1_FE_VERIFY(a)   secp256k1_fe_verify(a)
 
#define SECP256K1_FE_VERIFY_MAGNITUDE(a, m)   secp256k1_fe_verify_magnitude(a, m)
 

Functions

static void secp256k1_fe_normalize (secp256k1_fe *r)
 Normalize a field element. More...
 
static void secp256k1_fe_normalize_weak (secp256k1_fe *r)
 Give a field element magnitude 1. More...
 
static void secp256k1_fe_normalize_var (secp256k1_fe *r)
 Normalize a field element, without constant-time guarantee. More...
 
static int secp256k1_fe_normalizes_to_zero (const secp256k1_fe *r)
 Determine whether r represents field element 0. More...
 
static int secp256k1_fe_normalizes_to_zero_var (const secp256k1_fe *r)
 Determine whether r represents field element 0, without constant-time guarantee. More...
 
static void secp256k1_fe_set_int (secp256k1_fe *r, int a)
 Set a field element to an integer in range [0,0x7FFF]. More...
 
static void secp256k1_fe_clear (secp256k1_fe *a)
 Set a field element to 0. More...
 
static int secp256k1_fe_is_zero (const secp256k1_fe *a)
 Determine whether a represents field element 0. More...
 
static int secp256k1_fe_is_odd (const secp256k1_fe *a)
 Determine whether a (mod p) is odd. More...
 
static int secp256k1_fe_equal (const secp256k1_fe *a, const secp256k1_fe *b)
 Determine whether two field elements are equal. More...
 
static int secp256k1_fe_cmp_var (const secp256k1_fe *a, const secp256k1_fe *b)
 Compare the values represented by 2 field elements, without constant-time guarantee. More...
 
static void secp256k1_fe_set_b32_mod (secp256k1_fe *r, const unsigned char *a)
 Set a field element equal to the element represented by a provided 32-byte big endian value interpreted modulo p. More...
 
static int secp256k1_fe_set_b32_limit (secp256k1_fe *r, const unsigned char *a)
 Set a field element equal to a provided 32-byte big endian value, checking for overflow. More...
 
static void secp256k1_fe_get_b32 (unsigned char *r, const secp256k1_fe *a)
 Convert a field element to 32-byte big endian byte array. More...
 
static void secp256k1_fe_negate_unchecked (secp256k1_fe *r, const secp256k1_fe *a, int m)
 Like secp256k1_fe_negate_unchecked but m is not checked to be an integer constant expression. More...
 
static void secp256k1_fe_add_int (secp256k1_fe *r, int a)
 Add a small integer to a field element. More...
 
static void secp256k1_fe_mul_int_unchecked (secp256k1_fe *r, int a)
 Like secp256k1_fe_mul_int but a is not checked to be an integer constant expression. More...
 
static void secp256k1_fe_add (secp256k1_fe *r, const secp256k1_fe *a)
 Increment a field element by another. More...
 
static void secp256k1_fe_mul (secp256k1_fe *r, const secp256k1_fe *a, const secp256k1_fe *SECP256K1_RESTRICT b)
 Multiply two field elements. More...
 
static void secp256k1_fe_sqr (secp256k1_fe *r, const secp256k1_fe *a)
 Square a field element. More...
 
static int secp256k1_fe_sqrt (secp256k1_fe *SECP256K1_RESTRICT r, const secp256k1_fe *SECP256K1_RESTRICT a)
 Compute a square root of a field element. More...
 
static void secp256k1_fe_inv (secp256k1_fe *r, const secp256k1_fe *a)
 Compute the modular inverse of a field element. More...
 
static void secp256k1_fe_inv_var (secp256k1_fe *r, const secp256k1_fe *a)
 Compute the modular inverse of a field element, without constant-time guarantee. More...
 
static void secp256k1_fe_to_storage (secp256k1_fe_storage *r, const secp256k1_fe *a)
 Convert a field element to secp256k1_fe_storage. More...
 
static void secp256k1_fe_from_storage (secp256k1_fe *r, const secp256k1_fe_storage *a)
 Convert a field element back from secp256k1_fe_storage. More...
 
static void secp256k1_fe_storage_cmov (secp256k1_fe_storage *r, const secp256k1_fe_storage *a, int flag)
 If flag is true, set *r equal to *a; otherwise leave it. More...
 
static void secp256k1_fe_cmov (secp256k1_fe *r, const secp256k1_fe *a, int flag)
 Conditionally move a field element in constant time. More...
 
static void secp256k1_fe_half (secp256k1_fe *r)
 Halve the value of a field element modulo the field prime in constant-time. More...
 
static void secp256k1_fe_get_bounds (secp256k1_fe *r, int m)
 Sets r to a field element with magnitude m, normalized if (and only if) m==0. More...
 
static int secp256k1_fe_is_square_var (const secp256k1_fe *a)
 Determine whether a is a square (modulo p). More...
 
static void secp256k1_fe_verify (const secp256k1_fe *a)
 Check invariants on a field element (no-op unless VERIFY is enabled). More...
 
static void secp256k1_fe_verify_magnitude (const secp256k1_fe *a, int m)
 Check that magnitude of a is at most m (no-op unless VERIFY is enabled). More...
 

Variables

static const secp256k1_fe secp256k1_fe_one = SECP256K1_FE_CONST(0, 0, 0, 0, 0, 0, 0, 1)
 
static const secp256k1_fe secp256k1_const_beta
 

Macro Definition Documentation

◆ secp256k1_fe_add

#define secp256k1_fe_add   secp256k1_fe_impl_add

Definition at line 93 of file field.h.

◆ secp256k1_fe_add_int

#define secp256k1_fe_add_int   secp256k1_fe_impl_add_int

Definition at line 103 of file field.h.

◆ secp256k1_fe_clear

#define secp256k1_fe_clear   secp256k1_fe_impl_clear

Definition at line 84 of file field.h.

◆ secp256k1_fe_cmov

#define secp256k1_fe_cmov   secp256k1_fe_impl_cmov

Definition at line 96 of file field.h.

◆ secp256k1_fe_cmp_var

#define secp256k1_fe_cmp_var   secp256k1_fe_impl_cmp_var

Definition at line 87 of file field.h.

◆ SECP256K1_FE_CONST

#define SECP256K1_FE_CONST (   d7,
  d6,
  d5,
  d4,
  d3,
  d2,
  d1,
  d0 
)    {SECP256K1_FE_CONST_INNER((d7), (d6), (d5), (d4), (d3), (d2), (d1), (d0)) SECP256K1_FE_VERIFY_CONST((d7), (d6), (d5), (d4), (d3), (d2), (d1), (d0)) }

This expands to an initializer for a secp256k1_fe valued sum((i*32) * d_i, i=0..7) mod p.

It has magnitude 1, unless d_i are all 0, in which case the magnitude is 0. It is normalized, unless sum(2^(i*32) * d_i, i=0..7) >= p.

SECP256K1_FE_CONST_INNER is provided by the implementation.

Definition at line 66 of file field.h.

◆ secp256k1_fe_from_storage

#define secp256k1_fe_from_storage   secp256k1_fe_impl_from_storage

Definition at line 98 of file field.h.

◆ secp256k1_fe_get_b32

#define secp256k1_fe_get_b32   secp256k1_fe_impl_get_b32

Definition at line 90 of file field.h.

◆ secp256k1_fe_get_bounds

#define secp256k1_fe_get_bounds   secp256k1_fe_impl_get_bounds

Definition at line 101 of file field.h.

◆ secp256k1_fe_half

#define secp256k1_fe_half   secp256k1_fe_impl_half

Definition at line 102 of file field.h.

◆ secp256k1_fe_inv

#define secp256k1_fe_inv   secp256k1_fe_impl_inv

Definition at line 99 of file field.h.

◆ secp256k1_fe_inv_var

#define secp256k1_fe_inv_var   secp256k1_fe_impl_inv_var

Definition at line 100 of file field.h.

◆ secp256k1_fe_is_odd

#define secp256k1_fe_is_odd   secp256k1_fe_impl_is_odd

Definition at line 86 of file field.h.

◆ secp256k1_fe_is_square_var

#define secp256k1_fe_is_square_var   secp256k1_fe_impl_is_square_var

Definition at line 104 of file field.h.

◆ secp256k1_fe_is_zero

#define secp256k1_fe_is_zero   secp256k1_fe_impl_is_zero

Definition at line 85 of file field.h.

◆ secp256k1_fe_mul

#define secp256k1_fe_mul   secp256k1_fe_impl_mul

Definition at line 94 of file field.h.

◆ secp256k1_fe_mul_int

#define secp256k1_fe_mul_int (   r,
 
)    ASSERT_INT_CONST_AND_DO(a, secp256k1_fe_mul_int_unchecked(r, a))

Multiply a field element with a small integer.

On input, r must be a valid field element. a must be an integer constant expression in [0,32]. The magnitude of r times a must not exceed 32. Performs {r *= a}. On output, r's magnitude is multiplied by a, and r will not be normalized.

Definition at line 238 of file field.h.

◆ secp256k1_fe_mul_int_unchecked

#define secp256k1_fe_mul_int_unchecked   secp256k1_fe_impl_mul_int_unchecked

Definition at line 92 of file field.h.

◆ secp256k1_fe_negate

#define secp256k1_fe_negate (   r,
  a,
 
)    ASSERT_INT_CONST_AND_DO(m, secp256k1_fe_negate_unchecked(r, a, m))

Negate a field element.

On input, r does not need to be initialized. a must be a valid field element with magnitude not exceeding m. m must be an integer constant expression in [0,31]. Performs {r = -a}. On output, r will not be normalized, and will have magnitude m+1.

Definition at line 216 of file field.h.

◆ secp256k1_fe_negate_unchecked

#define secp256k1_fe_negate_unchecked   secp256k1_fe_impl_negate_unchecked

Definition at line 91 of file field.h.

◆ secp256k1_fe_normalize

#define secp256k1_fe_normalize   secp256k1_fe_impl_normalize

Definition at line 78 of file field.h.

◆ secp256k1_fe_normalize_var

#define secp256k1_fe_normalize_var   secp256k1_fe_impl_normalize_var

Definition at line 80 of file field.h.

◆ secp256k1_fe_normalize_weak

#define secp256k1_fe_normalize_weak   secp256k1_fe_impl_normalize_weak

Definition at line 79 of file field.h.

◆ secp256k1_fe_normalizes_to_zero

#define secp256k1_fe_normalizes_to_zero   secp256k1_fe_impl_normalizes_to_zero

Definition at line 81 of file field.h.

◆ secp256k1_fe_normalizes_to_zero_var

#define secp256k1_fe_normalizes_to_zero_var   secp256k1_fe_impl_normalizes_to_zero_var

Definition at line 82 of file field.h.

◆ secp256k1_fe_set_b32_limit

#define secp256k1_fe_set_b32_limit   secp256k1_fe_impl_set_b32_limit

Definition at line 89 of file field.h.

◆ secp256k1_fe_set_b32_mod

#define secp256k1_fe_set_b32_mod   secp256k1_fe_impl_set_b32_mod

Definition at line 88 of file field.h.

◆ secp256k1_fe_set_int

#define secp256k1_fe_set_int   secp256k1_fe_impl_set_int

Definition at line 83 of file field.h.

◆ secp256k1_fe_sqr

#define secp256k1_fe_sqr   secp256k1_fe_impl_sqr

Definition at line 95 of file field.h.

◆ secp256k1_fe_to_storage

#define secp256k1_fe_to_storage   secp256k1_fe_impl_to_storage

Definition at line 97 of file field.h.

◆ SECP256K1_FE_VERIFY

#define SECP256K1_FE_VERIFY (   a)    secp256k1_fe_verify(a)

Definition at line 349 of file field.h.

◆ SECP256K1_FE_VERIFY_CONST

#define SECP256K1_FE_VERIFY_CONST (   d7,
  d6,
  d5,
  d4,
  d3,
  d2,
  d1,
  d0 
)

Definition at line 56 of file field.h.

◆ SECP256K1_FE_VERIFY_FIELDS

#define SECP256K1_FE_VERIFY_FIELDS

Definition at line 37 of file field.h.

◆ SECP256K1_FE_VERIFY_MAGNITUDE

#define SECP256K1_FE_VERIFY_MAGNITUDE (   a,
 
)    secp256k1_fe_verify_magnitude(a, m)

Definition at line 353 of file field.h.

Function Documentation

◆ secp256k1_fe_add()

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

Increment a field element by another.

On input, r and a must be valid field elements, not necessarily normalized. The sum of their magnitudes must not exceed 32. Performs {r += a}. On output, r will not be normalized, and will have magnitude incremented by a's.

◆ secp256k1_fe_add_int()

static void secp256k1_fe_add_int ( secp256k1_fe r,
int  a 
)
static

Add a small integer to a field element.

Performs {r += a}. The magnitude of r increases by 1, and normalized is cleared. a must be in range [0,0x7FFF].

◆ secp256k1_fe_clear()

static void secp256k1_fe_clear ( secp256k1_fe a)
static

Set a field element to 0.

On input, a does not need to be initialized. On output, a represents 0, is normalized and has magnitude 0.

◆ secp256k1_fe_cmov()

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

Conditionally move a field element in constant time.

On input, both r and a must be valid field elements. Flag must be 0 or 1. Performs {r = flag ? a : r}.

On output, r's magnitude will be the maximum of both input magnitudes. It will be normalized if and only if both inputs were normalized.

◆ secp256k1_fe_cmp_var()

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

Compare the values represented by 2 field elements, without constant-time guarantee.

On input, a and b must be valid normalized field elements. Returns 1 if a > b, -1 if a < b, and 0 if a = b (comparisons are done as integers in range 0..p-1).

◆ secp256k1_fe_equal()

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

Determine whether two field elements are equal.

On input, a and b must be valid field elements with magnitudes not exceeding 1 and 31, respectively. Returns a = b (mod p).

Here is the caller graph for this function:

◆ secp256k1_fe_from_storage()

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

Convert a field element back from secp256k1_fe_storage.

On input, r need not be initialized. Performs {r = a}. On output, r will be normalized and will have magnitude 1.

◆ secp256k1_fe_get_b32()

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

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

On input, a must be a valid normalized field element, and r a pointer to a 32-byte array. On output, r = a (mod p).

◆ secp256k1_fe_get_bounds()

static void secp256k1_fe_get_bounds ( secp256k1_fe r,
int  m 
)
static

Sets r to a field element with magnitude m, normalized if (and only if) m==0.

The value is chosen so that it is likely to trigger edge cases related to internal overflows.

◆ secp256k1_fe_half()

static void secp256k1_fe_half ( secp256k1_fe r)
static

Halve the value of a field element modulo the field prime in constant-time.

On input, r must be a valid field element. On output, r will be normalized and have magnitude floor(m/2) + 1 where m is the magnitude of r on input.

◆ secp256k1_fe_inv()

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

Compute the modular inverse of a field element.

On input, a must be a valid field element; r need not be initialized. Performs {r = a**(p-2)} (which maps 0 to 0, and every other element to its inverse). On output, r will have magnitude (a.magnitude != 0) and be normalized.

◆ secp256k1_fe_inv_var()

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

Compute the modular inverse of a field element, without constant-time guarantee.

Behaves identically to secp256k1_fe_inv, but is not constant-time in a.

◆ secp256k1_fe_is_odd()

static int secp256k1_fe_is_odd ( const secp256k1_fe a)
static

Determine whether a (mod p) is odd.

On input, a must be a valid normalized field element. Returns (int(a) mod p) & 1.

◆ secp256k1_fe_is_square_var()

static int secp256k1_fe_is_square_var ( const secp256k1_fe a)
static

Determine whether a is a square (modulo p).

On input, a must be a valid field element.

◆ secp256k1_fe_is_zero()

static int secp256k1_fe_is_zero ( const secp256k1_fe a)
static

Determine whether a represents field element 0.

On input, a must be a valid normalized field element. Returns whether a = 0 (mod p).

This behaves identical to secp256k1_normalizes_to_zero{,_var}, but requires normalized input (and is much faster).

◆ secp256k1_fe_mul()

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

Multiply two field elements.

On input, a and b must be valid field elements; r does not need to be initialized. r and a may point to the same object, but neither can be equal to b. The magnitudes of a and b must not exceed 8. Performs {r = a * b} On output, r will have magnitude 1, but won't be normalized.

◆ secp256k1_fe_mul_int_unchecked()

static void secp256k1_fe_mul_int_unchecked ( secp256k1_fe r,
int  a 
)
static

Like secp256k1_fe_mul_int but a is not checked to be an integer constant expression.

Should not be called directly outside of tests.

◆ secp256k1_fe_negate_unchecked()

static void secp256k1_fe_negate_unchecked ( secp256k1_fe r,
const secp256k1_fe a,
int  m 
)
static

Like secp256k1_fe_negate_unchecked but m is not checked to be an integer constant expression.

Should not be called directly outside of tests.

◆ secp256k1_fe_normalize()

static void secp256k1_fe_normalize ( secp256k1_fe r)
static

Normalize a field element.

On input, r must be a valid field element. On output, r represents the same value but has normalized=1 and magnitude=1.

◆ secp256k1_fe_normalize_var()

static void secp256k1_fe_normalize_var ( secp256k1_fe r)
static

Normalize a field element, without constant-time guarantee.

Identical in behavior to secp256k1_fe_normalize, but not constant time in r.

◆ secp256k1_fe_normalize_weak()

static void secp256k1_fe_normalize_weak ( secp256k1_fe r)
static

Give a field element magnitude 1.

On input, r must be a valid field element. On output, r represents the same value but has magnitude=1. Normalized is unchanged.

◆ secp256k1_fe_normalizes_to_zero()

static int secp256k1_fe_normalizes_to_zero ( const secp256k1_fe r)
static

Determine whether r represents field element 0.

On input, r must be a valid field element. Returns whether r = 0 (mod p).

◆ secp256k1_fe_normalizes_to_zero_var()

static int secp256k1_fe_normalizes_to_zero_var ( const secp256k1_fe r)
static

Determine whether r represents field element 0, without constant-time guarantee.

Identical in behavior to secp256k1_normalizes_to_zero, but not constant time in r.

◆ secp256k1_fe_set_b32_limit()

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

Set a field element equal to a provided 32-byte big endian value, checking for overflow.

On input, r does not need to be initialized. a must be a pointer to an initialized 32-byte array. On output, r = a if (a < p), it will be normalized with magnitude 1, and 1 is returned. If a >= p, 0 is returned, and r will be made invalid (and must not be used without overwriting).

◆ secp256k1_fe_set_b32_mod()

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

Set a field element equal to the element represented by a provided 32-byte big endian value interpreted modulo p.

On input, r does not need to be initialized. a must be a pointer to an initialized 32-byte array. On output, r = a (mod p). It will have magnitude 1, and not be normalized.

◆ secp256k1_fe_set_int()

static void secp256k1_fe_set_int ( secp256k1_fe r,
int  a 
)
static

Set a field element to an integer in range [0,0x7FFF].

On input, r does not need to be initialized, a must be in [0,0x7FFF]. On output, r represents value a, is normalized and has magnitude (a!=0).

◆ secp256k1_fe_sqr()

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

Square a field element.

On input, a must be a valid field element; r does not need to be initialized. The magnitude of a must not exceed 8. Performs {r = a**2} On output, r will have magnitude 1, but won't be normalized.

◆ secp256k1_fe_sqrt()

static int secp256k1_fe_sqrt ( secp256k1_fe *SECP256K1_RESTRICT  r,
const secp256k1_fe *SECP256K1_RESTRICT  a 
)
static

Compute a square root of a field element.

On input, a must be a valid field element with magnitude<=8; r need not be initialized. If sqrt(a) exists, performs {r = sqrt(a)} and returns 1. Otherwise, sqrt(-a) exists. The function performs {r = sqrt(-a)} and returns 0. The resulting value represented by r will be a square itself. Variables r and a must not point to the same object. On output, r will have magnitude 1 but will not be normalized.

Here is the caller graph for this function:

◆ secp256k1_fe_storage_cmov()

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

If flag is true, set *r equal to *a; otherwise leave it.

Constant-time. Both *r and *a must be initialized.

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

Convert a field element to secp256k1_fe_storage.

On input, a must be a valid normalized field element. Performs {r = a}.

◆ secp256k1_fe_verify()

static void secp256k1_fe_verify ( const secp256k1_fe a)
static

Check invariants on a field element (no-op unless VERIFY is enabled).

◆ secp256k1_fe_verify_magnitude()

static void secp256k1_fe_verify_magnitude ( const secp256k1_fe a,
int  m 
)
static

Check that magnitude of a is at most m (no-op unless VERIFY is enabled).

Variable Documentation

◆ secp256k1_const_beta

const secp256k1_fe secp256k1_const_beta
static
Initial value:
0x7ae96a2bul, 0x657c0710ul, 0x6e64479eul, 0xac3434e9ul,
0x9cf04975ul, 0x12f58995ul, 0xc1396c28ul, 0x719501eeul
)
#define SECP256K1_FE_CONST(d7, d6, d5, d4, d3, d2, d1, d0)
This expands to an initializer for a secp256k1_fe valued sum((i*32) * d_i, i=0..7) mod p.
Definition: field.h:66

Definition at line 69 of file field.h.

◆ secp256k1_fe_one

const secp256k1_fe secp256k1_fe_one = SECP256K1_FE_CONST(0, 0, 0, 0, 0, 0, 0, 1)
static

Definition at line 68 of file field.h.