• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1.text
2.globl	_BF_encrypt
3.type	_BF_encrypt,@function
4.align	4
5_BF_encrypt:
6L_BF_encrypt_begin:
7	%ifdef __CET__
8
9.byte	243,15,30,251
10	%endif
11
12
13	pushl	%ebp
14	pushl	%ebx
15	movl	12(%esp),%ebx
16	movl	16(%esp),%ebp
17	pushl	%esi
18	pushl	%edi
19	# Load the 2 words
20	movl	(%ebx),%edi
21	movl	4(%ebx),%esi
22	xorl	%eax,%eax
23	movl	(%ebp),%ebx
24	xorl	%ecx,%ecx
25	xorl	%ebx,%edi
26
27	# Round 0
28	movl	4(%ebp),%edx
29	movl	%edi,%ebx
30	xorl	%edx,%esi
31	shrl	$16,%ebx
32	movl	%edi,%edx
33	movb	%bh,%al
34	andl	$255,%ebx
35	movb	%dh,%cl
36	andl	$255,%edx
37	movl	72(%ebp,%eax,4),%eax
38	movl	1096(%ebp,%ebx,4),%ebx
39	addl	%eax,%ebx
40	movl	2120(%ebp,%ecx,4),%eax
41	xorl	%eax,%ebx
42	movl	3144(%ebp,%edx,4),%edx
43	addl	%edx,%ebx
44	xorl	%eax,%eax
45	xorl	%ebx,%esi
46
47	# Round 1
48	movl	8(%ebp),%edx
49	movl	%esi,%ebx
50	xorl	%edx,%edi
51	shrl	$16,%ebx
52	movl	%esi,%edx
53	movb	%bh,%al
54	andl	$255,%ebx
55	movb	%dh,%cl
56	andl	$255,%edx
57	movl	72(%ebp,%eax,4),%eax
58	movl	1096(%ebp,%ebx,4),%ebx
59	addl	%eax,%ebx
60	movl	2120(%ebp,%ecx,4),%eax
61	xorl	%eax,%ebx
62	movl	3144(%ebp,%edx,4),%edx
63	addl	%edx,%ebx
64	xorl	%eax,%eax
65	xorl	%ebx,%edi
66
67	# Round 2
68	movl	12(%ebp),%edx
69	movl	%edi,%ebx
70	xorl	%edx,%esi
71	shrl	$16,%ebx
72	movl	%edi,%edx
73	movb	%bh,%al
74	andl	$255,%ebx
75	movb	%dh,%cl
76	andl	$255,%edx
77	movl	72(%ebp,%eax,4),%eax
78	movl	1096(%ebp,%ebx,4),%ebx
79	addl	%eax,%ebx
80	movl	2120(%ebp,%ecx,4),%eax
81	xorl	%eax,%ebx
82	movl	3144(%ebp,%edx,4),%edx
83	addl	%edx,%ebx
84	xorl	%eax,%eax
85	xorl	%ebx,%esi
86
87	# Round 3
88	movl	16(%ebp),%edx
89	movl	%esi,%ebx
90	xorl	%edx,%edi
91	shrl	$16,%ebx
92	movl	%esi,%edx
93	movb	%bh,%al
94	andl	$255,%ebx
95	movb	%dh,%cl
96	andl	$255,%edx
97	movl	72(%ebp,%eax,4),%eax
98	movl	1096(%ebp,%ebx,4),%ebx
99	addl	%eax,%ebx
100	movl	2120(%ebp,%ecx,4),%eax
101	xorl	%eax,%ebx
102	movl	3144(%ebp,%edx,4),%edx
103	addl	%edx,%ebx
104	xorl	%eax,%eax
105	xorl	%ebx,%edi
106
107	# Round 4
108	movl	20(%ebp),%edx
109	movl	%edi,%ebx
110	xorl	%edx,%esi
111	shrl	$16,%ebx
112	movl	%edi,%edx
113	movb	%bh,%al
114	andl	$255,%ebx
115	movb	%dh,%cl
116	andl	$255,%edx
117	movl	72(%ebp,%eax,4),%eax
118	movl	1096(%ebp,%ebx,4),%ebx
119	addl	%eax,%ebx
120	movl	2120(%ebp,%ecx,4),%eax
121	xorl	%eax,%ebx
122	movl	3144(%ebp,%edx,4),%edx
123	addl	%edx,%ebx
124	xorl	%eax,%eax
125	xorl	%ebx,%esi
126
127	# Round 5
128	movl	24(%ebp),%edx
129	movl	%esi,%ebx
130	xorl	%edx,%edi
131	shrl	$16,%ebx
132	movl	%esi,%edx
133	movb	%bh,%al
134	andl	$255,%ebx
135	movb	%dh,%cl
136	andl	$255,%edx
137	movl	72(%ebp,%eax,4),%eax
138	movl	1096(%ebp,%ebx,4),%ebx
139	addl	%eax,%ebx
140	movl	2120(%ebp,%ecx,4),%eax
141	xorl	%eax,%ebx
142	movl	3144(%ebp,%edx,4),%edx
143	addl	%edx,%ebx
144	xorl	%eax,%eax
145	xorl	%ebx,%edi
146
147	# Round 6
148	movl	28(%ebp),%edx
149	movl	%edi,%ebx
150	xorl	%edx,%esi
151	shrl	$16,%ebx
152	movl	%edi,%edx
153	movb	%bh,%al
154	andl	$255,%ebx
155	movb	%dh,%cl
156	andl	$255,%edx
157	movl	72(%ebp,%eax,4),%eax
158	movl	1096(%ebp,%ebx,4),%ebx
159	addl	%eax,%ebx
160	movl	2120(%ebp,%ecx,4),%eax
161	xorl	%eax,%ebx
162	movl	3144(%ebp,%edx,4),%edx
163	addl	%edx,%ebx
164	xorl	%eax,%eax
165	xorl	%ebx,%esi
166
167	# Round 7
168	movl	32(%ebp),%edx
169	movl	%esi,%ebx
170	xorl	%edx,%edi
171	shrl	$16,%ebx
172	movl	%esi,%edx
173	movb	%bh,%al
174	andl	$255,%ebx
175	movb	%dh,%cl
176	andl	$255,%edx
177	movl	72(%ebp,%eax,4),%eax
178	movl	1096(%ebp,%ebx,4),%ebx
179	addl	%eax,%ebx
180	movl	2120(%ebp,%ecx,4),%eax
181	xorl	%eax,%ebx
182	movl	3144(%ebp,%edx,4),%edx
183	addl	%edx,%ebx
184	xorl	%eax,%eax
185	xorl	%ebx,%edi
186
187	# Round 8
188	movl	36(%ebp),%edx
189	movl	%edi,%ebx
190	xorl	%edx,%esi
191	shrl	$16,%ebx
192	movl	%edi,%edx
193	movb	%bh,%al
194	andl	$255,%ebx
195	movb	%dh,%cl
196	andl	$255,%edx
197	movl	72(%ebp,%eax,4),%eax
198	movl	1096(%ebp,%ebx,4),%ebx
199	addl	%eax,%ebx
200	movl	2120(%ebp,%ecx,4),%eax
201	xorl	%eax,%ebx
202	movl	3144(%ebp,%edx,4),%edx
203	addl	%edx,%ebx
204	xorl	%eax,%eax
205	xorl	%ebx,%esi
206
207	# Round 9
208	movl	40(%ebp),%edx
209	movl	%esi,%ebx
210	xorl	%edx,%edi
211	shrl	$16,%ebx
212	movl	%esi,%edx
213	movb	%bh,%al
214	andl	$255,%ebx
215	movb	%dh,%cl
216	andl	$255,%edx
217	movl	72(%ebp,%eax,4),%eax
218	movl	1096(%ebp,%ebx,4),%ebx
219	addl	%eax,%ebx
220	movl	2120(%ebp,%ecx,4),%eax
221	xorl	%eax,%ebx
222	movl	3144(%ebp,%edx,4),%edx
223	addl	%edx,%ebx
224	xorl	%eax,%eax
225	xorl	%ebx,%edi
226
227	# Round 10
228	movl	44(%ebp),%edx
229	movl	%edi,%ebx
230	xorl	%edx,%esi
231	shrl	$16,%ebx
232	movl	%edi,%edx
233	movb	%bh,%al
234	andl	$255,%ebx
235	movb	%dh,%cl
236	andl	$255,%edx
237	movl	72(%ebp,%eax,4),%eax
238	movl	1096(%ebp,%ebx,4),%ebx
239	addl	%eax,%ebx
240	movl	2120(%ebp,%ecx,4),%eax
241	xorl	%eax,%ebx
242	movl	3144(%ebp,%edx,4),%edx
243	addl	%edx,%ebx
244	xorl	%eax,%eax
245	xorl	%ebx,%esi
246
247	# Round 11
248	movl	48(%ebp),%edx
249	movl	%esi,%ebx
250	xorl	%edx,%edi
251	shrl	$16,%ebx
252	movl	%esi,%edx
253	movb	%bh,%al
254	andl	$255,%ebx
255	movb	%dh,%cl
256	andl	$255,%edx
257	movl	72(%ebp,%eax,4),%eax
258	movl	1096(%ebp,%ebx,4),%ebx
259	addl	%eax,%ebx
260	movl	2120(%ebp,%ecx,4),%eax
261	xorl	%eax,%ebx
262	movl	3144(%ebp,%edx,4),%edx
263	addl	%edx,%ebx
264	xorl	%eax,%eax
265	xorl	%ebx,%edi
266
267	# Round 12
268	movl	52(%ebp),%edx
269	movl	%edi,%ebx
270	xorl	%edx,%esi
271	shrl	$16,%ebx
272	movl	%edi,%edx
273	movb	%bh,%al
274	andl	$255,%ebx
275	movb	%dh,%cl
276	andl	$255,%edx
277	movl	72(%ebp,%eax,4),%eax
278	movl	1096(%ebp,%ebx,4),%ebx
279	addl	%eax,%ebx
280	movl	2120(%ebp,%ecx,4),%eax
281	xorl	%eax,%ebx
282	movl	3144(%ebp,%edx,4),%edx
283	addl	%edx,%ebx
284	xorl	%eax,%eax
285	xorl	%ebx,%esi
286
287	# Round 13
288	movl	56(%ebp),%edx
289	movl	%esi,%ebx
290	xorl	%edx,%edi
291	shrl	$16,%ebx
292	movl	%esi,%edx
293	movb	%bh,%al
294	andl	$255,%ebx
295	movb	%dh,%cl
296	andl	$255,%edx
297	movl	72(%ebp,%eax,4),%eax
298	movl	1096(%ebp,%ebx,4),%ebx
299	addl	%eax,%ebx
300	movl	2120(%ebp,%ecx,4),%eax
301	xorl	%eax,%ebx
302	movl	3144(%ebp,%edx,4),%edx
303	addl	%edx,%ebx
304	xorl	%eax,%eax
305	xorl	%ebx,%edi
306
307	# Round 14
308	movl	60(%ebp),%edx
309	movl	%edi,%ebx
310	xorl	%edx,%esi
311	shrl	$16,%ebx
312	movl	%edi,%edx
313	movb	%bh,%al
314	andl	$255,%ebx
315	movb	%dh,%cl
316	andl	$255,%edx
317	movl	72(%ebp,%eax,4),%eax
318	movl	1096(%ebp,%ebx,4),%ebx
319	addl	%eax,%ebx
320	movl	2120(%ebp,%ecx,4),%eax
321	xorl	%eax,%ebx
322	movl	3144(%ebp,%edx,4),%edx
323	addl	%edx,%ebx
324	xorl	%eax,%eax
325	xorl	%ebx,%esi
326
327	# Round 15
328	movl	64(%ebp),%edx
329	movl	%esi,%ebx
330	xorl	%edx,%edi
331	shrl	$16,%ebx
332	movl	%esi,%edx
333	movb	%bh,%al
334	andl	$255,%ebx
335	movb	%dh,%cl
336	andl	$255,%edx
337	movl	72(%ebp,%eax,4),%eax
338	movl	1096(%ebp,%ebx,4),%ebx
339	addl	%eax,%ebx
340	movl	2120(%ebp,%ecx,4),%eax
341	xorl	%eax,%ebx
342	movl	3144(%ebp,%edx,4),%edx
343	addl	%edx,%ebx
344	# Load parameter 0 (16) enc=1
345	movl	20(%esp),%eax
346	xorl	%ebx,%edi
347	movl	68(%ebp),%edx
348	xorl	%edx,%esi
349	movl	%edi,4(%eax)
350	movl	%esi,(%eax)
351	popl	%edi
352	popl	%esi
353	popl	%ebx
354	popl	%ebp
355	ret
356.globl	_BF_decrypt
357.type	_BF_decrypt,@function
358.align	4
359_BF_decrypt:
360L_BF_decrypt_begin:
361	%ifdef __CET__
362
363.byte	243,15,30,251
364	%endif
365
366
367	pushl	%ebp
368	pushl	%ebx
369	movl	12(%esp),%ebx
370	movl	16(%esp),%ebp
371	pushl	%esi
372	pushl	%edi
373	# Load the 2 words
374	movl	(%ebx),%edi
375	movl	4(%ebx),%esi
376	xorl	%eax,%eax
377	movl	68(%ebp),%ebx
378	xorl	%ecx,%ecx
379	xorl	%ebx,%edi
380
381	# Round 16
382	movl	64(%ebp),%edx
383	movl	%edi,%ebx
384	xorl	%edx,%esi
385	shrl	$16,%ebx
386	movl	%edi,%edx
387	movb	%bh,%al
388	andl	$255,%ebx
389	movb	%dh,%cl
390	andl	$255,%edx
391	movl	72(%ebp,%eax,4),%eax
392	movl	1096(%ebp,%ebx,4),%ebx
393	addl	%eax,%ebx
394	movl	2120(%ebp,%ecx,4),%eax
395	xorl	%eax,%ebx
396	movl	3144(%ebp,%edx,4),%edx
397	addl	%edx,%ebx
398	xorl	%eax,%eax
399	xorl	%ebx,%esi
400
401	# Round 15
402	movl	60(%ebp),%edx
403	movl	%esi,%ebx
404	xorl	%edx,%edi
405	shrl	$16,%ebx
406	movl	%esi,%edx
407	movb	%bh,%al
408	andl	$255,%ebx
409	movb	%dh,%cl
410	andl	$255,%edx
411	movl	72(%ebp,%eax,4),%eax
412	movl	1096(%ebp,%ebx,4),%ebx
413	addl	%eax,%ebx
414	movl	2120(%ebp,%ecx,4),%eax
415	xorl	%eax,%ebx
416	movl	3144(%ebp,%edx,4),%edx
417	addl	%edx,%ebx
418	xorl	%eax,%eax
419	xorl	%ebx,%edi
420
421	# Round 14
422	movl	56(%ebp),%edx
423	movl	%edi,%ebx
424	xorl	%edx,%esi
425	shrl	$16,%ebx
426	movl	%edi,%edx
427	movb	%bh,%al
428	andl	$255,%ebx
429	movb	%dh,%cl
430	andl	$255,%edx
431	movl	72(%ebp,%eax,4),%eax
432	movl	1096(%ebp,%ebx,4),%ebx
433	addl	%eax,%ebx
434	movl	2120(%ebp,%ecx,4),%eax
435	xorl	%eax,%ebx
436	movl	3144(%ebp,%edx,4),%edx
437	addl	%edx,%ebx
438	xorl	%eax,%eax
439	xorl	%ebx,%esi
440
441	# Round 13
442	movl	52(%ebp),%edx
443	movl	%esi,%ebx
444	xorl	%edx,%edi
445	shrl	$16,%ebx
446	movl	%esi,%edx
447	movb	%bh,%al
448	andl	$255,%ebx
449	movb	%dh,%cl
450	andl	$255,%edx
451	movl	72(%ebp,%eax,4),%eax
452	movl	1096(%ebp,%ebx,4),%ebx
453	addl	%eax,%ebx
454	movl	2120(%ebp,%ecx,4),%eax
455	xorl	%eax,%ebx
456	movl	3144(%ebp,%edx,4),%edx
457	addl	%edx,%ebx
458	xorl	%eax,%eax
459	xorl	%ebx,%edi
460
461	# Round 12
462	movl	48(%ebp),%edx
463	movl	%edi,%ebx
464	xorl	%edx,%esi
465	shrl	$16,%ebx
466	movl	%edi,%edx
467	movb	%bh,%al
468	andl	$255,%ebx
469	movb	%dh,%cl
470	andl	$255,%edx
471	movl	72(%ebp,%eax,4),%eax
472	movl	1096(%ebp,%ebx,4),%ebx
473	addl	%eax,%ebx
474	movl	2120(%ebp,%ecx,4),%eax
475	xorl	%eax,%ebx
476	movl	3144(%ebp,%edx,4),%edx
477	addl	%edx,%ebx
478	xorl	%eax,%eax
479	xorl	%ebx,%esi
480
481	# Round 11
482	movl	44(%ebp),%edx
483	movl	%esi,%ebx
484	xorl	%edx,%edi
485	shrl	$16,%ebx
486	movl	%esi,%edx
487	movb	%bh,%al
488	andl	$255,%ebx
489	movb	%dh,%cl
490	andl	$255,%edx
491	movl	72(%ebp,%eax,4),%eax
492	movl	1096(%ebp,%ebx,4),%ebx
493	addl	%eax,%ebx
494	movl	2120(%ebp,%ecx,4),%eax
495	xorl	%eax,%ebx
496	movl	3144(%ebp,%edx,4),%edx
497	addl	%edx,%ebx
498	xorl	%eax,%eax
499	xorl	%ebx,%edi
500
501	# Round 10
502	movl	40(%ebp),%edx
503	movl	%edi,%ebx
504	xorl	%edx,%esi
505	shrl	$16,%ebx
506	movl	%edi,%edx
507	movb	%bh,%al
508	andl	$255,%ebx
509	movb	%dh,%cl
510	andl	$255,%edx
511	movl	72(%ebp,%eax,4),%eax
512	movl	1096(%ebp,%ebx,4),%ebx
513	addl	%eax,%ebx
514	movl	2120(%ebp,%ecx,4),%eax
515	xorl	%eax,%ebx
516	movl	3144(%ebp,%edx,4),%edx
517	addl	%edx,%ebx
518	xorl	%eax,%eax
519	xorl	%ebx,%esi
520
521	# Round 9
522	movl	36(%ebp),%edx
523	movl	%esi,%ebx
524	xorl	%edx,%edi
525	shrl	$16,%ebx
526	movl	%esi,%edx
527	movb	%bh,%al
528	andl	$255,%ebx
529	movb	%dh,%cl
530	andl	$255,%edx
531	movl	72(%ebp,%eax,4),%eax
532	movl	1096(%ebp,%ebx,4),%ebx
533	addl	%eax,%ebx
534	movl	2120(%ebp,%ecx,4),%eax
535	xorl	%eax,%ebx
536	movl	3144(%ebp,%edx,4),%edx
537	addl	%edx,%ebx
538	xorl	%eax,%eax
539	xorl	%ebx,%edi
540
541	# Round 8
542	movl	32(%ebp),%edx
543	movl	%edi,%ebx
544	xorl	%edx,%esi
545	shrl	$16,%ebx
546	movl	%edi,%edx
547	movb	%bh,%al
548	andl	$255,%ebx
549	movb	%dh,%cl
550	andl	$255,%edx
551	movl	72(%ebp,%eax,4),%eax
552	movl	1096(%ebp,%ebx,4),%ebx
553	addl	%eax,%ebx
554	movl	2120(%ebp,%ecx,4),%eax
555	xorl	%eax,%ebx
556	movl	3144(%ebp,%edx,4),%edx
557	addl	%edx,%ebx
558	xorl	%eax,%eax
559	xorl	%ebx,%esi
560
561	# Round 7
562	movl	28(%ebp),%edx
563	movl	%esi,%ebx
564	xorl	%edx,%edi
565	shrl	$16,%ebx
566	movl	%esi,%edx
567	movb	%bh,%al
568	andl	$255,%ebx
569	movb	%dh,%cl
570	andl	$255,%edx
571	movl	72(%ebp,%eax,4),%eax
572	movl	1096(%ebp,%ebx,4),%ebx
573	addl	%eax,%ebx
574	movl	2120(%ebp,%ecx,4),%eax
575	xorl	%eax,%ebx
576	movl	3144(%ebp,%edx,4),%edx
577	addl	%edx,%ebx
578	xorl	%eax,%eax
579	xorl	%ebx,%edi
580
581	# Round 6
582	movl	24(%ebp),%edx
583	movl	%edi,%ebx
584	xorl	%edx,%esi
585	shrl	$16,%ebx
586	movl	%edi,%edx
587	movb	%bh,%al
588	andl	$255,%ebx
589	movb	%dh,%cl
590	andl	$255,%edx
591	movl	72(%ebp,%eax,4),%eax
592	movl	1096(%ebp,%ebx,4),%ebx
593	addl	%eax,%ebx
594	movl	2120(%ebp,%ecx,4),%eax
595	xorl	%eax,%ebx
596	movl	3144(%ebp,%edx,4),%edx
597	addl	%edx,%ebx
598	xorl	%eax,%eax
599	xorl	%ebx,%esi
600
601	# Round 5
602	movl	20(%ebp),%edx
603	movl	%esi,%ebx
604	xorl	%edx,%edi
605	shrl	$16,%ebx
606	movl	%esi,%edx
607	movb	%bh,%al
608	andl	$255,%ebx
609	movb	%dh,%cl
610	andl	$255,%edx
611	movl	72(%ebp,%eax,4),%eax
612	movl	1096(%ebp,%ebx,4),%ebx
613	addl	%eax,%ebx
614	movl	2120(%ebp,%ecx,4),%eax
615	xorl	%eax,%ebx
616	movl	3144(%ebp,%edx,4),%edx
617	addl	%edx,%ebx
618	xorl	%eax,%eax
619	xorl	%ebx,%edi
620
621	# Round 4
622	movl	16(%ebp),%edx
623	movl	%edi,%ebx
624	xorl	%edx,%esi
625	shrl	$16,%ebx
626	movl	%edi,%edx
627	movb	%bh,%al
628	andl	$255,%ebx
629	movb	%dh,%cl
630	andl	$255,%edx
631	movl	72(%ebp,%eax,4),%eax
632	movl	1096(%ebp,%ebx,4),%ebx
633	addl	%eax,%ebx
634	movl	2120(%ebp,%ecx,4),%eax
635	xorl	%eax,%ebx
636	movl	3144(%ebp,%edx,4),%edx
637	addl	%edx,%ebx
638	xorl	%eax,%eax
639	xorl	%ebx,%esi
640
641	# Round 3
642	movl	12(%ebp),%edx
643	movl	%esi,%ebx
644	xorl	%edx,%edi
645	shrl	$16,%ebx
646	movl	%esi,%edx
647	movb	%bh,%al
648	andl	$255,%ebx
649	movb	%dh,%cl
650	andl	$255,%edx
651	movl	72(%ebp,%eax,4),%eax
652	movl	1096(%ebp,%ebx,4),%ebx
653	addl	%eax,%ebx
654	movl	2120(%ebp,%ecx,4),%eax
655	xorl	%eax,%ebx
656	movl	3144(%ebp,%edx,4),%edx
657	addl	%edx,%ebx
658	xorl	%eax,%eax
659	xorl	%ebx,%edi
660
661	# Round 2
662	movl	8(%ebp),%edx
663	movl	%edi,%ebx
664	xorl	%edx,%esi
665	shrl	$16,%ebx
666	movl	%edi,%edx
667	movb	%bh,%al
668	andl	$255,%ebx
669	movb	%dh,%cl
670	andl	$255,%edx
671	movl	72(%ebp,%eax,4),%eax
672	movl	1096(%ebp,%ebx,4),%ebx
673	addl	%eax,%ebx
674	movl	2120(%ebp,%ecx,4),%eax
675	xorl	%eax,%ebx
676	movl	3144(%ebp,%edx,4),%edx
677	addl	%edx,%ebx
678	xorl	%eax,%eax
679	xorl	%ebx,%esi
680
681	# Round 1
682	movl	4(%ebp),%edx
683	movl	%esi,%ebx
684	xorl	%edx,%edi
685	shrl	$16,%ebx
686	movl	%esi,%edx
687	movb	%bh,%al
688	andl	$255,%ebx
689	movb	%dh,%cl
690	andl	$255,%edx
691	movl	72(%ebp,%eax,4),%eax
692	movl	1096(%ebp,%ebx,4),%ebx
693	addl	%eax,%ebx
694	movl	2120(%ebp,%ecx,4),%eax
695	xorl	%eax,%ebx
696	movl	3144(%ebp,%edx,4),%edx
697	addl	%edx,%ebx
698	# Load parameter 0 (1) enc=0
699	movl	20(%esp),%eax
700	xorl	%ebx,%edi
701	movl	(%ebp),%edx
702	xorl	%edx,%esi
703	movl	%edi,4(%eax)
704	movl	%esi,(%eax)
705	popl	%edi
706	popl	%esi
707	popl	%ebx
708	popl	%ebp
709	ret
710.globl	_BF_cbc_encrypt
711.type	_BF_cbc_encrypt,@function
712.align	4
713_BF_cbc_encrypt:
714L_BF_cbc_encrypt_begin:
715	%ifdef __CET__
716
717.byte	243,15,30,251
718	%endif
719
720
721	pushl	%ebp
722	pushl	%ebx
723	pushl	%esi
724	pushl	%edi
725	movl	28(%esp),%ebp
726	# getting iv ptr from parameter 4
727	movl	36(%esp),%ebx
728	movl	(%ebx),%esi
729	movl	4(%ebx),%edi
730	pushl	%edi
731	pushl	%esi
732	pushl	%edi
733	pushl	%esi
734	movl	%esp,%ebx
735	movl	36(%esp),%esi
736	movl	40(%esp),%edi
737	# getting encrypt flag from parameter 5
738	movl	56(%esp),%ecx
739	# get and push parameter 3
740	movl	48(%esp),%eax
741	pushl	%eax
742	pushl	%ebx
743	cmpl	$0,%ecx
744	jz	L000decrypt
745	andl	$4294967288,%ebp
746	movl	8(%esp),%eax
747	movl	12(%esp),%ebx
748	jz	L001encrypt_finish
749L002encrypt_loop:
750	movl	(%esi),%ecx
751	movl	4(%esi),%edx
752	xorl	%ecx,%eax
753	xorl	%edx,%ebx
754	bswap	%eax
755	bswap	%ebx
756	movl	%eax,8(%esp)
757	movl	%ebx,12(%esp)
758	call	L_BF_encrypt_begin
759	movl	8(%esp),%eax
760	movl	12(%esp),%ebx
761	bswap	%eax
762	bswap	%ebx
763	movl	%eax,(%edi)
764	movl	%ebx,4(%edi)
765	addl	$8,%esi
766	addl	$8,%edi
767	subl	$8,%ebp
768	jnz	L002encrypt_loop
769L001encrypt_finish:
770	movl	52(%esp),%ebp
771	andl	$7,%ebp
772	jz	L003finish
773	call	L004PIC_point
774L004PIC_point:
775	popl	%edx
776	leal	L005cbc_enc_jmp_table-L004PIC_point(%edx),%ecx
777	movl	(%ecx,%ebp,4),%ebp
778	addl	%edx,%ebp
779	xorl	%ecx,%ecx
780	xorl	%edx,%edx
781	jmp	*%ebp
782L006ej7:
783	%ifdef __CET__
784
785.byte	243,15,30,251
786	%endif
787
788	movb	6(%esi),%dh
789	shll	$8,%edx
790L007ej6:
791	%ifdef __CET__
792
793.byte	243,15,30,251
794	%endif
795
796	movb	5(%esi),%dh
797L008ej5:
798	%ifdef __CET__
799
800.byte	243,15,30,251
801	%endif
802
803	movb	4(%esi),%dl
804L009ej4:
805	%ifdef __CET__
806
807.byte	243,15,30,251
808	%endif
809
810	movl	(%esi),%ecx
811	jmp	L010ejend
812L011ej3:
813	%ifdef __CET__
814
815.byte	243,15,30,251
816	%endif
817
818	movb	2(%esi),%ch
819	shll	$8,%ecx
820L012ej2:
821	%ifdef __CET__
822
823.byte	243,15,30,251
824	%endif
825
826	movb	1(%esi),%ch
827L013ej1:
828	%ifdef __CET__
829
830.byte	243,15,30,251
831	%endif
832
833	movb	(%esi),%cl
834L010ejend:
835	xorl	%ecx,%eax
836	xorl	%edx,%ebx
837	bswap	%eax
838	bswap	%ebx
839	movl	%eax,8(%esp)
840	movl	%ebx,12(%esp)
841	call	L_BF_encrypt_begin
842	movl	8(%esp),%eax
843	movl	12(%esp),%ebx
844	bswap	%eax
845	bswap	%ebx
846	movl	%eax,(%edi)
847	movl	%ebx,4(%edi)
848	jmp	L003finish
849L000decrypt:
850	andl	$4294967288,%ebp
851	movl	16(%esp),%eax
852	movl	20(%esp),%ebx
853	jz	L014decrypt_finish
854L015decrypt_loop:
855	movl	(%esi),%eax
856	movl	4(%esi),%ebx
857	bswap	%eax
858	bswap	%ebx
859	movl	%eax,8(%esp)
860	movl	%ebx,12(%esp)
861	call	L_BF_decrypt_begin
862	movl	8(%esp),%eax
863	movl	12(%esp),%ebx
864	bswap	%eax
865	bswap	%ebx
866	movl	16(%esp),%ecx
867	movl	20(%esp),%edx
868	xorl	%eax,%ecx
869	xorl	%ebx,%edx
870	movl	(%esi),%eax
871	movl	4(%esi),%ebx
872	movl	%ecx,(%edi)
873	movl	%edx,4(%edi)
874	movl	%eax,16(%esp)
875	movl	%ebx,20(%esp)
876	addl	$8,%esi
877	addl	$8,%edi
878	subl	$8,%ebp
879	jnz	L015decrypt_loop
880L014decrypt_finish:
881	movl	52(%esp),%ebp
882	andl	$7,%ebp
883	jz	L003finish
884	movl	(%esi),%eax
885	movl	4(%esi),%ebx
886	bswap	%eax
887	bswap	%ebx
888	movl	%eax,8(%esp)
889	movl	%ebx,12(%esp)
890	call	L_BF_decrypt_begin
891	movl	8(%esp),%eax
892	movl	12(%esp),%ebx
893	bswap	%eax
894	bswap	%ebx
895	movl	16(%esp),%ecx
896	movl	20(%esp),%edx
897	xorl	%eax,%ecx
898	xorl	%ebx,%edx
899	movl	(%esi),%eax
900	movl	4(%esi),%ebx
901L016dj7:
902	rorl	$16,%edx
903	movb	%dl,6(%edi)
904	shrl	$16,%edx
905L017dj6:
906	movb	%dh,5(%edi)
907L018dj5:
908	movb	%dl,4(%edi)
909L019dj4:
910	movl	%ecx,(%edi)
911	jmp	L020djend
912L021dj3:
913	rorl	$16,%ecx
914	movb	%cl,2(%edi)
915	shll	$16,%ecx
916L022dj2:
917	movb	%ch,1(%esi)
918L023dj1:
919	movb	%cl,(%esi)
920L020djend:
921	jmp	L003finish
922L003finish:
923	movl	60(%esp),%ecx
924	addl	$24,%esp
925	movl	%eax,(%ecx)
926	movl	%ebx,4(%ecx)
927	popl	%edi
928	popl	%esi
929	popl	%ebx
930	popl	%ebp
931	ret
932.align	6,0x90
933L005cbc_enc_jmp_table:
934.long	0
935.long	L013ej1-L004PIC_point
936.long	L012ej2-L004PIC_point
937.long	L011ej3-L004PIC_point
938.long	L009ej4-L004PIC_point
939.long	L008ej5-L004PIC_point
940.long	L007ej6-L004PIC_point
941.long	L006ej7-L004PIC_point
942.align	6,0x90
943