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