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