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