do { \
int m = 0; \
\
int mask = (n) >> (sizeof(n) * CHAR_BIT - 1); \
int abs_n = ((n) + mask) ^ mask; \
int idx_n = abs_n >> 1; \
VERIFY_CHECK(((n) & 1) == 1); \
VERIFY_CHECK((n) >= -((1 << ((w)-1)) - 1)); \
VERIFY_CHECK((n) <= ((1 << ((w)-1)) - 1)); \
VERIFY_SETUP(secp256k1_fe_clear(&(
r)->x)); \
VERIFY_SETUP(secp256k1_fe_clear(&(
r)->y)); \
\
\
secp256k1_fe_cmov(&(
r)->x, &(pre)[m].x, m == idx_n); \
secp256k1_fe_cmov(&(
r)->y, &(pre)[m].y, m == idx_n); \
} \
secp256k1_fe_negate(&neg_y, &(
r)->y, 1); \
secp256k1_fe_cmov(&(
r)->y, &neg_y, (n) != abs_n); \
} while(0)
#define ECMULT_TABLE_SIZE(w)
29#define ECMULT_CONST_TABLE_GET_GE(r,pre,n,w) do { \
30 int m = 0; \
31 \
32 int mask = (n) >> (sizeof(n) * CHAR_BIT - 1); \
33 int abs_n = ((n) + mask) ^ mask; \
34 int idx_n = abs_n >> 1; \
35 secp256k1_fe neg_y; \
36 VERIFY_CHECK(((n) & 1) == 1); \
37 VERIFY_CHECK((n) >= -((1 << ((w)-1)) - 1)); \
38 VERIFY_CHECK((n) <= ((1 << ((w)-1)) - 1)); \
39 VERIFY_SETUP(secp256k1_fe_clear(&(r)->x)); \
40 VERIFY_SETUP(secp256k1_fe_clear(&(r)->y)); \
41
42 \
43 (r)->x = (pre)[m].x; \
44 (r)->y = (pre)[m].y; \
45 for (m = 1; m < ECMULT_TABLE_SIZE(w); m++) { \
46
47 \
48 secp256k1_fe_cmov(&(r)->x, &(pre)[m].x, m == idx_n); \
49 secp256k1_fe_cmov(&(r)->y, &(pre)[m].y, m == idx_n); \
50 } \
51 (r)->infinity = 0; \
52 secp256k1_fe_negate(&neg_y, &(r)->y, 1); \