• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1.text
2.globl	_padlock_capability
3.align	4
4_padlock_capability:
5L_padlock_capability_begin:
6	%ifdef __CET__
7
8.byte	243,15,30,251
9	%endif
10
11	pushl	%ebx
12	pushfl
13	popl	%eax
14	movl	%eax,%ecx
15	xorl	$2097152,%eax
16	pushl	%eax
17	popfl
18	pushfl
19	popl	%eax
20	xorl	%eax,%ecx
21	xorl	%eax,%eax
22	btl	$21,%ecx
23	jnc	L000noluck
24	.byte	0x0f,0xa2
25	xorl	%eax,%eax
26	cmpl	$0x746e6543,%ebx
27	jne	L001zhaoxin
28	cmpl	$0x48727561,%edx
29	jne	L000noluck
30	cmpl	$0x736c7561,%ecx
31	jne	L000noluck
32	jmp	L002zhaoxinEnd
33L001zhaoxin:
34	cmpl	$0x68532020,%ebx
35	jne	L000noluck
36	cmpl	$0x68676e61,%edx
37	jne	L000noluck
38	cmpl	$0x20206961,%ecx
39	jne	L000noluck
40L002zhaoxinEnd:
41	movl	$3221225472,%eax
42	.byte	0x0f,0xa2
43	movl	%eax,%edx
44	xorl	%eax,%eax
45	cmpl	$3221225473,%edx
46	jb	L000noluck
47	movl	$1,%eax
48	.byte	0x0f,0xa2
49	orl	$15,%eax
50	xorl	%ebx,%ebx
51	andl	$4095,%eax
52	cmpl	$1791,%eax
53	sete	%bl
54	movl	$3221225473,%eax
55	pushl	%ebx
56	.byte	0x0f,0xa2
57	popl	%ebx
58	movl	%edx,%eax
59	shll	$4,%ebx
60	andl	$4294967279,%eax
61	orl	%ebx,%eax
62L000noluck:
63	popl	%ebx
64	ret
65.globl	_padlock_key_bswap
66.align	4
67_padlock_key_bswap:
68L_padlock_key_bswap_begin:
69	%ifdef __CET__
70
71.byte	243,15,30,251
72	%endif
73
74	movl	4(%esp),%edx
75	movl	240(%edx),%ecx
76	incl	%ecx
77	shll	$2,%ecx
78L003bswap_loop:
79	movl	(%edx),%eax
80	bswap	%eax
81	movl	%eax,(%edx)
82	leal	4(%edx),%edx
83	subl	$1,%ecx
84	jnz	L003bswap_loop
85	ret
86.globl	_padlock_verify_context
87.align	4
88_padlock_verify_context:
89L_padlock_verify_context_begin:
90	%ifdef __CET__
91
92.byte	243,15,30,251
93	%endif
94
95	movl	4(%esp),%edx
96	leal	Lpadlock_saved_context-L004verify_pic_point,%eax
97	pushfl
98	call	__padlock_verify_ctx
99L004verify_pic_point:
100	leal	4(%esp),%esp
101	ret
102.align	4
103__padlock_verify_ctx:
104	%ifdef __CET__
105
106.byte	243,15,30,251
107	%endif
108
109	addl	(%esp),%eax
110	btl	$30,4(%esp)
111	jnc	L005verified
112	cmpl	(%eax),%edx
113	je	L005verified
114	pushfl
115	popfl
116L005verified:
117	movl	%edx,(%eax)
118	ret
119.globl	_padlock_reload_key
120.align	4
121_padlock_reload_key:
122L_padlock_reload_key_begin:
123	%ifdef __CET__
124
125.byte	243,15,30,251
126	%endif
127
128	pushfl
129	popfl
130	ret
131.globl	_padlock_aes_block
132.align	4
133_padlock_aes_block:
134L_padlock_aes_block_begin:
135	%ifdef __CET__
136
137.byte	243,15,30,251
138	%endif
139
140	pushl	%edi
141	pushl	%esi
142	pushl	%ebx
143	movl	16(%esp),%edi
144	movl	20(%esp),%esi
145	movl	24(%esp),%edx
146	movl	$1,%ecx
147	leal	32(%edx),%ebx
148	leal	16(%edx),%edx
149.byte	243,15,167,200
150	popl	%ebx
151	popl	%esi
152	popl	%edi
153	ret
154.globl	_padlock_ecb_encrypt
155.align	4
156_padlock_ecb_encrypt:
157L_padlock_ecb_encrypt_begin:
158	%ifdef __CET__
159
160.byte	243,15,30,251
161	%endif
162
163	pushl	%ebp
164	pushl	%ebx
165	pushl	%esi
166	pushl	%edi
167	movl	20(%esp),%edi
168	movl	24(%esp),%esi
169	movl	28(%esp),%edx
170	movl	32(%esp),%ecx
171	testl	$15,%edx
172	jnz	L006ecb_abort
173	testl	$15,%ecx
174	jnz	L006ecb_abort
175	leal	Lpadlock_saved_context-L007ecb_pic_point,%eax
176	pushfl
177	cld
178	call	__padlock_verify_ctx
179L007ecb_pic_point:
180	leal	16(%edx),%edx
181	xorl	%eax,%eax
182	xorl	%ebx,%ebx
183	testl	$32,(%edx)
184	jnz	L008ecb_aligned
185	testl	$15,%edi
186	setz	%al
187	testl	$15,%esi
188	setz	%bl
189	testl	%ebx,%eax
190	jnz	L008ecb_aligned
191	negl	%eax
192	movl	$512,%ebx
193	notl	%eax
194	leal	-24(%esp),%ebp
195	cmpl	%ebx,%ecx
196	cmovcl	%ecx,%ebx
197	andl	%ebx,%eax
198	movl	%ecx,%ebx
199	negl	%eax
200	andl	$511,%ebx
201	leal	(%eax,%ebp,1),%esp
202	movl	$512,%eax
203	cmovzl	%eax,%ebx
204	movl	%ebp,%eax
205	andl	$-16,%ebp
206	andl	$-16,%esp
207	movl	%eax,16(%ebp)
208	cmpl	%ebx,%ecx
209	ja	L009ecb_loop
210	movl	%esi,%eax
211	cmpl	%esp,%ebp
212	cmovel	%edi,%eax
213	addl	%ecx,%eax
214	negl	%eax
215	andl	$4095,%eax
216	cmpl	$128,%eax
217	movl	$-128,%eax
218	cmovael	%ebx,%eax
219	andl	%eax,%ebx
220	jz	L010ecb_unaligned_tail
221	jmp	L009ecb_loop
222.align	4,0x90
223L009ecb_loop:
224	movl	%edi,(%ebp)
225	movl	%esi,4(%ebp)
226	movl	%ecx,8(%ebp)
227	movl	%ebx,%ecx
228	movl	%ebx,12(%ebp)
229	testl	$15,%edi
230	cmovnzl	%esp,%edi
231	testl	$15,%esi
232	jz	L011ecb_inp_aligned
233	shrl	$2,%ecx
234.byte	243,165
235	subl	%ebx,%edi
236	movl	%ebx,%ecx
237	movl	%edi,%esi
238L011ecb_inp_aligned:
239	leal	-16(%edx),%eax
240	leal	16(%edx),%ebx
241	shrl	$4,%ecx
242.byte	243,15,167,200
243	movl	(%ebp),%edi
244	movl	12(%ebp),%ebx
245	testl	$15,%edi
246	jz	L012ecb_out_aligned
247	movl	%ebx,%ecx
248	leal	(%esp),%esi
249	shrl	$2,%ecx
250.byte	243,165
251	subl	%ebx,%edi
252L012ecb_out_aligned:
253	movl	4(%ebp),%esi
254	movl	8(%ebp),%ecx
255	addl	%ebx,%edi
256	addl	%ebx,%esi
257	subl	%ebx,%ecx
258	movl	$512,%ebx
259	jz	L013ecb_break
260	cmpl	%ebx,%ecx
261	jae	L009ecb_loop
262L010ecb_unaligned_tail:
263	xorl	%eax,%eax
264	cmpl	%ebp,%esp
265	cmovel	%ecx,%eax
266	subl	%eax,%esp
267	movl	%edi,%eax
268	movl	%ecx,%ebx
269	shrl	$2,%ecx
270	leal	(%esp),%edi
271.byte	243,165
272	movl	%esp,%esi
273	movl	%eax,%edi
274	movl	%ebx,%ecx
275	jmp	L009ecb_loop
276.align	4,0x90
277L013ecb_break:
278	cmpl	%ebp,%esp
279	je	L014ecb_done
280	pxor	%xmm0,%xmm0
281	leal	(%esp),%eax
282L015ecb_bzero:
283	movaps	%xmm0,(%eax)
284	leal	16(%eax),%eax
285	cmpl	%eax,%ebp
286	ja	L015ecb_bzero
287L014ecb_done:
288	movl	16(%ebp),%ebp
289	leal	24(%ebp),%esp
290	jmp	L016ecb_exit
291.align	4,0x90
292L008ecb_aligned:
293	leal	(%esi,%ecx,1),%ebp
294	negl	%ebp
295	andl	$4095,%ebp
296	xorl	%eax,%eax
297	cmpl	$128,%ebp
298	movl	$127,%ebp
299	cmovael	%eax,%ebp
300	andl	%ecx,%ebp
301	subl	%ebp,%ecx
302	jz	L017ecb_aligned_tail
303	leal	-16(%edx),%eax
304	leal	16(%edx),%ebx
305	shrl	$4,%ecx
306.byte	243,15,167,200
307	testl	%ebp,%ebp
308	jz	L016ecb_exit
309L017ecb_aligned_tail:
310	movl	%ebp,%ecx
311	leal	-24(%esp),%ebp
312	movl	%ebp,%esp
313	movl	%ebp,%eax
314	subl	%ecx,%esp
315	andl	$-16,%ebp
316	andl	$-16,%esp
317	movl	%eax,16(%ebp)
318	movl	%edi,%eax
319	movl	%ecx,%ebx
320	shrl	$2,%ecx
321	leal	(%esp),%edi
322.byte	243,165
323	movl	%esp,%esi
324	movl	%eax,%edi
325	movl	%ebx,%ecx
326	jmp	L009ecb_loop
327L016ecb_exit:
328	movl	$1,%eax
329	leal	4(%esp),%esp
330L006ecb_abort:
331	popl	%edi
332	popl	%esi
333	popl	%ebx
334	popl	%ebp
335	ret
336.globl	_padlock_cbc_encrypt
337.align	4
338_padlock_cbc_encrypt:
339L_padlock_cbc_encrypt_begin:
340	%ifdef __CET__
341
342.byte	243,15,30,251
343	%endif
344
345	pushl	%ebp
346	pushl	%ebx
347	pushl	%esi
348	pushl	%edi
349	movl	20(%esp),%edi
350	movl	24(%esp),%esi
351	movl	28(%esp),%edx
352	movl	32(%esp),%ecx
353	testl	$15,%edx
354	jnz	L018cbc_abort
355	testl	$15,%ecx
356	jnz	L018cbc_abort
357	leal	Lpadlock_saved_context-L019cbc_pic_point,%eax
358	pushfl
359	cld
360	call	__padlock_verify_ctx
361L019cbc_pic_point:
362	leal	16(%edx),%edx
363	xorl	%eax,%eax
364	xorl	%ebx,%ebx
365	testl	$32,(%edx)
366	jnz	L020cbc_aligned
367	testl	$15,%edi
368	setz	%al
369	testl	$15,%esi
370	setz	%bl
371	testl	%ebx,%eax
372	jnz	L020cbc_aligned
373	negl	%eax
374	movl	$512,%ebx
375	notl	%eax
376	leal	-24(%esp),%ebp
377	cmpl	%ebx,%ecx
378	cmovcl	%ecx,%ebx
379	andl	%ebx,%eax
380	movl	%ecx,%ebx
381	negl	%eax
382	andl	$511,%ebx
383	leal	(%eax,%ebp,1),%esp
384	movl	$512,%eax
385	cmovzl	%eax,%ebx
386	movl	%ebp,%eax
387	andl	$-16,%ebp
388	andl	$-16,%esp
389	movl	%eax,16(%ebp)
390	cmpl	%ebx,%ecx
391	ja	L021cbc_loop
392	movl	%esi,%eax
393	cmpl	%esp,%ebp
394	cmovel	%edi,%eax
395	addl	%ecx,%eax
396	negl	%eax
397	andl	$4095,%eax
398	cmpl	$64,%eax
399	movl	$-64,%eax
400	cmovael	%ebx,%eax
401	andl	%eax,%ebx
402	jz	L022cbc_unaligned_tail
403	jmp	L021cbc_loop
404.align	4,0x90
405L021cbc_loop:
406	movl	%edi,(%ebp)
407	movl	%esi,4(%ebp)
408	movl	%ecx,8(%ebp)
409	movl	%ebx,%ecx
410	movl	%ebx,12(%ebp)
411	testl	$15,%edi
412	cmovnzl	%esp,%edi
413	testl	$15,%esi
414	jz	L023cbc_inp_aligned
415	shrl	$2,%ecx
416.byte	243,165
417	subl	%ebx,%edi
418	movl	%ebx,%ecx
419	movl	%edi,%esi
420L023cbc_inp_aligned:
421	leal	-16(%edx),%eax
422	leal	16(%edx),%ebx
423	shrl	$4,%ecx
424.byte	243,15,167,208
425	movaps	(%eax),%xmm0
426	movaps	%xmm0,-16(%edx)
427	movl	(%ebp),%edi
428	movl	12(%ebp),%ebx
429	testl	$15,%edi
430	jz	L024cbc_out_aligned
431	movl	%ebx,%ecx
432	leal	(%esp),%esi
433	shrl	$2,%ecx
434.byte	243,165
435	subl	%ebx,%edi
436L024cbc_out_aligned:
437	movl	4(%ebp),%esi
438	movl	8(%ebp),%ecx
439	addl	%ebx,%edi
440	addl	%ebx,%esi
441	subl	%ebx,%ecx
442	movl	$512,%ebx
443	jz	L025cbc_break
444	cmpl	%ebx,%ecx
445	jae	L021cbc_loop
446L022cbc_unaligned_tail:
447	xorl	%eax,%eax
448	cmpl	%ebp,%esp
449	cmovel	%ecx,%eax
450	subl	%eax,%esp
451	movl	%edi,%eax
452	movl	%ecx,%ebx
453	shrl	$2,%ecx
454	leal	(%esp),%edi
455.byte	243,165
456	movl	%esp,%esi
457	movl	%eax,%edi
458	movl	%ebx,%ecx
459	jmp	L021cbc_loop
460.align	4,0x90
461L025cbc_break:
462	cmpl	%ebp,%esp
463	je	L026cbc_done
464	pxor	%xmm0,%xmm0
465	leal	(%esp),%eax
466L027cbc_bzero:
467	movaps	%xmm0,(%eax)
468	leal	16(%eax),%eax
469	cmpl	%eax,%ebp
470	ja	L027cbc_bzero
471L026cbc_done:
472	movl	16(%ebp),%ebp
473	leal	24(%ebp),%esp
474	jmp	L028cbc_exit
475.align	4,0x90
476L020cbc_aligned:
477	leal	(%esi,%ecx,1),%ebp
478	negl	%ebp
479	andl	$4095,%ebp
480	xorl	%eax,%eax
481	cmpl	$64,%ebp
482	movl	$63,%ebp
483	cmovael	%eax,%ebp
484	andl	%ecx,%ebp
485	subl	%ebp,%ecx
486	jz	L029cbc_aligned_tail
487	leal	-16(%edx),%eax
488	leal	16(%edx),%ebx
489	shrl	$4,%ecx
490.byte	243,15,167,208
491	movaps	(%eax),%xmm0
492	movaps	%xmm0,-16(%edx)
493	testl	%ebp,%ebp
494	jz	L028cbc_exit
495L029cbc_aligned_tail:
496	movl	%ebp,%ecx
497	leal	-24(%esp),%ebp
498	movl	%ebp,%esp
499	movl	%ebp,%eax
500	subl	%ecx,%esp
501	andl	$-16,%ebp
502	andl	$-16,%esp
503	movl	%eax,16(%ebp)
504	movl	%edi,%eax
505	movl	%ecx,%ebx
506	shrl	$2,%ecx
507	leal	(%esp),%edi
508.byte	243,165
509	movl	%esp,%esi
510	movl	%eax,%edi
511	movl	%ebx,%ecx
512	jmp	L021cbc_loop
513L028cbc_exit:
514	movl	$1,%eax
515	leal	4(%esp),%esp
516L018cbc_abort:
517	popl	%edi
518	popl	%esi
519	popl	%ebx
520	popl	%ebp
521	ret
522.globl	_padlock_cfb_encrypt
523.align	4
524_padlock_cfb_encrypt:
525L_padlock_cfb_encrypt_begin:
526	%ifdef __CET__
527
528.byte	243,15,30,251
529	%endif
530
531	pushl	%ebp
532	pushl	%ebx
533	pushl	%esi
534	pushl	%edi
535	movl	20(%esp),%edi
536	movl	24(%esp),%esi
537	movl	28(%esp),%edx
538	movl	32(%esp),%ecx
539	testl	$15,%edx
540	jnz	L030cfb_abort
541	testl	$15,%ecx
542	jnz	L030cfb_abort
543	leal	Lpadlock_saved_context-L031cfb_pic_point,%eax
544	pushfl
545	cld
546	call	__padlock_verify_ctx
547L031cfb_pic_point:
548	leal	16(%edx),%edx
549	xorl	%eax,%eax
550	xorl	%ebx,%ebx
551	testl	$32,(%edx)
552	jnz	L032cfb_aligned
553	testl	$15,%edi
554	setz	%al
555	testl	$15,%esi
556	setz	%bl
557	testl	%ebx,%eax
558	jnz	L032cfb_aligned
559	negl	%eax
560	movl	$512,%ebx
561	notl	%eax
562	leal	-24(%esp),%ebp
563	cmpl	%ebx,%ecx
564	cmovcl	%ecx,%ebx
565	andl	%ebx,%eax
566	movl	%ecx,%ebx
567	negl	%eax
568	andl	$511,%ebx
569	leal	(%eax,%ebp,1),%esp
570	movl	$512,%eax
571	cmovzl	%eax,%ebx
572	movl	%ebp,%eax
573	andl	$-16,%ebp
574	andl	$-16,%esp
575	movl	%eax,16(%ebp)
576	jmp	L033cfb_loop
577.align	4,0x90
578L033cfb_loop:
579	movl	%edi,(%ebp)
580	movl	%esi,4(%ebp)
581	movl	%ecx,8(%ebp)
582	movl	%ebx,%ecx
583	movl	%ebx,12(%ebp)
584	testl	$15,%edi
585	cmovnzl	%esp,%edi
586	testl	$15,%esi
587	jz	L034cfb_inp_aligned
588	shrl	$2,%ecx
589.byte	243,165
590	subl	%ebx,%edi
591	movl	%ebx,%ecx
592	movl	%edi,%esi
593L034cfb_inp_aligned:
594	leal	-16(%edx),%eax
595	leal	16(%edx),%ebx
596	shrl	$4,%ecx
597.byte	243,15,167,224
598	movaps	(%eax),%xmm0
599	movaps	%xmm0,-16(%edx)
600	movl	(%ebp),%edi
601	movl	12(%ebp),%ebx
602	testl	$15,%edi
603	jz	L035cfb_out_aligned
604	movl	%ebx,%ecx
605	leal	(%esp),%esi
606	shrl	$2,%ecx
607.byte	243,165
608	subl	%ebx,%edi
609L035cfb_out_aligned:
610	movl	4(%ebp),%esi
611	movl	8(%ebp),%ecx
612	addl	%ebx,%edi
613	addl	%ebx,%esi
614	subl	%ebx,%ecx
615	movl	$512,%ebx
616	jnz	L033cfb_loop
617	cmpl	%ebp,%esp
618	je	L036cfb_done
619	pxor	%xmm0,%xmm0
620	leal	(%esp),%eax
621L037cfb_bzero:
622	movaps	%xmm0,(%eax)
623	leal	16(%eax),%eax
624	cmpl	%eax,%ebp
625	ja	L037cfb_bzero
626L036cfb_done:
627	movl	16(%ebp),%ebp
628	leal	24(%ebp),%esp
629	jmp	L038cfb_exit
630.align	4,0x90
631L032cfb_aligned:
632	leal	-16(%edx),%eax
633	leal	16(%edx),%ebx
634	shrl	$4,%ecx
635.byte	243,15,167,224
636	movaps	(%eax),%xmm0
637	movaps	%xmm0,-16(%edx)
638L038cfb_exit:
639	movl	$1,%eax
640	leal	4(%esp),%esp
641L030cfb_abort:
642	popl	%edi
643	popl	%esi
644	popl	%ebx
645	popl	%ebp
646	ret
647.globl	_padlock_ofb_encrypt
648.align	4
649_padlock_ofb_encrypt:
650L_padlock_ofb_encrypt_begin:
651	%ifdef __CET__
652
653.byte	243,15,30,251
654	%endif
655
656	pushl	%ebp
657	pushl	%ebx
658	pushl	%esi
659	pushl	%edi
660	movl	20(%esp),%edi
661	movl	24(%esp),%esi
662	movl	28(%esp),%edx
663	movl	32(%esp),%ecx
664	testl	$15,%edx
665	jnz	L039ofb_abort
666	testl	$15,%ecx
667	jnz	L039ofb_abort
668	leal	Lpadlock_saved_context-L040ofb_pic_point,%eax
669	pushfl
670	cld
671	call	__padlock_verify_ctx
672L040ofb_pic_point:
673	leal	16(%edx),%edx
674	xorl	%eax,%eax
675	xorl	%ebx,%ebx
676	testl	$32,(%edx)
677	jnz	L041ofb_aligned
678	testl	$15,%edi
679	setz	%al
680	testl	$15,%esi
681	setz	%bl
682	testl	%ebx,%eax
683	jnz	L041ofb_aligned
684	negl	%eax
685	movl	$512,%ebx
686	notl	%eax
687	leal	-24(%esp),%ebp
688	cmpl	%ebx,%ecx
689	cmovcl	%ecx,%ebx
690	andl	%ebx,%eax
691	movl	%ecx,%ebx
692	negl	%eax
693	andl	$511,%ebx
694	leal	(%eax,%ebp,1),%esp
695	movl	$512,%eax
696	cmovzl	%eax,%ebx
697	movl	%ebp,%eax
698	andl	$-16,%ebp
699	andl	$-16,%esp
700	movl	%eax,16(%ebp)
701	jmp	L042ofb_loop
702.align	4,0x90
703L042ofb_loop:
704	movl	%edi,(%ebp)
705	movl	%esi,4(%ebp)
706	movl	%ecx,8(%ebp)
707	movl	%ebx,%ecx
708	movl	%ebx,12(%ebp)
709	testl	$15,%edi
710	cmovnzl	%esp,%edi
711	testl	$15,%esi
712	jz	L043ofb_inp_aligned
713	shrl	$2,%ecx
714.byte	243,165
715	subl	%ebx,%edi
716	movl	%ebx,%ecx
717	movl	%edi,%esi
718L043ofb_inp_aligned:
719	leal	-16(%edx),%eax
720	leal	16(%edx),%ebx
721	shrl	$4,%ecx
722.byte	243,15,167,232
723	movaps	(%eax),%xmm0
724	movaps	%xmm0,-16(%edx)
725	movl	(%ebp),%edi
726	movl	12(%ebp),%ebx
727	testl	$15,%edi
728	jz	L044ofb_out_aligned
729	movl	%ebx,%ecx
730	leal	(%esp),%esi
731	shrl	$2,%ecx
732.byte	243,165
733	subl	%ebx,%edi
734L044ofb_out_aligned:
735	movl	4(%ebp),%esi
736	movl	8(%ebp),%ecx
737	addl	%ebx,%edi
738	addl	%ebx,%esi
739	subl	%ebx,%ecx
740	movl	$512,%ebx
741	jnz	L042ofb_loop
742	cmpl	%ebp,%esp
743	je	L045ofb_done
744	pxor	%xmm0,%xmm0
745	leal	(%esp),%eax
746L046ofb_bzero:
747	movaps	%xmm0,(%eax)
748	leal	16(%eax),%eax
749	cmpl	%eax,%ebp
750	ja	L046ofb_bzero
751L045ofb_done:
752	movl	16(%ebp),%ebp
753	leal	24(%ebp),%esp
754	jmp	L047ofb_exit
755.align	4,0x90
756L041ofb_aligned:
757	leal	-16(%edx),%eax
758	leal	16(%edx),%ebx
759	shrl	$4,%ecx
760.byte	243,15,167,232
761	movaps	(%eax),%xmm0
762	movaps	%xmm0,-16(%edx)
763L047ofb_exit:
764	movl	$1,%eax
765	leal	4(%esp),%esp
766L039ofb_abort:
767	popl	%edi
768	popl	%esi
769	popl	%ebx
770	popl	%ebp
771	ret
772.globl	_padlock_ctr32_encrypt
773.align	4
774_padlock_ctr32_encrypt:
775L_padlock_ctr32_encrypt_begin:
776	%ifdef __CET__
777
778.byte	243,15,30,251
779	%endif
780
781	pushl	%ebp
782	pushl	%ebx
783	pushl	%esi
784	pushl	%edi
785	movl	20(%esp),%edi
786	movl	24(%esp),%esi
787	movl	28(%esp),%edx
788	movl	32(%esp),%ecx
789	testl	$15,%edx
790	jnz	L048ctr32_abort
791	testl	$15,%ecx
792	jnz	L048ctr32_abort
793	leal	Lpadlock_saved_context-L049ctr32_pic_point,%eax
794	pushfl
795	cld
796	call	__padlock_verify_ctx
797L049ctr32_pic_point:
798	leal	16(%edx),%edx
799	xorl	%eax,%eax
800	movq	-16(%edx),%mm0
801	movl	$512,%ebx
802	notl	%eax
803	leal	-24(%esp),%ebp
804	cmpl	%ebx,%ecx
805	cmovcl	%ecx,%ebx
806	andl	%ebx,%eax
807	movl	%ecx,%ebx
808	negl	%eax
809	andl	$511,%ebx
810	leal	(%eax,%ebp,1),%esp
811	movl	$512,%eax
812	cmovzl	%eax,%ebx
813	movl	%ebp,%eax
814	andl	$-16,%ebp
815	andl	$-16,%esp
816	movl	%eax,16(%ebp)
817	jmp	L050ctr32_loop
818.align	4,0x90
819L050ctr32_loop:
820	movl	%edi,(%ebp)
821	movl	%esi,4(%ebp)
822	movl	%ecx,8(%ebp)
823	movl	%ebx,%ecx
824	movl	%ebx,12(%ebp)
825	movl	-4(%edx),%ecx
826	xorl	%edi,%edi
827	movl	-8(%edx),%eax
828L051ctr32_prepare:
829	movl	%ecx,12(%esp,%edi,1)
830	bswap	%ecx
831	movq	%mm0,(%esp,%edi,1)
832	incl	%ecx
833	movl	%eax,8(%esp,%edi,1)
834	bswap	%ecx
835	leal	16(%edi),%edi
836	cmpl	%ebx,%edi
837	jb	L051ctr32_prepare
838	movl	%ecx,-4(%edx)
839	leal	(%esp),%esi
840	leal	(%esp),%edi
841	movl	%ebx,%ecx
842	leal	-16(%edx),%eax
843	leal	16(%edx),%ebx
844	shrl	$4,%ecx
845.byte	243,15,167,200
846	movl	(%ebp),%edi
847	movl	12(%ebp),%ebx
848	movl	4(%ebp),%esi
849	xorl	%ecx,%ecx
850L052ctr32_xor:
851	movups	(%esi,%ecx,1),%xmm1
852	leal	16(%ecx),%ecx
853	pxor	-16(%esp,%ecx,1),%xmm1
854	movups	%xmm1,-16(%edi,%ecx,1)
855	cmpl	%ebx,%ecx
856	jb	L052ctr32_xor
857	movl	8(%ebp),%ecx
858	addl	%ebx,%edi
859	addl	%ebx,%esi
860	subl	%ebx,%ecx
861	movl	$512,%ebx
862	jnz	L050ctr32_loop
863	pxor	%xmm0,%xmm0
864	leal	(%esp),%eax
865L053ctr32_bzero:
866	movaps	%xmm0,(%eax)
867	leal	16(%eax),%eax
868	cmpl	%eax,%ebp
869	ja	L053ctr32_bzero
870L054ctr32_done:
871	movl	16(%ebp),%ebp
872	leal	24(%ebp),%esp
873	movl	$1,%eax
874	leal	4(%esp),%esp
875	emms
876L048ctr32_abort:
877	popl	%edi
878	popl	%esi
879	popl	%ebx
880	popl	%ebp
881	ret
882.globl	_padlock_xstore
883.align	4
884_padlock_xstore:
885L_padlock_xstore_begin:
886	%ifdef __CET__
887
888.byte	243,15,30,251
889	%endif
890
891	pushl	%edi
892	movl	8(%esp),%edi
893	movl	12(%esp),%edx
894.byte	15,167,192
895	popl	%edi
896	ret
897.align	4
898__win32_segv_handler:
899	%ifdef __CET__
900
901.byte	243,15,30,251
902	%endif
903
904	movl	$1,%eax
905	movl	4(%esp),%edx
906	movl	12(%esp),%ecx
907	cmpl	$3221225477,(%edx)
908	jne	L055ret
909	addl	$4,184(%ecx)
910	movl	$0,%eax
911L055ret:
912	ret
913.globl	_padlock_sha1_oneshot
914.align	4
915_padlock_sha1_oneshot:
916L_padlock_sha1_oneshot_begin:
917	%ifdef __CET__
918
919.byte	243,15,30,251
920	%endif
921
922	pushl	%edi
923	pushl	%esi
924	xorl	%eax,%eax
925	movl	12(%esp),%edi
926	movl	16(%esp),%esi
927	movl	20(%esp),%ecx
928	movl	%esp,%edx
929	addl	$-128,%esp
930	movups	(%edi),%xmm0
931	andl	$-16,%esp
932	movl	16(%edi),%eax
933	movaps	%xmm0,(%esp)
934	movl	%esp,%edi
935	movl	%eax,16(%esp)
936	xorl	%eax,%eax
937.byte	243,15,166,200
938	movaps	(%esp),%xmm0
939	movl	16(%esp),%eax
940	movl	%edx,%esp
941	movl	12(%esp),%edi
942	movups	%xmm0,(%edi)
943	movl	%eax,16(%edi)
944	popl	%esi
945	popl	%edi
946	ret
947.globl	_padlock_sha1_blocks
948.align	4
949_padlock_sha1_blocks:
950L_padlock_sha1_blocks_begin:
951	%ifdef __CET__
952
953.byte	243,15,30,251
954	%endif
955
956	pushl	%edi
957	pushl	%esi
958	movl	12(%esp),%edi
959	movl	16(%esp),%esi
960	movl	%esp,%edx
961	movl	20(%esp),%ecx
962	addl	$-128,%esp
963	movups	(%edi),%xmm0
964	andl	$-16,%esp
965	movl	16(%edi),%eax
966	movaps	%xmm0,(%esp)
967	movl	%esp,%edi
968	movl	%eax,16(%esp)
969	movl	$-1,%eax
970.byte	243,15,166,200
971	movaps	(%esp),%xmm0
972	movl	16(%esp),%eax
973	movl	%edx,%esp
974	movl	12(%esp),%edi
975	movups	%xmm0,(%edi)
976	movl	%eax,16(%edi)
977	popl	%esi
978	popl	%edi
979	ret
980.globl	_padlock_sha256_oneshot
981.align	4
982_padlock_sha256_oneshot:
983L_padlock_sha256_oneshot_begin:
984	%ifdef __CET__
985
986.byte	243,15,30,251
987	%endif
988
989	pushl	%edi
990	pushl	%esi
991	xorl	%eax,%eax
992	movl	12(%esp),%edi
993	movl	16(%esp),%esi
994	movl	20(%esp),%ecx
995	movl	%esp,%edx
996	addl	$-128,%esp
997	movups	(%edi),%xmm0
998	andl	$-16,%esp
999	movups	16(%edi),%xmm1
1000	movaps	%xmm0,(%esp)
1001	movl	%esp,%edi
1002	movaps	%xmm1,16(%esp)
1003	xorl	%eax,%eax
1004.byte	243,15,166,208
1005	movaps	(%esp),%xmm0
1006	movaps	16(%esp),%xmm1
1007	movl	%edx,%esp
1008	movl	12(%esp),%edi
1009	movups	%xmm0,(%edi)
1010	movups	%xmm1,16(%edi)
1011	popl	%esi
1012	popl	%edi
1013	ret
1014.globl	_padlock_sha256_blocks
1015.align	4
1016_padlock_sha256_blocks:
1017L_padlock_sha256_blocks_begin:
1018	%ifdef __CET__
1019
1020.byte	243,15,30,251
1021	%endif
1022
1023	pushl	%edi
1024	pushl	%esi
1025	movl	12(%esp),%edi
1026	movl	16(%esp),%esi
1027	movl	20(%esp),%ecx
1028	movl	%esp,%edx
1029	addl	$-128,%esp
1030	movups	(%edi),%xmm0
1031	andl	$-16,%esp
1032	movups	16(%edi),%xmm1
1033	movaps	%xmm0,(%esp)
1034	movl	%esp,%edi
1035	movaps	%xmm1,16(%esp)
1036	movl	$-1,%eax
1037.byte	243,15,166,208
1038	movaps	(%esp),%xmm0
1039	movaps	16(%esp),%xmm1
1040	movl	%edx,%esp
1041	movl	12(%esp),%edi
1042	movups	%xmm0,(%edi)
1043	movups	%xmm1,16(%edi)
1044	popl	%esi
1045	popl	%edi
1046	ret
1047.globl	_padlock_sha512_blocks
1048.align	4
1049_padlock_sha512_blocks:
1050L_padlock_sha512_blocks_begin:
1051	%ifdef __CET__
1052
1053.byte	243,15,30,251
1054	%endif
1055
1056	pushl	%edi
1057	pushl	%esi
1058	movl	12(%esp),%edi
1059	movl	16(%esp),%esi
1060	movl	20(%esp),%ecx
1061	movl	%esp,%edx
1062	addl	$-128,%esp
1063	movups	(%edi),%xmm0
1064	andl	$-16,%esp
1065	movups	16(%edi),%xmm1
1066	movups	32(%edi),%xmm2
1067	movups	48(%edi),%xmm3
1068	movaps	%xmm0,(%esp)
1069	movl	%esp,%edi
1070	movaps	%xmm1,16(%esp)
1071	movaps	%xmm2,32(%esp)
1072	movaps	%xmm3,48(%esp)
1073.byte	243,15,166,224
1074	movaps	(%esp),%xmm0
1075	movaps	16(%esp),%xmm1
1076	movaps	32(%esp),%xmm2
1077	movaps	48(%esp),%xmm3
1078	movl	%edx,%esp
1079	movl	12(%esp),%edi
1080	movups	%xmm0,(%edi)
1081	movups	%xmm1,16(%edi)
1082	movups	%xmm2,32(%edi)
1083	movups	%xmm3,48(%edi)
1084	popl	%esi
1085	popl	%edi
1086	ret
1087.byte	86,73,65,32,80,97,100,108,111,99,107,32,120,56,54,32
1088.byte	109,111,100,117,108,101,44,32,67,82,89,80,84,79,71,65
1089.byte	77,83,32,98,121,32,60,97,112,112,114,111,64,111,112,101
1090.byte	110,115,115,108,46,111,114,103,62,0
1091.align	4,0x90
1092.data
1093.align	2,0x90
1094Lpadlock_saved_context:
1095.long	0
1096