Update files for OpenSSL-1.0.1 update.
[dragonfly.git] / secure / lib / libcrypto / asm / rc4-586.s
1 .file   "rc4-586.s"
2 .text
3 .globl  RC4
4 .type   RC4,@function
5 .align  16
6 RC4:
7 .L_RC4_begin:
8         pushl   %ebp
9         pushl   %ebx
10         pushl   %esi
11         pushl   %edi
12         movl    20(%esp),%edi
13         movl    24(%esp),%edx
14         movl    28(%esp),%esi
15         movl    32(%esp),%ebp
16         xorl    %eax,%eax
17         xorl    %ebx,%ebx
18         cmpl    $0,%edx
19         je      .L000abort
20         movb    (%edi),%al
21         movb    4(%edi),%bl
22         addl    $8,%edi
23         leal    (%esi,%edx,1),%ecx
24         subl    %esi,%ebp
25         movl    %ecx,24(%esp)
26         incb    %al
27         cmpl    $-1,256(%edi)
28         je      .L001RC4_CHAR
29         movl    (%edi,%eax,4),%ecx
30         andl    $-4,%edx
31         jz      .L002loop1
32         testl   $-8,%edx
33         movl    %ebp,32(%esp)
34         jz      .L003go4loop4
35         leal    OPENSSL_ia32cap_P,%ebp
36         btl     $26,(%ebp)
37         jnc     .L003go4loop4
38         movl    32(%esp),%ebp
39         andl    $-8,%edx
40         leal    -8(%esi,%edx,1),%edx
41         movl    %edx,-4(%edi)
42         addb    %cl,%bl
43         movl    (%edi,%ebx,4),%edx
44         movl    %ecx,(%edi,%ebx,4)
45         movl    %edx,(%edi,%eax,4)
46         incl    %eax
47         addl    %ecx,%edx
48         movzbl  %al,%eax
49         movzbl  %dl,%edx
50         movq    (%esi),%mm0
51         movl    (%edi,%eax,4),%ecx
52         movd    (%edi,%edx,4),%mm2
53         jmp     .L004loop_mmx_enter
54 .align  16
55 .L005loop_mmx:
56         addb    %cl,%bl
57         psllq   $56,%mm1
58         movl    (%edi,%ebx,4),%edx
59         movl    %ecx,(%edi,%ebx,4)
60         movl    %edx,(%edi,%eax,4)
61         incl    %eax
62         addl    %ecx,%edx
63         movzbl  %al,%eax
64         movzbl  %dl,%edx
65         pxor    %mm1,%mm2
66         movq    (%esi),%mm0
67         movq    %mm2,-8(%ebp,%esi,1)
68         movl    (%edi,%eax,4),%ecx
69         movd    (%edi,%edx,4),%mm2
70 .L004loop_mmx_enter:
71         addb    %cl,%bl
72         movl    (%edi,%ebx,4),%edx
73         movl    %ecx,(%edi,%ebx,4)
74         movl    %edx,(%edi,%eax,4)
75         incl    %eax
76         addl    %ecx,%edx
77         movzbl  %al,%eax
78         movzbl  %dl,%edx
79         pxor    %mm0,%mm2
80         movl    (%edi,%eax,4),%ecx
81         movd    (%edi,%edx,4),%mm1
82         addb    %cl,%bl
83         psllq   $8,%mm1
84         movl    (%edi,%ebx,4),%edx
85         movl    %ecx,(%edi,%ebx,4)
86         movl    %edx,(%edi,%eax,4)
87         incl    %eax
88         addl    %ecx,%edx
89         movzbl  %al,%eax
90         movzbl  %dl,%edx
91         pxor    %mm1,%mm2
92         movl    (%edi,%eax,4),%ecx
93         movd    (%edi,%edx,4),%mm1
94         addb    %cl,%bl
95         psllq   $16,%mm1
96         movl    (%edi,%ebx,4),%edx
97         movl    %ecx,(%edi,%ebx,4)
98         movl    %edx,(%edi,%eax,4)
99         incl    %eax
100         addl    %ecx,%edx
101         movzbl  %al,%eax
102         movzbl  %dl,%edx
103         pxor    %mm1,%mm2
104         movl    (%edi,%eax,4),%ecx
105         movd    (%edi,%edx,4),%mm1
106         addb    %cl,%bl
107         psllq   $24,%mm1
108         movl    (%edi,%ebx,4),%edx
109         movl    %ecx,(%edi,%ebx,4)
110         movl    %edx,(%edi,%eax,4)
111         incl    %eax
112         addl    %ecx,%edx
113         movzbl  %al,%eax
114         movzbl  %dl,%edx
115         pxor    %mm1,%mm2
116         movl    (%edi,%eax,4),%ecx
117         movd    (%edi,%edx,4),%mm1
118         addb    %cl,%bl
119         psllq   $32,%mm1
120         movl    (%edi,%ebx,4),%edx
121         movl    %ecx,(%edi,%ebx,4)
122         movl    %edx,(%edi,%eax,4)
123         incl    %eax
124         addl    %ecx,%edx
125         movzbl  %al,%eax
126         movzbl  %dl,%edx
127         pxor    %mm1,%mm2
128         movl    (%edi,%eax,4),%ecx
129         movd    (%edi,%edx,4),%mm1
130         addb    %cl,%bl
131         psllq   $40,%mm1
132         movl    (%edi,%ebx,4),%edx
133         movl    %ecx,(%edi,%ebx,4)
134         movl    %edx,(%edi,%eax,4)
135         incl    %eax
136         addl    %ecx,%edx
137         movzbl  %al,%eax
138         movzbl  %dl,%edx
139         pxor    %mm1,%mm2
140         movl    (%edi,%eax,4),%ecx
141         movd    (%edi,%edx,4),%mm1
142         addb    %cl,%bl
143         psllq   $48,%mm1
144         movl    (%edi,%ebx,4),%edx
145         movl    %ecx,(%edi,%ebx,4)
146         movl    %edx,(%edi,%eax,4)
147         incl    %eax
148         addl    %ecx,%edx
149         movzbl  %al,%eax
150         movzbl  %dl,%edx
151         pxor    %mm1,%mm2
152         movl    (%edi,%eax,4),%ecx
153         movd    (%edi,%edx,4),%mm1
154         movl    %ebx,%edx
155         xorl    %ebx,%ebx
156         movb    %dl,%bl
157         cmpl    -4(%edi),%esi
158         leal    8(%esi),%esi
159         jb      .L005loop_mmx
160         psllq   $56,%mm1
161         pxor    %mm1,%mm2
162         movq    %mm2,-8(%ebp,%esi,1)
163         emms
164         cmpl    24(%esp),%esi
165         je      .L006done
166         jmp     .L002loop1
167 .align  16
168 .L003go4loop4:
169         leal    -4(%esi,%edx,1),%edx
170         movl    %edx,28(%esp)
171 .L007loop4:
172         addb    %cl,%bl
173         movl    (%edi,%ebx,4),%edx
174         movl    %ecx,(%edi,%ebx,4)
175         movl    %edx,(%edi,%eax,4)
176         addl    %ecx,%edx
177         incb    %al
178         andl    $255,%edx
179         movl    (%edi,%eax,4),%ecx
180         movl    (%edi,%edx,4),%ebp
181         addb    %cl,%bl
182         movl    (%edi,%ebx,4),%edx
183         movl    %ecx,(%edi,%ebx,4)
184         movl    %edx,(%edi,%eax,4)
185         addl    %ecx,%edx
186         incb    %al
187         andl    $255,%edx
188         rorl    $8,%ebp
189         movl    (%edi,%eax,4),%ecx
190         orl     (%edi,%edx,4),%ebp
191         addb    %cl,%bl
192         movl    (%edi,%ebx,4),%edx
193         movl    %ecx,(%edi,%ebx,4)
194         movl    %edx,(%edi,%eax,4)
195         addl    %ecx,%edx
196         incb    %al
197         andl    $255,%edx
198         rorl    $8,%ebp
199         movl    (%edi,%eax,4),%ecx
200         orl     (%edi,%edx,4),%ebp
201         addb    %cl,%bl
202         movl    (%edi,%ebx,4),%edx
203         movl    %ecx,(%edi,%ebx,4)
204         movl    %edx,(%edi,%eax,4)
205         addl    %ecx,%edx
206         incb    %al
207         andl    $255,%edx
208         rorl    $8,%ebp
209         movl    32(%esp),%ecx
210         orl     (%edi,%edx,4),%ebp
211         rorl    $8,%ebp
212         xorl    (%esi),%ebp
213         cmpl    28(%esp),%esi
214         movl    %ebp,(%ecx,%esi,1)
215         leal    4(%esi),%esi
216         movl    (%edi,%eax,4),%ecx
217         jb      .L007loop4
218         cmpl    24(%esp),%esi
219         je      .L006done
220         movl    32(%esp),%ebp
221 .align  16
222 .L002loop1:
223         addb    %cl,%bl
224         movl    (%edi,%ebx,4),%edx
225         movl    %ecx,(%edi,%ebx,4)
226         movl    %edx,(%edi,%eax,4)
227         addl    %ecx,%edx
228         incb    %al
229         andl    $255,%edx
230         movl    (%edi,%edx,4),%edx
231         xorb    (%esi),%dl
232         leal    1(%esi),%esi
233         movl    (%edi,%eax,4),%ecx
234         cmpl    24(%esp),%esi
235         movb    %dl,-1(%ebp,%esi,1)
236         jb      .L002loop1
237         jmp     .L006done
238 .align  16
239 .L001RC4_CHAR:
240         movzbl  (%edi,%eax,1),%ecx
241 .L008cloop1:
242         addb    %cl,%bl
243         movzbl  (%edi,%ebx,1),%edx
244         movb    %cl,(%edi,%ebx,1)
245         movb    %dl,(%edi,%eax,1)
246         addb    %cl,%dl
247         movzbl  (%edi,%edx,1),%edx
248         addb    $1,%al
249         xorb    (%esi),%dl
250         leal    1(%esi),%esi
251         movzbl  (%edi,%eax,1),%ecx
252         cmpl    24(%esp),%esi
253         movb    %dl,-1(%ebp,%esi,1)
254         jb      .L008cloop1
255 .L006done:
256         decb    %al
257         movl    %ebx,-4(%edi)
258         movb    %al,-8(%edi)
259 .L000abort:
260         popl    %edi
261         popl    %esi
262         popl    %ebx
263         popl    %ebp
264         ret
265 .size   RC4,.-.L_RC4_begin
266 .globl  private_RC4_set_key
267 .type   private_RC4_set_key,@function
268 .align  16
269 private_RC4_set_key:
270 .L_private_RC4_set_key_begin:
271         pushl   %ebp
272         pushl   %ebx
273         pushl   %esi
274         pushl   %edi
275         movl    20(%esp),%edi
276         movl    24(%esp),%ebp
277         movl    28(%esp),%esi
278         leal    OPENSSL_ia32cap_P,%edx
279         leal    8(%edi),%edi
280         leal    (%esi,%ebp,1),%esi
281         negl    %ebp
282         xorl    %eax,%eax
283         movl    %ebp,-4(%edi)
284         btl     $20,(%edx)
285         jc      .L009c1stloop
286 .align  16
287 .L010w1stloop:
288         movl    %eax,(%edi,%eax,4)
289         addb    $1,%al
290         jnc     .L010w1stloop
291         xorl    %ecx,%ecx
292         xorl    %edx,%edx
293 .align  16
294 .L011w2ndloop:
295         movl    (%edi,%ecx,4),%eax
296         addb    (%esi,%ebp,1),%dl
297         addb    %al,%dl
298         addl    $1,%ebp
299         movl    (%edi,%edx,4),%ebx
300         jnz     .L012wnowrap
301         movl    -4(%edi),%ebp
302 .L012wnowrap:
303         movl    %eax,(%edi,%edx,4)
304         movl    %ebx,(%edi,%ecx,4)
305         addb    $1,%cl
306         jnc     .L011w2ndloop
307         jmp     .L013exit
308 .align  16
309 .L009c1stloop:
310         movb    %al,(%edi,%eax,1)
311         addb    $1,%al
312         jnc     .L009c1stloop
313         xorl    %ecx,%ecx
314         xorl    %edx,%edx
315         xorl    %ebx,%ebx
316 .align  16
317 .L014c2ndloop:
318         movb    (%edi,%ecx,1),%al
319         addb    (%esi,%ebp,1),%dl
320         addb    %al,%dl
321         addl    $1,%ebp
322         movb    (%edi,%edx,1),%bl
323         jnz     .L015cnowrap
324         movl    -4(%edi),%ebp
325 .L015cnowrap:
326         movb    %al,(%edi,%edx,1)
327         movb    %bl,(%edi,%ecx,1)
328         addb    $1,%cl
329         jnc     .L014c2ndloop
330         movl    $-1,256(%edi)
331 .L013exit:
332         xorl    %eax,%eax
333         movl    %eax,-8(%edi)
334         movl    %eax,-4(%edi)
335         popl    %edi
336         popl    %esi
337         popl    %ebx
338         popl    %ebp
339         ret
340 .size   private_RC4_set_key,.-.L_private_RC4_set_key_begin
341 .globl  RC4_options
342 .type   RC4_options,@function
343 .align  16
344 RC4_options:
345 .L_RC4_options_begin:
346         call    .L016pic_point
347 .L016pic_point:
348         popl    %eax
349         leal    .L017opts-.L016pic_point(%eax),%eax
350         leal    OPENSSL_ia32cap_P,%edx
351         movl    (%edx),%edx
352         btl     $20,%edx
353         jc      .L0181xchar
354         btl     $26,%edx
355         jnc     .L019ret
356         addl    $25,%eax
357         ret
358 .L0181xchar:
359         addl    $12,%eax
360 .L019ret:
361         ret
362 .align  64
363 .L017opts:
364 .byte   114,99,52,40,52,120,44,105,110,116,41,0
365 .byte   114,99,52,40,49,120,44,99,104,97,114,41,0
366 .byte   114,99,52,40,56,120,44,109,109,120,41,0
367 .byte   82,67,52,32,102,111,114,32,120,56,54,44,32,67,82,89
368 .byte   80,84,79,71,65,77,83,32,98,121,32,60,97,112,112,114
369 .byte   111,64,111,112,101,110,115,115,108,46,111,114,103,62,0
370 .align  64
371 .size   RC4_options,.-.L_RC4_options_begin
372 .comm   OPENSSL_ia32cap_P,8,4