7#ifndef SECP256K1_GROUP_IMPL_H
8#define SECP256K1_GROUP_IMPL_H
15#define SECP256K1_G_ORDER_7 SECP256K1_GE_CONST(\
16 0x66625d13, 0x317ffe44, 0x63d32cff, 0x1ca02b9b,\
17 0xe5c6d070, 0x50b4b05e, 0x81cc30db, 0xf5166f0a,\
18 0x1e60e897, 0xa7c00c7c, 0x2df53eb6, 0x98274ff4,\
19 0x64252f42, 0x8ca44e17, 0x3b25418c, 0xff4ab0cf\
21#define SECP256K1_G_ORDER_13 SECP256K1_GE_CONST(\
22 0xa2482ff8, 0x4bf34edf, 0xa51262fd, 0xe57921db,\
23 0xe0dd2cb7, 0xa5914790, 0xbc71631f, 0xc09704fb,\
24 0x942536cb, 0xa3e49492, 0x3a701cc3, 0xee3e443f,\
25 0xdf182aa9, 0x15b8aa6a, 0x166d3b19, 0xba84b045\
27#define SECP256K1_G_ORDER_199 SECP256K1_GE_CONST(\
28 0x7fb07b5c, 0xd07c3bda, 0x553902e2, 0x7a87ea2c,\
29 0x35108a7f, 0x051f41e5, 0xb76abad5, 0x1f2703ad,\
30 0x0a251539, 0x5b4c4438, 0x952a634f, 0xac10dd4d,\
31 0x6d6f4745, 0x98990c27, 0x3a4f3116, 0xd32ff969\
36#define SECP256K1_G SECP256K1_GE_CONST(\
37 0x79be667e, 0xf9dcbbac, 0x55a06295, 0xce870b07,\
38 0x029bfcdb, 0x2dce28d9, 0x59f2815b, 0x16f81798,\
39 0x483ada77, 0x26a3c465, 0x5da4fbfc, 0x0e1108a8,\
40 0xfd17b448, 0xa6855419, 0x9c47d08f, 0xfb10d4b8\
49#if defined(EXHAUSTIVE_TEST_ORDER)
50# if EXHAUSTIVE_TEST_ORDER == 7
55# elif EXHAUSTIVE_TEST_ORDER == 13
60# elif EXHAUSTIVE_TEST_ORDER == 199
66# error No known generator for the specified exhaustive test group order.
183 size_t last_i = SIZE_MAX;
185 for (i = 0; i < len; i++) {
191 if (last_i == SIZE_MAX) {
199 if (last_i == SIZE_MAX) {
207 if (!a[i].infinity) {
216 for (i = 0; i < len; i++) {
217 if (!a[i].infinity) {
427 secp256k1_fe z22, z12, u1, u2, s1, s2, h, i, h2, h3, t;
551 secp256k1_fe az, z12, u1, u2, s1, s2, h, i, h2, h3, t;
619 secp256k1_fe zz, u1, u2, s1, s2, t, tt, m, n, q, rr;
825#ifdef EXHAUSTIVE_TEST_ORDER
832 for (i = 0; i < 32; ++i) {
#define secp256k1_fe_cmov
static int secp256k1_fe_is_quad_var(const secp256k1_fe *a)
Checks whether a field element is a quadratic residue.
static int secp256k1_fe_equal_var(const secp256k1_fe *a, const secp256k1_fe *b)
Determine whether two field elements are equal, without constant-time guarantee.
#define secp256k1_fe_normalizes_to_zero_var
#define secp256k1_fe_mul_int
#define secp256k1_fe_negate
#define secp256k1_fe_normalize_weak
static const secp256k1_fe secp256k1_const_beta
static void secp256k1_fe_verify(const secp256k1_fe *a)
Check invariants on a field element (no-op unless VERIFY is enabled).
#define secp256k1_fe_is_odd
static const secp256k1_fe secp256k1_fe_one
static int secp256k1_fe_sqrt(secp256k1_fe *SECP256K1_RESTRICT r, const secp256k1_fe *SECP256K1_RESTRICT a)
Compute a square root of a field element.
#define secp256k1_fe_clear
#define secp256k1_fe_normalize_var
#define secp256k1_fe_half
#define secp256k1_fe_to_storage
#define secp256k1_fe_inv_var
#define secp256k1_fe_from_storage
#define secp256k1_fe_normalizes_to_zero
#define secp256k1_fe_normalize
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.
#define secp256k1_fe_add_int
#define secp256k1_fe_set_int
static int secp256k1_gej_eq_var(const secp256k1_gej *a, const secp256k1_gej *b)
static void secp256k1_gej_double_var(secp256k1_gej *r, const secp256k1_gej *a, secp256k1_fe *rzr)
static void secp256k1_gej_add_zinv_var(secp256k1_gej *r, const secp256k1_gej *a, const secp256k1_ge *b, const secp256k1_fe *bzinv)
#define SECP256K1_G_ORDER_13
static void secp256k1_gej_clear(secp256k1_gej *r)
static void secp256k1_ge_mul_lambda(secp256k1_ge *r, const secp256k1_ge *a)
static void secp256k1_gej_set_infinity(secp256k1_gej *r)
static int secp256k1_gej_is_infinity(const secp256k1_gej *a)
static void secp256k1_ge_clear(secp256k1_ge *r)
static void secp256k1_ge_set_xy(secp256k1_ge *r, const secp256k1_fe *x, const secp256k1_fe *y)
static void secp256k1_gej_verify(const secp256k1_gej *a)
static int secp256k1_ge_set_xo_var(secp256k1_ge *r, const secp256k1_fe *x, int odd)
static void secp256k1_ge_verify(const secp256k1_ge *a)
static void secp256k1_gej_add_ge_var(secp256k1_gej *r, const secp256k1_gej *a, const secp256k1_ge *b, secp256k1_fe *rzr)
static SECP256K1_INLINE void secp256k1_gej_cmov(secp256k1_gej *r, const secp256k1_gej *a, int flag)
static void secp256k1_gej_add_ge(secp256k1_gej *r, const secp256k1_gej *a, const secp256k1_ge *b)
#define SECP256K1_G
Generator for secp256k1, value 'g' defined in "Standards for Efficient Cryptography" (SEC2) 2....
static void secp256k1_ge_set_gej_zinv(secp256k1_ge *r, const secp256k1_gej *a, const secp256k1_fe *zi)
static int secp256k1_ge_is_valid_var(const secp256k1_ge *a)
static void secp256k1_ge_from_storage(secp256k1_ge *r, const secp256k1_ge_storage *a)
static void secp256k1_gej_add_var(secp256k1_gej *r, const secp256k1_gej *a, const secp256k1_gej *b, secp256k1_fe *rzr)
static void secp256k1_gej_rescale(secp256k1_gej *r, const secp256k1_fe *s)
static int secp256k1_ge_set_xquad(secp256k1_ge *r, const secp256k1_fe *x)
static void secp256k1_ge_set_ge_zinv(secp256k1_ge *r, const secp256k1_ge *a, const secp256k1_fe *zi)
static int secp256k1_gej_eq_x_var(const secp256k1_fe *x, const secp256k1_gej *a)
#define SECP256K1_G_ORDER_7
static void secp256k1_ge_set_gej(secp256k1_ge *r, secp256k1_gej *a)
static int secp256k1_ge_is_in_correct_subgroup(const secp256k1_ge *ge)
static void secp256k1_ge_table_set_globalz(size_t len, secp256k1_ge *a, const secp256k1_fe *zr)
static void secp256k1_ge_neg(secp256k1_ge *r, const secp256k1_ge *a)
static const secp256k1_ge secp256k1_ge_const_g
static int secp256k1_ge_is_infinity(const secp256k1_ge *a)
static void secp256k1_ge_set_infinity(secp256k1_ge *r)
static void secp256k1_ge_set_all_gej_var(secp256k1_ge *r, const secp256k1_gej *a, size_t len)
static void secp256k1_gej_set_ge(secp256k1_gej *r, const secp256k1_ge *a)
static void secp256k1_ge_to_storage(secp256k1_ge_storage *r, const secp256k1_ge *a)
static SECP256K1_INLINE void secp256k1_ge_storage_cmov(secp256k1_ge_storage *r, const secp256k1_ge_storage *a, int flag)
#define SECP256K1_G_ORDER_199
static void secp256k1_ge_set_gej_var(secp256k1_ge *r, secp256k1_gej *a)
static int secp256k1_gej_has_quad_y_var(const secp256k1_gej *a)
static void secp256k1_gej_neg(secp256k1_gej *r, const secp256k1_gej *a)
static SECP256K1_INLINE void secp256k1_gej_double(secp256k1_gej *r, const secp256k1_gej *a)
#define VERIFY_CHECK(cond)
This field implementation represents the value as 10 uint32_t limbs in base 2^26.
A group element in affine coordinates on the secp256k1 curve, or occasionally on an isomorphic curve ...
A group element of the secp256k1 curve, in jacobian coordinates.
#define EXHAUSTIVE_TEST_ORDER