PRCYCoin  2.0.0.7rc1
P2P Digital Currency
scalar_8x32_impl.h
Go to the documentation of this file.
1 /**********************************************************************
2  * Copyright (c) 2014 Pieter Wuille *
3  * Distributed under the MIT software license, see the accompanying *
4  * file COPYING or http://www.opensource.org/licenses/mit-license.php.*
5  **********************************************************************/
6 
7 #ifndef SECP256K1_SCALAR_REPR_IMPL_H
8 #define SECP256K1_SCALAR_REPR_IMPL_H
9 
10 #include <string.h>
11 
12 /* Limbs of the secp256k1 order. */
13 #define SECP256K1_N_0 ((uint32_t)0xD0364141UL)
14 #define SECP256K1_N_1 ((uint32_t)0xBFD25E8CUL)
15 #define SECP256K1_N_2 ((uint32_t)0xAF48A03BUL)
16 #define SECP256K1_N_3 ((uint32_t)0xBAAEDCE6UL)
17 #define SECP256K1_N_4 ((uint32_t)0xFFFFFFFEUL)
18 #define SECP256K1_N_5 ((uint32_t)0xFFFFFFFFUL)
19 #define SECP256K1_N_6 ((uint32_t)0xFFFFFFFFUL)
20 #define SECP256K1_N_7 ((uint32_t)0xFFFFFFFFUL)
21 
22 /* Limbs of 2^256 minus the secp256k1 order. */
23 #define SECP256K1_N_C_0 (~SECP256K1_N_0 + 1)
24 #define SECP256K1_N_C_1 (~SECP256K1_N_1)
25 #define SECP256K1_N_C_2 (~SECP256K1_N_2)
26 #define SECP256K1_N_C_3 (~SECP256K1_N_3)
27 #define SECP256K1_N_C_4 (1)
28 
29 /* Limbs of half the secp256k1 order. */
30 #define SECP256K1_N_H_0 ((uint32_t)0x681B20A0UL)
31 #define SECP256K1_N_H_1 ((uint32_t)0xDFE92F46UL)
32 #define SECP256K1_N_H_2 ((uint32_t)0x57A4501DUL)
33 #define SECP256K1_N_H_3 ((uint32_t)0x5D576E73UL)
34 #define SECP256K1_N_H_4 ((uint32_t)0xFFFFFFFFUL)
35 #define SECP256K1_N_H_5 ((uint32_t)0xFFFFFFFFUL)
36 #define SECP256K1_N_H_6 ((uint32_t)0xFFFFFFFFUL)
37 #define SECP256K1_N_H_7 ((uint32_t)0x7FFFFFFFUL)
38 
39 SECP256K1_INLINE static void secp256k1_scalar_clear(secp256k1_scalar *r) {
40  r->d[0] = 0;
41  r->d[1] = 0;
42  r->d[2] = 0;
43  r->d[3] = 0;
44  r->d[4] = 0;
45  r->d[5] = 0;
46  r->d[6] = 0;
47  r->d[7] = 0;
48 }
49 
50 SECP256K1_INLINE static void secp256k1_scalar_set_int(secp256k1_scalar *r, unsigned int v) {
51  r->d[0] = v;
52  r->d[1] = 0;
53  r->d[2] = 0;
54  r->d[3] = 0;
55  r->d[4] = 0;
56  r->d[5] = 0;
57  r->d[6] = 0;
58  r->d[7] = 0;
59 }
60 
61 SECP256K1_INLINE static void secp256k1_scalar_set_u64(secp256k1_scalar *r, uint64_t v) {
62  r->d[0] = v;
63  r->d[1] = v >> 32;
64  r->d[2] = 0;
65  r->d[3] = 0;
66  r->d[4] = 0;
67  r->d[5] = 0;
68  r->d[6] = 0;
69  r->d[7] = 0;
70 }
71 
72 SECP256K1_INLINE static unsigned int secp256k1_scalar_get_bits(const secp256k1_scalar *a, unsigned int offset, unsigned int count) {
73  VERIFY_CHECK((offset + count - 1) >> 5 == offset >> 5);
74  return (a->d[offset >> 5] >> (offset & 0x1F)) & ((1 << count) - 1);
75 }
76 
77 SECP256K1_INLINE static unsigned int secp256k1_scalar_get_bits_var(const secp256k1_scalar *a, unsigned int offset, unsigned int count) {
78  VERIFY_CHECK(count < 32);
79  VERIFY_CHECK(offset + count <= 256);
80  if ((offset + count - 1) >> 5 == offset >> 5) {
81  return secp256k1_scalar_get_bits(a, offset, count);
82  } else {
83  VERIFY_CHECK((offset >> 5) + 1 < 8);
84  return ((a->d[offset >> 5] >> (offset & 0x1F)) | (a->d[(offset >> 5) + 1] << (32 - (offset & 0x1F)))) & ((((uint32_t)1) << count) - 1);
85  }
86 }
87 
88 SECP256K1_INLINE static int secp256k1_scalar_check_overflow(const secp256k1_scalar *a) {
89  int yes = 0;
90  int no = 0;
91  no |= (a->d[7] < SECP256K1_N_7); /* No need for a > check. */
92  no |= (a->d[6] < SECP256K1_N_6); /* No need for a > check. */
93  no |= (a->d[5] < SECP256K1_N_5); /* No need for a > check. */
94  no |= (a->d[4] < SECP256K1_N_4);
95  yes |= (a->d[4] > SECP256K1_N_4) & ~no;
96  no |= (a->d[3] < SECP256K1_N_3) & ~yes;
97  yes |= (a->d[3] > SECP256K1_N_3) & ~no;
98  no |= (a->d[2] < SECP256K1_N_2) & ~yes;
99  yes |= (a->d[2] > SECP256K1_N_2) & ~no;
100  no |= (a->d[1] < SECP256K1_N_1) & ~yes;
101  yes |= (a->d[1] > SECP256K1_N_1) & ~no;
102  yes |= (a->d[0] >= SECP256K1_N_0) & ~no;
103  return yes;
104 }
105 
106 SECP256K1_INLINE static int secp256k1_scalar_reduce(secp256k1_scalar *r, uint32_t overflow) {
107  uint64_t t;
108  VERIFY_CHECK(overflow <= 1);
109  t = (uint64_t)r->d[0] + overflow * SECP256K1_N_C_0;
110  r->d[0] = t & 0xFFFFFFFFUL; t >>= 32;
111  t += (uint64_t)r->d[1] + overflow * SECP256K1_N_C_1;
112  r->d[1] = t & 0xFFFFFFFFUL; t >>= 32;
113  t += (uint64_t)r->d[2] + overflow * SECP256K1_N_C_2;
114  r->d[2] = t & 0xFFFFFFFFUL; t >>= 32;
115  t += (uint64_t)r->d[3] + overflow * SECP256K1_N_C_3;
116  r->d[3] = t & 0xFFFFFFFFUL; t >>= 32;
117  t += (uint64_t)r->d[4] + overflow * SECP256K1_N_C_4;
118  r->d[4] = t & 0xFFFFFFFFUL; t >>= 32;
119  t += (uint64_t)r->d[5];
120  r->d[5] = t & 0xFFFFFFFFUL; t >>= 32;
121  t += (uint64_t)r->d[6];
122  r->d[6] = t & 0xFFFFFFFFUL; t >>= 32;
123  t += (uint64_t)r->d[7];
124  r->d[7] = t & 0xFFFFFFFFUL;
125  return overflow;
126 }
127 
128 static int secp256k1_scalar_add(secp256k1_scalar *r, const secp256k1_scalar *a, const secp256k1_scalar *b) {
129  int overflow;
130  uint64_t t = (uint64_t)a->d[0] + b->d[0];
131  r->d[0] = t & 0xFFFFFFFFULL; t >>= 32;
132  t += (uint64_t)a->d[1] + b->d[1];
133  r->d[1] = t & 0xFFFFFFFFULL; t >>= 32;
134  t += (uint64_t)a->d[2] + b->d[2];
135  r->d[2] = t & 0xFFFFFFFFULL; t >>= 32;
136  t += (uint64_t)a->d[3] + b->d[3];
137  r->d[3] = t & 0xFFFFFFFFULL; t >>= 32;
138  t += (uint64_t)a->d[4] + b->d[4];
139  r->d[4] = t & 0xFFFFFFFFULL; t >>= 32;
140  t += (uint64_t)a->d[5] + b->d[5];
141  r->d[5] = t & 0xFFFFFFFFULL; t >>= 32;
142  t += (uint64_t)a->d[6] + b->d[6];
143  r->d[6] = t & 0xFFFFFFFFULL; t >>= 32;
144  t += (uint64_t)a->d[7] + b->d[7];
145  r->d[7] = t & 0xFFFFFFFFULL; t >>= 32;
146  overflow = t + secp256k1_scalar_check_overflow(r);
147  VERIFY_CHECK(overflow == 0 || overflow == 1);
148  secp256k1_scalar_reduce(r, overflow);
149  return overflow;
150 }
151 
152 static void secp256k1_scalar_cadd_bit(secp256k1_scalar *r, unsigned int bit, int flag) {
153  uint64_t t;
154  VERIFY_CHECK(bit < 256);
155  bit += ((uint32_t) flag - 1) & 0x100; /* forcing (bit >> 5) > 7 makes this a noop */
156  t = (uint64_t)r->d[0] + (((uint32_t)((bit >> 5) == 0)) << (bit & 0x1F));
157  r->d[0] = t & 0xFFFFFFFFULL; t >>= 32;
158  t += (uint64_t)r->d[1] + (((uint32_t)((bit >> 5) == 1)) << (bit & 0x1F));
159  r->d[1] = t & 0xFFFFFFFFULL; t >>= 32;
160  t += (uint64_t)r->d[2] + (((uint32_t)((bit >> 5) == 2)) << (bit & 0x1F));
161  r->d[2] = t & 0xFFFFFFFFULL; t >>= 32;
162  t += (uint64_t)r->d[3] + (((uint32_t)((bit >> 5) == 3)) << (bit & 0x1F));
163  r->d[3] = t & 0xFFFFFFFFULL; t >>= 32;
164  t += (uint64_t)r->d[4] + (((uint32_t)((bit >> 5) == 4)) << (bit & 0x1F));
165  r->d[4] = t & 0xFFFFFFFFULL; t >>= 32;
166  t += (uint64_t)r->d[5] + (((uint32_t)((bit >> 5) == 5)) << (bit & 0x1F));
167  r->d[5] = t & 0xFFFFFFFFULL; t >>= 32;
168  t += (uint64_t)r->d[6] + (((uint32_t)((bit >> 5) == 6)) << (bit & 0x1F));
169  r->d[6] = t & 0xFFFFFFFFULL; t >>= 32;
170  t += (uint64_t)r->d[7] + (((uint32_t)((bit >> 5) == 7)) << (bit & 0x1F));
171  r->d[7] = t & 0xFFFFFFFFULL;
172 #ifdef VERIFY
173  VERIFY_CHECK((t >> 32) == 0);
174  VERIFY_CHECK(secp256k1_scalar_check_overflow(r) == 0);
175 #endif
176 }
177 
178 static void secp256k1_scalar_set_b32(secp256k1_scalar *r, const unsigned char *b32, int *overflow) {
179  int over;
180  r->d[0] = (uint32_t)b32[31] | (uint32_t)b32[30] << 8 | (uint32_t)b32[29] << 16 | (uint32_t)b32[28] << 24;
181  r->d[1] = (uint32_t)b32[27] | (uint32_t)b32[26] << 8 | (uint32_t)b32[25] << 16 | (uint32_t)b32[24] << 24;
182  r->d[2] = (uint32_t)b32[23] | (uint32_t)b32[22] << 8 | (uint32_t)b32[21] << 16 | (uint32_t)b32[20] << 24;
183  r->d[3] = (uint32_t)b32[19] | (uint32_t)b32[18] << 8 | (uint32_t)b32[17] << 16 | (uint32_t)b32[16] << 24;
184  r->d[4] = (uint32_t)b32[15] | (uint32_t)b32[14] << 8 | (uint32_t)b32[13] << 16 | (uint32_t)b32[12] << 24;
185  r->d[5] = (uint32_t)b32[11] | (uint32_t)b32[10] << 8 | (uint32_t)b32[9] << 16 | (uint32_t)b32[8] << 24;
186  r->d[6] = (uint32_t)b32[7] | (uint32_t)b32[6] << 8 | (uint32_t)b32[5] << 16 | (uint32_t)b32[4] << 24;
187  r->d[7] = (uint32_t)b32[3] | (uint32_t)b32[2] << 8 | (uint32_t)b32[1] << 16 | (uint32_t)b32[0] << 24;
188  over = secp256k1_scalar_reduce(r, secp256k1_scalar_check_overflow(r));
189  if (overflow) {
190  *overflow = over;
191  }
192 }
193 
194 static void secp256k1_scalar_get_b32(unsigned char *bin, const secp256k1_scalar* a) {
195  bin[0] = a->d[7] >> 24; bin[1] = a->d[7] >> 16; bin[2] = a->d[7] >> 8; bin[3] = a->d[7];
196  bin[4] = a->d[6] >> 24; bin[5] = a->d[6] >> 16; bin[6] = a->d[6] >> 8; bin[7] = a->d[6];
197  bin[8] = a->d[5] >> 24; bin[9] = a->d[5] >> 16; bin[10] = a->d[5] >> 8; bin[11] = a->d[5];
198  bin[12] = a->d[4] >> 24; bin[13] = a->d[4] >> 16; bin[14] = a->d[4] >> 8; bin[15] = a->d[4];
199  bin[16] = a->d[3] >> 24; bin[17] = a->d[3] >> 16; bin[18] = a->d[3] >> 8; bin[19] = a->d[3];
200  bin[20] = a->d[2] >> 24; bin[21] = a->d[2] >> 16; bin[22] = a->d[2] >> 8; bin[23] = a->d[2];
201  bin[24] = a->d[1] >> 24; bin[25] = a->d[1] >> 16; bin[26] = a->d[1] >> 8; bin[27] = a->d[1];
202  bin[28] = a->d[0] >> 24; bin[29] = a->d[0] >> 16; bin[30] = a->d[0] >> 8; bin[31] = a->d[0];
203 }
204 
205 SECP256K1_INLINE static int secp256k1_scalar_is_zero(const secp256k1_scalar *a) {
206  return (a->d[0] | a->d[1] | a->d[2] | a->d[3] | a->d[4] | a->d[5] | a->d[6] | a->d[7]) == 0;
207 }
208 
209 static void secp256k1_scalar_negate(secp256k1_scalar *r, const secp256k1_scalar *a) {
210  uint32_t nonzero = 0xFFFFFFFFUL * (secp256k1_scalar_is_zero(a) == 0);
211  uint64_t t = (uint64_t)(~a->d[0]) + SECP256K1_N_0 + 1;
212  r->d[0] = t & nonzero; t >>= 32;
213  t += (uint64_t)(~a->d[1]) + SECP256K1_N_1;
214  r->d[1] = t & nonzero; t >>= 32;
215  t += (uint64_t)(~a->d[2]) + SECP256K1_N_2;
216  r->d[2] = t & nonzero; t >>= 32;
217  t += (uint64_t)(~a->d[3]) + SECP256K1_N_3;
218  r->d[3] = t & nonzero; t >>= 32;
219  t += (uint64_t)(~a->d[4]) + SECP256K1_N_4;
220  r->d[4] = t & nonzero; t >>= 32;
221  t += (uint64_t)(~a->d[5]) + SECP256K1_N_5;
222  r->d[5] = t & nonzero; t >>= 32;
223  t += (uint64_t)(~a->d[6]) + SECP256K1_N_6;
224  r->d[6] = t & nonzero; t >>= 32;
225  t += (uint64_t)(~a->d[7]) + SECP256K1_N_7;
226  r->d[7] = t & nonzero;
227 }
228 
229 SECP256K1_INLINE static int secp256k1_scalar_is_one(const secp256k1_scalar *a) {
230  return ((a->d[0] ^ 1) | a->d[1] | a->d[2] | a->d[3] | a->d[4] | a->d[5] | a->d[6] | a->d[7]) == 0;
231 }
232 
233 static int secp256k1_scalar_is_high(const secp256k1_scalar *a) {
234  int yes = 0;
235  int no = 0;
236  no |= (a->d[7] < SECP256K1_N_H_7);
237  yes |= (a->d[7] > SECP256K1_N_H_7) & ~no;
238  no |= (a->d[6] < SECP256K1_N_H_6) & ~yes; /* No need for a > check. */
239  no |= (a->d[5] < SECP256K1_N_H_5) & ~yes; /* No need for a > check. */
240  no |= (a->d[4] < SECP256K1_N_H_4) & ~yes; /* No need for a > check. */
241  no |= (a->d[3] < SECP256K1_N_H_3) & ~yes;
242  yes |= (a->d[3] > SECP256K1_N_H_3) & ~no;
243  no |= (a->d[2] < SECP256K1_N_H_2) & ~yes;
244  yes |= (a->d[2] > SECP256K1_N_H_2) & ~no;
245  no |= (a->d[1] < SECP256K1_N_H_1) & ~yes;
246  yes |= (a->d[1] > SECP256K1_N_H_1) & ~no;
247  yes |= (a->d[0] > SECP256K1_N_H_0) & ~no;
248  return yes;
249 }
250 
251 static int secp256k1_scalar_cond_negate(secp256k1_scalar *r, int flag) {
252  /* If we are flag = 0, mask = 00...00 and this is a no-op;
253  * if we are flag = 1, mask = 11...11 and this is identical to secp256k1_scalar_negate */
254  uint32_t mask = !flag - 1;
255  uint32_t nonzero = 0xFFFFFFFFUL * (secp256k1_scalar_is_zero(r) == 0);
256  uint64_t t = (uint64_t)(r->d[0] ^ mask) + ((SECP256K1_N_0 + 1) & mask);
257  r->d[0] = t & nonzero; t >>= 32;
258  t += (uint64_t)(r->d[1] ^ mask) + (SECP256K1_N_1 & mask);
259  r->d[1] = t & nonzero; t >>= 32;
260  t += (uint64_t)(r->d[2] ^ mask) + (SECP256K1_N_2 & mask);
261  r->d[2] = t & nonzero; t >>= 32;
262  t += (uint64_t)(r->d[3] ^ mask) + (SECP256K1_N_3 & mask);
263  r->d[3] = t & nonzero; t >>= 32;
264  t += (uint64_t)(r->d[4] ^ mask) + (SECP256K1_N_4 & mask);
265  r->d[4] = t & nonzero; t >>= 32;
266  t += (uint64_t)(r->d[5] ^ mask) + (SECP256K1_N_5 & mask);
267  r->d[5] = t & nonzero; t >>= 32;
268  t += (uint64_t)(r->d[6] ^ mask) + (SECP256K1_N_6 & mask);
269  r->d[6] = t & nonzero; t >>= 32;
270  t += (uint64_t)(r->d[7] ^ mask) + (SECP256K1_N_7 & mask);
271  r->d[7] = t & nonzero;
272  return 2 * (mask == 0) - 1;
273 }
274 
275 
276 /* Inspired by the macros in OpenSSL's crypto/bn/asm/x86_64-gcc.c. */
277 
279 #define muladd(a,b) { \
280  uint32_t tl, th; \
281  { \
282  uint64_t t = (uint64_t)a * b; \
283  th = t >> 32; /* at most 0xFFFFFFFE */ \
284  tl = t; \
285  } \
286  c0 += tl; /* overflow is handled on the next line */ \
287  th += (c0 < tl) ? 1 : 0; /* at most 0xFFFFFFFF */ \
288  c1 += th; /* overflow is handled on the next line */ \
289  c2 += (c1 < th) ? 1 : 0; /* never overflows by contract (verified in the next line) */ \
290  VERIFY_CHECK((c1 >= th) || (c2 != 0)); \
291 }
292 
294 #define muladd_fast(a,b) { \
295  uint32_t tl, th; \
296  { \
297  uint64_t t = (uint64_t)a * b; \
298  th = t >> 32; /* at most 0xFFFFFFFE */ \
299  tl = t; \
300  } \
301  c0 += tl; /* overflow is handled on the next line */ \
302  th += (c0 < tl) ? 1 : 0; /* at most 0xFFFFFFFF */ \
303  c1 += th; /* never overflows by contract (verified in the next line) */ \
304  VERIFY_CHECK(c1 >= th); \
305 }
306 
308 #define muladd2(a,b) { \
309  uint32_t tl, th, th2, tl2; \
310  { \
311  uint64_t t = (uint64_t)a * b; \
312  th = t >> 32; /* at most 0xFFFFFFFE */ \
313  tl = t; \
314  } \
315  th2 = th + th; /* at most 0xFFFFFFFE (in case th was 0x7FFFFFFF) */ \
316  c2 += (th2 < th) ? 1 : 0; /* never overflows by contract (verified the next line) */ \
317  VERIFY_CHECK((th2 >= th) || (c2 != 0)); \
318  tl2 = tl + tl; /* at most 0xFFFFFFFE (in case the lowest 63 bits of tl were 0x7FFFFFFF) */ \
319  th2 += (tl2 < tl) ? 1 : 0; /* at most 0xFFFFFFFF */ \
320  c0 += tl2; /* overflow is handled on the next line */ \
321  th2 += (c0 < tl2) ? 1 : 0; /* second overflow is handled on the next line */ \
322  c2 += (c0 < tl2) & (th2 == 0); /* never overflows by contract (verified the next line) */ \
323  VERIFY_CHECK((c0 >= tl2) || (th2 != 0) || (c2 != 0)); \
324  c1 += th2; /* overflow is handled on the next line */ \
325  c2 += (c1 < th2) ? 1 : 0; /* never overflows by contract (verified the next line) */ \
326  VERIFY_CHECK((c1 >= th2) || (c2 != 0)); \
327 }
328 
330 #define sumadd(a) { \
331  unsigned int over; \
332  c0 += (a); /* overflow is handled on the next line */ \
333  over = (c0 < (a)) ? 1 : 0; \
334  c1 += over; /* overflow is handled on the next line */ \
335  c2 += (c1 < over) ? 1 : 0; /* never overflows by contract */ \
336 }
337 
339 #define sumadd_fast(a) { \
340  c0 += (a); /* overflow is handled on the next line */ \
341  c1 += (c0 < (a)) ? 1 : 0; /* never overflows by contract (verified the next line) */ \
342  VERIFY_CHECK((c1 != 0) | (c0 >= (a))); \
343  VERIFY_CHECK(c2 == 0); \
344 }
345 
347 #define extract(n) { \
348  (n) = c0; \
349  c0 = c1; \
350  c1 = c2; \
351  c2 = 0; \
352 }
353 
355 #define extract_fast(n) { \
356  (n) = c0; \
357  c0 = c1; \
358  c1 = 0; \
359  VERIFY_CHECK(c2 == 0); \
360 }
361 
362 static void secp256k1_scalar_reduce_512(secp256k1_scalar *r, const uint32_t *l) {
363  uint64_t c;
364  uint32_t n0 = l[8], n1 = l[9], n2 = l[10], n3 = l[11], n4 = l[12], n5 = l[13], n6 = l[14], n7 = l[15];
365  uint32_t m0, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12;
366  uint32_t p0, p1, p2, p3, p4, p5, p6, p7, p8;
367 
368  /* 96 bit accumulator. */
369  uint32_t c0, c1, c2;
370 
371  /* Reduce 512 bits into 385. */
372  /* m[0..12] = l[0..7] + n[0..7] * SECP256K1_N_C. */
373  c0 = l[0]; c1 = 0; c2 = 0;
375  extract_fast(m0);
376  sumadd_fast(l[1]);
377  muladd(n1, SECP256K1_N_C_0);
378  muladd(n0, SECP256K1_N_C_1);
379  extract(m1);
380  sumadd(l[2]);
381  muladd(n2, SECP256K1_N_C_0);
382  muladd(n1, SECP256K1_N_C_1);
383  muladd(n0, SECP256K1_N_C_2);
384  extract(m2);
385  sumadd(l[3]);
386  muladd(n3, SECP256K1_N_C_0);
387  muladd(n2, SECP256K1_N_C_1);
388  muladd(n1, SECP256K1_N_C_2);
389  muladd(n0, SECP256K1_N_C_3);
390  extract(m3);
391  sumadd(l[4]);
392  muladd(n4, SECP256K1_N_C_0);
393  muladd(n3, SECP256K1_N_C_1);
394  muladd(n2, SECP256K1_N_C_2);
395  muladd(n1, SECP256K1_N_C_3);
396  sumadd(n0);
397  extract(m4);
398  sumadd(l[5]);
399  muladd(n5, SECP256K1_N_C_0);
400  muladd(n4, SECP256K1_N_C_1);
401  muladd(n3, SECP256K1_N_C_2);
402  muladd(n2, SECP256K1_N_C_3);
403  sumadd(n1);
404  extract(m5);
405  sumadd(l[6]);
406  muladd(n6, SECP256K1_N_C_0);
407  muladd(n5, SECP256K1_N_C_1);
408  muladd(n4, SECP256K1_N_C_2);
409  muladd(n3, SECP256K1_N_C_3);
410  sumadd(n2);
411  extract(m6);
412  sumadd(l[7]);
413  muladd(n7, SECP256K1_N_C_0);
414  muladd(n6, SECP256K1_N_C_1);
415  muladd(n5, SECP256K1_N_C_2);
416  muladd(n4, SECP256K1_N_C_3);
417  sumadd(n3);
418  extract(m7);
419  muladd(n7, SECP256K1_N_C_1);
420  muladd(n6, SECP256K1_N_C_2);
421  muladd(n5, SECP256K1_N_C_3);
422  sumadd(n4);
423  extract(m8);
424  muladd(n7, SECP256K1_N_C_2);
425  muladd(n6, SECP256K1_N_C_3);
426  sumadd(n5);
427  extract(m9);
428  muladd(n7, SECP256K1_N_C_3);
429  sumadd(n6);
430  extract(m10);
431  sumadd_fast(n7);
432  extract_fast(m11);
433  VERIFY_CHECK(c0 <= 1);
434  m12 = c0;
435 
436  /* Reduce 385 bits into 258. */
437  /* p[0..8] = m[0..7] + m[8..12] * SECP256K1_N_C. */
438  c0 = m0; c1 = 0; c2 = 0;
440  extract_fast(p0);
441  sumadd_fast(m1);
442  muladd(m9, SECP256K1_N_C_0);
443  muladd(m8, SECP256K1_N_C_1);
444  extract(p1);
445  sumadd(m2);
446  muladd(m10, SECP256K1_N_C_0);
447  muladd(m9, SECP256K1_N_C_1);
448  muladd(m8, SECP256K1_N_C_2);
449  extract(p2);
450  sumadd(m3);
451  muladd(m11, SECP256K1_N_C_0);
452  muladd(m10, SECP256K1_N_C_1);
453  muladd(m9, SECP256K1_N_C_2);
454  muladd(m8, SECP256K1_N_C_3);
455  extract(p3);
456  sumadd(m4);
457  muladd(m12, SECP256K1_N_C_0);
458  muladd(m11, SECP256K1_N_C_1);
459  muladd(m10, SECP256K1_N_C_2);
460  muladd(m9, SECP256K1_N_C_3);
461  sumadd(m8);
462  extract(p4);
463  sumadd(m5);
464  muladd(m12, SECP256K1_N_C_1);
465  muladd(m11, SECP256K1_N_C_2);
466  muladd(m10, SECP256K1_N_C_3);
467  sumadd(m9);
468  extract(p5);
469  sumadd(m6);
470  muladd(m12, SECP256K1_N_C_2);
471  muladd(m11, SECP256K1_N_C_3);
472  sumadd(m10);
473  extract(p6);
474  sumadd_fast(m7);
476  sumadd_fast(m11);
477  extract_fast(p7);
478  p8 = c0 + m12;
479  VERIFY_CHECK(p8 <= 2);
480 
481  /* Reduce 258 bits into 256. */
482  /* r[0..7] = p[0..7] + p[8] * SECP256K1_N_C. */
483  c = p0 + (uint64_t)SECP256K1_N_C_0 * p8;
484  r->d[0] = c & 0xFFFFFFFFUL; c >>= 32;
485  c += p1 + (uint64_t)SECP256K1_N_C_1 * p8;
486  r->d[1] = c & 0xFFFFFFFFUL; c >>= 32;
487  c += p2 + (uint64_t)SECP256K1_N_C_2 * p8;
488  r->d[2] = c & 0xFFFFFFFFUL; c >>= 32;
489  c += p3 + (uint64_t)SECP256K1_N_C_3 * p8;
490  r->d[3] = c & 0xFFFFFFFFUL; c >>= 32;
491  c += p4 + (uint64_t)p8;
492  r->d[4] = c & 0xFFFFFFFFUL; c >>= 32;
493  c += p5;
494  r->d[5] = c & 0xFFFFFFFFUL; c >>= 32;
495  c += p6;
496  r->d[6] = c & 0xFFFFFFFFUL; c >>= 32;
497  c += p7;
498  r->d[7] = c & 0xFFFFFFFFUL; c >>= 32;
499 
500  /* Final reduction of r. */
501  secp256k1_scalar_reduce(r, c + secp256k1_scalar_check_overflow(r));
502 }
503 
504 static void secp256k1_scalar_mul_512(uint32_t *l, const secp256k1_scalar *a, const secp256k1_scalar *b) {
505  /* 96 bit accumulator. */
506  uint32_t c0 = 0, c1 = 0, c2 = 0;
507 
508  /* l[0..15] = a[0..7] * b[0..7]. */
509  muladd_fast(a->d[0], b->d[0]);
510  extract_fast(l[0]);
511  muladd(a->d[0], b->d[1]);
512  muladd(a->d[1], b->d[0]);
513  extract(l[1]);
514  muladd(a->d[0], b->d[2]);
515  muladd(a->d[1], b->d[1]);
516  muladd(a->d[2], b->d[0]);
517  extract(l[2]);
518  muladd(a->d[0], b->d[3]);
519  muladd(a->d[1], b->d[2]);
520  muladd(a->d[2], b->d[1]);
521  muladd(a->d[3], b->d[0]);
522  extract(l[3]);
523  muladd(a->d[0], b->d[4]);
524  muladd(a->d[1], b->d[3]);
525  muladd(a->d[2], b->d[2]);
526  muladd(a->d[3], b->d[1]);
527  muladd(a->d[4], b->d[0]);
528  extract(l[4]);
529  muladd(a->d[0], b->d[5]);
530  muladd(a->d[1], b->d[4]);
531  muladd(a->d[2], b->d[3]);
532  muladd(a->d[3], b->d[2]);
533  muladd(a->d[4], b->d[1]);
534  muladd(a->d[5], b->d[0]);
535  extract(l[5]);
536  muladd(a->d[0], b->d[6]);
537  muladd(a->d[1], b->d[5]);
538  muladd(a->d[2], b->d[4]);
539  muladd(a->d[3], b->d[3]);
540  muladd(a->d[4], b->d[2]);
541  muladd(a->d[5], b->d[1]);
542  muladd(a->d[6], b->d[0]);
543  extract(l[6]);
544  muladd(a->d[0], b->d[7]);
545  muladd(a->d[1], b->d[6]);
546  muladd(a->d[2], b->d[5]);
547  muladd(a->d[3], b->d[4]);
548  muladd(a->d[4], b->d[3]);
549  muladd(a->d[5], b->d[2]);
550  muladd(a->d[6], b->d[1]);
551  muladd(a->d[7], b->d[0]);
552  extract(l[7]);
553  muladd(a->d[1], b->d[7]);
554  muladd(a->d[2], b->d[6]);
555  muladd(a->d[3], b->d[5]);
556  muladd(a->d[4], b->d[4]);
557  muladd(a->d[5], b->d[3]);
558  muladd(a->d[6], b->d[2]);
559  muladd(a->d[7], b->d[1]);
560  extract(l[8]);
561  muladd(a->d[2], b->d[7]);
562  muladd(a->d[3], b->d[6]);
563  muladd(a->d[4], b->d[5]);
564  muladd(a->d[5], b->d[4]);
565  muladd(a->d[6], b->d[3]);
566  muladd(a->d[7], b->d[2]);
567  extract(l[9]);
568  muladd(a->d[3], b->d[7]);
569  muladd(a->d[4], b->d[6]);
570  muladd(a->d[5], b->d[5]);
571  muladd(a->d[6], b->d[4]);
572  muladd(a->d[7], b->d[3]);
573  extract(l[10]);
574  muladd(a->d[4], b->d[7]);
575  muladd(a->d[5], b->d[6]);
576  muladd(a->d[6], b->d[5]);
577  muladd(a->d[7], b->d[4]);
578  extract(l[11]);
579  muladd(a->d[5], b->d[7]);
580  muladd(a->d[6], b->d[6]);
581  muladd(a->d[7], b->d[5]);
582  extract(l[12]);
583  muladd(a->d[6], b->d[7]);
584  muladd(a->d[7], b->d[6]);
585  extract(l[13]);
586  muladd_fast(a->d[7], b->d[7]);
587  extract_fast(l[14]);
588  VERIFY_CHECK(c1 == 0);
589  l[15] = c0;
590 }
591 
592 static void secp256k1_scalar_sqr_512(uint32_t *l, const secp256k1_scalar *a) {
593  /* 96 bit accumulator. */
594  uint32_t c0 = 0, c1 = 0, c2 = 0;
595 
596  /* l[0..15] = a[0..7]^2. */
597  muladd_fast(a->d[0], a->d[0]);
598  extract_fast(l[0]);
599  muladd2(a->d[0], a->d[1]);
600  extract(l[1]);
601  muladd2(a->d[0], a->d[2]);
602  muladd(a->d[1], a->d[1]);
603  extract(l[2]);
604  muladd2(a->d[0], a->d[3]);
605  muladd2(a->d[1], a->d[2]);
606  extract(l[3]);
607  muladd2(a->d[0], a->d[4]);
608  muladd2(a->d[1], a->d[3]);
609  muladd(a->d[2], a->d[2]);
610  extract(l[4]);
611  muladd2(a->d[0], a->d[5]);
612  muladd2(a->d[1], a->d[4]);
613  muladd2(a->d[2], a->d[3]);
614  extract(l[5]);
615  muladd2(a->d[0], a->d[6]);
616  muladd2(a->d[1], a->d[5]);
617  muladd2(a->d[2], a->d[4]);
618  muladd(a->d[3], a->d[3]);
619  extract(l[6]);
620  muladd2(a->d[0], a->d[7]);
621  muladd2(a->d[1], a->d[6]);
622  muladd2(a->d[2], a->d[5]);
623  muladd2(a->d[3], a->d[4]);
624  extract(l[7]);
625  muladd2(a->d[1], a->d[7]);
626  muladd2(a->d[2], a->d[6]);
627  muladd2(a->d[3], a->d[5]);
628  muladd(a->d[4], a->d[4]);
629  extract(l[8]);
630  muladd2(a->d[2], a->d[7]);
631  muladd2(a->d[3], a->d[6]);
632  muladd2(a->d[4], a->d[5]);
633  extract(l[9]);
634  muladd2(a->d[3], a->d[7]);
635  muladd2(a->d[4], a->d[6]);
636  muladd(a->d[5], a->d[5]);
637  extract(l[10]);
638  muladd2(a->d[4], a->d[7]);
639  muladd2(a->d[5], a->d[6]);
640  extract(l[11]);
641  muladd2(a->d[5], a->d[7]);
642  muladd(a->d[6], a->d[6]);
643  extract(l[12]);
644  muladd2(a->d[6], a->d[7]);
645  extract(l[13]);
646  muladd_fast(a->d[7], a->d[7]);
647  extract_fast(l[14]);
648  VERIFY_CHECK(c1 == 0);
649  l[15] = c0;
650 }
651 
652 #undef sumadd
653 #undef sumadd_fast
654 #undef muladd
655 #undef muladd_fast
656 #undef muladd2
657 #undef extract
658 #undef extract_fast
659 
660 static void secp256k1_scalar_mul(secp256k1_scalar *r, const secp256k1_scalar *a, const secp256k1_scalar *b) {
661  uint32_t l[16];
662  secp256k1_scalar_mul_512(l, a, b);
663  secp256k1_scalar_reduce_512(r, l);
664 }
665 
666 static int secp256k1_scalar_shr_int(secp256k1_scalar *r, int n) {
667  int ret;
668  VERIFY_CHECK(n > 0);
669  VERIFY_CHECK(n < 16);
670  ret = r->d[0] & ((1 << n) - 1);
671  r->d[0] = (r->d[0] >> n) + (r->d[1] << (32 - n));
672  r->d[1] = (r->d[1] >> n) + (r->d[2] << (32 - n));
673  r->d[2] = (r->d[2] >> n) + (r->d[3] << (32 - n));
674  r->d[3] = (r->d[3] >> n) + (r->d[4] << (32 - n));
675  r->d[4] = (r->d[4] >> n) + (r->d[5] << (32 - n));
676  r->d[5] = (r->d[5] >> n) + (r->d[6] << (32 - n));
677  r->d[6] = (r->d[6] >> n) + (r->d[7] << (32 - n));
678  r->d[7] = (r->d[7] >> n);
679  return ret;
680 }
681 
682 static void secp256k1_scalar_sqr(secp256k1_scalar *r, const secp256k1_scalar *a) {
683  uint32_t l[16];
684  secp256k1_scalar_sqr_512(l, a);
685  secp256k1_scalar_reduce_512(r, l);
686 }
687 
688 #ifdef USE_ENDOMORPHISM
689 static void secp256k1_scalar_split_128(secp256k1_scalar *r1, secp256k1_scalar *r2, const secp256k1_scalar *a) {
690  r1->d[0] = a->d[0];
691  r1->d[1] = a->d[1];
692  r1->d[2] = a->d[2];
693  r1->d[3] = a->d[3];
694  r1->d[4] = 0;
695  r1->d[5] = 0;
696  r1->d[6] = 0;
697  r1->d[7] = 0;
698  r2->d[0] = a->d[4];
699  r2->d[1] = a->d[5];
700  r2->d[2] = a->d[6];
701  r2->d[3] = a->d[7];
702  r2->d[4] = 0;
703  r2->d[5] = 0;
704  r2->d[6] = 0;
705  r2->d[7] = 0;
706 }
707 #endif
708 
709 SECP256K1_INLINE static int secp256k1_scalar_eq(const secp256k1_scalar *a, const secp256k1_scalar *b) {
710  return ((a->d[0] ^ b->d[0]) | (a->d[1] ^ b->d[1]) | (a->d[2] ^ b->d[2]) | (a->d[3] ^ b->d[3]) | (a->d[4] ^ b->d[4]) | (a->d[5] ^ b->d[5]) | (a->d[6] ^ b->d[6]) | (a->d[7] ^ b->d[7])) == 0;
711 }
712 
713 SECP256K1_INLINE static void secp256k1_scalar_mul_shift_var(secp256k1_scalar *r, const secp256k1_scalar *a, const secp256k1_scalar *b, unsigned int shift) {
714  uint32_t l[16];
715  unsigned int shiftlimbs;
716  unsigned int shiftlow;
717  unsigned int shifthigh;
718  VERIFY_CHECK(shift >= 256);
719  secp256k1_scalar_mul_512(l, a, b);
720  shiftlimbs = shift >> 5;
721  shiftlow = shift & 0x1F;
722  shifthigh = 32 - shiftlow;
723  r->d[0] = shift < 512 ? (l[0 + shiftlimbs] >> shiftlow | (shift < 480 && shiftlow ? (l[1 + shiftlimbs] << shifthigh) : 0)) : 0;
724  r->d[1] = shift < 480 ? (l[1 + shiftlimbs] >> shiftlow | (shift < 448 && shiftlow ? (l[2 + shiftlimbs] << shifthigh) : 0)) : 0;
725  r->d[2] = shift < 448 ? (l[2 + shiftlimbs] >> shiftlow | (shift < 416 && shiftlow ? (l[3 + shiftlimbs] << shifthigh) : 0)) : 0;
726  r->d[3] = shift < 416 ? (l[3 + shiftlimbs] >> shiftlow | (shift < 384 && shiftlow ? (l[4 + shiftlimbs] << shifthigh) : 0)) : 0;
727  r->d[4] = shift < 384 ? (l[4 + shiftlimbs] >> shiftlow | (shift < 352 && shiftlow ? (l[5 + shiftlimbs] << shifthigh) : 0)) : 0;
728  r->d[5] = shift < 352 ? (l[5 + shiftlimbs] >> shiftlow | (shift < 320 && shiftlow ? (l[6 + shiftlimbs] << shifthigh) : 0)) : 0;
729  r->d[6] = shift < 320 ? (l[6 + shiftlimbs] >> shiftlow | (shift < 288 && shiftlow ? (l[7 + shiftlimbs] << shifthigh) : 0)) : 0;
730  r->d[7] = shift < 288 ? (l[7 + shiftlimbs] >> shiftlow) : 0;
731  secp256k1_scalar_cadd_bit(r, 0, (l[(shift - 1) >> 5] >> ((shift - 1) & 0x1f)) & 1);
732 }
733 
734 #define ROTL32(x,n) ((x) << (n) | (x) >> (32-(n)))
735 #define QUARTERROUND(a,b,c,d) \
736  a += b; d = ROTL32(d ^ a, 16); \
737  c += d; b = ROTL32(b ^ c, 12); \
738  a += b; d = ROTL32(d ^ a, 8); \
739  c += d; b = ROTL32(b ^ c, 7);
740 
741 #ifdef WORDS_BIGENDIAN
742 #define LE32(p) ((((p) & 0xFF) << 24) | (((p) & 0xFF00) << 8) | (((p) & 0xFF0000) >> 8) | (((p) & 0xFF000000) >> 24))
743 #define BE32(p) (p)
744 #else
745 #define BE32(p) ((((p) & 0xFF) << 24) | (((p) & 0xFF00) << 8) | (((p) & 0xFF0000) >> 8) | (((p) & 0xFF000000) >> 24))
746 #define LE32(p) (p)
747 #endif
748 
749 static void secp256k1_scalar_chacha20(secp256k1_scalar *r1, secp256k1_scalar *r2, const unsigned char *seed, uint64_t idx) {
750  size_t n;
751  size_t over_count = 0;
752  uint32_t seed32[8];
753  uint32_t x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15;
754  int over1, over2;
755 
756  memcpy((void *) seed32, (const void *) seed, 32);
757  do {
758  x0 = 0x61707865;
759  x1 = 0x3320646e;
760  x2 = 0x79622d32;
761  x3 = 0x6b206574;
762  x4 = LE32(seed32[0]);
763  x5 = LE32(seed32[1]);
764  x6 = LE32(seed32[2]);
765  x7 = LE32(seed32[3]);
766  x8 = LE32(seed32[4]);
767  x9 = LE32(seed32[5]);
768  x10 = LE32(seed32[6]);
769  x11 = LE32(seed32[7]);
770  x12 = idx;
771  x13 = idx >> 32;
772  x14 = 0;
773  x15 = over_count;
774 
775  n = 10;
776  while (n--) {
777  QUARTERROUND(x0, x4, x8,x12)
778  QUARTERROUND(x1, x5, x9,x13)
779  QUARTERROUND(x2, x6,x10,x14)
780  QUARTERROUND(x3, x7,x11,x15)
781  QUARTERROUND(x0, x5,x10,x15)
782  QUARTERROUND(x1, x6,x11,x12)
783  QUARTERROUND(x2, x7, x8,x13)
784  QUARTERROUND(x3, x4, x9,x14)
785  }
786 
787  x0 += 0x61707865;
788  x1 += 0x3320646e;
789  x2 += 0x79622d32;
790  x3 += 0x6b206574;
791  x4 += LE32(seed32[0]);
792  x5 += LE32(seed32[1]);
793  x6 += LE32(seed32[2]);
794  x7 += LE32(seed32[3]);
795  x8 += LE32(seed32[4]);
796  x9 += LE32(seed32[5]);
797  x10 += LE32(seed32[6]);
798  x11 += LE32(seed32[7]);
799  x12 += idx;
800  x13 += idx >> 32;
801  x14 += 0;
802  x15 += over_count;
803 
804  r1->d[7] = BE32(x0);
805  r1->d[6] = BE32(x1);
806  r1->d[5] = BE32(x2);
807  r1->d[4] = BE32(x3);
808  r1->d[3] = BE32(x4);
809  r1->d[2] = BE32(x5);
810  r1->d[1] = BE32(x6);
811  r1->d[0] = BE32(x7);
812  r2->d[7] = BE32(x8);
813  r2->d[6] = BE32(x9);
814  r2->d[5] = BE32(x10);
815  r2->d[4] = BE32(x11);
816  r2->d[3] = BE32(x12);
817  r2->d[2] = BE32(x13);
818  r2->d[1] = BE32(x14);
819  r2->d[0] = BE32(x15);
820 
821  over1 = secp256k1_scalar_check_overflow(r1);
822  over2 = secp256k1_scalar_check_overflow(r2);
823  over_count++;
824  } while (over1 | over2);
825 }
826 
827 #undef ROTL32
828 #undef QUARTERROUND
829 #undef BE32
830 #undef LE32
831 
832 #endif /* SECP256K1_SCALAR_REPR_IMPL_H */
muladd
#define muladd(a, b)
Add a*b to the number defined by (c0,c1,c2).
Definition: scalar_8x32_impl.h:279
VERIFY_CHECK
#define VERIFY_CHECK(cond)
Definition: util.h:61
SECP256K1_N_C_2
#define SECP256K1_N_C_2
Definition: scalar_8x32_impl.h:25
SECP256K1_N_H_4
#define SECP256K1_N_H_4
Definition: scalar_8x32_impl.h:34
SECP256K1_N_H_1
#define SECP256K1_N_H_1
Definition: scalar_8x32_impl.h:31
b
void const uint64_t * b
Definition: field_5x52_asm_impl.h:10
QUARTERROUND
#define QUARTERROUND(a, b, c, d)
Definition: scalar_8x32_impl.h:735
SECP256K1_N_H_3
#define SECP256K1_N_H_3
Definition: scalar_8x32_impl.h:33
BE32
#define BE32(p)
Definition: scalar_8x32_impl.h:745
SECP256K1_N_H_2
#define SECP256K1_N_H_2
Definition: scalar_8x32_impl.h:32
memcpy
void * memcpy(void *a, const void *b, size_t c)
Definition: glibc_compat.cpp:15
SECP256K1_N_C_3
#define SECP256K1_N_C_3
Definition: scalar_8x32_impl.h:26
SECP256K1_N_0
#define SECP256K1_N_0
Definition: scalar_8x32_impl.h:13
r
void const uint64_t uint64_t * r
Definition: field_5x52_asm_impl.h:10
secp256k1_scalar
A scalar modulo the group order of the secp256k1 curve.
Definition: scalar_4x64.h:13
SECP256K1_N_H_0
#define SECP256K1_N_H_0
Definition: scalar_8x32_impl.h:30
SECP256K1_N_C_4
#define SECP256K1_N_C_4
Definition: scalar_8x32_impl.h:27
sumadd_fast
#define sumadd_fast(a)
Add a to the number defined by (c0,c1).
Definition: scalar_8x32_impl.h:339
muladd_fast
#define muladd_fast(a, b)
Add a*b to the number defined by (c0,c1).
Definition: scalar_8x32_impl.h:294
extract
#define extract(n)
Extract the lowest 32 bits of (c0,c1,c2) into n, and left shift the number 32 bits.
Definition: scalar_8x32_impl.h:347
SECP256K1_N_1
#define SECP256K1_N_1
Definition: scalar_8x32_impl.h:14
SECP256K1_N_H_6
#define SECP256K1_N_H_6
Definition: scalar_8x32_impl.h:36
SECP256K1_N_H_5
#define SECP256K1_N_H_5
Definition: scalar_8x32_impl.h:35
SECP256K1_N_7
#define SECP256K1_N_7
Definition: scalar_8x32_impl.h:20
extract_fast
#define extract_fast(n)
Extract the lowest 32 bits of (c0,c1,c2) into n, and left shift the number 32 bits.
Definition: scalar_8x32_impl.h:355
zxcvbn::no
const auto no
Definition: adjacency_graphs.cpp:17
muladd2
#define muladd2(a, b)
Add 2*a*b to the number defined by (c0,c1,c2).
Definition: scalar_8x32_impl.h:308
secp256k1_scalar::d
uint64_t d[4]
Definition: scalar_4x64.h:18
SECP256K1_N_C_0
#define SECP256K1_N_C_0
Definition: scalar_8x32_impl.h:23
LE32
#define LE32(p)
Definition: scalar_8x32_impl.h:746
SECP256K1_N_2
#define SECP256K1_N_2
Definition: scalar_8x32_impl.h:15
SECP256K1_N_C_1
#define SECP256K1_N_C_1
Definition: scalar_8x32_impl.h:24
SECP256K1_N_3
#define SECP256K1_N_3
Definition: scalar_8x32_impl.h:16
sumadd
#define sumadd(a)
Add a to the number defined by (c0,c1,c2).
Definition: scalar_8x32_impl.h:330
SECP256K1_N_H_7
#define SECP256K1_N_H_7
Definition: scalar_8x32_impl.h:37
SECP256K1_N_4
#define SECP256K1_N_4
Definition: scalar_8x32_impl.h:17
SECP256K1_INLINE
#define SECP256K1_INLINE
Definition: secp256k1.h:23
SECP256K1_N_6
#define SECP256K1_N_6
Definition: scalar_8x32_impl.h:19
SECP256K1_N_5
#define SECP256K1_N_5
Definition: scalar_8x32_impl.h:18