7 #ifndef SECP256K1_ECMULT_CONST_IMPL_H 8 #define SECP256K1_ECMULT_CONST_IMPL_H 16 #define ECMULT_CONST_TABLE_GET_GE(r,pre,n,w) do { \ 18 int abs_n = (n) * (((n) > 0) * 2 - 1); \ 19 int idx_n = abs_n / 2; \ 21 VERIFY_CHECK(((n) & 1) == 1); \ 22 VERIFY_CHECK((n) >= -((1 << ((w)-1)) - 1)); \ 23 VERIFY_CHECK((n) <= ((1 << ((w)-1)) - 1)); \ 24 VERIFY_SETUP(secp256k1_fe_clear(&(r)->x)); \ 25 VERIFY_SETUP(secp256k1_fe_clear(&(r)->y)); \ 26 for (m = 0; m < ECMULT_TABLE_SIZE(w); m++) { \ 29 secp256k1_fe_cmov(&(r)->x, &(pre)[m].x, m == idx_n); \ 30 secp256k1_fe_cmov(&(r)->y, &(pre)[m].y, m == idx_n); \ 33 secp256k1_fe_negate(&neg_y, &(r)->y, 1); \ 34 secp256k1_fe_cmov(&(r)->y, &neg_y, (n) != abs_n); \ 91 global_sign *= not_neg_one * 2 - 1;
96 while (word * w < size) {
103 even = ((u & 1) == 0);
104 sign = 2 * (u_last > 0) - 1;
106 u_last -=
sign * even * (1 << w);
109 wnaf[word++] = u_last * global_sign;
113 wnaf[word] = u * global_sign;
126 #ifdef USE_ENDOMORPHISM 139 #ifdef USE_ENDOMORPHISM 143 secp256k1_scalar_split_lambda(&q_1, &q_lam, &sc);
150 #ifdef USE_ENDOMORPHISM 166 #ifdef USE_ENDOMORPHISM 169 secp256k1_ge_mul_lambda(&pre_a_lam[i], &pre_a[i]);
181 #ifdef USE_ENDOMORPHISM 193 for (j = 0; j <
WINDOW_A - 1; ++j) {
201 #ifdef USE_ENDOMORPHISM 217 #ifdef USE_ENDOMORPHISM 226 #ifdef USE_ENDOMORPHISM 235 #ifdef USE_ENDOMORPHISM 246 #ifdef USE_ENDOMORPHISM 250 secp256k1_ge_mul_lambda(&correction, &correction);
#define VERIFY_CHECK(cond)
Definition: util.h:67
Definition: field_10x26.h:12
static int secp256k1_scalar_is_even(const secp256k1_scalar *a)
static void secp256k1_ge_neg(secp256k1_ge *r, const secp256k1_ge *a)
static void secp256k1_fe_mul(secp256k1_fe *r, const secp256k1_fe *a, const secp256k1_fe *SECP256K1_RESTRICT b)
static void secp256k1_gej_double_nonzero(secp256k1_gej *r, const secp256k1_gej *a, secp256k1_fe *rzr)
static void secp256k1_scalar_negate(secp256k1_scalar *r, const secp256k1_scalar *a)
static int secp256k1_scalar_is_zero(const secp256k1_scalar *a)
#define ECMULT_TABLE_SIZE(w)
Definition: ecmult_impl.h:54
static int secp256k1_scalar_shr_int(secp256k1_scalar *r, int n)
static void secp256k1_gej_double_var(secp256k1_gej *r, const secp256k1_gej *a, secp256k1_fe *rzr)
static void secp256k1_ecmult_odd_multiples_table_globalz_windowa(secp256k1_ge *pre, secp256k1_fe *globalz, const secp256k1_gej *a)
Definition: ecmult_impl.h:130
static int secp256k1_wnaf_const(int *wnaf, secp256k1_scalar s, int w, int size)
Definition: ecmult_const_impl.h:51
static void secp256k1_ecmult_const(secp256k1_gej *r, const secp256k1_ge *a, const secp256k1_scalar *scalar, int size)
Definition: ecmult_const_impl.h:120
#define ECMULT_CONST_TABLE_GET_GE(r, pre, n, w)
Definition: ecmult_const_impl.h:16
static void secp256k1_ge_set_gej(secp256k1_ge *r, secp256k1_gej *a)
#define WNAF_SIZE_BITS(bits, w)
Definition: ecmult_impl.h:50
static int secp256k1_scalar_is_high(const secp256k1_scalar *a)
static void secp256k1_scalar_cadd_bit(secp256k1_scalar *r, unsigned int bit, int flag)
static void secp256k1_fe_normalize_weak(secp256k1_fe *r)
static void secp256k1_ge_storage_cmov(secp256k1_ge_storage *r, const secp256k1_ge_storage *a, int flag)
Definition: scalar_4x64.h:13
static int secp256k1_scalar_cond_negate(secp256k1_scalar *a, int flag)
#define WINDOW_A
Definition: ecmult_impl.h:33
secp256k1_fe z
Definition: group.h:27
#define WNAF_SIZE(w)
Definition: ecmult_impl.h:51
static void secp256k1_gej_add_ge(secp256k1_gej *r, const secp256k1_gej *a, const secp256k1_ge *b)
static void secp256k1_ge_from_storage(secp256k1_ge *r, const secp256k1_ge_storage *a)
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 int secp256k1_scalar_is_one(const secp256k1_scalar *a)
def sign()
Definition: gitian-build.py:91