Debian Codegraph @

external/boringssl/crypto/curve25519/asm/x25519-asm-x86_64.S

raw
1 /* Copyright (c) 2015, Google Inc.
2 *
3 * Permission to use, copy, modify, and/or distribute this software for any
4 * purpose with or without fee is hereby granted, provided that the above
5 * copyright notice and this permission notice appear in all copies.
6 *
7 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
8 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
10 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
12 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
13 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
14
15 /* This file is adapted from crypto_scalarmult/curve25519/amd64-51/ in
16 * SUPERCOP 20141124 (http://bench.cr.yp.to/supercop.html). That code is public
17 * domain licensed but the standard ISC license is included above to keep
18 * licensing simple. */
19
20 #if !defined(OPENSSL_NO_ASM)
21 #if defined(__x86_64__)
22
23 .data
24 .p2align 4
25
26 #if defined(__APPLE__)
27 /* OS X's C ABI prefixes functions with underscore. */
28 #define C_ABI(x) _ ## x
29 #define HIDDEN .private_extern
30 #else
31 #define C_ABI(x) x
32 #define HIDDEN .hidden
33 #endif
34
35 x25519_x86_64_REDMASK51: .quad 0x0007FFFFFFFFFFFF
36 x25519_x86_64_121666_213: .quad 996687872
37 x25519_x86_64_2P0: .quad 0xFFFFFFFFFFFDA
38 x25519_x86_64_2P1234: .quad 0xFFFFFFFFFFFFE
39 x25519_x86_64_4P0: .quad 0x1FFFFFFFFFFFB4
40 x25519_x86_64_4P1234: .quad 0x1FFFFFFFFFFFFC
41 x25519_x86_64_MU0: .quad 0xED9CE5A30A2C131B
42 x25519_x86_64_MU1: .quad 0x2106215D086329A7
43 x25519_x86_64_MU2: .quad 0xFFFFFFFFFFFFFFEB
44 x25519_x86_64_MU3: .quad 0xFFFFFFFFFFFFFFFF
45 x25519_x86_64_MU4: .quad 0x000000000000000F
46 x25519_x86_64_ORDER0: .quad 0x5812631A5CF5D3ED
47 x25519_x86_64_ORDER1: .quad 0x14DEF9DEA2F79CD6
48 x25519_x86_64_ORDER2: .quad 0x0000000000000000
49 x25519_x86_64_ORDER3: .quad 0x1000000000000000
50 x25519_x86_64_EC2D0: .quad 1859910466990425
51 x25519_x86_64_EC2D1: .quad 932731440258426
52 x25519_x86_64_EC2D2: .quad 1072319116312658
53 x25519_x86_64_EC2D3: .quad 1815898335770999
54 x25519_x86_64_EC2D4: .quad 633789495995903
55 x25519_x86_64__38: .quad 38
56
57 .text
58 .p2align 5
59
60 .globl C_ABI(x25519_x86_64_freeze)
61 HIDDEN C_ABI(x25519_x86_64_freeze)
62 C_ABI(x25519_x86_64_freeze):
63 mov %rsp,%r11
64 and $31,%r11
65 add $64,%r11
66 sub %r11,%rsp
67 movq %r11,0(%rsp)
68 movq %r12,8(%rsp)
69 movq %r13,16(%rsp)
70 movq %r14,24(%rsp)
71 movq %r15,32(%rsp)
72 movq %rbx,40(%rsp)
73 movq %rbp,48(%rsp)
74 movq 0(%rdi),%rsi
75 movq 8(%rdi),%rdx
76 movq 16(%rdi),%rcx
77 movq 24(%rdi),%r8
78 movq 32(%rdi),%r9
79 movq x25519_x86_64_REDMASK51(%rip),%rax
80 mov %rax,%r10
81 sub $18,%r10
82 mov $3,%r11
83 ._reduceloop:
84 mov %rsi,%r12
85 shr $51,%r12
86 and %rax,%rsi
87 add %r12,%rdx
88 mov %rdx,%r12
89 shr $51,%r12
90 and %rax,%rdx
91 add %r12,%rcx
92 mov %rcx,%r12
93 shr $51,%r12
94 and %rax,%rcx
95 add %r12,%r8
96 mov %r8,%r12
97 shr $51,%r12
98 and %rax,%r8
99 add %r12,%r9
100 mov %r9,%r12
101 shr $51,%r12
102 and %rax,%r9
103 imulq $19,%r12,%r12
104 add %r12,%rsi
105 sub $1,%r11
106 ja ._reduceloop
107 mov $1,%r12
108 cmp %r10,%rsi
109 cmovl %r11,%r12
110 cmp %rax,%rdx
111 cmovne %r11,%r12
112 cmp %rax,%rcx
113 cmovne %r11,%r12
114 cmp %rax,%r8
115 cmovne %r11,%r12
116 cmp %rax,%r9
117 cmovne %r11,%r12
118 neg %r12
119 and %r12,%rax
120 and %r12,%r10
121 sub %r10,%rsi
122 sub %rax,%rdx
123 sub %rax,%rcx
124 sub %rax,%r8
125 sub %rax,%r9
126 movq %rsi,0(%rdi)
127 movq %rdx,8(%rdi)
128 movq %rcx,16(%rdi)
129 movq %r8,24(%rdi)
130 movq %r9,32(%rdi)
131 movq 0(%rsp),%r11
132 movq 8(%rsp),%r12
133 movq 16(%rsp),%r13
134 movq 24(%rsp),%r14
135 movq 32(%rsp),%r15
136 movq 40(%rsp),%rbx
137 movq 48(%rsp),%rbp
138 add %r11,%rsp
139 mov %rdi,%rax
140 mov %rsi,%rdx
141 ret
142
143 .p2align 5
144 .globl C_ABI(x25519_x86_64_mul)
145 HIDDEN C_ABI(x25519_x86_64_mul)
146 C_ABI(x25519_x86_64_mul):
147 mov %rsp,%r11
148 and $31,%r11
149 add $96,%r11
150 sub %r11,%rsp
151 movq %r11,0(%rsp)
152 movq %r12,8(%rsp)
153 movq %r13,16(%rsp)
154 movq %r14,24(%rsp)
155 movq %r15,32(%rsp)
156 movq %rbx,40(%rsp)
157 movq %rbp,48(%rsp)
158 movq %rdi,56(%rsp)
159 mov %rdx,%rcx
160 movq 24(%rsi),%rdx
161 imulq $19,%rdx,%rax
162 movq %rax,64(%rsp)
163 mulq 16(%rcx)
164 mov %rax,%r8
165 mov %rdx,%r9
166 movq 32(%rsi),%rdx
167 imulq $19,%rdx,%rax
168 movq %rax,72(%rsp)
169 mulq 8(%rcx)
170 add %rax,%r8
171 adc %rdx,%r9
172 movq 0(%rsi),%rax
173 mulq 0(%rcx)
174 add %rax,%r8
175 adc %rdx,%r9
176 movq 0(%rsi),%rax
177 mulq 8(%rcx)
178 mov %rax,%r10
179 mov %rdx,%r11
180 movq 0(%rsi),%rax
181 mulq 16(%rcx)
182 mov %rax,%r12
183 mov %rdx,%r13
184 movq 0(%rsi),%rax
185 mulq 24(%rcx)
186 mov %rax,%r14
187 mov %rdx,%r15
188 movq 0(%rsi),%rax
189 mulq 32(%rcx)
190 mov %rax,%rbx
191 mov %rdx,%rbp
192 movq 8(%rsi),%rax
193 mulq 0(%rcx)
194 add %rax,%r10
195 adc %rdx,%r11
196 movq 8(%rsi),%rax
197 mulq 8(%rcx)
198 add %rax,%r12
199 adc %rdx,%r13
200 movq 8(%rsi),%rax
201 mulq 16(%rcx)
202 add %rax,%r14
203 adc %rdx,%r15
204 movq 8(%rsi),%rax
205 mulq 24(%rcx)
206 add %rax,%rbx
207 adc %rdx,%rbp
208 movq 8(%rsi),%rdx
209 imulq $19,%rdx,%rax
210 mulq 32(%rcx)
211 add %rax,%r8
212 adc %rdx,%r9
213 movq 16(%rsi),%rax
214 mulq 0(%rcx)
215 add %rax,%r12
216 adc %rdx,%r13
217 movq 16(%rsi),%rax
218 mulq 8(%rcx)
219 add %rax,%r14
220 adc %rdx,%r15
221 movq 16(%rsi),%rax
222 mulq 16(%rcx)
223 add %rax,%rbx
224 adc %rdx,%rbp
225 movq 16(%rsi),%rdx
226 imulq $19,%rdx,%rax
227 mulq 24(%rcx)
228 add %rax,%r8
229 adc %rdx,%r9
230 movq 16(%rsi),%rdx
231 imulq $19,%rdx,%rax
232 mulq 32(%rcx)
233 add %rax,%r10
234 adc %rdx,%r11
235 movq 24(%rsi),%rax
236 mulq 0(%rcx)
237 add %rax,%r14
238 adc %rdx,%r15
239 movq 24(%rsi),%rax
240 mulq 8(%rcx)
241 add %rax,%rbx
242 adc %rdx,%rbp
243 movq 64(%rsp),%rax
244 mulq 24(%rcx)
245 add %rax,%r10
246 adc %rdx,%r11
247 movq 64(%rsp),%rax
248 mulq 32(%rcx)
249 add %rax,%r12
250 adc %rdx,%r13
251 movq 32(%rsi),%rax
252 mulq 0(%rcx)
253 add %rax,%rbx
254 adc %rdx,%rbp
255 movq 72(%rsp),%rax
256 mulq 16(%rcx)
257 add %rax,%r10
258 adc %rdx,%r11
259 movq 72(%rsp),%rax
260 mulq 24(%rcx)
261 add %rax,%r12
262 adc %rdx,%r13
263 movq 72(%rsp),%rax
264 mulq 32(%rcx)
265 add %rax,%r14
266 adc %rdx,%r15
267 movq x25519_x86_64_REDMASK51(%rip),%rsi
268 shld $13,%r8,%r9
269 and %rsi,%r8
270 shld $13,%r10,%r11
271 and %rsi,%r10
272 add %r9,%r10
273 shld $13,%r12,%r13
274 and %rsi,%r12
275 add %r11,%r12
276 shld $13,%r14,%r15
277 and %rsi,%r14
278 add %r13,%r14
279 shld $13,%rbx,%rbp
280 and %rsi,%rbx
281 add %r15,%rbx
282 imulq $19,%rbp,%rdx
283 add %rdx,%r8
284 mov %r8,%rdx
285 shr $51,%rdx
286 add %r10,%rdx
287 mov %rdx,%rcx
288 shr $51,%rdx
289 and %rsi,%r8
290 add %r12,%rdx
291 mov %rdx,%r9
292 shr $51,%rdx
293 and %rsi,%rcx
294 add %r14,%rdx
295 mov %rdx,%rax
296 shr $51,%rdx
297 and %rsi,%r9
298 add %rbx,%rdx
299 mov %rdx,%r10
300 shr $51,%rdx
301 and %rsi,%rax
302 imulq $19,%rdx,%rdx
303 add %rdx,%r8
304 and %rsi,%r10
305 movq %r8,0(%rdi)
306 movq %rcx,8(%rdi)
307 movq %r9,16(%rdi)
308 movq %rax,24(%rdi)
309 movq %r10,32(%rdi)
310 movq 0(%rsp),%r11
311 movq 8(%rsp),%r12
312 movq 16(%rsp),%r13
313 movq 24(%rsp),%r14
314 movq 32(%rsp),%r15
315 movq 40(%rsp),%rbx
316 movq 48(%rsp),%rbp
317 add %r11,%rsp
318 mov %rdi,%rax
319 mov %rsi,%rdx
320 ret
321
322 .p2align 5
323 .globl C_ABI(x25519_x86_64_square)
324 HIDDEN C_ABI(x25519_x86_64_square)
325 C_ABI(x25519_x86_64_square):
326 mov %rsp,%r11
327 and $31,%r11
328 add $64,%r11
329 sub %r11,%rsp
330 movq %r11,0(%rsp)
331 movq %r12,8(%rsp)
332 movq %r13,16(%rsp)
333 movq %r14,24(%rsp)
334 movq %r15,32(%rsp)
335 movq %rbx,40(%rsp)
336 movq %rbp,48(%rsp)
337 movq 0(%rsi),%rax
338 mulq 0(%rsi)
339 mov %rax,%rcx
340 mov %rdx,%r8
341 movq 0(%rsi),%rax
342 shl $1,%rax
343 mulq 8(%rsi)
344 mov %rax,%r9
345 mov %rdx,%r10
346 movq 0(%rsi),%rax
347 shl $1,%rax
348 mulq 16(%rsi)
349 mov %rax,%r11
350 mov %rdx,%r12
351 movq 0(%rsi),%rax
352 shl $1,%rax
353 mulq 24(%rsi)
354 mov %rax,%r13
355 mov %rdx,%r14
356 movq 0(%rsi),%rax
357 shl $1,%rax
358 mulq 32(%rsi)
359 mov %rax,%r15
360 mov %rdx,%rbx
361 movq 8(%rsi),%rax
362 mulq 8(%rsi)
363 add %rax,%r11
364 adc %rdx,%r12
365 movq 8(%rsi),%rax
366 shl $1,%rax
367 mulq 16(%rsi)
368 add %rax,%r13
369 adc %rdx,%r14
370 movq 8(%rsi),%rax
371 shl $1,%rax
372 mulq 24(%rsi)
373 add %rax,%r15
374 adc %rdx,%rbx
375 movq 8(%rsi),%rdx
376 imulq $38,%rdx,%rax
377 mulq 32(%rsi)
378 add %rax,%rcx
379 adc %rdx,%r8
380 movq 16(%rsi),%rax
381 mulq 16(%rsi)
382 add %rax,%r15
383 adc %rdx,%rbx
384 movq 16(%rsi),%rdx
385 imulq $38,%rdx,%rax
386 mulq 24(%rsi)
387 add %rax,%rcx
388 adc %rdx,%r8
389 movq 16(%rsi),%rdx
390 imulq $38,%rdx,%rax
391 mulq 32(%rsi)
392 add %rax,%r9
393 adc %rdx,%r10
394 movq 24(%rsi),%rdx
395 imulq $19,%rdx,%rax
396 mulq 24(%rsi)
397 add %rax,%r9
398 adc %rdx,%r10
399 movq 24(%rsi),%rdx
400 imulq $38,%rdx,%rax
401 mulq 32(%rsi)
402 add %rax,%r11
403 adc %rdx,%r12
404 movq 32(%rsi),%rdx
405 imulq $19,%rdx,%rax
406 mulq 32(%rsi)
407 add %rax,%r13
408 adc %rdx,%r14
409 movq x25519_x86_64_REDMASK51(%rip),%rsi
410 shld $13,%rcx,%r8
411 and %rsi,%rcx
412 shld $13,%r9,%r10
413 and %rsi,%r9
414 add %r8,%r9
415 shld $13,%r11,%r12
416 and %rsi,%r11
417 add %r10,%r11
418 shld $13,%r13,%r14
419 and %rsi,%r13
420 add %r12,%r13
421 shld $13,%r15,%rbx
422 and %rsi,%r15
423 add %r14,%r15
424 imulq $19,%rbx,%rdx
425 add %rdx,%rcx
426 mov %rcx,%rdx
427 shr $51,%rdx
428 add %r9,%rdx
429 and %rsi,%rcx
430 mov %rdx,%r8
431 shr $51,%rdx
432 add %r11,%rdx
433 and %rsi,%r8
434 mov %rdx,%r9
435 shr $51,%rdx
436 add %r13,%rdx
437 and %rsi,%r9
438 mov %rdx,%rax
439 shr $51,%rdx
440 add %r15,%rdx
441 and %rsi,%rax
442 mov %rdx,%r10
443 shr $51,%rdx
444 imulq $19,%rdx,%rdx
445 add %rdx,%rcx
446 and %rsi,%r10
447 movq %rcx,0(%rdi)
448 movq %r8,8(%rdi)
449 movq %r9,16(%rdi)
450 movq %rax,24(%rdi)
451 movq %r10,32(%rdi)
452 movq 0(%rsp),%r11
453 movq 8(%rsp),%r12
454 movq 16(%rsp),%r13
455 movq 24(%rsp),%r14
456 movq 32(%rsp),%r15
457 movq 40(%rsp),%rbx
458 movq 48(%rsp),%rbp
459 add %r11,%rsp
460 mov %rdi,%rax
461 mov %rsi,%rdx
462 ret
463
464 .p2align 5
465 .globl C_ABI(x25519_x86_64_ladderstep)
466 HIDDEN C_ABI(x25519_x86_64_ladderstep)
467 C_ABI(x25519_x86_64_ladderstep):
468 mov %rsp,%r11
469 and $31,%r11
470 add $352,%r11
471 sub %r11,%rsp
472 movq %r11,0(%rsp)
473 movq %r12,8(%rsp)
474 movq %r13,16(%rsp)
475 movq %r14,24(%rsp)
476 movq %r15,32(%rsp)
477 movq %rbx,40(%rsp)
478 movq %rbp,48(%rsp)
479 movq 40(%rdi),%rsi
480 movq 48(%rdi),%rdx
481 movq 56(%rdi),%rcx
482 movq 64(%rdi),%r8
483 movq 72(%rdi),%r9
484 mov %rsi,%rax
485 mov %rdx,%r10
486 mov %rcx,%r11
487 mov %r8,%r12
488 mov %r9,%r13
489 add x25519_x86_64_2P0(%rip),%rax
490 add x25519_x86_64_2P1234(%rip),%r10
491 add x25519_x86_64_2P1234(%rip),%r11
492 add x25519_x86_64_2P1234(%rip),%r12
493 add x25519_x86_64_2P1234(%rip),%r13
494 addq 80(%rdi),%rsi
495 addq 88(%rdi),%rdx
496 addq 96(%rdi),%rcx
497 addq 104(%rdi),%r8
498 addq 112(%rdi),%r9
499 subq 80(%rdi),%rax
500 subq 88(%rdi),%r10
501 subq 96(%rdi),%r11
502 subq 104(%rdi),%r12
503 subq 112(%rdi),%r13
504 movq %rsi,56(%rsp)
505 movq %rdx,64(%rsp)
506 movq %rcx,72(%rsp)
507 movq %r8,80(%rsp)
508 movq %r9,88(%rsp)
509 movq %rax,96(%rsp)
510 movq %r10,104(%rsp)
511 movq %r11,112(%rsp)
512 movq %r12,120(%rsp)
513 movq %r13,128(%rsp)
514 movq 96(%rsp),%rax
515 mulq 96(%rsp)
516 mov %rax,%rsi
517 mov %rdx,%rcx
518 movq 96(%rsp),%rax
519 shl $1,%rax
520 mulq 104(%rsp)
521 mov %rax,%r8
522 mov %rdx,%r9
523 movq 96(%rsp),%rax
524 shl $1,%rax
525 mulq 112(%rsp)
526 mov %rax,%r10
527 mov %rdx,%r11
528 movq 96(%rsp),%rax
529 shl $1,%rax
530 mulq 120(%rsp)
531 mov %rax,%r12
532 mov %rdx,%r13
533 movq 96(%rsp),%rax
534 shl $1,%rax
535 mulq 128(%rsp)
536 mov %rax,%r14
537 mov %rdx,%r15
538 movq 104(%rsp),%rax
539 mulq 104(%rsp)
540 add %rax,%r10
541 adc %rdx,%r11
542 movq 104(%rsp),%rax
543 shl $1,%rax
544 mulq 112(%rsp)
545 add %rax,%r12
546 adc %rdx,%r13
547 movq 104(%rsp),%rax
548 shl $1,%rax
549 mulq 120(%rsp)
550 add %rax,%r14
551 adc %rdx,%r15
552 movq 104(%rsp),%rdx
553 imulq $38,%rdx,%rax
554 mulq 128(%rsp)
555 add %rax,%rsi
556 adc %rdx,%rcx
557 movq 112(%rsp),%rax
558 mulq 112(%rsp)
559 add %rax,%r14
560 adc %rdx,%r15
561 movq 112(%rsp),%rdx
562 imulq $38,%rdx,%rax
563 mulq 120(%rsp)
564 add %rax,%rsi
565 adc %rdx,%rcx
566 movq 112(%rsp),%rdx
567 imulq $38,%rdx,%rax
568 mulq 128(%rsp)
569 add %rax,%r8
570 adc %rdx,%r9
571 movq 120(%rsp),%rdx
572 imulq $19,%rdx,%rax
573 mulq 120(%rsp)
574 add %rax,%r8
575 adc %rdx,%r9
576 movq 120(%rsp),%rdx
577 imulq $38,%rdx,%rax
578 mulq 128(%rsp)
579 add %rax,%r10
580 adc %rdx,%r11
581 movq 128(%rsp),%rdx
582 imulq $19,%rdx,%rax
583 mulq 128(%rsp)
584 add %rax,%r12
585 adc %rdx,%r13
586 movq x25519_x86_64_REDMASK51(%rip),%rdx
587 shld $13,%rsi,%rcx
588 and %rdx,%rsi
589 shld $13,%r8,%r9
590 and %rdx,%r8
591 add %rcx,%r8
592 shld $13,%r10,%r11
593 and %rdx,%r10
594 add %r9,%r10
595 shld $13,%r12,%r13
596 and %rdx,%r12
597 add %r11,%r12
598 shld $13,%r14,%r15
599 and %rdx,%r14
600 add %r13,%r14
601 imulq $19,%r15,%rcx
602 add %rcx,%rsi
603 mov %rsi,%rcx
604 shr $51,%rcx
605 add %r8,%rcx
606 and %rdx,%rsi
607 mov %rcx,%r8
608 shr $51,%rcx
609 add %r10,%rcx
610 and %rdx,%r8
611 mov %rcx,%r9
612 shr $51,%rcx
613 add %r12,%rcx
614 and %rdx,%r9
615 mov %rcx,%rax
616 shr $51,%rcx
617 add %r14,%rcx
618 and %rdx,%rax
619 mov %rcx,%r10
620 shr $51,%rcx
621 imulq $19,%rcx,%rcx
622 add %rcx,%rsi
623 and %rdx,%r10
624 movq %rsi,136(%rsp)
625 movq %r8,144(%rsp)
626 movq %r9,152(%rsp)
627 movq %rax,160(%rsp)
628 movq %r10,168(%rsp)
629 movq 56(%rsp),%rax
630 mulq 56(%rsp)
631 mov %rax,%rsi
632 mov %rdx,%rcx
633 movq 56(%rsp),%rax
634 shl $1,%rax
635 mulq 64(%rsp)
636 mov %rax,%r8
637 mov %rdx,%r9
638 movq 56(%rsp),%rax
639 shl $1,%rax
640 mulq 72(%rsp)
641 mov %rax,%r10
642 mov %rdx,%r11
643 movq 56(%rsp),%rax
644 shl $1,%rax
645 mulq 80(%rsp)
646 mov %rax,%r12
647 mov %rdx,%r13
648 movq 56(%rsp),%rax
649 shl $1,%rax
650 mulq 88(%rsp)
651 mov %rax,%r14
652 mov %rdx,%r15
653 movq 64(%rsp),%rax
654 mulq 64(%rsp)
655 add %rax,%r10
656 adc %rdx,%r11
657 movq 64(%rsp),%rax
658 shl $1,%rax
659 mulq 72(%rsp)
660 add %rax,%r12
661 adc %rdx,%r13
662 movq 64(%rsp),%rax
663 shl $1,%rax
664 mulq 80(%rsp)
665 add %rax,%r14
666 adc %rdx,%r15
667 movq 64(%rsp),%rdx
668 imulq $38,%rdx,%rax
669 mulq 88(%rsp)
670 add %rax,%rsi
671 adc %rdx,%rcx
672 movq 72(%rsp),%rax
673 mulq 72(%rsp)
674 add %rax,%r14
675 adc %rdx,%r15
676 movq 72(%rsp),%rdx
677 imulq $38,%rdx,%rax
678 mulq 80(%rsp)
679 add %rax,%rsi
680 adc %rdx,%rcx
681 movq 72(%rsp),%rdx
682 imulq $38,%rdx,%rax
683 mulq 88(%rsp)
684 add %rax,%r8
685 adc %rdx,%r9
686 movq 80(%rsp),%rdx
687 imulq $19,%rdx,%rax
688 mulq 80(%rsp)
689 add %rax,%r8
690 adc %rdx,%r9
691 movq 80(%rsp),%rdx
692 imulq $38,%rdx,%rax
693 mulq 88(%rsp)
694 add %rax,%r10
695 adc %rdx,%r11
696 movq 88(%rsp),%rdx
697 imulq $19,%rdx,%rax
698 mulq 88(%rsp)
699 add %rax,%r12
700 adc %rdx,%r13
701 movq x25519_x86_64_REDMASK51(%rip),%rdx
702 shld $13,%rsi,%rcx
703 and %rdx,%rsi
704 shld $13,%r8,%r9
705 and %rdx,%r8
706 add %rcx,%r8
707 shld $13,%r10,%r11
708 and %rdx,%r10
709 add %r9,%r10
710 shld $13,%r12,%r13
711 and %rdx,%r12
712 add %r11,%r12
713 shld $13,%r14,%r15
714 and %rdx,%r14
715 add %r13,%r14
716 imulq $19,%r15,%rcx
717 add %rcx,%rsi
718 mov %rsi,%rcx
719 shr $51,%rcx
720 add %r8,%rcx
721 and %rdx,%rsi
722 mov %rcx,%r8
723 shr $51,%rcx
724 add %r10,%rcx
725 and %rdx,%r8
726 mov %rcx,%r9
727 shr $51,%rcx
728 add %r12,%rcx
729 and %rdx,%r9
730 mov %rcx,%rax
731 shr $51,%rcx
732 add %r14,%rcx
733 and %rdx,%rax
734 mov %rcx,%r10
735 shr $51,%rcx
736 imulq $19,%rcx,%rcx
737 add %rcx,%rsi
738 and %rdx,%r10
739 movq %rsi,176(%rsp)
740 movq %r8,184(%rsp)
741 movq %r9,192(%rsp)
742 movq %rax,200(%rsp)
743 movq %r10,208(%rsp)
744 mov %rsi,%rsi
745 mov %r8,%rdx
746 mov %r9,%rcx
747 mov %rax,%r8
748 mov %r10,%r9
749 add x25519_x86_64_2P0(%rip),%rsi
750 add x25519_x86_64_2P1234(%rip),%rdx
751 add x25519_x86_64_2P1234(%rip),%rcx
752 add x25519_x86_64_2P1234(%rip),%r8
753 add x25519_x86_64_2P1234(%rip),%r9
754 subq 136(%rsp),%rsi
755 subq 144(%rsp),%rdx
756 subq 152(%rsp),%rcx
757 subq 160(%rsp),%r8
758 subq 168(%rsp),%r9
759 movq %rsi,216(%rsp)
760 movq %rdx,224(%rsp)
761 movq %rcx,232(%rsp)
762 movq %r8,240(%rsp)
763 movq %r9,248(%rsp)
764 movq 120(%rdi),%rsi
765 movq 128(%rdi),%rdx
766 movq 136(%rdi),%rcx
767 movq 144(%rdi),%r8
768 movq 152(%rdi),%r9
769 mov %rsi,%rax
770 mov %rdx,%r10
771 mov %rcx,%r11
772 mov %r8,%r12
773 mov %r9,%r13
774 add x25519_x86_64_2P0(%rip),%rax
775 add x25519_x86_64_2P1234(%rip),%r10
776 add x25519_x86_64_2P1234(%rip),%r11
777 add x25519_x86_64_2P1234(%rip),%r12
778 add x25519_x86_64_2P1234(%rip),%r13
779 addq 160(%rdi),%rsi
780 addq 168(%rdi),%rdx
781 addq 176(%rdi),%rcx
782 addq 184(%rdi),%r8
783 addq 192(%rdi),%r9
784 subq 160(%rdi),%rax
785 subq 168(%rdi),%r10
786 subq 176(%rdi),%r11
787 subq 184(%rdi),%r12
788 subq 192(%rdi),%r13
789 movq %rsi,256(%rsp)
790 movq %rdx,264(%rsp)
791 movq %rcx,272(%rsp)
792 movq %r8,280(%rsp)
793 movq %r9,288(%rsp)
794 movq %rax,296(%rsp)
795 movq %r10,304(%rsp)
796 movq %r11,312(%rsp)
797 movq %r12,320(%rsp)
798 movq %r13,328(%rsp)
799 movq 280(%rsp),%rsi
800 imulq $19,%rsi,%rax
801 movq %rax,336(%rsp)
802 mulq 112(%rsp)
803 mov %rax,%rsi
804 mov %rdx,%rcx
805 movq 288(%rsp),%rdx
806 imulq $19,%rdx,%rax
807 movq %rax,344(%rsp)
808 mulq 104(%rsp)
809 add %rax,%rsi
810 adc %rdx,%rcx
811 movq 256(%rsp),%rax
812 mulq 96(%rsp)
813 add %rax,%rsi
814 adc %rdx,%rcx
815 movq 256(%rsp),%rax
816 mulq 104(%rsp)
817 mov %rax,%r8
818 mov %rdx,%r9
819 movq 256(%rsp),%rax
820 mulq 112(%rsp)
821 mov %rax,%r10
822 mov %rdx,%r11
823 movq 256(%rsp),%rax
824 mulq 120(%rsp)
825 mov %rax,%r12
826 mov %rdx,%r13
827 movq 256(%rsp),%rax
828 mulq 128(%rsp)
829 mov %rax,%r14
830 mov %rdx,%r15
831 movq 264(%rsp),%rax
832 mulq 96(%rsp)
833 add %rax,%r8
834 adc %rdx,%r9
835 movq 264(%rsp),%rax
836 mulq 104(%rsp)
837 add %rax,%r10
838 adc %rdx,%r11
839 movq 264(%rsp),%rax
840 mulq 112(%rsp)
841 add %rax,%r12
842 adc %rdx,%r13
843 movq 264(%rsp),%rax
844 mulq 120(%rsp)
845 add %rax,%r14
846 adc %rdx,%r15
847 movq 264(%rsp),%rdx
848 imulq $19,%rdx,%rax
849 mulq 128(%rsp)
850 add %rax,%rsi
851 adc %rdx,%rcx
852 movq 272(%rsp),%rax
853 mulq 96(%rsp)
854 add %rax,%r10
855 adc %rdx,%r11
856 movq 272(%rsp),%rax
857 mulq 104(%rsp)
858 add %rax,%r12
859 adc %rdx,%r13
860 movq 272(%rsp),%rax
861 mulq 112(%rsp)
862 add %rax,%r14
863 adc %rdx,%r15
864 movq 272(%rsp),%rdx
865 imulq $19,%rdx,%rax
866 mulq 120(%rsp)
867 add %rax,%rsi
868 adc %rdx,%rcx
869 movq 272(%rsp),%rdx
870 imulq $19,%rdx,%rax
871 mulq 128(%rsp)
872 add %rax,%r8
873 adc %rdx,%r9
874 movq 280(%rsp),%rax
875 mulq 96(%rsp)
876 add %rax,%r12
877 adc %rdx,%r13
878 movq 280(%rsp),%rax
879 mulq 104(%rsp)
880 add %rax,%r14
881 adc %rdx,%r15
882 movq 336(%rsp),%rax
883 mulq 120(%rsp)
884 add %rax,%r8
885 adc %rdx,%r9
886 movq 336(%rsp),%rax
887 mulq 128(%rsp)
888 add %rax,%r10
889 adc %rdx,%r11
890 movq 288(%rsp),%rax
891 mulq 96(%rsp)
892 add %rax,%r14
893 adc %rdx,%r15
894 movq 344(%rsp),%rax
895 mulq 112(%rsp)
896 add %rax,%r8
897 adc %rdx,%r9
898 movq 344(%rsp),%rax
899 mulq 120(%rsp)
900 add %rax,%r10
901 adc %rdx,%r11
902 movq 344(%rsp),%rax
903 mulq 128(%rsp)
904 add %rax,%r12
905 adc %rdx,%r13
906 movq x25519_x86_64_REDMASK51(%rip),%rdx
907 shld $13,%rsi,%rcx
908 and %rdx,%rsi
909 shld $13,%r8,%r9
910 and %rdx,%r8
911 add %rcx,%r8
912 shld $13,%r10,%r11
913 and %rdx,%r10
914 add %r9,%r10
915 shld $13,%r12,%r13
916 and %rdx,%r12
917 add %r11,%r12
918 shld $13,%r14,%r15
919 and %rdx,%r14
920 add %r13,%r14
921 imulq $19,%r15,%rcx
922 add %rcx,%rsi
923 mov %rsi,%rcx
924 shr $51,%rcx
925 add %r8,%rcx
926 mov %rcx,%r8
927 shr $51,%rcx
928 and %rdx,%rsi
929 add %r10,%rcx
930 mov %rcx,%r9
931 shr $51,%rcx
932 and %rdx,%r8
933 add %r12,%rcx
934 mov %rcx,%rax
935 shr $51,%rcx
936 and %rdx,%r9
937 add %r14,%rcx
938 mov %rcx,%r10
939 shr $51,%rcx
940 and %rdx,%rax
941 imulq $19,%rcx,%rcx
942 add %rcx,%rsi
943 and %rdx,%r10
944 movq %rsi,96(%rsp)
945 movq %r8,104(%rsp)
946 movq %r9,112(%rsp)
947 movq %rax,120(%rsp)
948 movq %r10,128(%rsp)
949 movq 320(%rsp),%rsi
950 imulq $19,%rsi,%rax
951 movq %rax,256(%rsp)
952 mulq 72(%rsp)
953 mov %rax,%rsi
954 mov %rdx,%rcx
955 movq 328(%rsp),%rdx
956 imulq $19,%rdx,%rax
957 movq %rax,264(%rsp)
958 mulq 64(%rsp)
959 add %rax,%rsi
960 adc %rdx,%rcx
961 movq 296(%rsp),%rax
962 mulq 56(%rsp)
963 add %rax,%rsi
964 adc %rdx,%rcx
965 movq 296(%rsp),%rax
966 mulq 64(%rsp)
967 mov %rax,%r8
968 mov %rdx,%r9
969 movq 296(%rsp),%rax
970 mulq 72(%rsp)
971 mov %rax,%r10
972 mov %rdx,%r11
973 movq 296(%rsp),%rax
974 mulq 80(%rsp)
975 mov %rax,%r12
976 mov %rdx,%r13
977 movq 296(%rsp),%rax
978 mulq 88(%rsp)
979 mov %rax,%r14
980 mov %rdx,%r15
981 movq 304(%rsp),%rax
982 mulq 56(%rsp)
983 add %rax,%r8
984 adc %rdx,%r9
985 movq 304(%rsp),%rax
986 mulq 64(%rsp)
987 add %rax,%r10
988 adc %rdx,%r11
989 movq 304(%rsp),%rax
990 mulq 72(%rsp)
991 add %rax,%r12
992 adc %rdx,%r13
993 movq 304(%rsp),%rax
994 mulq 80(%rsp)
995 add %rax,%r14
996 adc %rdx,%r15
997 movq 304(%rsp),%rdx
998 imulq $19,%rdx,%rax
999 mulq 88(%rsp)
1000 add %rax,%rsi
1001 adc %rdx,%rcx
1002 movq 312(%rsp),%rax
1003 mulq 56(%rsp)
1004 add %rax,%r10
1005 adc %rdx,%r11
1006 movq 312(%rsp),%rax
1007 mulq 64(%rsp)
1008 add %rax,%r12
1009 adc %rdx,%r13
1010 movq 312(%rsp),%rax
1011 mulq 72(%rsp)
1012 add %rax,%r14
1013 adc %rdx,%r15
1014 movq 312(%rsp),%rdx
1015 imulq $19,%rdx,%rax
1016 mulq 80(%rsp)
1017 add %rax,%rsi
1018 adc %rdx,%rcx
1019 movq 312(%rsp),%rdx
1020 imulq $19,%rdx,%rax
1021 mulq 88(%rsp)
1022 add %rax,%r8
1023 adc %rdx,%r9
1024 movq 320(%rsp),%rax
1025 mulq 56(%rsp)
1026 add %rax,%r12
1027 adc %rdx,%r13
1028 movq 320(%rsp),%rax
1029 mulq 64(%rsp)
1030 add %rax,%r14
1031 adc %rdx,%r15
1032 movq 256(%rsp),%rax
1033 mulq 80(%rsp)
1034 add %rax,%r8
1035 adc %rdx,%r9
1036 movq 256(%rsp),%rax
1037 mulq 88(%rsp)
1038 add %rax,%r10
1039 adc %rdx,%r11
1040 movq 328(%rsp),%rax
1041 mulq 56(%rsp)
1042 add %rax,%r14
1043 adc %rdx,%r15
1044 movq 264(%rsp),%rax
1045 mulq 72(%rsp)
1046 add %rax,%r8
1047 adc %rdx,%r9
1048 movq 264(%rsp),%rax
1049 mulq 80(%rsp)
1050 add %rax,%r10
1051 adc %rdx,%r11
1052 movq 264(%rsp),%rax
1053 mulq 88(%rsp)
1054 add %rax,%r12
1055 adc %rdx,%r13
1056 movq x25519_x86_64_REDMASK51(%rip),%rdx
1057 shld $13,%rsi,%rcx
1058 and %rdx,%rsi
1059 shld $13,%r8,%r9
1060 and %rdx,%r8
1061 add %rcx,%r8
1062 shld $13,%r10,%r11
1063 and %rdx,%r10
1064 add %r9,%r10
1065 shld $13,%r12,%r13
1066 and %rdx,%r12
1067 add %r11,%r12
1068 shld $13,%r14,%r15
1069 and %rdx,%r14
1070 add %r13,%r14
1071 imulq $19,%r15,%rcx
1072 add %rcx,%rsi
1073 mov %rsi,%rcx
1074 shr $51,%rcx
1075 add %r8,%rcx
1076 mov %rcx,%r8
1077 shr $51,%rcx
1078 and %rdx,%rsi
1079 add %r10,%rcx
1080 mov %rcx,%r9
1081 shr $51,%rcx
1082 and %rdx,%r8
1083 add %r12,%rcx
1084 mov %rcx,%rax
1085 shr $51,%rcx
1086 and %rdx,%r9
1087 add %r14,%rcx
1088 mov %rcx,%r10
1089 shr $51,%rcx
1090 and %rdx,%rax
1091 imulq $19,%rcx,%rcx
1092 add %rcx,%rsi
1093 and %rdx,%r10
1094 mov %rsi,%rdx
1095 mov %r8,%rcx
1096 mov %r9,%r11
1097 mov %rax,%r12
1098 mov %r10,%r13
1099 add x25519_x86_64_2P0(%rip),%rdx
1100 add x25519_x86_64_2P1234(%rip),%rcx
1101 add x25519_x86_64_2P1234(%rip),%r11
1102 add x25519_x86_64_2P1234(%rip),%r12
1103 add x25519_x86_64_2P1234(%rip),%r13
1104 addq 96(%rsp),%rsi
1105 addq 104(%rsp),%r8
1106 addq 112(%rsp),%r9
1107 addq 120(%rsp),%rax
1108 addq 128(%rsp),%r10
1109 subq 96(%rsp),%rdx
1110 subq 104(%rsp),%rcx
1111 subq 112(%rsp),%r11
1112 subq 120(%rsp),%r12
1113 subq 128(%rsp),%r13
1114 movq %rsi,120(%rdi)
1115 movq %r8,128(%rdi)
1116 movq %r9,136(%rdi)
1117 movq %rax,144(%rdi)
1118 movq %r10,152(%rdi)
1119 movq %rdx,160(%rdi)
1120 movq %rcx,168(%rdi)
1121 movq %r11,176(%rdi)
1122 movq %r12,184(%rdi)
1123 movq %r13,192(%rdi)
1124 movq 120(%rdi),%rax
1125 mulq 120(%rdi)
1126 mov %rax,%rsi
1127 mov %rdx,%rcx
1128 movq 120(%rdi),%rax
1129 shl $1,%rax
1130 mulq 128(%rdi)
1131 mov %rax,%r8
1132 mov %rdx,%r9
1133 movq 120(%rdi),%rax
1134 shl $1,%rax
1135 mulq 136(%rdi)
1136 mov %rax,%r10
1137 mov %rdx,%r11
1138 movq 120(%rdi),%rax
1139 shl $1,%rax
1140 mulq 144(%rdi)
1141 mov %rax,%r12
1142 mov %rdx,%r13
1143 movq 120(%rdi),%rax
1144 shl $1,%rax
1145 mulq 152(%rdi)
1146 mov %rax,%r14
1147 mov %rdx,%r15
1148 movq 128(%rdi),%rax
1149 mulq 128(%rdi)
1150 add %rax,%r10
1151 adc %rdx,%r11
1152 movq 128(%rdi),%rax
1153 shl $1,%rax
1154 mulq 136(%rdi)
1155 add %rax,%r12
1156 adc %rdx,%r13
1157 movq 128(%rdi),%rax
1158 shl $1,%rax
1159 mulq 144(%rdi)
1160 add %rax,%r14
1161 adc %rdx,%r15
1162 movq 128(%rdi),%rdx
1163 imulq $38,%rdx,%rax
1164 mulq 152(%rdi)
1165 add %rax,%rsi
1166 adc %rdx,%rcx
1167 movq 136(%rdi),%rax
1168 mulq 136(%rdi)
1169 add %rax,%r14
1170 adc %rdx,%r15
1171 movq 136(%rdi),%rdx
1172 imulq $38,%rdx,%rax
1173 mulq 144(%rdi)
1174 add %rax,%rsi
1175 adc %rdx,%rcx
1176 movq 136(%rdi),%rdx
1177 imulq $38,%rdx,%rax
1178 mulq 152(%rdi)
1179 add %rax,%r8
1180 adc %rdx,%r9
1181 movq 144(%rdi),%rdx
1182 imulq $19,%rdx,%rax
1183 mulq 144(%rdi)
1184 add %rax,%r8
1185 adc %rdx,%r9
1186 movq 144(%rdi),%rdx
1187 imulq $38,%rdx,%rax
1188 mulq 152(%rdi)
1189 add %rax,%r10
1190 adc %rdx,%r11
1191 movq 152(%rdi),%rdx
1192 imulq $19,%rdx,%rax
1193 mulq 152(%rdi)
1194 add %rax,%r12
1195 adc %rdx,%r13
1196 movq x25519_x86_64_REDMASK51(%rip),%rdx
1197 shld $13,%rsi,%rcx
1198 and %rdx,%rsi
1199 shld $13,%r8,%r9
1200 and %rdx,%r8
1201 add %rcx,%r8
1202 shld $13,%r10,%r11
1203 and %rdx,%r10
1204 add %r9,%r10
1205 shld $13,%r12,%r13
1206 and %rdx,%r12
1207 add %r11,%r12
1208 shld $13,%r14,%r15
1209 and %rdx,%r14
1210 add %r13,%r14
1211 imulq $19,%r15,%rcx
1212 add %rcx,%rsi
1213 mov %rsi,%rcx
1214 shr $51,%rcx
1215 add %r8,%rcx
1216 and %rdx,%rsi
1217 mov %rcx,%r8
1218 shr $51,%rcx
1219 add %r10,%rcx
1220 and %rdx,%r8
1221 mov %rcx,%r9
1222 shr $51,%rcx
1223 add %r12,%rcx
1224 and %rdx,%r9
1225 mov %rcx,%rax
1226 shr $51,%rcx
1227 add %r14,%rcx
1228 and %rdx,%rax
1229 mov %rcx,%r10
1230 shr $51,%rcx
1231 imulq $19,%rcx,%rcx
1232 add %rcx,%rsi
1233 and %rdx,%r10
1234 movq %rsi,120(%rdi)
1235 movq %r8,128(%rdi)
1236 movq %r9,136(%rdi)
1237 movq %rax,144(%rdi)
1238 movq %r10,152(%rdi)
1239 movq 160(%rdi),%rax
1240 mulq 160(%rdi)
1241 mov %rax,%rsi
1242 mov %rdx,%rcx
1243 movq 160(%rdi),%rax
1244 shl $1,%rax
1245 mulq 168(%rdi)
1246 mov %rax,%r8
1247 mov %rdx,%r9
1248 movq 160(%rdi),%rax
1249 shl $1,%rax
1250 mulq 176(%rdi)
1251 mov %rax,%r10
1252 mov %rdx,%r11
1253 movq 160(%rdi),%rax
1254 shl $1,%rax
1255 mulq 184(%rdi)
1256 mov %rax,%r12
1257 mov %rdx,%r13
1258 movq 160(%rdi),%rax
1259 shl $1,%rax
1260 mulq 192(%rdi)
1261 mov %rax,%r14
1262 mov %rdx,%r15
1263 movq 168(%rdi),%rax
1264 mulq 168(%rdi)
1265 add %rax,%r10
1266 adc %rdx,%r11
1267 movq 168(%rdi),%rax
1268 shl $1,%rax
1269 mulq 176(%rdi)
1270 add %rax,%r12
1271 adc %rdx,%r13
1272 movq 168(%rdi),%rax
1273 shl $1,%rax
1274 mulq 184(%rdi)
1275 add %rax,%r14
1276 adc %rdx,%r15
1277 movq 168(%rdi),%rdx
1278 imulq $38,%rdx,%rax
1279 mulq 192(%rdi)
1280 add %rax,%rsi
1281 adc %rdx,%rcx
1282 movq 176(%rdi),%rax
1283 mulq 176(%rdi)
1284 add %rax,%r14
1285 adc %rdx,%r15
1286 movq 176(%rdi),%rdx
1287 imulq $38,%rdx,%rax
1288 mulq 184(%rdi)
1289 add %rax,%rsi
1290 adc %rdx,%rcx
1291 movq 176(%rdi),%rdx
1292 imulq $38,%rdx,%rax
1293 mulq 192(%rdi)
1294 add %rax,%r8
1295 adc %rdx,%r9
1296 movq 184(%rdi),%rdx
1297 imulq $19,%rdx,%rax
1298 mulq 184(%rdi)
1299 add %rax,%r8
1300 adc %rdx,%r9
1301 movq 184(%rdi),%rdx
1302 imulq $38,%rdx,%rax
1303 mulq 192(%rdi)
1304 add %rax,%r10
1305 adc %rdx,%r11
1306 movq 192(%rdi),%rdx
1307 imulq $19,%rdx,%rax
1308 mulq 192(%rdi)
1309 add %rax,%r12
1310 adc %rdx,%r13
1311 movq x25519_x86_64_REDMASK51(%rip),%rdx
1312 shld $13,%rsi,%rcx
1313 and %rdx,%rsi
1314 shld $13,%r8,%r9
1315 and %rdx,%r8
1316 add %rcx,%r8
1317 shld $13,%r10,%r11
1318 and %rdx,%r10
1319 add %r9,%r10
1320 shld $13,%r12,%r13
1321 and %rdx,%r12
1322 add %r11,%r12
1323 shld $13,%r14,%r15
1324 and %rdx,%r14
1325 add %r13,%r14
1326 imulq $19,%r15,%rcx
1327 add %rcx,%rsi
1328 mov %rsi,%rcx
1329 shr $51,%rcx
1330 add %r8,%rcx
1331 and %rdx,%rsi
1332 mov %rcx,%r8
1333 shr $51,%rcx
1334 add %r10,%rcx
1335 and %rdx,%r8
1336 mov %rcx,%r9
1337 shr $51,%rcx
1338 add %r12,%rcx
1339 and %rdx,%r9
1340 mov %rcx,%rax
1341 shr $51,%rcx
1342 add %r14,%rcx
1343 and %rdx,%rax
1344 mov %rcx,%r10
1345 shr $51,%rcx
1346 imulq $19,%rcx,%rcx
1347 add %rcx,%rsi
1348 and %rdx,%r10
1349 movq %rsi,160(%rdi)
1350 movq %r8,168(%rdi)
1351 movq %r9,176(%rdi)
1352 movq %rax,184(%rdi)
1353 movq %r10,192(%rdi)
1354 movq 184(%rdi),%rsi
1355 imulq $19,%rsi,%rax
1356 movq %rax,56(%rsp)
1357 mulq 16(%rdi)
1358 mov %rax,%rsi
1359 mov %rdx,%rcx
1360 movq 192(%rdi),%rdx
1361 imulq $19,%rdx,%rax
1362 movq %rax,64(%rsp)
1363 mulq 8(%rdi)
1364 add %rax,%rsi
1365 adc %rdx,%rcx
1366 movq 160(%rdi),%rax
1367 mulq 0(%rdi)
1368 add %rax,%rsi
1369 adc %rdx,%rcx
1370 movq 160(%rdi),%rax
1371 mulq 8(%rdi)
1372 mov %rax,%r8
1373 mov %rdx,%r9
1374 movq 160(%rdi),%rax
1375 mulq 16(%rdi)
1376 mov %rax,%r10
1377 mov %rdx,%r11
1378 movq 160(%rdi),%rax
1379 mulq 24(%rdi)
1380 mov %rax,%r12
1381 mov %rdx,%r13
1382 movq 160(%rdi),%rax
1383 mulq 32(%rdi)
1384 mov %rax,%r14
1385 mov %rdx,%r15
1386 movq 168(%rdi),%rax
1387 mulq 0(%rdi)
1388 add %rax,%r8
1389 adc %rdx,%r9
1390 movq 168(%rdi),%rax
1391 mulq 8(%rdi)
1392 add %rax,%r10
1393 adc %rdx,%r11
1394 movq 168(%rdi),%rax
1395 mulq 16(%rdi)
1396 add %rax,%r12
1397 adc %rdx,%r13
1398 movq 168(%rdi),%rax
1399 mulq 24(%rdi)
1400 add %rax,%r14
1401 adc %rdx,%r15
1402 movq 168(%rdi),%rdx
1403 imulq $19,%rdx,%rax
1404 mulq 32(%rdi)
1405 add %rax,%rsi
1406 adc %rdx,%rcx
1407 movq 176(%rdi),%rax
1408 mulq 0(%rdi)
1409 add %rax,%r10
1410 adc %rdx,%r11
1411 movq 176(%rdi),%rax
1412 mulq 8(%rdi)
1413 add %rax,%r12
1414 adc %rdx,%r13
1415 movq 176(%rdi),%rax
1416 mulq 16(%rdi)
1417 add %rax,%r14
1418 adc %rdx,%r15
1419 movq 176(%rdi),%rdx
1420 imulq $19,%rdx,%rax
1421 mulq 24(%rdi)
1422 add %rax,%rsi
1423 adc %rdx,%rcx
1424 movq 176(%rdi),%rdx
1425 imulq $19,%rdx,%rax
1426 mulq 32(%rdi)
1427 add %rax,%r8
1428 adc %rdx,%r9
1429 movq 184(%rdi),%rax
1430 mulq 0(%rdi)
1431 add %rax,%r12
1432 adc %rdx,%r13
1433 movq 184(%rdi),%rax
1434 mulq 8(%rdi)
1435 add %rax,%r14
1436 adc %rdx,%r15
1437 movq 56(%rsp),%rax
1438 mulq 24(%rdi)
1439 add %rax,%r8
1440 adc %rdx,%r9
1441 movq 56(%rsp),%rax
1442 mulq 32(%rdi)
1443 add %rax,%r10
1444 adc %rdx,%r11
1445 movq 192(%rdi),%rax
1446 mulq 0(%rdi)
1447 add %rax,%r14
1448 adc %rdx,%r15
1449 movq 64(%rsp),%rax
1450 mulq 16(%rdi)
1451 add %rax,%r8
1452 adc %rdx,%r9
1453 movq 64(%rsp),%rax
1454 mulq 24(%rdi)
1455 add %rax,%r10
1456 adc %rdx,%r11
1457 movq 64(%rsp),%rax
1458 mulq 32(%rdi)
1459 add %rax,%r12
1460 adc %rdx,%r13
1461 movq x25519_x86_64_REDMASK51(%rip),%rdx
1462 shld $13,%rsi,%rcx
1463 and %rdx,%rsi
1464 shld $13,%r8,%r9
1465 and %rdx,%r8
1466 add %rcx,%r8
1467 shld $13,%r10,%r11
1468 and %rdx,%r10
1469 add %r9,%r10
1470 shld $13,%r12,%r13
1471 and %rdx,%r12
1472 add %r11,%r12
1473 shld $13,%r14,%r15
1474 and %rdx,%r14
1475 add %r13,%r14
1476 imulq $19,%r15,%rcx
1477 add %rcx,%rsi
1478 mov %rsi,%rcx
1479 shr $51,%rcx
1480 add %r8,%rcx
1481 mov %rcx,%r8
1482 shr $51,%rcx
1483 and %rdx,%rsi
1484 add %r10,%rcx
1485 mov %rcx,%r9
1486 shr $51,%rcx
1487 and %rdx,%r8
1488 add %r12,%rcx
1489 mov %rcx,%rax
1490 shr $51,%rcx
1491 and %rdx,%r9
1492 add %r14,%rcx
1493 mov %rcx,%r10
1494 shr $51,%rcx
1495 and %rdx,%rax
1496 imulq $19,%rcx,%rcx
1497 add %rcx,%rsi
1498 and %rdx,%r10
1499 movq %rsi,160(%rdi)
1500 movq %r8,168(%rdi)
1501 movq %r9,176(%rdi)
1502 movq %rax,184(%rdi)
1503 movq %r10,192(%rdi)
1504 movq 200(%rsp),%rsi
1505 imulq $19,%rsi,%rax
1506 movq %rax,56(%rsp)
1507 mulq 152(%rsp)
1508 mov %rax,%rsi
1509 mov %rdx,%rcx
1510 movq 208(%rsp),%rdx
1511 imulq $19,%rdx,%rax
1512 movq %rax,64(%rsp)
1513 mulq 144(%rsp)
1514 add %rax,%rsi
1515 adc %rdx,%rcx
1516 movq 176(%rsp),%rax
1517 mulq 136(%rsp)
1518 add %rax,%rsi
1519 adc %rdx,%rcx
1520 movq 176(%rsp),%rax
1521 mulq 144(%rsp)
1522 mov %rax,%r8
1523 mov %rdx,%r9
1524 movq 176(%rsp),%rax
1525 mulq 152(%rsp)
1526 mov %rax,%r10
1527 mov %rdx,%r11
1528 movq 176(%rsp),%rax
1529 mulq 160(%rsp)
1530 mov %rax,%r12
1531 mov %rdx,%r13
1532 movq 176(%rsp),%rax
1533 mulq 168(%rsp)
1534 mov %rax,%r14
1535 mov %rdx,%r15
1536 movq 184(%rsp),%rax
1537 mulq 136(%rsp)
1538 add %rax,%r8
1539 adc %rdx,%r9
1540 movq 184(%rsp),%rax
1541 mulq 144(%rsp)
1542 add %rax,%r10
1543 adc %rdx,%r11
1544 movq 184(%rsp),%rax
1545 mulq 152(%rsp)
1546 add %rax,%r12
1547 adc %rdx,%r13
1548 movq 184(%rsp),%rax
1549 mulq 160(%rsp)
1550 add %rax,%r14
1551 adc %rdx,%r15
1552 movq 184(%rsp),%rdx
1553 imulq $19,%rdx,%rax
1554 mulq 168(%rsp)
1555 add %rax,%rsi
1556 adc %rdx,%rcx
1557 movq 192(%rsp),%rax
1558 mulq 136(%rsp)
1559 add %rax,%r10
1560 adc %rdx,%r11
1561 movq 192(%rsp),%rax
1562 mulq 144(%rsp)
1563 add %rax,%r12
1564 adc %rdx,%r13
1565 movq 192(%rsp),%rax
1566 mulq 152(%rsp)
1567 add %rax,%r14
1568 adc %rdx,%r15
1569 movq 192(%rsp),%rdx
1570 imulq $19,%rdx,%rax
1571 mulq 160(%rsp)
1572 add %rax,%rsi
1573 adc %rdx,%rcx
1574 movq 192(%rsp),%rdx
1575 imulq $19,%rdx,%rax
1576 mulq 168(%rsp)
1577 add %rax,%r8
1578 adc %rdx,%r9
1579 movq 200(%rsp),%rax
1580 mulq 136(%rsp)
1581 add %rax,%r12
1582 adc %rdx,%r13
1583 movq 200(%rsp),%rax
1584 mulq 144(%rsp)
1585 add %rax,%r14
1586 adc %rdx,%r15
1587 movq 56(%rsp),%rax
1588 mulq 160(%rsp)
1589 add %rax,%r8
1590 adc %rdx,%r9
1591 movq 56(%rsp),%rax
1592 mulq 168(%rsp)
1593 add %rax,%r10
1594 adc %rdx,%r11
1595 movq 208(%rsp),%rax
1596 mulq 136(%rsp)
1597 add %rax,%r14
1598 adc %rdx,%r15
1599 movq 64(%rsp),%rax
1600 mulq 152(%rsp)
1601 add %rax,%r8
1602 adc %rdx,%r9
1603 movq 64(%rsp),%rax
1604 mulq 160(%rsp)
1605 add %rax,%r10
1606 adc %rdx,%r11
1607 movq 64(%rsp),%rax
1608 mulq 168(%rsp)
1609 add %rax,%r12
1610 adc %rdx,%r13
1611 movq x25519_x86_64_REDMASK51(%rip),%rdx
1612 shld $13,%rsi,%rcx
1613 and %rdx,%rsi
1614 shld $13,%r8,%r9
1615 and %rdx,%r8
1616 add %rcx,%r8
1617 shld $13,%r10,%r11
1618 and %rdx,%r10
1619 add %r9,%r10
1620 shld $13,%r12,%r13
1621 and %rdx,%r12
1622 add %r11,%r12
1623 shld $13,%r14,%r15
1624 and %rdx,%r14
1625 add %r13,%r14
1626 imulq $19,%r15,%rcx
1627 add %rcx,%rsi
1628 mov %rsi,%rcx
1629 shr $51,%rcx
1630 add %r8,%rcx
1631 mov %rcx,%r8
1632 shr $51,%rcx
1633 and %rdx,%rsi
1634 add %r10,%rcx
1635 mov %rcx,%r9
1636 shr $51,%rcx
1637 and %rdx,%r8
1638 add %r12,%rcx
1639 mov %rcx,%rax
1640 shr $51,%rcx
1641 and %rdx,%r9
1642 add %r14,%rcx
1643 mov %rcx,%r10
1644 shr $51,%rcx
1645 and %rdx,%rax
1646 imulq $19,%rcx,%rcx
1647 add %rcx,%rsi
1648 and %rdx,%r10
1649 movq %rsi,40(%rdi)
1650 movq %r8,48(%rdi)
1651 movq %r9,56(%rdi)
1652 movq %rax,64(%rdi)
1653 movq %r10,72(%rdi)
1654 movq 216(%rsp),%rax
1655 mulq x25519_x86_64_121666_213(%rip)
1656 shr $13,%rax
1657 mov %rax,%rsi
1658 mov %rdx,%rcx
1659 movq 224(%rsp),%rax
1660 mulq x25519_x86_64_121666_213(%rip)
1661 shr $13,%rax
1662 add %rax,%rcx
1663 mov %rdx,%r8
1664 movq 232(%rsp),%rax
1665 mulq x25519_x86_64_121666_213(%rip)
1666 shr $13,%rax
1667 add %rax,%r8
1668 mov %rdx,%r9
1669 movq 240(%rsp),%rax
1670 mulq x25519_x86_64_121666_213(%rip)
1671 shr $13,%rax
1672 add %rax,%r9
1673 mov %rdx,%r10
1674 movq 248(%rsp),%rax
1675 mulq x25519_x86_64_121666_213(%rip)
1676 shr $13,%rax
1677 add %rax,%r10
1678 imulq $19,%rdx,%rdx
1679 add %rdx,%rsi
1680 addq 136(%rsp),%rsi
1681 addq 144(%rsp),%rcx
1682 addq 152(%rsp),%r8
1683 addq 160(%rsp),%r9
1684 addq 168(%rsp),%r10
1685 movq %rsi,80(%rdi)
1686 movq %rcx,88(%rdi)
1687 movq %r8,96(%rdi)
1688 movq %r9,104(%rdi)
1689 movq %r10,112(%rdi)
1690 movq 104(%rdi),%rsi
1691 imulq $19,%rsi,%rax
1692 movq %rax,56(%rsp)
1693 mulq 232(%rsp)
1694 mov %rax,%rsi
1695 mov %rdx,%rcx
1696 movq 112(%rdi),%rdx
1697 imulq $19,%rdx,%rax
1698 movq %rax,64(%rsp)
1699 mulq 224(%rsp)
1700 add %rax,%rsi
1701 adc %rdx,%rcx
1702 movq 80(%rdi),%rax
1703 mulq 216(%rsp)
1704 add %rax,%rsi
1705 adc %rdx,%rcx
1706 movq 80(%rdi),%rax
1707 mulq 224(%rsp)
1708 mov %rax,%r8
1709 mov %rdx,%r9
1710 movq 80(%rdi),%rax
1711 mulq 232(%rsp)
1712 mov %rax,%r10
1713 mov %rdx,%r11
1714 movq 80(%rdi),%rax
1715 mulq 240(%rsp)
1716 mov %rax,%r12
1717 mov %rdx,%r13
1718 movq 80(%rdi),%rax
1719 mulq 248(%rsp)
1720 mov %rax,%r14
1721 mov %rdx,%r15
1722 movq 88(%rdi),%rax
1723 mulq 216(%rsp)
1724 add %rax,%r8
1725 adc %rdx,%r9
1726 movq 88(%rdi),%rax
1727 mulq 224(%rsp)
1728 add %rax,%r10
1729 adc %rdx,%r11
1730 movq 88(%rdi),%rax
1731 mulq 232(%rsp)
1732 add %rax,%r12
1733 adc %rdx,%r13
1734 movq 88(%rdi),%rax
1735 mulq 240(%rsp)
1736 add %rax,%r14
1737 adc %rdx,%r15
1738 movq 88(%rdi),%rdx
1739 imulq $19,%rdx,%rax
1740 mulq 248(%rsp)
1741 add %rax,%rsi
1742 adc %rdx,%rcx
1743 movq 96(%rdi),%rax
1744 mulq 216(%rsp)
1745 add %rax,%r10
1746 adc %rdx,%r11
1747 movq 96(%rdi),%rax
1748 mulq 224(%rsp)
1749 add %rax,%r12
1750 adc %rdx,%r13
1751 movq 96(%rdi),%rax
1752 mulq 232(%rsp)
1753 add %rax,%r14
1754 adc %rdx,%r15
1755 movq 96(%rdi),%rdx
1756 imulq $19,%rdx,%rax
1757 mulq 240(%rsp)
1758 add %rax,%rsi
1759 adc %rdx,%rcx
1760 movq 96(%rdi),%rdx
1761 imulq $19,%rdx,%rax
1762 mulq 248(%rsp)
1763 add %rax,%r8
1764 adc %rdx,%r9
1765 movq 104(%rdi),%rax
1766 mulq 216(%rsp)
1767 add %rax,%r12
1768 adc %rdx,%r13
1769 movq 104(%rdi),%rax
1770 mulq 224(%rsp)
1771 add %rax,%r14
1772 adc %rdx,%r15
1773 movq 56(%rsp),%rax
1774 mulq 240(%rsp)
1775 add %rax,%r8
1776 adc %rdx,%r9
1777 movq 56(%rsp),%rax
1778 mulq 248(%rsp)
1779 add %rax,%r10
1780 adc %rdx,%r11
1781 movq 112(%rdi),%rax
1782 mulq 216(%rsp)
1783 add %rax,%r14
1784 adc %rdx,%r15
1785 movq 64(%rsp),%rax
1786 mulq 232(%rsp)
1787 add %rax,%r8
1788 adc %rdx,%r9
1789 movq 64(%rsp),%rax
1790 mulq 240(%rsp)
1791 add %rax,%r10
1792 adc %rdx,%r11
1793 movq 64(%rsp),%rax
1794 mulq 248(%rsp)
1795 add %rax,%r12
1796 adc %rdx,%r13
1797 movq x25519_x86_64_REDMASK51(%rip),%rdx
1798 shld $13,%rsi,%rcx
1799 and %rdx,%rsi
1800 shld $13,%r8,%r9
1801 and %rdx,%r8
1802 add %rcx,%r8
1803 shld $13,%r10,%r11
1804 and %rdx,%r10
1805 add %r9,%r10
1806 shld $13,%r12,%r13
1807 and %rdx,%r12
1808 add %r11,%r12
1809 shld $13,%r14,%r15
1810 and %rdx,%r14
1811 add %r13,%r14
1812 imulq $19,%r15,%rcx
1813 add %rcx,%rsi
1814 mov %rsi,%rcx
1815 shr $51,%rcx
1816 add %r8,%rcx
1817 mov %rcx,%r8
1818 shr $51,%rcx
1819 and %rdx,%rsi
1820 add %r10,%rcx
1821 mov %rcx,%r9
1822 shr $51,%rcx
1823 and %rdx,%r8
1824 add %r12,%rcx
1825 mov %rcx,%rax
1826 shr $51,%rcx
1827 and %rdx,%r9
1828 add %r14,%rcx
1829 mov %rcx,%r10
1830 shr $51,%rcx
1831 and %rdx,%rax
1832 imulq $19,%rcx,%rcx
1833 add %rcx,%rsi
1834 and %rdx,%r10
1835 movq %rsi,80(%rdi)
1836 movq %r8,88(%rdi)
1837 movq %r9,96(%rdi)
1838 movq %rax,104(%rdi)
1839 movq %r10,112(%rdi)
1840 movq 0(%rsp),%r11
1841 movq 8(%rsp),%r12
1842 movq 16(%rsp),%r13
1843 movq 24(%rsp),%r14
1844 movq 32(%rsp),%r15
1845 movq 40(%rsp),%rbx
1846 movq 48(%rsp),%rbp
1847 add %r11,%rsp
1848 mov %rdi,%rax
1849 mov %rsi,%rdx
1850 ret
1851
1852 .p2align 5
1853 .globl C_ABI(x25519_x86_64_work_cswap)
1854 HIDDEN C_ABI(x25519_x86_64_work_cswap)
1855 C_ABI(x25519_x86_64_work_cswap):
1856 mov %rsp,%r11
1857 and $31,%r11
1858 add $0,%r11
1859 sub %r11,%rsp
1860 cmp $1,%rsi
1861 movq 0(%rdi),%rsi
1862 movq 80(%rdi),%rdx
1863 movq 8(%rdi),%rcx
1864 movq 88(%rdi),%r8
1865 mov %rsi,%r9
1866 cmove %rdx,%rsi
1867 cmove %r9,%rdx
1868 mov %rcx,%r9
1869 cmove %r8,%rcx
1870 cmove %r9,%r8
1871 movq %rsi,0(%rdi)
1872 movq %rdx,80(%rdi)
1873 movq %rcx,8(%rdi)
1874 movq %r8,88(%rdi)
1875 movq 16(%rdi),%rsi
1876 movq 96(%rdi),%rdx
1877 movq 24(%rdi),%rcx
1878 movq 104(%rdi),%r8
1879 mov %rsi,%r9
1880 cmove %rdx,%rsi
1881 cmove %r9,%rdx
1882 mov %rcx,%r9
1883 cmove %r8,%rcx
1884 cmove %r9,%r8
1885 movq %rsi,16(%rdi)
1886 movq %rdx,96(%rdi)
1887 movq %rcx,24(%rdi)
1888 movq %r8,104(%rdi)
1889 movq 32(%rdi),%rsi
1890 movq 112(%rdi),%rdx
1891 movq 40(%rdi),%rcx
1892 movq 120(%rdi),%r8
1893 mov %rsi,%r9
1894 cmove %rdx,%rsi
1895 cmove %r9,%rdx
1896 mov %rcx,%r9
1897 cmove %r8,%rcx
1898 cmove %r9,%r8
1899 movq %rsi,32(%rdi)
1900 movq %rdx,112(%rdi)
1901 movq %rcx,40(%rdi)
1902 movq %r8,120(%rdi)
1903 movq 48(%rdi),%rsi
1904 movq 128(%rdi),%rdx
1905 movq 56(%rdi),%rcx
1906 movq 136(%rdi),%r8
1907 mov %rsi,%r9
1908 cmove %rdx,%rsi
1909 cmove %r9,%rdx
1910 mov %rcx,%r9
1911 cmove %r8,%rcx
1912 cmove %r9,%r8
1913 movq %rsi,48(%rdi)
1914 movq %rdx,128(%rdi)
1915 movq %rcx,56(%rdi)
1916 movq %r8,136(%rdi)
1917 movq 64(%rdi),%rsi
1918 movq 144(%rdi),%rdx
1919 movq 72(%rdi),%rcx
1920 movq 152(%rdi),%r8
1921 mov %rsi,%r9
1922 cmove %rdx,%rsi
1923 cmove %r9,%rdx
1924 mov %rcx,%r9
1925 cmove %r8,%rcx
1926 cmove %r9,%r8
1927 movq %rsi,64(%rdi)
1928 movq %rdx,144(%rdi)
1929 movq %rcx,72(%rdi)
1930 movq %r8,152(%rdi)
1931 add %r11,%rsp
1932 mov %rdi,%rax
1933 mov %rsi,%rdx
1934 ret
1935
1936 #endif /* __x86_64__ */
1937 #endif /* !OPENSSL_NO_ASM */