1 /* Autogenerated */
2 /* curve description: 25519 */
3 /* requested operations: carry_mul, carry_square, carry_scmul121666, carry, add, sub, opp, selectznz, to_bytes, from_bytes */
4 /* n = 10 (from "10") */
5 /* s = 0x8000000000000000000000000000000000000000000000000000000000000000 (from "2^255") */
6 /* c = [(1, 19)] (from "1,19") */
7 /* machine_wordsize = 32 (from "32") */
8
9 #include <stdint.h>
10
11 #ifndef UINT64_C
12 #define UINT64_C(x) x##ULL
13 #endif
14 #ifndef UINT32_C
15 #define UINT32_C(x) x##UL
16 #endif
17 #ifndef UINT8_C
18 #define UINT8_C(x) (x)
19 #endif
20
21 // fe means field element. Here the field is \Z/(2^255-19). An element t,
22 // entries t[0]...t[9], represents the integer t[0]+2^26 t[1]+2^51 t[2]+2^77
23 // t[3]+2^102 t[4]+...+2^230 t[9].
24 // fe limbs are bounded by 1.125*2^26,1.125*2^25,1.125*2^26,1.125*2^25,etc.
25 // Multiplication and carrying produce fe from fe_loose.
26 typedef struct fe { uint32_t v[10]; } fe;
27
28 // fe_loose limbs are bounded by 3.375*2^26,3.375*2^25,3.375*2^26,3.375*2^25,etc.
29 // Addition and subtraction produce fe_loose from (fe, fe).
30 typedef struct fe_loose { uint32_t v[10]; } fe_loose;
31
32 // ge means group element.
33 //
34 // Here the group is the set of pairs (x,y) of field elements (see fe.h)
35 // satisfying -x^2 + y^2 = 1 + d x^2y^2
36 // where d = -121665/121666.
37 //
38 // Representations:
39 // ge_p2 (projective): (X:Y:Z) satisfying x=X/Z, y=Y/Z
40 // ge_p3 (extended): (X:Y:Z:T) satisfying x=X/Z, y=Y/Z, XY=ZT
41 // ge_p1p1 (completed): ((X:Z),(Y:T)) satisfying x=X/Z, y=Y/T
42 // ge_precomp (Duif): (y+x,y-x,2dxy)
43
44 typedef struct {
45 fe X;
46 fe Y;
47 fe Z;
48 } ge_p2;
49
50 typedef struct {
51 fe X;
52 fe Y;
53 fe Z;
54 fe T;
55 } ge_p3;
56
57 typedef struct {
58 fe_loose X;
59 fe_loose Y;
60 fe_loose Z;
61 fe_loose T;
62 } ge_p1p1;
63
64 typedef struct {
65 fe_loose yplusx;
66 fe_loose yminusx;
67 fe_loose xy2d;
68 } ge_precomp;
69
70 typedef struct {
71 fe_loose YplusX;
72 fe_loose YminusX;
73 fe_loose Z;
74 fe_loose T2d;
75 } ge_cached;
76
77 typedef unsigned char fiat_25519_uint1;
78 typedef signed char fiat_25519_int1;
79
80 /*
81 * Input Bounds:
82 * arg1: [0x0 ~> 0x1]
83 * arg2: [0x0 ~> 0x3ffffff]
84 * arg3: [0x0 ~> 0x3ffffff]
85 * Output Bounds:
86 * out1: [0x0 ~> 0x3ffffff]
87 * out2: [0x0 ~> 0x1]
88 */
fiat_25519_addcarryx_u26(uint32_t * out1,fiat_25519_uint1 * out2,fiat_25519_uint1 arg1,uint32_t arg2,uint32_t arg3)89 static void fiat_25519_addcarryx_u26(uint32_t* out1, fiat_25519_uint1* out2, fiat_25519_uint1 arg1, uint32_t arg2, uint32_t arg3) {
90 uint32_t x1 = ((arg1 + arg2) + arg3);
91 uint32_t x2 = (x1 & UINT32_C(0x3ffffff));
92 fiat_25519_uint1 x3 = (fiat_25519_uint1)(x1 >> 26);
93 *out1 = x2;
94 *out2 = x3;
95 }
96
97 /*
98 * Input Bounds:
99 * arg1: [0x0 ~> 0x1]
100 * arg2: [0x0 ~> 0x3ffffff]
101 * arg3: [0x0 ~> 0x3ffffff]
102 * Output Bounds:
103 * out1: [0x0 ~> 0x3ffffff]
104 * out2: [0x0 ~> 0x1]
105 */
fiat_25519_subborrowx_u26(uint32_t * out1,fiat_25519_uint1 * out2,fiat_25519_uint1 arg1,uint32_t arg2,uint32_t arg3)106 static void fiat_25519_subborrowx_u26(uint32_t* out1, fiat_25519_uint1* out2, fiat_25519_uint1 arg1, uint32_t arg2, uint32_t arg3) {
107 int32_t x1 = ((int32_t)(arg2 - arg1) - (int32_t)arg3);
108 fiat_25519_int1 x2 = (fiat_25519_int1)(x1 >> 26);
109 uint32_t x3 = (x1 & UINT32_C(0x3ffffff));
110 *out1 = x3;
111 *out2 = (fiat_25519_uint1)(0x0 - x2);
112 }
113
114 /*
115 * Input Bounds:
116 * arg1: [0x0 ~> 0x1]
117 * arg2: [0x0 ~> 0x1ffffff]
118 * arg3: [0x0 ~> 0x1ffffff]
119 * Output Bounds:
120 * out1: [0x0 ~> 0x1ffffff]
121 * out2: [0x0 ~> 0x1]
122 */
fiat_25519_addcarryx_u25(uint32_t * out1,fiat_25519_uint1 * out2,fiat_25519_uint1 arg1,uint32_t arg2,uint32_t arg3)123 static void fiat_25519_addcarryx_u25(uint32_t* out1, fiat_25519_uint1* out2, fiat_25519_uint1 arg1, uint32_t arg2, uint32_t arg3) {
124 uint32_t x1 = ((arg1 + arg2) + arg3);
125 uint32_t x2 = (x1 & UINT32_C(0x1ffffff));
126 fiat_25519_uint1 x3 = (fiat_25519_uint1)(x1 >> 25);
127 *out1 = x2;
128 *out2 = x3;
129 }
130
131 /*
132 * Input Bounds:
133 * arg1: [0x0 ~> 0x1]
134 * arg2: [0x0 ~> 0x1ffffff]
135 * arg3: [0x0 ~> 0x1ffffff]
136 * Output Bounds:
137 * out1: [0x0 ~> 0x1ffffff]
138 * out2: [0x0 ~> 0x1]
139 */
fiat_25519_subborrowx_u25(uint32_t * out1,fiat_25519_uint1 * out2,fiat_25519_uint1 arg1,uint32_t arg2,uint32_t arg3)140 static void fiat_25519_subborrowx_u25(uint32_t* out1, fiat_25519_uint1* out2, fiat_25519_uint1 arg1, uint32_t arg2, uint32_t arg3) {
141 int32_t x1 = ((int32_t)(arg2 - arg1) - (int32_t)arg3);
142 fiat_25519_int1 x2 = (fiat_25519_int1)(x1 >> 25);
143 uint32_t x3 = (x1 & UINT32_C(0x1ffffff));
144 *out1 = x3;
145 *out2 = (fiat_25519_uint1)(0x0 - x2);
146 }
147
148 // value_barrier_u32 returns |a|, but prevents GCC and Clang from reasoning about
149 // the returned value. This is used to mitigate compilers undoing constant-time
150 // code, until we can express our requirements directly in the language.
151 //
152 // Note the compiler is aware that |value_barrier_u32| has no side effects and
153 // always has the same output for a given input. This allows it to eliminate
154 // dead code, move computations across loops, and vectorize.
value_barrier_u32(uint32_t a)155 static inline uint32_t value_barrier_u32(uint32_t a) {
156 #if !defined(OPENSSL_NO_ASM) && (defined(__GNUC__) || defined(__clang__))
157 __asm__("" : "+r"(a) : /* no inputs */);
158 #endif
159 return a;
160 }
161
162 /*
163 * Input Bounds:
164 * arg1: [0x0 ~> 0x1]
165 * arg2: [0x0 ~> 0xffffffff]
166 * arg3: [0x0 ~> 0xffffffff]
167 * Output Bounds:
168 * out1: [0x0 ~> 0xffffffff]
169 */
fiat_25519_cmovznz_u32(uint32_t * out1,fiat_25519_uint1 arg1,uint32_t arg2,uint32_t arg3)170 static void fiat_25519_cmovznz_u32(uint32_t* out1, fiat_25519_uint1 arg1, uint32_t arg2, uint32_t arg3) {
171 fiat_25519_uint1 x1 = (!(!arg1));
172 uint32_t x2 = ((fiat_25519_int1)(0x0 - x1) & UINT32_C(0xffffffff));
173 // Note this line has been patched from the synthesized code to add value
174 // barriers.
175 //
176 // Clang recognizes this pattern as a select. While it usually transforms it
177 // to a cmov, it sometimes further transforms it into a branch, which we do
178 // not want.
179 uint32_t x3 = ((value_barrier_u32(x2) & arg3) | (value_barrier_u32(~x2) & arg2));
180 *out1 = x3;
181 }
182
183 /*
184 * Input Bounds:
185 * arg1: [[0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999]]
186 * arg2: [[0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999]]
187 * Output Bounds:
188 * out1: [[0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333]]
189 */
fiat_25519_carry_mul(uint32_t out1[10],const uint32_t arg1[10],const uint32_t arg2[10])190 static void fiat_25519_carry_mul(uint32_t out1[10], const uint32_t arg1[10], const uint32_t arg2[10]) {
191 uint64_t x1 = ((uint64_t)(arg1[9]) * ((arg2[9]) * ((uint32_t)0x2 * UINT8_C(0x13))));
192 uint64_t x2 = ((uint64_t)(arg1[9]) * ((arg2[8]) * (uint32_t)UINT8_C(0x13)));
193 uint64_t x3 = ((uint64_t)(arg1[9]) * ((arg2[7]) * ((uint32_t)0x2 * UINT8_C(0x13))));
194 uint64_t x4 = ((uint64_t)(arg1[9]) * ((arg2[6]) * (uint32_t)UINT8_C(0x13)));
195 uint64_t x5 = ((uint64_t)(arg1[9]) * ((arg2[5]) * ((uint32_t)0x2 * UINT8_C(0x13))));
196 uint64_t x6 = ((uint64_t)(arg1[9]) * ((arg2[4]) * (uint32_t)UINT8_C(0x13)));
197 uint64_t x7 = ((uint64_t)(arg1[9]) * ((arg2[3]) * ((uint32_t)0x2 * UINT8_C(0x13))));
198 uint64_t x8 = ((uint64_t)(arg1[9]) * ((arg2[2]) * (uint32_t)UINT8_C(0x13)));
199 uint64_t x9 = ((uint64_t)(arg1[9]) * ((arg2[1]) * ((uint32_t)0x2 * UINT8_C(0x13))));
200 uint64_t x10 = ((uint64_t)(arg1[8]) * ((arg2[9]) * (uint32_t)UINT8_C(0x13)));
201 uint64_t x11 = ((uint64_t)(arg1[8]) * ((arg2[8]) * (uint32_t)UINT8_C(0x13)));
202 uint64_t x12 = ((uint64_t)(arg1[8]) * ((arg2[7]) * (uint32_t)UINT8_C(0x13)));
203 uint64_t x13 = ((uint64_t)(arg1[8]) * ((arg2[6]) * (uint32_t)UINT8_C(0x13)));
204 uint64_t x14 = ((uint64_t)(arg1[8]) * ((arg2[5]) * (uint32_t)UINT8_C(0x13)));
205 uint64_t x15 = ((uint64_t)(arg1[8]) * ((arg2[4]) * (uint32_t)UINT8_C(0x13)));
206 uint64_t x16 = ((uint64_t)(arg1[8]) * ((arg2[3]) * (uint32_t)UINT8_C(0x13)));
207 uint64_t x17 = ((uint64_t)(arg1[8]) * ((arg2[2]) * (uint32_t)UINT8_C(0x13)));
208 uint64_t x18 = ((uint64_t)(arg1[7]) * ((arg2[9]) * ((uint32_t)0x2 * UINT8_C(0x13))));
209 uint64_t x19 = ((uint64_t)(arg1[7]) * ((arg2[8]) * (uint32_t)UINT8_C(0x13)));
210 uint64_t x20 = ((uint64_t)(arg1[7]) * ((arg2[7]) * ((uint32_t)0x2 * UINT8_C(0x13))));
211 uint64_t x21 = ((uint64_t)(arg1[7]) * ((arg2[6]) * (uint32_t)UINT8_C(0x13)));
212 uint64_t x22 = ((uint64_t)(arg1[7]) * ((arg2[5]) * ((uint32_t)0x2 * UINT8_C(0x13))));
213 uint64_t x23 = ((uint64_t)(arg1[7]) * ((arg2[4]) * (uint32_t)UINT8_C(0x13)));
214 uint64_t x24 = ((uint64_t)(arg1[7]) * ((arg2[3]) * ((uint32_t)0x2 * UINT8_C(0x13))));
215 uint64_t x25 = ((uint64_t)(arg1[6]) * ((arg2[9]) * (uint32_t)UINT8_C(0x13)));
216 uint64_t x26 = ((uint64_t)(arg1[6]) * ((arg2[8]) * (uint32_t)UINT8_C(0x13)));
217 uint64_t x27 = ((uint64_t)(arg1[6]) * ((arg2[7]) * (uint32_t)UINT8_C(0x13)));
218 uint64_t x28 = ((uint64_t)(arg1[6]) * ((arg2[6]) * (uint32_t)UINT8_C(0x13)));
219 uint64_t x29 = ((uint64_t)(arg1[6]) * ((arg2[5]) * (uint32_t)UINT8_C(0x13)));
220 uint64_t x30 = ((uint64_t)(arg1[6]) * ((arg2[4]) * (uint32_t)UINT8_C(0x13)));
221 uint64_t x31 = ((uint64_t)(arg1[5]) * ((arg2[9]) * ((uint32_t)0x2 * UINT8_C(0x13))));
222 uint64_t x32 = ((uint64_t)(arg1[5]) * ((arg2[8]) * (uint32_t)UINT8_C(0x13)));
223 uint64_t x33 = ((uint64_t)(arg1[5]) * ((arg2[7]) * ((uint32_t)0x2 * UINT8_C(0x13))));
224 uint64_t x34 = ((uint64_t)(arg1[5]) * ((arg2[6]) * (uint32_t)UINT8_C(0x13)));
225 uint64_t x35 = ((uint64_t)(arg1[5]) * ((arg2[5]) * ((uint32_t)0x2 * UINT8_C(0x13))));
226 uint64_t x36 = ((uint64_t)(arg1[4]) * ((arg2[9]) * (uint32_t)UINT8_C(0x13)));
227 uint64_t x37 = ((uint64_t)(arg1[4]) * ((arg2[8]) * (uint32_t)UINT8_C(0x13)));
228 uint64_t x38 = ((uint64_t)(arg1[4]) * ((arg2[7]) * (uint32_t)UINT8_C(0x13)));
229 uint64_t x39 = ((uint64_t)(arg1[4]) * ((arg2[6]) * (uint32_t)UINT8_C(0x13)));
230 uint64_t x40 = ((uint64_t)(arg1[3]) * ((arg2[9]) * ((uint32_t)0x2 * UINT8_C(0x13))));
231 uint64_t x41 = ((uint64_t)(arg1[3]) * ((arg2[8]) * (uint32_t)UINT8_C(0x13)));
232 uint64_t x42 = ((uint64_t)(arg1[3]) * ((arg2[7]) * ((uint32_t)0x2 * UINT8_C(0x13))));
233 uint64_t x43 = ((uint64_t)(arg1[2]) * ((arg2[9]) * (uint32_t)UINT8_C(0x13)));
234 uint64_t x44 = ((uint64_t)(arg1[2]) * ((arg2[8]) * (uint32_t)UINT8_C(0x13)));
235 uint64_t x45 = ((uint64_t)(arg1[1]) * ((arg2[9]) * ((uint32_t)0x2 * UINT8_C(0x13))));
236 uint64_t x46 = ((uint64_t)(arg1[9]) * (arg2[0]));
237 uint64_t x47 = ((uint64_t)(arg1[8]) * (arg2[1]));
238 uint64_t x48 = ((uint64_t)(arg1[8]) * (arg2[0]));
239 uint64_t x49 = ((uint64_t)(arg1[7]) * (arg2[2]));
240 uint64_t x50 = ((uint64_t)(arg1[7]) * ((arg2[1]) * (uint32_t)0x2));
241 uint64_t x51 = ((uint64_t)(arg1[7]) * (arg2[0]));
242 uint64_t x52 = ((uint64_t)(arg1[6]) * (arg2[3]));
243 uint64_t x53 = ((uint64_t)(arg1[6]) * (arg2[2]));
244 uint64_t x54 = ((uint64_t)(arg1[6]) * (arg2[1]));
245 uint64_t x55 = ((uint64_t)(arg1[6]) * (arg2[0]));
246 uint64_t x56 = ((uint64_t)(arg1[5]) * (arg2[4]));
247 uint64_t x57 = ((uint64_t)(arg1[5]) * ((arg2[3]) * (uint32_t)0x2));
248 uint64_t x58 = ((uint64_t)(arg1[5]) * (arg2[2]));
249 uint64_t x59 = ((uint64_t)(arg1[5]) * ((arg2[1]) * (uint32_t)0x2));
250 uint64_t x60 = ((uint64_t)(arg1[5]) * (arg2[0]));
251 uint64_t x61 = ((uint64_t)(arg1[4]) * (arg2[5]));
252 uint64_t x62 = ((uint64_t)(arg1[4]) * (arg2[4]));
253 uint64_t x63 = ((uint64_t)(arg1[4]) * (arg2[3]));
254 uint64_t x64 = ((uint64_t)(arg1[4]) * (arg2[2]));
255 uint64_t x65 = ((uint64_t)(arg1[4]) * (arg2[1]));
256 uint64_t x66 = ((uint64_t)(arg1[4]) * (arg2[0]));
257 uint64_t x67 = ((uint64_t)(arg1[3]) * (arg2[6]));
258 uint64_t x68 = ((uint64_t)(arg1[3]) * ((arg2[5]) * (uint32_t)0x2));
259 uint64_t x69 = ((uint64_t)(arg1[3]) * (arg2[4]));
260 uint64_t x70 = ((uint64_t)(arg1[3]) * ((arg2[3]) * (uint32_t)0x2));
261 uint64_t x71 = ((uint64_t)(arg1[3]) * (arg2[2]));
262 uint64_t x72 = ((uint64_t)(arg1[3]) * ((arg2[1]) * (uint32_t)0x2));
263 uint64_t x73 = ((uint64_t)(arg1[3]) * (arg2[0]));
264 uint64_t x74 = ((uint64_t)(arg1[2]) * (arg2[7]));
265 uint64_t x75 = ((uint64_t)(arg1[2]) * (arg2[6]));
266 uint64_t x76 = ((uint64_t)(arg1[2]) * (arg2[5]));
267 uint64_t x77 = ((uint64_t)(arg1[2]) * (arg2[4]));
268 uint64_t x78 = ((uint64_t)(arg1[2]) * (arg2[3]));
269 uint64_t x79 = ((uint64_t)(arg1[2]) * (arg2[2]));
270 uint64_t x80 = ((uint64_t)(arg1[2]) * (arg2[1]));
271 uint64_t x81 = ((uint64_t)(arg1[2]) * (arg2[0]));
272 uint64_t x82 = ((uint64_t)(arg1[1]) * (arg2[8]));
273 uint64_t x83 = ((uint64_t)(arg1[1]) * ((arg2[7]) * (uint32_t)0x2));
274 uint64_t x84 = ((uint64_t)(arg1[1]) * (arg2[6]));
275 uint64_t x85 = ((uint64_t)(arg1[1]) * ((arg2[5]) * (uint32_t)0x2));
276 uint64_t x86 = ((uint64_t)(arg1[1]) * (arg2[4]));
277 uint64_t x87 = ((uint64_t)(arg1[1]) * ((arg2[3]) * (uint32_t)0x2));
278 uint64_t x88 = ((uint64_t)(arg1[1]) * (arg2[2]));
279 uint64_t x89 = ((uint64_t)(arg1[1]) * ((arg2[1]) * (uint32_t)0x2));
280 uint64_t x90 = ((uint64_t)(arg1[1]) * (arg2[0]));
281 uint64_t x91 = ((uint64_t)(arg1[0]) * (arg2[9]));
282 uint64_t x92 = ((uint64_t)(arg1[0]) * (arg2[8]));
283 uint64_t x93 = ((uint64_t)(arg1[0]) * (arg2[7]));
284 uint64_t x94 = ((uint64_t)(arg1[0]) * (arg2[6]));
285 uint64_t x95 = ((uint64_t)(arg1[0]) * (arg2[5]));
286 uint64_t x96 = ((uint64_t)(arg1[0]) * (arg2[4]));
287 uint64_t x97 = ((uint64_t)(arg1[0]) * (arg2[3]));
288 uint64_t x98 = ((uint64_t)(arg1[0]) * (arg2[2]));
289 uint64_t x99 = ((uint64_t)(arg1[0]) * (arg2[1]));
290 uint64_t x100 = ((uint64_t)(arg1[0]) * (arg2[0]));
291 uint64_t x101 = (x100 + (x45 + (x44 + (x42 + (x39 + (x35 + (x30 + (x24 + (x17 + x9)))))))));
292 uint64_t x102 = (x101 >> 26);
293 uint32_t x103 = (uint32_t)(x101 & UINT32_C(0x3ffffff));
294 uint64_t x104 = (x91 + (x82 + (x74 + (x67 + (x61 + (x56 + (x52 + (x49 + (x47 + x46)))))))));
295 uint64_t x105 = (x92 + (x83 + (x75 + (x68 + (x62 + (x57 + (x53 + (x50 + (x48 + x1)))))))));
296 uint64_t x106 = (x93 + (x84 + (x76 + (x69 + (x63 + (x58 + (x54 + (x51 + (x10 + x2)))))))));
297 uint64_t x107 = (x94 + (x85 + (x77 + (x70 + (x64 + (x59 + (x55 + (x18 + (x11 + x3)))))))));
298 uint64_t x108 = (x95 + (x86 + (x78 + (x71 + (x65 + (x60 + (x25 + (x19 + (x12 + x4)))))))));
299 uint64_t x109 = (x96 + (x87 + (x79 + (x72 + (x66 + (x31 + (x26 + (x20 + (x13 + x5)))))))));
300 uint64_t x110 = (x97 + (x88 + (x80 + (x73 + (x36 + (x32 + (x27 + (x21 + (x14 + x6)))))))));
301 uint64_t x111 = (x98 + (x89 + (x81 + (x40 + (x37 + (x33 + (x28 + (x22 + (x15 + x7)))))))));
302 uint64_t x112 = (x99 + (x90 + (x43 + (x41 + (x38 + (x34 + (x29 + (x23 + (x16 + x8)))))))));
303 uint64_t x113 = (x102 + x112);
304 uint64_t x114 = (x113 >> 25);
305 uint32_t x115 = (uint32_t)(x113 & UINT32_C(0x1ffffff));
306 uint64_t x116 = (x114 + x111);
307 uint64_t x117 = (x116 >> 26);
308 uint32_t x118 = (uint32_t)(x116 & UINT32_C(0x3ffffff));
309 uint64_t x119 = (x117 + x110);
310 uint64_t x120 = (x119 >> 25);
311 uint32_t x121 = (uint32_t)(x119 & UINT32_C(0x1ffffff));
312 uint64_t x122 = (x120 + x109);
313 uint64_t x123 = (x122 >> 26);
314 uint32_t x124 = (uint32_t)(x122 & UINT32_C(0x3ffffff));
315 uint64_t x125 = (x123 + x108);
316 uint64_t x126 = (x125 >> 25);
317 uint32_t x127 = (uint32_t)(x125 & UINT32_C(0x1ffffff));
318 uint64_t x128 = (x126 + x107);
319 uint64_t x129 = (x128 >> 26);
320 uint32_t x130 = (uint32_t)(x128 & UINT32_C(0x3ffffff));
321 uint64_t x131 = (x129 + x106);
322 uint64_t x132 = (x131 >> 25);
323 uint32_t x133 = (uint32_t)(x131 & UINT32_C(0x1ffffff));
324 uint64_t x134 = (x132 + x105);
325 uint64_t x135 = (x134 >> 26);
326 uint32_t x136 = (uint32_t)(x134 & UINT32_C(0x3ffffff));
327 uint64_t x137 = (x135 + x104);
328 uint64_t x138 = (x137 >> 25);
329 uint32_t x139 = (uint32_t)(x137 & UINT32_C(0x1ffffff));
330 uint64_t x140 = (x138 * (uint64_t)UINT8_C(0x13));
331 uint64_t x141 = (x103 + x140);
332 uint32_t x142 = (uint32_t)(x141 >> 26);
333 uint32_t x143 = (uint32_t)(x141 & UINT32_C(0x3ffffff));
334 uint32_t x144 = (x142 + x115);
335 uint32_t x145 = (x144 >> 25);
336 uint32_t x146 = (x144 & UINT32_C(0x1ffffff));
337 uint32_t x147 = (x145 + x118);
338 out1[0] = x143;
339 out1[1] = x146;
340 out1[2] = x147;
341 out1[3] = x121;
342 out1[4] = x124;
343 out1[5] = x127;
344 out1[6] = x130;
345 out1[7] = x133;
346 out1[8] = x136;
347 out1[9] = x139;
348 }
349
350 /*
351 * Input Bounds:
352 * arg1: [[0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999]]
353 * Output Bounds:
354 * out1: [[0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333]]
355 */
fiat_25519_carry_square(uint32_t out1[10],const uint32_t arg1[10])356 static void fiat_25519_carry_square(uint32_t out1[10], const uint32_t arg1[10]) {
357 uint32_t x1 = ((arg1[9]) * (uint32_t)UINT8_C(0x13));
358 uint32_t x2 = (x1 * (uint32_t)0x2);
359 uint32_t x3 = ((arg1[9]) * (uint32_t)0x2);
360 uint32_t x4 = ((arg1[8]) * (uint32_t)UINT8_C(0x13));
361 uint64_t x5 = (x4 * (uint64_t)0x2);
362 uint32_t x6 = ((arg1[8]) * (uint32_t)0x2);
363 uint32_t x7 = ((arg1[7]) * (uint32_t)UINT8_C(0x13));
364 uint32_t x8 = (x7 * (uint32_t)0x2);
365 uint32_t x9 = ((arg1[7]) * (uint32_t)0x2);
366 uint32_t x10 = ((arg1[6]) * (uint32_t)UINT8_C(0x13));
367 uint64_t x11 = (x10 * (uint64_t)0x2);
368 uint32_t x12 = ((arg1[6]) * (uint32_t)0x2);
369 uint32_t x13 = ((arg1[5]) * (uint32_t)UINT8_C(0x13));
370 uint32_t x14 = ((arg1[5]) * (uint32_t)0x2);
371 uint32_t x15 = ((arg1[4]) * (uint32_t)0x2);
372 uint32_t x16 = ((arg1[3]) * (uint32_t)0x2);
373 uint32_t x17 = ((arg1[2]) * (uint32_t)0x2);
374 uint32_t x18 = ((arg1[1]) * (uint32_t)0x2);
375 uint64_t x19 = ((uint64_t)(arg1[9]) * (x1 * (uint32_t)0x2));
376 uint64_t x20 = ((uint64_t)(arg1[8]) * x2);
377 uint64_t x21 = ((uint64_t)(arg1[8]) * x4);
378 uint64_t x22 = ((arg1[7]) * (x2 * (uint64_t)0x2));
379 uint64_t x23 = ((arg1[7]) * x5);
380 uint64_t x24 = ((uint64_t)(arg1[7]) * (x7 * (uint32_t)0x2));
381 uint64_t x25 = ((uint64_t)(arg1[6]) * x2);
382 uint64_t x26 = ((arg1[6]) * x5);
383 uint64_t x27 = ((uint64_t)(arg1[6]) * x8);
384 uint64_t x28 = ((uint64_t)(arg1[6]) * x10);
385 uint64_t x29 = ((arg1[5]) * (x2 * (uint64_t)0x2));
386 uint64_t x30 = ((arg1[5]) * x5);
387 uint64_t x31 = ((arg1[5]) * (x8 * (uint64_t)0x2));
388 uint64_t x32 = ((arg1[5]) * x11);
389 uint64_t x33 = ((uint64_t)(arg1[5]) * (x13 * (uint32_t)0x2));
390 uint64_t x34 = ((uint64_t)(arg1[4]) * x2);
391 uint64_t x35 = ((arg1[4]) * x5);
392 uint64_t x36 = ((uint64_t)(arg1[4]) * x8);
393 uint64_t x37 = ((arg1[4]) * x11);
394 uint64_t x38 = ((uint64_t)(arg1[4]) * x14);
395 uint64_t x39 = ((uint64_t)(arg1[4]) * (arg1[4]));
396 uint64_t x40 = ((arg1[3]) * (x2 * (uint64_t)0x2));
397 uint64_t x41 = ((arg1[3]) * x5);
398 uint64_t x42 = ((arg1[3]) * (x8 * (uint64_t)0x2));
399 uint64_t x43 = ((uint64_t)(arg1[3]) * x12);
400 uint64_t x44 = ((uint64_t)(arg1[3]) * (x14 * (uint32_t)0x2));
401 uint64_t x45 = ((uint64_t)(arg1[3]) * x15);
402 uint64_t x46 = ((uint64_t)(arg1[3]) * ((arg1[3]) * (uint32_t)0x2));
403 uint64_t x47 = ((uint64_t)(arg1[2]) * x2);
404 uint64_t x48 = ((arg1[2]) * x5);
405 uint64_t x49 = ((uint64_t)(arg1[2]) * x9);
406 uint64_t x50 = ((uint64_t)(arg1[2]) * x12);
407 uint64_t x51 = ((uint64_t)(arg1[2]) * x14);
408 uint64_t x52 = ((uint64_t)(arg1[2]) * x15);
409 uint64_t x53 = ((uint64_t)(arg1[2]) * x16);
410 uint64_t x54 = ((uint64_t)(arg1[2]) * (arg1[2]));
411 uint64_t x55 = ((arg1[1]) * (x2 * (uint64_t)0x2));
412 uint64_t x56 = ((uint64_t)(arg1[1]) * x6);
413 uint64_t x57 = ((uint64_t)(arg1[1]) * (x9 * (uint32_t)0x2));
414 uint64_t x58 = ((uint64_t)(arg1[1]) * x12);
415 uint64_t x59 = ((uint64_t)(arg1[1]) * (x14 * (uint32_t)0x2));
416 uint64_t x60 = ((uint64_t)(arg1[1]) * x15);
417 uint64_t x61 = ((uint64_t)(arg1[1]) * (x16 * (uint32_t)0x2));
418 uint64_t x62 = ((uint64_t)(arg1[1]) * x17);
419 uint64_t x63 = ((uint64_t)(arg1[1]) * ((arg1[1]) * (uint32_t)0x2));
420 uint64_t x64 = ((uint64_t)(arg1[0]) * x3);
421 uint64_t x65 = ((uint64_t)(arg1[0]) * x6);
422 uint64_t x66 = ((uint64_t)(arg1[0]) * x9);
423 uint64_t x67 = ((uint64_t)(arg1[0]) * x12);
424 uint64_t x68 = ((uint64_t)(arg1[0]) * x14);
425 uint64_t x69 = ((uint64_t)(arg1[0]) * x15);
426 uint64_t x70 = ((uint64_t)(arg1[0]) * x16);
427 uint64_t x71 = ((uint64_t)(arg1[0]) * x17);
428 uint64_t x72 = ((uint64_t)(arg1[0]) * x18);
429 uint64_t x73 = ((uint64_t)(arg1[0]) * (arg1[0]));
430 uint64_t x74 = (x73 + (x55 + (x48 + (x42 + (x37 + x33)))));
431 uint64_t x75 = (x74 >> 26);
432 uint32_t x76 = (uint32_t)(x74 & UINT32_C(0x3ffffff));
433 uint64_t x77 = (x64 + (x56 + (x49 + (x43 + x38))));
434 uint64_t x78 = (x65 + (x57 + (x50 + (x44 + (x39 + x19)))));
435 uint64_t x79 = (x66 + (x58 + (x51 + (x45 + x20))));
436 uint64_t x80 = (x67 + (x59 + (x52 + (x46 + (x22 + x21)))));
437 uint64_t x81 = (x68 + (x60 + (x53 + (x25 + x23))));
438 uint64_t x82 = (x69 + (x61 + (x54 + (x29 + (x26 + x24)))));
439 uint64_t x83 = (x70 + (x62 + (x34 + (x30 + x27))));
440 uint64_t x84 = (x71 + (x63 + (x40 + (x35 + (x31 + x28)))));
441 uint64_t x85 = (x72 + (x47 + (x41 + (x36 + x32))));
442 uint64_t x86 = (x75 + x85);
443 uint64_t x87 = (x86 >> 25);
444 uint32_t x88 = (uint32_t)(x86 & UINT32_C(0x1ffffff));
445 uint64_t x89 = (x87 + x84);
446 uint64_t x90 = (x89 >> 26);
447 uint32_t x91 = (uint32_t)(x89 & UINT32_C(0x3ffffff));
448 uint64_t x92 = (x90 + x83);
449 uint64_t x93 = (x92 >> 25);
450 uint32_t x94 = (uint32_t)(x92 & UINT32_C(0x1ffffff));
451 uint64_t x95 = (x93 + x82);
452 uint64_t x96 = (x95 >> 26);
453 uint32_t x97 = (uint32_t)(x95 & UINT32_C(0x3ffffff));
454 uint64_t x98 = (x96 + x81);
455 uint64_t x99 = (x98 >> 25);
456 uint32_t x100 = (uint32_t)(x98 & UINT32_C(0x1ffffff));
457 uint64_t x101 = (x99 + x80);
458 uint64_t x102 = (x101 >> 26);
459 uint32_t x103 = (uint32_t)(x101 & UINT32_C(0x3ffffff));
460 uint64_t x104 = (x102 + x79);
461 uint64_t x105 = (x104 >> 25);
462 uint32_t x106 = (uint32_t)(x104 & UINT32_C(0x1ffffff));
463 uint64_t x107 = (x105 + x78);
464 uint64_t x108 = (x107 >> 26);
465 uint32_t x109 = (uint32_t)(x107 & UINT32_C(0x3ffffff));
466 uint64_t x110 = (x108 + x77);
467 uint64_t x111 = (x110 >> 25);
468 uint32_t x112 = (uint32_t)(x110 & UINT32_C(0x1ffffff));
469 uint64_t x113 = (x111 * (uint64_t)UINT8_C(0x13));
470 uint64_t x114 = (x76 + x113);
471 uint32_t x115 = (uint32_t)(x114 >> 26);
472 uint32_t x116 = (uint32_t)(x114 & UINT32_C(0x3ffffff));
473 uint32_t x117 = (x115 + x88);
474 uint32_t x118 = (x117 >> 25);
475 uint32_t x119 = (x117 & UINT32_C(0x1ffffff));
476 uint32_t x120 = (x118 + x91);
477 out1[0] = x116;
478 out1[1] = x119;
479 out1[2] = x120;
480 out1[3] = x94;
481 out1[4] = x97;
482 out1[5] = x100;
483 out1[6] = x103;
484 out1[7] = x106;
485 out1[8] = x109;
486 out1[9] = x112;
487 }
488
489 /*
490 * Input Bounds:
491 * arg1: [[0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999]]
492 * Output Bounds:
493 * out1: [[0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333]]
494 */
fiat_25519_carry(uint32_t out1[10],const uint32_t arg1[10])495 static void fiat_25519_carry(uint32_t out1[10], const uint32_t arg1[10]) {
496 uint32_t x1 = (arg1[0]);
497 uint32_t x2 = ((x1 >> 26) + (arg1[1]));
498 uint32_t x3 = ((x2 >> 25) + (arg1[2]));
499 uint32_t x4 = ((x3 >> 26) + (arg1[3]));
500 uint32_t x5 = ((x4 >> 25) + (arg1[4]));
501 uint32_t x6 = ((x5 >> 26) + (arg1[5]));
502 uint32_t x7 = ((x6 >> 25) + (arg1[6]));
503 uint32_t x8 = ((x7 >> 26) + (arg1[7]));
504 uint32_t x9 = ((x8 >> 25) + (arg1[8]));
505 uint32_t x10 = ((x9 >> 26) + (arg1[9]));
506 uint32_t x11 = ((x1 & UINT32_C(0x3ffffff)) + ((x10 >> 25) * (uint32_t)UINT8_C(0x13)));
507 uint32_t x12 = ((x11 >> 26) + (x2 & UINT32_C(0x1ffffff)));
508 uint32_t x13 = (x11 & UINT32_C(0x3ffffff));
509 uint32_t x14 = (x12 & UINT32_C(0x1ffffff));
510 uint32_t x15 = ((x12 >> 25) + (x3 & UINT32_C(0x3ffffff)));
511 uint32_t x16 = (x4 & UINT32_C(0x1ffffff));
512 uint32_t x17 = (x5 & UINT32_C(0x3ffffff));
513 uint32_t x18 = (x6 & UINT32_C(0x1ffffff));
514 uint32_t x19 = (x7 & UINT32_C(0x3ffffff));
515 uint32_t x20 = (x8 & UINT32_C(0x1ffffff));
516 uint32_t x21 = (x9 & UINT32_C(0x3ffffff));
517 uint32_t x22 = (x10 & UINT32_C(0x1ffffff));
518 out1[0] = x13;
519 out1[1] = x14;
520 out1[2] = x15;
521 out1[3] = x16;
522 out1[4] = x17;
523 out1[5] = x18;
524 out1[6] = x19;
525 out1[7] = x20;
526 out1[8] = x21;
527 out1[9] = x22;
528 }
529
530 /*
531 * Input Bounds:
532 * arg1: [[0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333]]
533 * arg2: [[0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333]]
534 * Output Bounds:
535 * out1: [[0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999]]
536 */
fiat_25519_add(uint32_t out1[10],const uint32_t arg1[10],const uint32_t arg2[10])537 static void fiat_25519_add(uint32_t out1[10], const uint32_t arg1[10], const uint32_t arg2[10]) {
538 uint32_t x1 = ((arg1[0]) + (arg2[0]));
539 uint32_t x2 = ((arg1[1]) + (arg2[1]));
540 uint32_t x3 = ((arg1[2]) + (arg2[2]));
541 uint32_t x4 = ((arg1[3]) + (arg2[3]));
542 uint32_t x5 = ((arg1[4]) + (arg2[4]));
543 uint32_t x6 = ((arg1[5]) + (arg2[5]));
544 uint32_t x7 = ((arg1[6]) + (arg2[6]));
545 uint32_t x8 = ((arg1[7]) + (arg2[7]));
546 uint32_t x9 = ((arg1[8]) + (arg2[8]));
547 uint32_t x10 = ((arg1[9]) + (arg2[9]));
548 out1[0] = x1;
549 out1[1] = x2;
550 out1[2] = x3;
551 out1[3] = x4;
552 out1[4] = x5;
553 out1[5] = x6;
554 out1[6] = x7;
555 out1[7] = x8;
556 out1[8] = x9;
557 out1[9] = x10;
558 }
559
560 /*
561 * Input Bounds:
562 * arg1: [[0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333]]
563 * arg2: [[0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333]]
564 * Output Bounds:
565 * out1: [[0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999]]
566 */
fiat_25519_sub(uint32_t out1[10],const uint32_t arg1[10],const uint32_t arg2[10])567 static void fiat_25519_sub(uint32_t out1[10], const uint32_t arg1[10], const uint32_t arg2[10]) {
568 uint32_t x1 = ((UINT32_C(0x7ffffda) + (arg1[0])) - (arg2[0]));
569 uint32_t x2 = ((UINT32_C(0x3fffffe) + (arg1[1])) - (arg2[1]));
570 uint32_t x3 = ((UINT32_C(0x7fffffe) + (arg1[2])) - (arg2[2]));
571 uint32_t x4 = ((UINT32_C(0x3fffffe) + (arg1[3])) - (arg2[3]));
572 uint32_t x5 = ((UINT32_C(0x7fffffe) + (arg1[4])) - (arg2[4]));
573 uint32_t x6 = ((UINT32_C(0x3fffffe) + (arg1[5])) - (arg2[5]));
574 uint32_t x7 = ((UINT32_C(0x7fffffe) + (arg1[6])) - (arg2[6]));
575 uint32_t x8 = ((UINT32_C(0x3fffffe) + (arg1[7])) - (arg2[7]));
576 uint32_t x9 = ((UINT32_C(0x7fffffe) + (arg1[8])) - (arg2[8]));
577 uint32_t x10 = ((UINT32_C(0x3fffffe) + (arg1[9])) - (arg2[9]));
578 out1[0] = x1;
579 out1[1] = x2;
580 out1[2] = x3;
581 out1[3] = x4;
582 out1[4] = x5;
583 out1[5] = x6;
584 out1[6] = x7;
585 out1[7] = x8;
586 out1[8] = x9;
587 out1[9] = x10;
588 }
589
590 /*
591 * Input Bounds:
592 * arg1: [[0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333]]
593 * Output Bounds:
594 * out1: [[0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999], [0x0 ~> 0xd333332], [0x0 ~> 0x6999999]]
595 */
fiat_25519_opp(uint32_t out1[10],const uint32_t arg1[10])596 static void fiat_25519_opp(uint32_t out1[10], const uint32_t arg1[10]) {
597 uint32_t x1 = (UINT32_C(0x7ffffda) - (arg1[0]));
598 uint32_t x2 = (UINT32_C(0x3fffffe) - (arg1[1]));
599 uint32_t x3 = (UINT32_C(0x7fffffe) - (arg1[2]));
600 uint32_t x4 = (UINT32_C(0x3fffffe) - (arg1[3]));
601 uint32_t x5 = (UINT32_C(0x7fffffe) - (arg1[4]));
602 uint32_t x6 = (UINT32_C(0x3fffffe) - (arg1[5]));
603 uint32_t x7 = (UINT32_C(0x7fffffe) - (arg1[6]));
604 uint32_t x8 = (UINT32_C(0x3fffffe) - (arg1[7]));
605 uint32_t x9 = (UINT32_C(0x7fffffe) - (arg1[8]));
606 uint32_t x10 = (UINT32_C(0x3fffffe) - (arg1[9]));
607 out1[0] = x1;
608 out1[1] = x2;
609 out1[2] = x3;
610 out1[3] = x4;
611 out1[4] = x5;
612 out1[5] = x6;
613 out1[6] = x7;
614 out1[7] = x8;
615 out1[8] = x9;
616 out1[9] = x10;
617 }
618
619 /*
620 * Input Bounds:
621 * arg1: [[0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333]]
622 * Output Bounds:
623 * out1: [[0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0x7f]]
624 */
fiat_25519_to_bytes(uint8_t out1[32],const uint32_t arg1[10])625 static void fiat_25519_to_bytes(uint8_t out1[32], const uint32_t arg1[10]) {
626 uint32_t x1;
627 fiat_25519_uint1 x2;
628 fiat_25519_subborrowx_u26(&x1, &x2, 0x0, (arg1[0]), UINT32_C(0x3ffffed));
629 uint32_t x3;
630 fiat_25519_uint1 x4;
631 fiat_25519_subborrowx_u25(&x3, &x4, x2, (arg1[1]), UINT32_C(0x1ffffff));
632 uint32_t x5;
633 fiat_25519_uint1 x6;
634 fiat_25519_subborrowx_u26(&x5, &x6, x4, (arg1[2]), UINT32_C(0x3ffffff));
635 uint32_t x7;
636 fiat_25519_uint1 x8;
637 fiat_25519_subborrowx_u25(&x7, &x8, x6, (arg1[3]), UINT32_C(0x1ffffff));
638 uint32_t x9;
639 fiat_25519_uint1 x10;
640 fiat_25519_subborrowx_u26(&x9, &x10, x8, (arg1[4]), UINT32_C(0x3ffffff));
641 uint32_t x11;
642 fiat_25519_uint1 x12;
643 fiat_25519_subborrowx_u25(&x11, &x12, x10, (arg1[5]), UINT32_C(0x1ffffff));
644 uint32_t x13;
645 fiat_25519_uint1 x14;
646 fiat_25519_subborrowx_u26(&x13, &x14, x12, (arg1[6]), UINT32_C(0x3ffffff));
647 uint32_t x15;
648 fiat_25519_uint1 x16;
649 fiat_25519_subborrowx_u25(&x15, &x16, x14, (arg1[7]), UINT32_C(0x1ffffff));
650 uint32_t x17;
651 fiat_25519_uint1 x18;
652 fiat_25519_subborrowx_u26(&x17, &x18, x16, (arg1[8]), UINT32_C(0x3ffffff));
653 uint32_t x19;
654 fiat_25519_uint1 x20;
655 fiat_25519_subborrowx_u25(&x19, &x20, x18, (arg1[9]), UINT32_C(0x1ffffff));
656 uint32_t x21;
657 fiat_25519_cmovznz_u32(&x21, x20, 0x0, UINT32_C(0xffffffff));
658 uint32_t x22;
659 fiat_25519_uint1 x23;
660 fiat_25519_addcarryx_u26(&x22, &x23, 0x0, (x21 & UINT32_C(0x3ffffed)), x1);
661 uint32_t x24;
662 fiat_25519_uint1 x25;
663 fiat_25519_addcarryx_u25(&x24, &x25, x23, (x21 & UINT32_C(0x1ffffff)), x3);
664 uint32_t x26;
665 fiat_25519_uint1 x27;
666 fiat_25519_addcarryx_u26(&x26, &x27, x25, (x21 & UINT32_C(0x3ffffff)), x5);
667 uint32_t x28;
668 fiat_25519_uint1 x29;
669 fiat_25519_addcarryx_u25(&x28, &x29, x27, (x21 & UINT32_C(0x1ffffff)), x7);
670 uint32_t x30;
671 fiat_25519_uint1 x31;
672 fiat_25519_addcarryx_u26(&x30, &x31, x29, (x21 & UINT32_C(0x3ffffff)), x9);
673 uint32_t x32;
674 fiat_25519_uint1 x33;
675 fiat_25519_addcarryx_u25(&x32, &x33, x31, (x21 & UINT32_C(0x1ffffff)), x11);
676 uint32_t x34;
677 fiat_25519_uint1 x35;
678 fiat_25519_addcarryx_u26(&x34, &x35, x33, (x21 & UINT32_C(0x3ffffff)), x13);
679 uint32_t x36;
680 fiat_25519_uint1 x37;
681 fiat_25519_addcarryx_u25(&x36, &x37, x35, (x21 & UINT32_C(0x1ffffff)), x15);
682 uint32_t x38;
683 fiat_25519_uint1 x39;
684 fiat_25519_addcarryx_u26(&x38, &x39, x37, (x21 & UINT32_C(0x3ffffff)), x17);
685 uint32_t x40;
686 fiat_25519_uint1 x41;
687 fiat_25519_addcarryx_u25(&x40, &x41, x39, (x21 & UINT32_C(0x1ffffff)), x19);
688 uint32_t x42 = (x40 << 6);
689 uint32_t x43 = (x38 << 4);
690 uint32_t x44 = (x36 << 3);
691 uint32_t x45 = (x34 * (uint32_t)0x2);
692 uint32_t x46 = (x30 << 6);
693 uint32_t x47 = (x28 << 5);
694 uint32_t x48 = (x26 << 3);
695 uint32_t x49 = (x24 << 2);
696 uint32_t x50 = (x22 >> 8);
697 uint8_t x51 = (uint8_t)(x22 & UINT8_C(0xff));
698 uint32_t x52 = (x50 >> 8);
699 uint8_t x53 = (uint8_t)(x50 & UINT8_C(0xff));
700 uint8_t x54 = (uint8_t)(x52 >> 8);
701 uint8_t x55 = (uint8_t)(x52 & UINT8_C(0xff));
702 uint32_t x56 = (x54 + x49);
703 uint32_t x57 = (x56 >> 8);
704 uint8_t x58 = (uint8_t)(x56 & UINT8_C(0xff));
705 uint32_t x59 = (x57 >> 8);
706 uint8_t x60 = (uint8_t)(x57 & UINT8_C(0xff));
707 uint8_t x61 = (uint8_t)(x59 >> 8);
708 uint8_t x62 = (uint8_t)(x59 & UINT8_C(0xff));
709 uint32_t x63 = (x61 + x48);
710 uint32_t x64 = (x63 >> 8);
711 uint8_t x65 = (uint8_t)(x63 & UINT8_C(0xff));
712 uint32_t x66 = (x64 >> 8);
713 uint8_t x67 = (uint8_t)(x64 & UINT8_C(0xff));
714 uint8_t x68 = (uint8_t)(x66 >> 8);
715 uint8_t x69 = (uint8_t)(x66 & UINT8_C(0xff));
716 uint32_t x70 = (x68 + x47);
717 uint32_t x71 = (x70 >> 8);
718 uint8_t x72 = (uint8_t)(x70 & UINT8_C(0xff));
719 uint32_t x73 = (x71 >> 8);
720 uint8_t x74 = (uint8_t)(x71 & UINT8_C(0xff));
721 uint8_t x75 = (uint8_t)(x73 >> 8);
722 uint8_t x76 = (uint8_t)(x73 & UINT8_C(0xff));
723 uint32_t x77 = (x75 + x46);
724 uint32_t x78 = (x77 >> 8);
725 uint8_t x79 = (uint8_t)(x77 & UINT8_C(0xff));
726 uint32_t x80 = (x78 >> 8);
727 uint8_t x81 = (uint8_t)(x78 & UINT8_C(0xff));
728 uint8_t x82 = (uint8_t)(x80 >> 8);
729 uint8_t x83 = (uint8_t)(x80 & UINT8_C(0xff));
730 uint8_t x84 = (uint8_t)(x82 & UINT8_C(0xff));
731 uint32_t x85 = (x32 >> 8);
732 uint8_t x86 = (uint8_t)(x32 & UINT8_C(0xff));
733 uint32_t x87 = (x85 >> 8);
734 uint8_t x88 = (uint8_t)(x85 & UINT8_C(0xff));
735 fiat_25519_uint1 x89 = (fiat_25519_uint1)(x87 >> 8);
736 uint8_t x90 = (uint8_t)(x87 & UINT8_C(0xff));
737 uint32_t x91 = (x89 + x45);
738 uint32_t x92 = (x91 >> 8);
739 uint8_t x93 = (uint8_t)(x91 & UINT8_C(0xff));
740 uint32_t x94 = (x92 >> 8);
741 uint8_t x95 = (uint8_t)(x92 & UINT8_C(0xff));
742 uint8_t x96 = (uint8_t)(x94 >> 8);
743 uint8_t x97 = (uint8_t)(x94 & UINT8_C(0xff));
744 uint32_t x98 = (x96 + x44);
745 uint32_t x99 = (x98 >> 8);
746 uint8_t x100 = (uint8_t)(x98 & UINT8_C(0xff));
747 uint32_t x101 = (x99 >> 8);
748 uint8_t x102 = (uint8_t)(x99 & UINT8_C(0xff));
749 uint8_t x103 = (uint8_t)(x101 >> 8);
750 uint8_t x104 = (uint8_t)(x101 & UINT8_C(0xff));
751 uint32_t x105 = (x103 + x43);
752 uint32_t x106 = (x105 >> 8);
753 uint8_t x107 = (uint8_t)(x105 & UINT8_C(0xff));
754 uint32_t x108 = (x106 >> 8);
755 uint8_t x109 = (uint8_t)(x106 & UINT8_C(0xff));
756 uint8_t x110 = (uint8_t)(x108 >> 8);
757 uint8_t x111 = (uint8_t)(x108 & UINT8_C(0xff));
758 uint32_t x112 = (x110 + x42);
759 uint32_t x113 = (x112 >> 8);
760 uint8_t x114 = (uint8_t)(x112 & UINT8_C(0xff));
761 uint32_t x115 = (x113 >> 8);
762 uint8_t x116 = (uint8_t)(x113 & UINT8_C(0xff));
763 uint8_t x117 = (uint8_t)(x115 >> 8);
764 uint8_t x118 = (uint8_t)(x115 & UINT8_C(0xff));
765 out1[0] = x51;
766 out1[1] = x53;
767 out1[2] = x55;
768 out1[3] = x58;
769 out1[4] = x60;
770 out1[5] = x62;
771 out1[6] = x65;
772 out1[7] = x67;
773 out1[8] = x69;
774 out1[9] = x72;
775 out1[10] = x74;
776 out1[11] = x76;
777 out1[12] = x79;
778 out1[13] = x81;
779 out1[14] = x83;
780 out1[15] = x84;
781 out1[16] = x86;
782 out1[17] = x88;
783 out1[18] = x90;
784 out1[19] = x93;
785 out1[20] = x95;
786 out1[21] = x97;
787 out1[22] = x100;
788 out1[23] = x102;
789 out1[24] = x104;
790 out1[25] = x107;
791 out1[26] = x109;
792 out1[27] = x111;
793 out1[28] = x114;
794 out1[29] = x116;
795 out1[30] = x118;
796 out1[31] = x117;
797 }
798
799 /*
800 * Input Bounds:
801 * arg1: [[0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0x7f]]
802 * Output Bounds:
803 * out1: [[0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333], [0x0 ~> 0x4666666], [0x0 ~> 0x2333333]]
804 */
fiat_25519_from_bytes(uint32_t out1[10],const uint8_t arg1[32])805 static void fiat_25519_from_bytes(uint32_t out1[10], const uint8_t arg1[32]) {
806 uint32_t x1 = ((uint32_t)(arg1[31]) << 18);
807 uint32_t x2 = ((uint32_t)(arg1[30]) << 10);
808 uint32_t x3 = ((uint32_t)(arg1[29]) << 2);
809 uint32_t x4 = ((uint32_t)(arg1[28]) << 20);
810 uint32_t x5 = ((uint32_t)(arg1[27]) << 12);
811 uint32_t x6 = ((uint32_t)(arg1[26]) << 4);
812 uint32_t x7 = ((uint32_t)(arg1[25]) << 21);
813 uint32_t x8 = ((uint32_t)(arg1[24]) << 13);
814 uint32_t x9 = ((uint32_t)(arg1[23]) << 5);
815 uint32_t x10 = ((uint32_t)(arg1[22]) << 23);
816 uint32_t x11 = ((uint32_t)(arg1[21]) << 15);
817 uint32_t x12 = ((uint32_t)(arg1[20]) << 7);
818 uint32_t x13 = ((uint32_t)(arg1[19]) << 24);
819 uint32_t x14 = ((uint32_t)(arg1[18]) << 16);
820 uint32_t x15 = ((uint32_t)(arg1[17]) << 8);
821 uint8_t x16 = (arg1[16]);
822 uint32_t x17 = ((uint32_t)(arg1[15]) << 18);
823 uint32_t x18 = ((uint32_t)(arg1[14]) << 10);
824 uint32_t x19 = ((uint32_t)(arg1[13]) << 2);
825 uint32_t x20 = ((uint32_t)(arg1[12]) << 19);
826 uint32_t x21 = ((uint32_t)(arg1[11]) << 11);
827 uint32_t x22 = ((uint32_t)(arg1[10]) << 3);
828 uint32_t x23 = ((uint32_t)(arg1[9]) << 21);
829 uint32_t x24 = ((uint32_t)(arg1[8]) << 13);
830 uint32_t x25 = ((uint32_t)(arg1[7]) << 5);
831 uint32_t x26 = ((uint32_t)(arg1[6]) << 22);
832 uint32_t x27 = ((uint32_t)(arg1[5]) << 14);
833 uint32_t x28 = ((uint32_t)(arg1[4]) << 6);
834 uint32_t x29 = ((uint32_t)(arg1[3]) << 24);
835 uint32_t x30 = ((uint32_t)(arg1[2]) << 16);
836 uint32_t x31 = ((uint32_t)(arg1[1]) << 8);
837 uint8_t x32 = (arg1[0]);
838 uint32_t x33 = (x32 + (x31 + (x30 + x29)));
839 uint8_t x34 = (uint8_t)(x33 >> 26);
840 uint32_t x35 = (x33 & UINT32_C(0x3ffffff));
841 uint32_t x36 = (x3 + (x2 + x1));
842 uint32_t x37 = (x6 + (x5 + x4));
843 uint32_t x38 = (x9 + (x8 + x7));
844 uint32_t x39 = (x12 + (x11 + x10));
845 uint32_t x40 = (x16 + (x15 + (x14 + x13)));
846 uint32_t x41 = (x19 + (x18 + x17));
847 uint32_t x42 = (x22 + (x21 + x20));
848 uint32_t x43 = (x25 + (x24 + x23));
849 uint32_t x44 = (x28 + (x27 + x26));
850 uint32_t x45 = (x34 + x44);
851 uint8_t x46 = (uint8_t)(x45 >> 25);
852 uint32_t x47 = (x45 & UINT32_C(0x1ffffff));
853 uint32_t x48 = (x46 + x43);
854 uint8_t x49 = (uint8_t)(x48 >> 26);
855 uint32_t x50 = (x48 & UINT32_C(0x3ffffff));
856 uint32_t x51 = (x49 + x42);
857 uint8_t x52 = (uint8_t)(x51 >> 25);
858 uint32_t x53 = (x51 & UINT32_C(0x1ffffff));
859 uint32_t x54 = (x52 + x41);
860 uint32_t x55 = (x54 & UINT32_C(0x3ffffff));
861 uint8_t x56 = (uint8_t)(x40 >> 25);
862 uint32_t x57 = (x40 & UINT32_C(0x1ffffff));
863 uint32_t x58 = (x56 + x39);
864 uint8_t x59 = (uint8_t)(x58 >> 26);
865 uint32_t x60 = (x58 & UINT32_C(0x3ffffff));
866 uint32_t x61 = (x59 + x38);
867 uint8_t x62 = (uint8_t)(x61 >> 25);
868 uint32_t x63 = (x61 & UINT32_C(0x1ffffff));
869 uint32_t x64 = (x62 + x37);
870 uint8_t x65 = (uint8_t)(x64 >> 26);
871 uint32_t x66 = (x64 & UINT32_C(0x3ffffff));
872 uint32_t x67 = (x65 + x36);
873 out1[0] = x35;
874 out1[1] = x47;
875 out1[2] = x50;
876 out1[3] = x53;
877 out1[4] = x55;
878 out1[5] = x57;
879 out1[6] = x60;
880 out1[7] = x63;
881 out1[8] = x66;
882 out1[9] = x67;
883 }
884
885