rc5-586.s revision 267654
1285163Sdim	# $FreeBSD: releng/9.3/secure/lib/libcrypto/i386/rc5-586.s 127326 2004-03-23 08:32:29Z markm $
2285163Sdim
3353358Sdim
4353358Sdim
5353358Sdim
6285163Sdim
7285163Sdim
8285163Sdim	.file	"rc5-586.s"
9285163Sdim	.version	"01.01"
10341825Sdimgcc2_compiled.:
11285163Sdim.text
12285163Sdim	.align 16
13285163Sdim.globl RC5_32_encrypt
14285163Sdim	.type	RC5_32_encrypt,@function
15285163SdimRC5_32_encrypt:
16285163Sdim
17285163Sdim	pushl	%ebp
18285163Sdim	pushl	%esi
19285163Sdim	pushl	%edi
20285163Sdim	movl	16(%esp),	%edx
21285163Sdim	movl	20(%esp),	%ebp
22285163Sdim
23285163Sdim	movl	(%edx),		%edi
24344779Sdim	movl	4(%edx),	%esi
25285163Sdim	pushl	%ebx
26285163Sdim	movl	(%ebp),		%ebx
27285163Sdim	addl	4(%ebp),	%edi
28285163Sdim	addl	8(%ebp),	%esi
29285163Sdim	xorl	%esi,		%edi
30285163Sdim	movl	12(%ebp),	%eax
31285163Sdim	movl	%esi,		%ecx
32286684Sdim	roll	%cl,		%edi
33286684Sdim	addl	%eax,		%edi
34286684Sdim	xorl	%edi,		%esi
35286684Sdim	movl	16(%ebp),	%eax
36286684Sdim	movl	%edi,		%ecx
37286684Sdim	roll	%cl,		%esi
38286684Sdim	addl	%eax,		%esi
39286684Sdim	xorl	%esi,		%edi
40286684Sdim	movl	20(%ebp),	%eax
41286684Sdim	movl	%esi,		%ecx
42286684Sdim	roll	%cl,		%edi
43286684Sdim	addl	%eax,		%edi
44286684Sdim	xorl	%edi,		%esi
45296417Sdim	movl	24(%ebp),	%eax
46286684Sdim	movl	%edi,		%ecx
47286684Sdim	roll	%cl,		%esi
48286684Sdim	addl	%eax,		%esi
49286684Sdim	xorl	%esi,		%edi
50286684Sdim	movl	28(%ebp),	%eax
51286684Sdim	movl	%esi,		%ecx
52286684Sdim	roll	%cl,		%edi
53286684Sdim	addl	%eax,		%edi
54309124Sdim	xorl	%edi,		%esi
55309124Sdim	movl	32(%ebp),	%eax
56296417Sdim	movl	%edi,		%ecx
57296417Sdim	roll	%cl,		%esi
58296417Sdim	addl	%eax,		%esi
59296417Sdim	xorl	%esi,		%edi
60296417Sdim	movl	36(%ebp),	%eax
61309124Sdim	movl	%esi,		%ecx
62296417Sdim	roll	%cl,		%edi
63314564Sdim	addl	%eax,		%edi
64296417Sdim	xorl	%edi,		%esi
65296417Sdim	movl	40(%ebp),	%eax
66314564Sdim	movl	%edi,		%ecx
67314564Sdim	roll	%cl,		%esi
68314564Sdim	addl	%eax,		%esi
69353358Sdim	xorl	%esi,		%edi
70314564Sdim	movl	44(%ebp),	%eax
71309124Sdim	movl	%esi,		%ecx
72309124Sdim	roll	%cl,		%edi
73353358Sdim	addl	%eax,		%edi
74353358Sdim	xorl	%edi,		%esi
75353358Sdim	movl	48(%ebp),	%eax
76353358Sdim	movl	%edi,		%ecx
77353358Sdim	roll	%cl,		%esi
78353358Sdim	addl	%eax,		%esi
79353358Sdim	xorl	%esi,		%edi
80296417Sdim	movl	52(%ebp),	%eax
81309124Sdim	movl	%esi,		%ecx
82353358Sdim	roll	%cl,		%edi
83309124Sdim	addl	%eax,		%edi
84353358Sdim	xorl	%edi,		%esi
85309124Sdim	movl	56(%ebp),	%eax
86296417Sdim	movl	%edi,		%ecx
87309124Sdim	roll	%cl,		%esi
88296417Sdim	addl	%eax,		%esi
89309124Sdim	xorl	%esi,		%edi
90309124Sdim	movl	60(%ebp),	%eax
91309124Sdim	movl	%esi,		%ecx
92309124Sdim	roll	%cl,		%edi
93309124Sdim	addl	%eax,		%edi
94360784Sdim	xorl	%edi,		%esi
95360784Sdim	movl	64(%ebp),	%eax
96309124Sdim	movl	%edi,		%ecx
97309124Sdim	roll	%cl,		%esi
98309124Sdim	addl	%eax,		%esi
99309124Sdim	xorl	%esi,		%edi
100309124Sdim	movl	68(%ebp),	%eax
101309124Sdim	movl	%esi,		%ecx
102309124Sdim	roll	%cl,		%edi
103309124Sdim	addl	%eax,		%edi
104309124Sdim	xorl	%edi,		%esi
105353358Sdim	movl	72(%ebp),	%eax
106309124Sdim	movl	%edi,		%ecx
107309124Sdim	roll	%cl,		%esi
108309124Sdim	addl	%eax,		%esi
109309124Sdim	cmpl	$8,		%ebx
110309124Sdim	je	.L000rc5_exit
111309124Sdim	xorl	%esi,		%edi
112309124Sdim	movl	76(%ebp),	%eax
113309124Sdim	movl	%esi,		%ecx
114309124Sdim	roll	%cl,		%edi
115314564Sdim	addl	%eax,		%edi
116309124Sdim	xorl	%edi,		%esi
117309124Sdim	movl	80(%ebp),	%eax
118309124Sdim	movl	%edi,		%ecx
119309124Sdim	roll	%cl,		%esi
120360784Sdim	addl	%eax,		%esi
121309124Sdim	xorl	%esi,		%edi
122309124Sdim	movl	84(%ebp),	%eax
123296417Sdim	movl	%esi,		%ecx
124309124Sdim	roll	%cl,		%edi
125309124Sdim	addl	%eax,		%edi
126309124Sdim	xorl	%edi,		%esi
127314564Sdim	movl	88(%ebp),	%eax
128309124Sdim	movl	%edi,		%ecx
129296417Sdim	roll	%cl,		%esi
130353358Sdim	addl	%eax,		%esi
131286684Sdim	xorl	%esi,		%edi
132286684Sdim	movl	92(%ebp),	%eax
133353358Sdim	movl	%esi,		%ecx
134286684Sdim	roll	%cl,		%edi
135286684Sdim	addl	%eax,		%edi
136286684Sdim	xorl	%edi,		%esi
137286684Sdim	movl	96(%ebp),	%eax
138286684Sdim	movl	%edi,		%ecx
139286684Sdim	roll	%cl,		%esi
140286684Sdim	addl	%eax,		%esi
141286684Sdim	xorl	%esi,		%edi
142286684Sdim	movl	100(%ebp),	%eax
143296417Sdim	movl	%esi,		%ecx
144296417Sdim	roll	%cl,		%edi
145296417Sdim	addl	%eax,		%edi
146296417Sdim	xorl	%edi,		%esi
147296417Sdim	movl	104(%ebp),	%eax
148296417Sdim	movl	%edi,		%ecx
149296417Sdim	roll	%cl,		%esi
150286684Sdim	addl	%eax,		%esi
151	cmpl	$12,		%ebx
152	je	.L000rc5_exit
153	xorl	%esi,		%edi
154	movl	108(%ebp),	%eax
155	movl	%esi,		%ecx
156	roll	%cl,		%edi
157	addl	%eax,		%edi
158	xorl	%edi,		%esi
159	movl	112(%ebp),	%eax
160	movl	%edi,		%ecx
161	roll	%cl,		%esi
162	addl	%eax,		%esi
163	xorl	%esi,		%edi
164	movl	116(%ebp),	%eax
165	movl	%esi,		%ecx
166	roll	%cl,		%edi
167	addl	%eax,		%edi
168	xorl	%edi,		%esi
169	movl	120(%ebp),	%eax
170	movl	%edi,		%ecx
171	roll	%cl,		%esi
172	addl	%eax,		%esi
173	xorl	%esi,		%edi
174	movl	124(%ebp),	%eax
175	movl	%esi,		%ecx
176	roll	%cl,		%edi
177	addl	%eax,		%edi
178	xorl	%edi,		%esi
179	movl	128(%ebp),	%eax
180	movl	%edi,		%ecx
181	roll	%cl,		%esi
182	addl	%eax,		%esi
183	xorl	%esi,		%edi
184	movl	132(%ebp),	%eax
185	movl	%esi,		%ecx
186	roll	%cl,		%edi
187	addl	%eax,		%edi
188	xorl	%edi,		%esi
189	movl	136(%ebp),	%eax
190	movl	%edi,		%ecx
191	roll	%cl,		%esi
192	addl	%eax,		%esi
193.L000rc5_exit:
194	movl	%edi,		(%edx)
195	movl	%esi,		4(%edx)
196	popl	%ebx
197	popl	%edi
198	popl	%esi
199	popl	%ebp
200	ret
201.L_RC5_32_encrypt_end:
202	.size	RC5_32_encrypt,.L_RC5_32_encrypt_end-RC5_32_encrypt
203.ident	"desasm.pl"
204.text
205	.align 16
206.globl RC5_32_decrypt
207	.type	RC5_32_decrypt,@function
208RC5_32_decrypt:
209
210	pushl	%ebp
211	pushl	%esi
212	pushl	%edi
213	movl	16(%esp),	%edx
214	movl	20(%esp),	%ebp
215
216	movl	(%edx),		%edi
217	movl	4(%edx),	%esi
218	pushl	%ebx
219	movl	(%ebp),		%ebx
220	cmpl	$12,		%ebx
221	je	.L001rc5_dec_12
222	cmpl	$8,		%ebx
223	je	.L002rc5_dec_8
224	movl	136(%ebp),	%eax
225	subl	%eax,		%esi
226	movl	%edi,		%ecx
227	rorl	%cl,		%esi
228	xorl	%edi,		%esi
229	movl	132(%ebp),	%eax
230	subl	%eax,		%edi
231	movl	%esi,		%ecx
232	rorl	%cl,		%edi
233	xorl	%esi,		%edi
234	movl	128(%ebp),	%eax
235	subl	%eax,		%esi
236	movl	%edi,		%ecx
237	rorl	%cl,		%esi
238	xorl	%edi,		%esi
239	movl	124(%ebp),	%eax
240	subl	%eax,		%edi
241	movl	%esi,		%ecx
242	rorl	%cl,		%edi
243	xorl	%esi,		%edi
244	movl	120(%ebp),	%eax
245	subl	%eax,		%esi
246	movl	%edi,		%ecx
247	rorl	%cl,		%esi
248	xorl	%edi,		%esi
249	movl	116(%ebp),	%eax
250	subl	%eax,		%edi
251	movl	%esi,		%ecx
252	rorl	%cl,		%edi
253	xorl	%esi,		%edi
254	movl	112(%ebp),	%eax
255	subl	%eax,		%esi
256	movl	%edi,		%ecx
257	rorl	%cl,		%esi
258	xorl	%edi,		%esi
259	movl	108(%ebp),	%eax
260	subl	%eax,		%edi
261	movl	%esi,		%ecx
262	rorl	%cl,		%edi
263	xorl	%esi,		%edi
264.L001rc5_dec_12:
265	movl	104(%ebp),	%eax
266	subl	%eax,		%esi
267	movl	%edi,		%ecx
268	rorl	%cl,		%esi
269	xorl	%edi,		%esi
270	movl	100(%ebp),	%eax
271	subl	%eax,		%edi
272	movl	%esi,		%ecx
273	rorl	%cl,		%edi
274	xorl	%esi,		%edi
275	movl	96(%ebp),	%eax
276	subl	%eax,		%esi
277	movl	%edi,		%ecx
278	rorl	%cl,		%esi
279	xorl	%edi,		%esi
280	movl	92(%ebp),	%eax
281	subl	%eax,		%edi
282	movl	%esi,		%ecx
283	rorl	%cl,		%edi
284	xorl	%esi,		%edi
285	movl	88(%ebp),	%eax
286	subl	%eax,		%esi
287	movl	%edi,		%ecx
288	rorl	%cl,		%esi
289	xorl	%edi,		%esi
290	movl	84(%ebp),	%eax
291	subl	%eax,		%edi
292	movl	%esi,		%ecx
293	rorl	%cl,		%edi
294	xorl	%esi,		%edi
295	movl	80(%ebp),	%eax
296	subl	%eax,		%esi
297	movl	%edi,		%ecx
298	rorl	%cl,		%esi
299	xorl	%edi,		%esi
300	movl	76(%ebp),	%eax
301	subl	%eax,		%edi
302	movl	%esi,		%ecx
303	rorl	%cl,		%edi
304	xorl	%esi,		%edi
305.L002rc5_dec_8:
306	movl	72(%ebp),	%eax
307	subl	%eax,		%esi
308	movl	%edi,		%ecx
309	rorl	%cl,		%esi
310	xorl	%edi,		%esi
311	movl	68(%ebp),	%eax
312	subl	%eax,		%edi
313	movl	%esi,		%ecx
314	rorl	%cl,		%edi
315	xorl	%esi,		%edi
316	movl	64(%ebp),	%eax
317	subl	%eax,		%esi
318	movl	%edi,		%ecx
319	rorl	%cl,		%esi
320	xorl	%edi,		%esi
321	movl	60(%ebp),	%eax
322	subl	%eax,		%edi
323	movl	%esi,		%ecx
324	rorl	%cl,		%edi
325	xorl	%esi,		%edi
326	movl	56(%ebp),	%eax
327	subl	%eax,		%esi
328	movl	%edi,		%ecx
329	rorl	%cl,		%esi
330	xorl	%edi,		%esi
331	movl	52(%ebp),	%eax
332	subl	%eax,		%edi
333	movl	%esi,		%ecx
334	rorl	%cl,		%edi
335	xorl	%esi,		%edi
336	movl	48(%ebp),	%eax
337	subl	%eax,		%esi
338	movl	%edi,		%ecx
339	rorl	%cl,		%esi
340	xorl	%edi,		%esi
341	movl	44(%ebp),	%eax
342	subl	%eax,		%edi
343	movl	%esi,		%ecx
344	rorl	%cl,		%edi
345	xorl	%esi,		%edi
346	movl	40(%ebp),	%eax
347	subl	%eax,		%esi
348	movl	%edi,		%ecx
349	rorl	%cl,		%esi
350	xorl	%edi,		%esi
351	movl	36(%ebp),	%eax
352	subl	%eax,		%edi
353	movl	%esi,		%ecx
354	rorl	%cl,		%edi
355	xorl	%esi,		%edi
356	movl	32(%ebp),	%eax
357	subl	%eax,		%esi
358	movl	%edi,		%ecx
359	rorl	%cl,		%esi
360	xorl	%edi,		%esi
361	movl	28(%ebp),	%eax
362	subl	%eax,		%edi
363	movl	%esi,		%ecx
364	rorl	%cl,		%edi
365	xorl	%esi,		%edi
366	movl	24(%ebp),	%eax
367	subl	%eax,		%esi
368	movl	%edi,		%ecx
369	rorl	%cl,		%esi
370	xorl	%edi,		%esi
371	movl	20(%ebp),	%eax
372	subl	%eax,		%edi
373	movl	%esi,		%ecx
374	rorl	%cl,		%edi
375	xorl	%esi,		%edi
376	movl	16(%ebp),	%eax
377	subl	%eax,		%esi
378	movl	%edi,		%ecx
379	rorl	%cl,		%esi
380	xorl	%edi,		%esi
381	movl	12(%ebp),	%eax
382	subl	%eax,		%edi
383	movl	%esi,		%ecx
384	rorl	%cl,		%edi
385	xorl	%esi,		%edi
386	subl	8(%ebp),	%esi
387	subl	4(%ebp),	%edi
388.L003rc5_exit:
389	movl	%edi,		(%edx)
390	movl	%esi,		4(%edx)
391	popl	%ebx
392	popl	%edi
393	popl	%esi
394	popl	%ebp
395	ret
396.L_RC5_32_decrypt_end:
397	.size	RC5_32_decrypt,.L_RC5_32_decrypt_end-RC5_32_decrypt
398.ident	"desasm.pl"
399.text
400	.align 16
401.globl RC5_32_cbc_encrypt
402	.type	RC5_32_cbc_encrypt,@function
403RC5_32_cbc_encrypt:
404
405	pushl	%ebp
406	pushl	%ebx
407	pushl	%esi
408	pushl	%edi
409	movl	28(%esp),	%ebp
410
411	movl	36(%esp),	%ebx
412	movl	(%ebx),		%esi
413	movl	4(%ebx),	%edi
414	pushl	%edi
415	pushl	%esi
416	pushl	%edi
417	pushl	%esi
418	movl	%esp,		%ebx
419	movl	36(%esp),	%esi
420	movl	40(%esp),	%edi
421
422	movl	56(%esp),	%ecx
423
424	movl	48(%esp),	%eax
425	pushl	%eax
426	pushl	%ebx
427	cmpl	$0,		%ecx
428	jz	.L004decrypt
429	andl	$4294967288,	%ebp
430	movl	8(%esp),	%eax
431	movl	12(%esp),	%ebx
432	jz	.L005encrypt_finish
433.L006encrypt_loop:
434	movl	(%esi),		%ecx
435	movl	4(%esi),	%edx
436	xorl	%ecx,		%eax
437	xorl	%edx,		%ebx
438	movl	%eax,		8(%esp)
439	movl	%ebx,		12(%esp)
440	call	RC5_32_encrypt
441	movl	8(%esp),	%eax
442	movl	12(%esp),	%ebx
443	movl	%eax,		(%edi)
444	movl	%ebx,		4(%edi)
445	addl	$8,		%esi
446	addl	$8,		%edi
447	subl	$8,		%ebp
448	jnz	.L006encrypt_loop
449.L005encrypt_finish:
450	movl	52(%esp),	%ebp
451	andl	$7,		%ebp
452	jz	.L007finish
453	call	.L008PIC_point
454.L008PIC_point:
455	popl	%edx
456	leal	.L009cbc_enc_jmp_table-.L008PIC_point(%edx),%ecx
457	movl	(%ecx,%ebp,4),	%ebp
458	addl	%edx,		%ebp
459	xorl	%ecx,		%ecx
460	xorl	%edx,		%edx
461	jmp	*%ebp
462.L010ej7:
463	movb	6(%esi),	%dh
464	sall	$8,		%edx
465.L011ej6:
466	movb	5(%esi),	%dh
467.L012ej5:
468	movb	4(%esi),	%dl
469.L013ej4:
470	movl	(%esi),		%ecx
471	jmp	.L014ejend
472.L015ej3:
473	movb	2(%esi),	%ch
474	sall	$8,		%ecx
475.L016ej2:
476	movb	1(%esi),	%ch
477.L017ej1:
478	movb	(%esi),		%cl
479.L014ejend:
480	xorl	%ecx,		%eax
481	xorl	%edx,		%ebx
482	movl	%eax,		8(%esp)
483	movl	%ebx,		12(%esp)
484	call	RC5_32_encrypt
485	movl	8(%esp),	%eax
486	movl	12(%esp),	%ebx
487	movl	%eax,		(%edi)
488	movl	%ebx,		4(%edi)
489	jmp	.L007finish
490.align 16
491.L004decrypt:
492	andl	$4294967288,	%ebp
493	movl	16(%esp),	%eax
494	movl	20(%esp),	%ebx
495	jz	.L018decrypt_finish
496.L019decrypt_loop:
497	movl	(%esi),		%eax
498	movl	4(%esi),	%ebx
499	movl	%eax,		8(%esp)
500	movl	%ebx,		12(%esp)
501	call	RC5_32_decrypt
502	movl	8(%esp),	%eax
503	movl	12(%esp),	%ebx
504	movl	16(%esp),	%ecx
505	movl	20(%esp),	%edx
506	xorl	%eax,		%ecx
507	xorl	%ebx,		%edx
508	movl	(%esi),		%eax
509	movl	4(%esi),	%ebx
510	movl	%ecx,		(%edi)
511	movl	%edx,		4(%edi)
512	movl	%eax,		16(%esp)
513	movl	%ebx,		20(%esp)
514	addl	$8,		%esi
515	addl	$8,		%edi
516	subl	$8,		%ebp
517	jnz	.L019decrypt_loop
518.L018decrypt_finish:
519	movl	52(%esp),	%ebp
520	andl	$7,		%ebp
521	jz	.L007finish
522	movl	(%esi),		%eax
523	movl	4(%esi),	%ebx
524	movl	%eax,		8(%esp)
525	movl	%ebx,		12(%esp)
526	call	RC5_32_decrypt
527	movl	8(%esp),	%eax
528	movl	12(%esp),	%ebx
529	movl	16(%esp),	%ecx
530	movl	20(%esp),	%edx
531	xorl	%eax,		%ecx
532	xorl	%ebx,		%edx
533	movl	(%esi),		%eax
534	movl	4(%esi),	%ebx
535.L020dj7:
536	rorl	$16,		%edx
537	movb	%dl,		6(%edi)
538	shrl	$16,		%edx
539.L021dj6:
540	movb	%dh,		5(%edi)
541.L022dj5:
542	movb	%dl,		4(%edi)
543.L023dj4:
544	movl	%ecx,		(%edi)
545	jmp	.L024djend
546.L025dj3:
547	rorl	$16,		%ecx
548	movb	%cl,		2(%edi)
549	sall	$16,		%ecx
550.L026dj2:
551	movb	%ch,		1(%esi)
552.L027dj1:
553	movb	%cl,		(%esi)
554.L024djend:
555	jmp	.L007finish
556.align 16
557.L007finish:
558	movl	60(%esp),	%ecx
559	addl	$24,		%esp
560	movl	%eax,		(%ecx)
561	movl	%ebx,		4(%ecx)
562	popl	%edi
563	popl	%esi
564	popl	%ebx
565	popl	%ebp
566	ret
567.align 16
568.L009cbc_enc_jmp_table:
569	.long 0
570	.long .L017ej1-.L008PIC_point
571	.long .L016ej2-.L008PIC_point
572	.long .L015ej3-.L008PIC_point
573	.long .L013ej4-.L008PIC_point
574	.long .L012ej5-.L008PIC_point
575	.long .L011ej6-.L008PIC_point
576	.long .L010ej7-.L008PIC_point
577.L_RC5_32_cbc_encrypt_end:
578	.size	RC5_32_cbc_encrypt,.L_RC5_32_cbc_encrypt_end-RC5_32_cbc_encrypt
579.ident	"desasm.pl"
580