Correct PPTP server firewall rules chain.
[tomato/davidwu.git] / release / src / router / nettle / x86_64 / ecc-521-modp.asm
blobafe3d2aa52cde0fc0a65fd7733c4b0792bebfd52
1 C nettle, low-level cryptographics library
3 C Copyright (C) 2013 Niels Möller
5 C The nettle library is free software; you can redistribute it and/or modify
6 C it under the terms of the GNU Lesser General Public License as published by
7 C the Free Software Foundation; either version 2.1 of the License, or (at your
8 C option) any later version.
10 C The nettle library is distributed in the hope that it will be useful, but
11 C WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 C or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
13 C License for more details.
15 C You should have received a copy of the GNU Lesser General Public License
16 C along with the nettle library; see the file COPYING.LIB. If not, write to
17 C the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18 C MA 02111-1301, USA.
20 .file "ecc-521-modp.asm"
22 define(<RP>, <%rsi>)
23 define(<U0>, <%rax>)
24 define(<U1>, <%rbx>)
25 define(<U2>, <%rcx>)
26 define(<U3>, <%rdx>)
27 define(<U4>, <%rbp>)
28 define(<U5>, <%rdi>)
29 define(<U6>, <%r8>)
30 define(<U7>, <%r9>)
31 define(<U8>, <%r10>)
32 define(<U9>, <%r11>)
33 define(<T0>, <%r12>)
34 define(<T1>, <%r13>)
36 PROLOGUE(nettle_ecc_521_modp)
37 W64_ENTRY(2, 0)
38 push %rbx
39 push %rbp
40 push %r12
41 push %r13
43 C Read top 17 limbs, shift left 55 bits
44 mov 72(RP), U1
45 mov U1, U0
46 shl $55, U0
47 shr $9, U1
49 mov 80(RP), U2
50 mov U2, T0
51 shr $9, U2
52 shl $55, T0
53 or T0, U1
55 mov 88(RP), U3
56 mov U3, T0
57 shr $9, U3
58 shl $55, T0
59 or T0, U2
61 mov 96(RP), U4
62 mov U4, T0
63 shr $9, U4
64 shl $55, T0
65 or T0, U3
67 mov 104(RP), U5
68 mov U5, T0
69 shr $9, U5
70 shl $55, T0
71 or T0, U4
73 mov 112(RP), U6
74 mov U6, T0
75 shr $9, U6
76 shl $55, T0
77 or T0, U5
79 mov 120(RP), U7
80 mov U7, T0
81 shr $9, U7
82 shl $55, T0
83 or T0, U6
85 mov 128(RP), U8
86 mov U8, T0
87 shr $9, U8
88 shl $55, T0
89 or T0, U7
91 mov 136(RP), U9
92 mov U9, T0
93 shr $9, U9
94 shl $55, T0
95 or T0, U8
97 add (RP), U0
98 adc 8(RP), U1
99 adc 16(RP), U2
100 adc 24(RP), U3
101 adc 32(RP), U4
102 adc 40(RP), U5
103 adc 48(RP), U6
104 adc 56(RP), U7
105 adc 64(RP), U8
106 adc $0, U9
108 C Top limbs are <U9, U8>. Keep low 9 bits of 8, and fold the
109 C top bits (at most 65 bits).
110 mov U8, T0
111 shr $9, T0
112 and $0x1ff, U8
113 mov U9, T1
114 shl $55, U9
115 shr $9, T1
116 or U9, T0
118 add T0, U0
119 mov U0, (RP)
120 adc T1, U1
121 mov U1, 8(RP)
122 adc $0, U2
123 mov U2, 16(RP)
124 adc $0, U3
125 mov U3, 24(RP)
126 adc $0, U4
127 mov U4, 32(RP)
128 adc $0, U5
129 mov U5, 40(RP)
130 adc $0, U6
131 mov U6, 48(RP)
132 adc $0, U7
133 mov U7, 56(RP)
134 adc $0, U8
135 mov U8, 64(RP)
137 pop %r13
138 pop %r12
139 pop %rbp
140 pop %rbx
141 W64_EXIT(2, 0)
143 EPILOGUE(nettle_ecc_521_modp)