VirtualBox

source: vbox/trunk/src/libs/openssl-1.1.1j/crypto/genasm-nasm/x86-mont.S@ 88461

Last change on this file since 88461 was 83531, checked in by vboxsync, 5 years ago

setting svn:sync-process=export for openssl-1.1.1f, all files except tests

File size: 6.4 KB
Line 
1%ifidn __OUTPUT_FORMAT__,obj
2section code use32 class=code align=64
3%elifidn __OUTPUT_FORMAT__,win32
4section .text code align=64
5%else
6section .text code
7%endif
8global _bn_mul_mont
9align 16
10_bn_mul_mont:
11L$_bn_mul_mont_begin:
12 push ebp
13 push ebx
14 push esi
15 push edi
16 xor eax,eax
17 mov edi,DWORD [40+esp]
18 cmp edi,4
19 jl NEAR L$000just_leave
20 lea esi,[20+esp]
21 lea edx,[24+esp]
22 add edi,2
23 neg edi
24 lea ebp,[edi*4+esp-32]
25 neg edi
26 mov eax,ebp
27 sub eax,edx
28 and eax,2047
29 sub ebp,eax
30 xor edx,ebp
31 and edx,2048
32 xor edx,2048
33 sub ebp,edx
34 and ebp,-64
35 mov eax,esp
36 sub eax,ebp
37 and eax,-4096
38 mov edx,esp
39 lea esp,[eax*1+ebp]
40 mov eax,DWORD [esp]
41 cmp esp,ebp
42 ja NEAR L$001page_walk
43 jmp NEAR L$002page_walk_done
44align 16
45L$001page_walk:
46 lea esp,[esp-4096]
47 mov eax,DWORD [esp]
48 cmp esp,ebp
49 ja NEAR L$001page_walk
50L$002page_walk_done:
51 mov eax,DWORD [esi]
52 mov ebx,DWORD [4+esi]
53 mov ecx,DWORD [8+esi]
54 mov ebp,DWORD [12+esi]
55 mov esi,DWORD [16+esi]
56 mov esi,DWORD [esi]
57 mov DWORD [4+esp],eax
58 mov DWORD [8+esp],ebx
59 mov DWORD [12+esp],ecx
60 mov DWORD [16+esp],ebp
61 mov DWORD [20+esp],esi
62 lea ebx,[edi-3]
63 mov DWORD [24+esp],edx
64 mov esi,DWORD [8+esp]
65 lea ebp,[1+ebx]
66 mov edi,DWORD [12+esp]
67 xor ecx,ecx
68 mov edx,esi
69 and ebp,1
70 sub edx,edi
71 lea eax,[4+ebx*4+edi]
72 or ebp,edx
73 mov edi,DWORD [edi]
74 jz NEAR L$003bn_sqr_mont
75 mov DWORD [28+esp],eax
76 mov eax,DWORD [esi]
77 xor edx,edx
78align 16
79L$004mull:
80 mov ebp,edx
81 mul edi
82 add ebp,eax
83 lea ecx,[1+ecx]
84 adc edx,0
85 mov eax,DWORD [ecx*4+esi]
86 cmp ecx,ebx
87 mov DWORD [28+ecx*4+esp],ebp
88 jl NEAR L$004mull
89 mov ebp,edx
90 mul edi
91 mov edi,DWORD [20+esp]
92 add eax,ebp
93 mov esi,DWORD [16+esp]
94 adc edx,0
95 imul edi,DWORD [32+esp]
96 mov DWORD [32+ebx*4+esp],eax
97 xor ecx,ecx
98 mov DWORD [36+ebx*4+esp],edx
99 mov DWORD [40+ebx*4+esp],ecx
100 mov eax,DWORD [esi]
101 mul edi
102 add eax,DWORD [32+esp]
103 mov eax,DWORD [4+esi]
104 adc edx,0
105 inc ecx
106 jmp NEAR L$0052ndmadd
107align 16
108L$0061stmadd:
109 mov ebp,edx
110 mul edi
111 add ebp,DWORD [32+ecx*4+esp]
112 lea ecx,[1+ecx]
113 adc edx,0
114 add ebp,eax
115 mov eax,DWORD [ecx*4+esi]
116 adc edx,0
117 cmp ecx,ebx
118 mov DWORD [28+ecx*4+esp],ebp
119 jl NEAR L$0061stmadd
120 mov ebp,edx
121 mul edi
122 add eax,DWORD [32+ebx*4+esp]
123 mov edi,DWORD [20+esp]
124 adc edx,0
125 mov esi,DWORD [16+esp]
126 add ebp,eax
127 adc edx,0
128 imul edi,DWORD [32+esp]
129 xor ecx,ecx
130 add edx,DWORD [36+ebx*4+esp]
131 mov DWORD [32+ebx*4+esp],ebp
132 adc ecx,0
133 mov eax,DWORD [esi]
134 mov DWORD [36+ebx*4+esp],edx
135 mov DWORD [40+ebx*4+esp],ecx
136 mul edi
137 add eax,DWORD [32+esp]
138 mov eax,DWORD [4+esi]
139 adc edx,0
140 mov ecx,1
141align 16
142L$0052ndmadd:
143 mov ebp,edx
144 mul edi
145 add ebp,DWORD [32+ecx*4+esp]
146 lea ecx,[1+ecx]
147 adc edx,0
148 add ebp,eax
149 mov eax,DWORD [ecx*4+esi]
150 adc edx,0
151 cmp ecx,ebx
152 mov DWORD [24+ecx*4+esp],ebp
153 jl NEAR L$0052ndmadd
154 mov ebp,edx
155 mul edi
156 add ebp,DWORD [32+ebx*4+esp]
157 adc edx,0
158 add ebp,eax
159 adc edx,0
160 mov DWORD [28+ebx*4+esp],ebp
161 xor eax,eax
162 mov ecx,DWORD [12+esp]
163 add edx,DWORD [36+ebx*4+esp]
164 adc eax,DWORD [40+ebx*4+esp]
165 lea ecx,[4+ecx]
166 mov DWORD [32+ebx*4+esp],edx
167 cmp ecx,DWORD [28+esp]
168 mov DWORD [36+ebx*4+esp],eax
169 je NEAR L$007common_tail
170 mov edi,DWORD [ecx]
171 mov esi,DWORD [8+esp]
172 mov DWORD [12+esp],ecx
173 xor ecx,ecx
174 xor edx,edx
175 mov eax,DWORD [esi]
176 jmp NEAR L$0061stmadd
177align 16
178L$003bn_sqr_mont:
179 mov DWORD [esp],ebx
180 mov DWORD [12+esp],ecx
181 mov eax,edi
182 mul edi
183 mov DWORD [32+esp],eax
184 mov ebx,edx
185 shr edx,1
186 and ebx,1
187 inc ecx
188align 16
189L$008sqr:
190 mov eax,DWORD [ecx*4+esi]
191 mov ebp,edx
192 mul edi
193 add eax,ebp
194 lea ecx,[1+ecx]
195 adc edx,0
196 lea ebp,[eax*2+ebx]
197 shr eax,31
198 cmp ecx,DWORD [esp]
199 mov ebx,eax
200 mov DWORD [28+ecx*4+esp],ebp
201 jl NEAR L$008sqr
202 mov eax,DWORD [ecx*4+esi]
203 mov ebp,edx
204 mul edi
205 add eax,ebp
206 mov edi,DWORD [20+esp]
207 adc edx,0
208 mov esi,DWORD [16+esp]
209 lea ebp,[eax*2+ebx]
210 imul edi,DWORD [32+esp]
211 shr eax,31
212 mov DWORD [32+ecx*4+esp],ebp
213 lea ebp,[edx*2+eax]
214 mov eax,DWORD [esi]
215 shr edx,31
216 mov DWORD [36+ecx*4+esp],ebp
217 mov DWORD [40+ecx*4+esp],edx
218 mul edi
219 add eax,DWORD [32+esp]
220 mov ebx,ecx
221 adc edx,0
222 mov eax,DWORD [4+esi]
223 mov ecx,1
224align 16
225L$0093rdmadd:
226 mov ebp,edx
227 mul edi
228 add ebp,DWORD [32+ecx*4+esp]
229 adc edx,0
230 add ebp,eax
231 mov eax,DWORD [4+ecx*4+esi]
232 adc edx,0
233 mov DWORD [28+ecx*4+esp],ebp
234 mov ebp,edx
235 mul edi
236 add ebp,DWORD [36+ecx*4+esp]
237 lea ecx,[2+ecx]
238 adc edx,0
239 add ebp,eax
240 mov eax,DWORD [ecx*4+esi]
241 adc edx,0
242 cmp ecx,ebx
243 mov DWORD [24+ecx*4+esp],ebp
244 jl NEAR L$0093rdmadd
245 mov ebp,edx
246 mul edi
247 add ebp,DWORD [32+ebx*4+esp]
248 adc edx,0
249 add ebp,eax
250 adc edx,0
251 mov DWORD [28+ebx*4+esp],ebp
252 mov ecx,DWORD [12+esp]
253 xor eax,eax
254 mov esi,DWORD [8+esp]
255 add edx,DWORD [36+ebx*4+esp]
256 adc eax,DWORD [40+ebx*4+esp]
257 mov DWORD [32+ebx*4+esp],edx
258 cmp ecx,ebx
259 mov DWORD [36+ebx*4+esp],eax
260 je NEAR L$007common_tail
261 mov edi,DWORD [4+ecx*4+esi]
262 lea ecx,[1+ecx]
263 mov eax,edi
264 mov DWORD [12+esp],ecx
265 mul edi
266 add eax,DWORD [32+ecx*4+esp]
267 adc edx,0
268 mov DWORD [32+ecx*4+esp],eax
269 xor ebp,ebp
270 cmp ecx,ebx
271 lea ecx,[1+ecx]
272 je NEAR L$010sqrlast
273 mov ebx,edx
274 shr edx,1
275 and ebx,1
276align 16
277L$011sqradd:
278 mov eax,DWORD [ecx*4+esi]
279 mov ebp,edx
280 mul edi
281 add eax,ebp
282 lea ebp,[eax*1+eax]
283 adc edx,0
284 shr eax,31
285 add ebp,DWORD [32+ecx*4+esp]
286 lea ecx,[1+ecx]
287 adc eax,0
288 add ebp,ebx
289 adc eax,0
290 cmp ecx,DWORD [esp]
291 mov DWORD [28+ecx*4+esp],ebp
292 mov ebx,eax
293 jle NEAR L$011sqradd
294 mov ebp,edx
295 add edx,edx
296 shr ebp,31
297 add edx,ebx
298 adc ebp,0
299L$010sqrlast:
300 mov edi,DWORD [20+esp]
301 mov esi,DWORD [16+esp]
302 imul edi,DWORD [32+esp]
303 add edx,DWORD [32+ecx*4+esp]
304 mov eax,DWORD [esi]
305 adc ebp,0
306 mov DWORD [32+ecx*4+esp],edx
307 mov DWORD [36+ecx*4+esp],ebp
308 mul edi
309 add eax,DWORD [32+esp]
310 lea ebx,[ecx-1]
311 adc edx,0
312 mov ecx,1
313 mov eax,DWORD [4+esi]
314 jmp NEAR L$0093rdmadd
315align 16
316L$007common_tail:
317 mov ebp,DWORD [16+esp]
318 mov edi,DWORD [4+esp]
319 lea esi,[32+esp]
320 mov eax,DWORD [esi]
321 mov ecx,ebx
322 xor edx,edx
323align 16
324L$012sub:
325 sbb eax,DWORD [edx*4+ebp]
326 mov DWORD [edx*4+edi],eax
327 dec ecx
328 mov eax,DWORD [4+edx*4+esi]
329 lea edx,[1+edx]
330 jge NEAR L$012sub
331 sbb eax,0
332 mov edx,-1
333 xor edx,eax
334 jmp NEAR L$013copy
335align 16
336L$013copy:
337 mov esi,DWORD [32+ebx*4+esp]
338 mov ebp,DWORD [ebx*4+edi]
339 mov DWORD [32+ebx*4+esp],ecx
340 and esi,eax
341 and ebp,edx
342 or ebp,esi
343 mov DWORD [ebx*4+edi],ebp
344 dec ebx
345 jge NEAR L$013copy
346 mov esp,DWORD [24+esp]
347 mov eax,1
348L$000just_leave:
349 pop edi
350 pop esi
351 pop ebx
352 pop ebp
353 ret
354db 77,111,110,116,103,111,109,101,114,121,32,77,117,108,116,105
355db 112,108,105,99,97,116,105,111,110,32,102,111,114,32,120,56
356db 54,44,32,67,82,89,80,84,79,71,65,77,83,32,98,121
357db 32,60,97,112,112,114,111,64,111,112,101,110,115,115,108,46
358db 111,114,103,62,0
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette