|
| #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.
|
| |
| #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_unchecked secp256k1_fe_impl_set_int_unchecked |
| |
| #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_set_int(r, a) ASSERT_INT_CONST_AND_DO(a, secp256k1_fe_set_int_unchecked(r, a)) |
| | Set a field element to an integer in range [0,0x7FFF].
|
| |
| #define | secp256k1_fe_negate(r, a, m) ASSERT_INT_CONST_AND_DO(m, secp256k1_fe_negate_unchecked(r, a, m)) |
| | Negate a field element.
|
| |
| #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.
|
| |
| #define | SECP256K1_FE_VERIFY(a) secp256k1_fe_verify(a) |
| |
| #define | SECP256K1_FE_VERIFY_MAGNITUDE(a, m) secp256k1_fe_verify_magnitude(a, m) |
| |
|
| static void | secp256k1_fe_normalize (secp256k1_fe *r) |
| | Normalize a field element.
|
| |
| static void | secp256k1_fe_normalize_weak (secp256k1_fe *r) |
| | Give a field element magnitude 1.
|
| |
| static void | secp256k1_fe_normalize_var (secp256k1_fe *r) |
| | Normalize a field element, without constant-time guarantee.
|
| |
| static int | secp256k1_fe_normalizes_to_zero (const secp256k1_fe *r) |
| | Determine whether r represents field element 0.
|
| |
| static int | secp256k1_fe_normalizes_to_zero_var (const secp256k1_fe *r) |
| | Determine whether r represents field element 0, without constant-time guarantee.
|
| |
| static void | secp256k1_fe_set_int_unchecked (secp256k1_fe *r, int a) |
| | Like secp256k1_fe_set_int but a is not checked to be an integer constant expression.
|
| |
| static void | secp256k1_fe_clear (secp256k1_fe *a) |
| | Clear a field element to prevent leaking sensitive information.
|
| |
| static int | secp256k1_fe_is_zero (const secp256k1_fe *a) |
| | Determine whether a represents field element 0.
|
| |
| static int | secp256k1_fe_is_odd (const secp256k1_fe *a) |
| | Determine whether a (mod p) is odd.
|
| |
| static int | secp256k1_fe_equal (const secp256k1_fe *a, const secp256k1_fe *b) |
| | Determine whether two field elements are equal.
|
| |
| 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.
|
| |
| 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.
|
| |
| 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.
|
| |
| static void | secp256k1_fe_get_b32 (unsigned char *r, const secp256k1_fe *a) |
| | Convert a field element to 32-byte big endian byte array.
|
| |
| static void | secp256k1_fe_negate_unchecked (secp256k1_fe *r, const secp256k1_fe *a, int m) |
| | Like secp256k1_fe_negate but m is not checked to be an integer constant expression.
|
| |
| static void | secp256k1_fe_add_int (secp256k1_fe *r, int a) |
| | Add a small integer to a field element.
|
| |
| 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.
|
| |
| static void | secp256k1_fe_add (secp256k1_fe *r, const secp256k1_fe *a) |
| | Increment a field element by another.
|
| |
| static void | secp256k1_fe_mul (secp256k1_fe *r, const secp256k1_fe *a, const secp256k1_fe *SECP256K1_RESTRICT b) |
| | Multiply two field elements.
|
| |
| static void | secp256k1_fe_sqr (secp256k1_fe *r, const secp256k1_fe *a) |
| | Square a field element.
|
| |
| static int | secp256k1_fe_sqrt (secp256k1_fe *SECP256K1_RESTRICT r, const secp256k1_fe *SECP256K1_RESTRICT a) |
| | Compute a square root of a field element.
|
| |
| static void | secp256k1_fe_inv (secp256k1_fe *r, const secp256k1_fe *a) |
| | Compute the modular inverse of a field element.
|
| |
| 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.
|
| |
| static void | secp256k1_fe_to_storage (secp256k1_fe_storage *r, const secp256k1_fe *a) |
| | Convert a field element to secp256k1_fe_storage.
|
| |
| static void | secp256k1_fe_from_storage (secp256k1_fe *r, const secp256k1_fe_storage *a) |
| | Convert a field element back from secp256k1_fe_storage.
|
| |
| static void | secp256k1_fe_storage_cmov (secp256k1_fe_storage *r, const secp256k1_fe_storage *a, int flag) |
| | If flag is 1, set *r equal to *a; if flag is 0, leave it.
|
| |
| static void | secp256k1_fe_cmov (secp256k1_fe *r, const secp256k1_fe *a, int flag) |
| | Conditionally move a field element in constant time.
|
| |
| static void | secp256k1_fe_half (secp256k1_fe *r) |
| | Halve the value of a field element modulo the field prime in constant-time.
|
| |
| 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.
|
| |
| static int | secp256k1_fe_is_square_var (const secp256k1_fe *a) |
| | Determine whether a is a square (modulo p).
|
| |
| static void | secp256k1_fe_verify (const secp256k1_fe *a) |
| | Check invariants on a field element (no-op unless VERIFY is enabled).
|
| |
| 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).
|
| |
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).