Utilize the optimized SHA functions in Padlock HMAC.
[gnutls:gnutls.git] / lib / accelerated / x86 / coff / padlock-x86-coff.s
1 # Copyright (c) 2011-2012, Andy Polyakov <appro@openssl.org>
2 # All rights reserved.
3 #
4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions
6 # are met:
7
8 #     * Redistributions of source code must retain copyright notices,
9 #      this list of conditions and the following disclaimer.
10 #
11 #     * Redistributions in binary form must reproduce the above
12 #      copyright notice, this list of conditions and the following
13 #      disclaimer in the documentation and/or other materials
14 #      provided with the distribution.
15 #
16 #     * Neither the name of the Andy Polyakov nor the names of its
17 #      copyright holder and contributors may be used to endorse or
18 #      promote products derived from this software without specific
19 #      prior written permission.
20 #
21 # ALTERNATIVELY, provided that this notice is retained in full, this
22 # product may be distributed under the terms of the GNU General Public
23 # License (GPL), in which case the provisions of the GPL apply INSTEAD OF
24 # those given above.
25 #
26 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS
27 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
28 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
29 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
30 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
31 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
32 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
33 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
34 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
35 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
36 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 #
38 # *** This file is auto-generated ***
39 #
40 .file   "devel/perlasm/e_padlock-x86.s"
41 .text
42 .globl  _padlock_capability
43 .def    _padlock_capability;    .scl    2;      .type   32;     .endef
44 .align  16
45 _padlock_capability:
46 .L_padlock_capability_begin:
47         pushl   %ebx
48         pushfl
49         popl    %eax
50         movl    %eax,%ecx
51         xorl    $2097152,%eax
52         pushl   %eax
53         popfl
54         pushfl
55         popl    %eax
56         xorl    %eax,%ecx
57         xorl    %eax,%eax
58         btl     $21,%ecx
59         jnc     .L000noluck
60         .byte   0x0f,0xa2
61         xorl    %eax,%eax
62         cmpl    $0x746e6543,%ebx
63         jne     .L000noluck
64         cmpl    $0x48727561,%edx
65         jne     .L000noluck
66         cmpl    $0x736c7561,%ecx
67         jne     .L000noluck
68         movl    $3221225472,%eax
69         .byte   0x0f,0xa2
70         movl    %eax,%edx
71         xorl    %eax,%eax
72         cmpl    $3221225473,%edx
73         jb      .L000noluck
74         movl    $1,%eax
75         .byte   0x0f,0xa2
76         orl     $15,%eax
77         xorl    %ebx,%ebx
78         andl    $4095,%eax
79         cmpl    $1791,%eax
80         sete    %bl
81         movl    $3221225473,%eax
82         pushl   %ebx
83         .byte   0x0f,0xa2
84         popl    %ebx
85         movl    %edx,%eax
86         shll    $4,%ebx
87         andl    $4294967279,%eax
88         orl     %ebx,%eax
89 .L000noluck:
90         popl    %ebx
91         ret
92 .globl  _padlock_key_bswap
93 .def    _padlock_key_bswap;     .scl    2;      .type   32;     .endef
94 .align  16
95 _padlock_key_bswap:
96 .L_padlock_key_bswap_begin:
97         movl    4(%esp),%edx
98         movl    240(%edx),%ecx
99 .L001bswap_loop:
100         movl    (%edx),%eax
101         bswap   %eax
102         movl    %eax,(%edx)
103         leal    4(%edx),%edx
104         subl    $1,%ecx
105         jnz     .L001bswap_loop
106         ret
107 .globl  _padlock_verify_context
108 .def    _padlock_verify_context;        .scl    2;      .type   32;     .endef
109 .align  16
110 _padlock_verify_context:
111 .L_padlock_verify_context_begin:
112         movl    4(%esp),%edx
113         leal    .Lpadlock_saved_context,%eax
114         pushfl
115         call    __padlock_verify_ctx
116 .L002verify_pic_point:
117         leal    4(%esp),%esp
118         ret
119 .def    __padlock_verify_ctx;   .scl    3;      .type   32;     .endef
120 .align  16
121 __padlock_verify_ctx:
122         btl     $30,4(%esp)
123         jnc     .L003verified
124         cmpl    (%eax),%edx
125         je      .L003verified
126         pushfl
127         popfl
128 .L003verified:
129         movl    %edx,(%eax)
130         ret
131 .globl  _padlock_reload_key
132 .def    _padlock_reload_key;    .scl    2;      .type   32;     .endef
133 .align  16
134 _padlock_reload_key:
135 .L_padlock_reload_key_begin:
136         pushfl
137         popfl
138         ret
139 .globl  _padlock_aes_block
140 .def    _padlock_aes_block;     .scl    2;      .type   32;     .endef
141 .align  16
142 _padlock_aes_block:
143 .L_padlock_aes_block_begin:
144         pushl   %edi
145         pushl   %esi
146         pushl   %ebx
147         movl    16(%esp),%edi
148         movl    20(%esp),%esi
149         movl    24(%esp),%edx
150         movl    $1,%ecx
151         leal    32(%edx),%ebx
152         leal    16(%edx),%edx
153 .byte   243,15,167,200
154         popl    %ebx
155         popl    %esi
156         popl    %edi
157         ret
158 .globl  _padlock_ecb_encrypt
159 .def    _padlock_ecb_encrypt;   .scl    2;      .type   32;     .endef
160 .align  16
161 _padlock_ecb_encrypt:
162 .L_padlock_ecb_encrypt_begin:
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     .L004ecb_abort
173         testl   $15,%ecx
174         jnz     .L004ecb_abort
175         leal    .Lpadlock_saved_context,%eax
176         pushfl
177         cld
178         call    __padlock_verify_ctx
179 .L005ecb_pic_point:
180         leal    16(%edx),%edx
181         xorl    %eax,%eax
182         xorl    %ebx,%ebx
183         testl   $32,(%edx)
184         jnz     .L006ecb_aligned
185         testl   $15,%edi
186         setz    %al
187         testl   $15,%esi
188         setz    %bl
189         testl   %ebx,%eax
190         jnz     .L006ecb_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      .L007ecb_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      .L008ecb_unaligned_tail
221         jmp     .L007ecb_loop
222 .align  16
223 .L007ecb_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      .L009ecb_inp_aligned
233         shrl    $2,%ecx
234 .byte   243,165
235         subl    %ebx,%edi
236         movl    %ebx,%ecx
237         movl    %edi,%esi
238 .L009ecb_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      .L010ecb_out_aligned
247         movl    %ebx,%ecx
248         leal    (%esp),%esi
249         shrl    $2,%ecx
250 .byte   243,165
251         subl    %ebx,%edi
252 .L010ecb_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      .L011ecb_break
260         cmpl    %ebx,%ecx
261         jae     .L007ecb_loop
262 .L008ecb_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     .L007ecb_loop
276 .align  16
277 .L011ecb_break:
278         cmpl    %ebp,%esp
279         je      .L012ecb_done
280         pxor    %xmm0,%xmm0
281         leal    (%esp),%eax
282 .L013ecb_bzero:
283         movaps  %xmm0,(%eax)
284         leal    16(%eax),%eax
285         cmpl    %eax,%ebp
286         ja      .L013ecb_bzero
287 .L012ecb_done:
288         movl    16(%ebp),%ebp
289         leal    24(%ebp),%esp
290         jmp     .L014ecb_exit
291 .align  16
292 .L006ecb_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      .L015ecb_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      .L014ecb_exit
309 .L015ecb_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     .L007ecb_loop
327 .L014ecb_exit:
328         movl    $1,%eax
329         leal    4(%esp),%esp
330 .L004ecb_abort:
331         popl    %edi
332         popl    %esi
333         popl    %ebx
334         popl    %ebp
335         ret
336 .globl  _padlock_cbc_encrypt
337 .def    _padlock_cbc_encrypt;   .scl    2;      .type   32;     .endef
338 .align  16
339 _padlock_cbc_encrypt:
340 .L_padlock_cbc_encrypt_begin:
341         pushl   %ebp
342         pushl   %ebx
343         pushl   %esi
344         pushl   %edi
345         movl    20(%esp),%edi
346         movl    24(%esp),%esi
347         movl    28(%esp),%edx
348         movl    32(%esp),%ecx
349         testl   $15,%edx
350         jnz     .L016cbc_abort
351         testl   $15,%ecx
352         jnz     .L016cbc_abort
353         leal    .Lpadlock_saved_context,%eax
354         pushfl
355         cld
356         call    __padlock_verify_ctx
357 .L017cbc_pic_point:
358         leal    16(%edx),%edx
359         xorl    %eax,%eax
360         xorl    %ebx,%ebx
361         testl   $32,(%edx)
362         jnz     .L018cbc_aligned
363         testl   $15,%edi
364         setz    %al
365         testl   $15,%esi
366         setz    %bl
367         testl   %ebx,%eax
368         jnz     .L018cbc_aligned
369         negl    %eax
370         movl    $512,%ebx
371         notl    %eax
372         leal    -24(%esp),%ebp
373         cmpl    %ebx,%ecx
374         cmovcl  %ecx,%ebx
375         andl    %ebx,%eax
376         movl    %ecx,%ebx
377         negl    %eax
378         andl    $511,%ebx
379         leal    (%eax,%ebp,1),%esp
380         movl    $512,%eax
381         cmovzl  %eax,%ebx
382         movl    %ebp,%eax
383         andl    $-16,%ebp
384         andl    $-16,%esp
385         movl    %eax,16(%ebp)
386         cmpl    %ebx,%ecx
387         ja      .L019cbc_loop
388         movl    %esi,%eax
389         cmpl    %esp,%ebp
390         cmovel  %edi,%eax
391         addl    %ecx,%eax
392         negl    %eax
393         andl    $4095,%eax
394         cmpl    $64,%eax
395         movl    $-64,%eax
396         cmovael %ebx,%eax
397         andl    %eax,%ebx
398         jz      .L020cbc_unaligned_tail
399         jmp     .L019cbc_loop
400 .align  16
401 .L019cbc_loop:
402         movl    %edi,(%ebp)
403         movl    %esi,4(%ebp)
404         movl    %ecx,8(%ebp)
405         movl    %ebx,%ecx
406         movl    %ebx,12(%ebp)
407         testl   $15,%edi
408         cmovnzl %esp,%edi
409         testl   $15,%esi
410         jz      .L021cbc_inp_aligned
411         shrl    $2,%ecx
412 .byte   243,165
413         subl    %ebx,%edi
414         movl    %ebx,%ecx
415         movl    %edi,%esi
416 .L021cbc_inp_aligned:
417         leal    -16(%edx),%eax
418         leal    16(%edx),%ebx
419         shrl    $4,%ecx
420 .byte   243,15,167,208
421         movaps  (%eax),%xmm0
422         movaps  %xmm0,-16(%edx)
423         movl    (%ebp),%edi
424         movl    12(%ebp),%ebx
425         testl   $15,%edi
426         jz      .L022cbc_out_aligned
427         movl    %ebx,%ecx
428         leal    (%esp),%esi
429         shrl    $2,%ecx
430 .byte   243,165
431         subl    %ebx,%edi
432 .L022cbc_out_aligned:
433         movl    4(%ebp),%esi
434         movl    8(%ebp),%ecx
435         addl    %ebx,%edi
436         addl    %ebx,%esi
437         subl    %ebx,%ecx
438         movl    $512,%ebx
439         jz      .L023cbc_break
440         cmpl    %ebx,%ecx
441         jae     .L019cbc_loop
442 .L020cbc_unaligned_tail:
443         xorl    %eax,%eax
444         cmpl    %ebp,%esp
445         cmovel  %ecx,%eax
446         subl    %eax,%esp
447         movl    %edi,%eax
448         movl    %ecx,%ebx
449         shrl    $2,%ecx
450         leal    (%esp),%edi
451 .byte   243,165
452         movl    %esp,%esi
453         movl    %eax,%edi
454         movl    %ebx,%ecx
455         jmp     .L019cbc_loop
456 .align  16
457 .L023cbc_break:
458         cmpl    %ebp,%esp
459         je      .L024cbc_done
460         pxor    %xmm0,%xmm0
461         leal    (%esp),%eax
462 .L025cbc_bzero:
463         movaps  %xmm0,(%eax)
464         leal    16(%eax),%eax
465         cmpl    %eax,%ebp
466         ja      .L025cbc_bzero
467 .L024cbc_done:
468         movl    16(%ebp),%ebp
469         leal    24(%ebp),%esp
470         jmp     .L026cbc_exit
471 .align  16
472 .L018cbc_aligned:
473         leal    (%esi,%ecx,1),%ebp
474         negl    %ebp
475         andl    $4095,%ebp
476         xorl    %eax,%eax
477         cmpl    $64,%ebp
478         movl    $63,%ebp
479         cmovael %eax,%ebp
480         andl    %ecx,%ebp
481         subl    %ebp,%ecx
482         jz      .L027cbc_aligned_tail
483         leal    -16(%edx),%eax
484         leal    16(%edx),%ebx
485         shrl    $4,%ecx
486 .byte   243,15,167,208
487         movaps  (%eax),%xmm0
488         movaps  %xmm0,-16(%edx)
489         testl   %ebp,%ebp
490         jz      .L026cbc_exit
491 .L027cbc_aligned_tail:
492         movl    %ebp,%ecx
493         leal    -24(%esp),%ebp
494         movl    %ebp,%esp
495         movl    %ebp,%eax
496         subl    %ecx,%esp
497         andl    $-16,%ebp
498         andl    $-16,%esp
499         movl    %eax,16(%ebp)
500         movl    %edi,%eax
501         movl    %ecx,%ebx
502         shrl    $2,%ecx
503         leal    (%esp),%edi
504 .byte   243,165
505         movl    %esp,%esi
506         movl    %eax,%edi
507         movl    %ebx,%ecx
508         jmp     .L019cbc_loop
509 .L026cbc_exit:
510         movl    $1,%eax
511         leal    4(%esp),%esp
512 .L016cbc_abort:
513         popl    %edi
514         popl    %esi
515         popl    %ebx
516         popl    %ebp
517         ret
518 .globl  _padlock_cfb_encrypt
519 .def    _padlock_cfb_encrypt;   .scl    2;      .type   32;     .endef
520 .align  16
521 _padlock_cfb_encrypt:
522 .L_padlock_cfb_encrypt_begin:
523         pushl   %ebp
524         pushl   %ebx
525         pushl   %esi
526         pushl   %edi
527         movl    20(%esp),%edi
528         movl    24(%esp),%esi
529         movl    28(%esp),%edx
530         movl    32(%esp),%ecx
531         testl   $15,%edx
532         jnz     .L028cfb_abort
533         testl   $15,%ecx
534         jnz     .L028cfb_abort
535         leal    .Lpadlock_saved_context,%eax
536         pushfl
537         cld
538         call    __padlock_verify_ctx
539 .L029cfb_pic_point:
540         leal    16(%edx),%edx
541         xorl    %eax,%eax
542         xorl    %ebx,%ebx
543         testl   $32,(%edx)
544         jnz     .L030cfb_aligned
545         testl   $15,%edi
546         setz    %al
547         testl   $15,%esi
548         setz    %bl
549         testl   %ebx,%eax
550         jnz     .L030cfb_aligned
551         negl    %eax
552         movl    $512,%ebx
553         notl    %eax
554         leal    -24(%esp),%ebp
555         cmpl    %ebx,%ecx
556         cmovcl  %ecx,%ebx
557         andl    %ebx,%eax
558         movl    %ecx,%ebx
559         negl    %eax
560         andl    $511,%ebx
561         leal    (%eax,%ebp,1),%esp
562         movl    $512,%eax
563         cmovzl  %eax,%ebx
564         movl    %ebp,%eax
565         andl    $-16,%ebp
566         andl    $-16,%esp
567         movl    %eax,16(%ebp)
568         jmp     .L031cfb_loop
569 .align  16
570 .L031cfb_loop:
571         movl    %edi,(%ebp)
572         movl    %esi,4(%ebp)
573         movl    %ecx,8(%ebp)
574         movl    %ebx,%ecx
575         movl    %ebx,12(%ebp)
576         testl   $15,%edi
577         cmovnzl %esp,%edi
578         testl   $15,%esi
579         jz      .L032cfb_inp_aligned
580         shrl    $2,%ecx
581 .byte   243,165
582         subl    %ebx,%edi
583         movl    %ebx,%ecx
584         movl    %edi,%esi
585 .L032cfb_inp_aligned:
586         leal    -16(%edx),%eax
587         leal    16(%edx),%ebx
588         shrl    $4,%ecx
589 .byte   243,15,167,224
590         movaps  (%eax),%xmm0
591         movaps  %xmm0,-16(%edx)
592         movl    (%ebp),%edi
593         movl    12(%ebp),%ebx
594         testl   $15,%edi
595         jz      .L033cfb_out_aligned
596         movl    %ebx,%ecx
597         leal    (%esp),%esi
598         shrl    $2,%ecx
599 .byte   243,165
600         subl    %ebx,%edi
601 .L033cfb_out_aligned:
602         movl    4(%ebp),%esi
603         movl    8(%ebp),%ecx
604         addl    %ebx,%edi
605         addl    %ebx,%esi
606         subl    %ebx,%ecx
607         movl    $512,%ebx
608         jnz     .L031cfb_loop
609         cmpl    %ebp,%esp
610         je      .L034cfb_done
611         pxor    %xmm0,%xmm0
612         leal    (%esp),%eax
613 .L035cfb_bzero:
614         movaps  %xmm0,(%eax)
615         leal    16(%eax),%eax
616         cmpl    %eax,%ebp
617         ja      .L035cfb_bzero
618 .L034cfb_done:
619         movl    16(%ebp),%ebp
620         leal    24(%ebp),%esp
621         jmp     .L036cfb_exit
622 .align  16
623 .L030cfb_aligned:
624         leal    -16(%edx),%eax
625         leal    16(%edx),%ebx
626         shrl    $4,%ecx
627 .byte   243,15,167,224
628         movaps  (%eax),%xmm0
629         movaps  %xmm0,-16(%edx)
630 .L036cfb_exit:
631         movl    $1,%eax
632         leal    4(%esp),%esp
633 .L028cfb_abort:
634         popl    %edi
635         popl    %esi
636         popl    %ebx
637         popl    %ebp
638         ret
639 .globl  _padlock_ofb_encrypt
640 .def    _padlock_ofb_encrypt;   .scl    2;      .type   32;     .endef
641 .align  16
642 _padlock_ofb_encrypt:
643 .L_padlock_ofb_encrypt_begin:
644         pushl   %ebp
645         pushl   %ebx
646         pushl   %esi
647         pushl   %edi
648         movl    20(%esp),%edi
649         movl    24(%esp),%esi
650         movl    28(%esp),%edx
651         movl    32(%esp),%ecx
652         testl   $15,%edx
653         jnz     .L037ofb_abort
654         testl   $15,%ecx
655         jnz     .L037ofb_abort
656         leal    .Lpadlock_saved_context,%eax
657         pushfl
658         cld
659         call    __padlock_verify_ctx
660 .L038ofb_pic_point:
661         leal    16(%edx),%edx
662         xorl    %eax,%eax
663         xorl    %ebx,%ebx
664         testl   $32,(%edx)
665         jnz     .L039ofb_aligned
666         testl   $15,%edi
667         setz    %al
668         testl   $15,%esi
669         setz    %bl
670         testl   %ebx,%eax
671         jnz     .L039ofb_aligned
672         negl    %eax
673         movl    $512,%ebx
674         notl    %eax
675         leal    -24(%esp),%ebp
676         cmpl    %ebx,%ecx
677         cmovcl  %ecx,%ebx
678         andl    %ebx,%eax
679         movl    %ecx,%ebx
680         negl    %eax
681         andl    $511,%ebx
682         leal    (%eax,%ebp,1),%esp
683         movl    $512,%eax
684         cmovzl  %eax,%ebx
685         movl    %ebp,%eax
686         andl    $-16,%ebp
687         andl    $-16,%esp
688         movl    %eax,16(%ebp)
689         jmp     .L040ofb_loop
690 .align  16
691 .L040ofb_loop:
692         movl    %edi,(%ebp)
693         movl    %esi,4(%ebp)
694         movl    %ecx,8(%ebp)
695         movl    %ebx,%ecx
696         movl    %ebx,12(%ebp)
697         testl   $15,%edi
698         cmovnzl %esp,%edi
699         testl   $15,%esi
700         jz      .L041ofb_inp_aligned
701         shrl    $2,%ecx
702 .byte   243,165
703         subl    %ebx,%edi
704         movl    %ebx,%ecx
705         movl    %edi,%esi
706 .L041ofb_inp_aligned:
707         leal    -16(%edx),%eax
708         leal    16(%edx),%ebx
709         shrl    $4,%ecx
710 .byte   243,15,167,232
711         movaps  (%eax),%xmm0
712         movaps  %xmm0,-16(%edx)
713         movl    (%ebp),%edi
714         movl    12(%ebp),%ebx
715         testl   $15,%edi
716         jz      .L042ofb_out_aligned
717         movl    %ebx,%ecx
718         leal    (%esp),%esi
719         shrl    $2,%ecx
720 .byte   243,165
721         subl    %ebx,%edi
722 .L042ofb_out_aligned:
723         movl    4(%ebp),%esi
724         movl    8(%ebp),%ecx
725         addl    %ebx,%edi
726         addl    %ebx,%esi
727         subl    %ebx,%ecx
728         movl    $512,%ebx
729         jnz     .L040ofb_loop
730         cmpl    %ebp,%esp
731         je      .L043ofb_done
732         pxor    %xmm0,%xmm0
733         leal    (%esp),%eax
734 .L044ofb_bzero:
735         movaps  %xmm0,(%eax)
736         leal    16(%eax),%eax
737         cmpl    %eax,%ebp
738         ja      .L044ofb_bzero
739 .L043ofb_done:
740         movl    16(%ebp),%ebp
741         leal    24(%ebp),%esp
742         jmp     .L045ofb_exit
743 .align  16
744 .L039ofb_aligned:
745         leal    -16(%edx),%eax
746         leal    16(%edx),%ebx
747         shrl    $4,%ecx
748 .byte   243,15,167,232
749         movaps  (%eax),%xmm0
750         movaps  %xmm0,-16(%edx)
751 .L045ofb_exit:
752         movl    $1,%eax
753         leal    4(%esp),%esp
754 .L037ofb_abort:
755         popl    %edi
756         popl    %esi
757         popl    %ebx
758         popl    %ebp
759         ret
760 .globl  _padlock_ctr32_encrypt
761 .def    _padlock_ctr32_encrypt; .scl    2;      .type   32;     .endef
762 .align  16
763 _padlock_ctr32_encrypt:
764 .L_padlock_ctr32_encrypt_begin:
765         pushl   %ebp
766         pushl   %ebx
767         pushl   %esi
768         pushl   %edi
769         movl    20(%esp),%edi
770         movl    24(%esp),%esi
771         movl    28(%esp),%edx
772         movl    32(%esp),%ecx
773         testl   $15,%edx
774         jnz     .L046ctr32_abort
775         testl   $15,%ecx
776         jnz     .L046ctr32_abort
777         leal    .Lpadlock_saved_context,%eax
778         pushfl
779         cld
780         call    __padlock_verify_ctx
781 .L047ctr32_pic_point:
782         leal    16(%edx),%edx
783         xorl    %eax,%eax
784         movq    -16(%edx),%mm0
785         movl    $512,%ebx
786         notl    %eax
787         leal    -24(%esp),%ebp
788         cmpl    %ebx,%ecx
789         cmovcl  %ecx,%ebx
790         andl    %ebx,%eax
791         movl    %ecx,%ebx
792         negl    %eax
793         andl    $511,%ebx
794         leal    (%eax,%ebp,1),%esp
795         movl    $512,%eax
796         cmovzl  %eax,%ebx
797         movl    %ebp,%eax
798         andl    $-16,%ebp
799         andl    $-16,%esp
800         movl    %eax,16(%ebp)
801         jmp     .L048ctr32_loop
802 .align  16
803 .L048ctr32_loop:
804         movl    %edi,(%ebp)
805         movl    %esi,4(%ebp)
806         movl    %ecx,8(%ebp)
807         movl    %ebx,%ecx
808         movl    %ebx,12(%ebp)
809         movl    -4(%edx),%ecx
810         xorl    %edi,%edi
811         movl    -8(%edx),%eax
812 .L049ctr32_prepare:
813         movl    %ecx,12(%esp,%edi,1)
814         bswap   %ecx
815         movq    %mm0,(%esp,%edi,1)
816         incl    %ecx
817         movl    %eax,8(%esp,%edi,1)
818         bswap   %ecx
819         leal    16(%edi),%edi
820         cmpl    %ebx,%edi
821         jb      .L049ctr32_prepare
822         movl    %ecx,-4(%edx)
823         leal    (%esp),%esi
824         leal    (%esp),%edi
825         movl    %ebx,%ecx
826         leal    -16(%edx),%eax
827         leal    16(%edx),%ebx
828         shrl    $4,%ecx
829 .byte   243,15,167,200
830         movl    (%ebp),%edi
831         movl    12(%ebp),%ebx
832         movl    4(%ebp),%esi
833         xorl    %ecx,%ecx
834 .L050ctr32_xor:
835         movups  (%esi,%ecx,1),%xmm1
836         leal    16(%ecx),%ecx
837         pxor    -16(%esp,%ecx,1),%xmm1
838         movups  %xmm1,-16(%edi,%ecx,1)
839         cmpl    %ebx,%ecx
840         jb      .L050ctr32_xor
841         movl    8(%ebp),%ecx
842         addl    %ebx,%edi
843         addl    %ebx,%esi
844         subl    %ebx,%ecx
845         movl    $512,%ebx
846         jnz     .L048ctr32_loop
847         pxor    %xmm0,%xmm0
848         leal    (%esp),%eax
849 .L051ctr32_bzero:
850         movaps  %xmm0,(%eax)
851         leal    16(%eax),%eax
852         cmpl    %eax,%ebp
853         ja      .L051ctr32_bzero
854 .L052ctr32_done:
855         movl    16(%ebp),%ebp
856         leal    24(%ebp),%esp
857         movl    $1,%eax
858         leal    4(%esp),%esp
859         emms
860 .L046ctr32_abort:
861         popl    %edi
862         popl    %esi
863         popl    %ebx
864         popl    %ebp
865         ret
866 .globl  _padlock_xstore
867 .def    _padlock_xstore;        .scl    2;      .type   32;     .endef
868 .align  16
869 _padlock_xstore:
870 .L_padlock_xstore_begin:
871         pushl   %edi
872         movl    8(%esp),%edi
873         movl    12(%esp),%edx
874 .byte   15,167,192
875         popl    %edi
876         ret
877 .def    __win32_segv_handler;   .scl    3;      .type   32;     .endef
878 .align  16
879 __win32_segv_handler:
880         movl    $1,%eax
881         movl    4(%esp),%edx
882         movl    12(%esp),%ecx
883         cmpl    $3221225477,(%edx)
884         jne     .L053ret
885         addl    $4,184(%ecx)
886         movl    $0,%eax
887 .L053ret:
888         ret
889 .globl  _padlock_sha1_oneshot
890 .def    _padlock_sha1_oneshot;  .scl    2;      .type   32;     .endef
891 .align  16
892 _padlock_sha1_oneshot:
893 .L_padlock_sha1_oneshot_begin:
894         pushl   %edi
895         pushl   %esi
896         xorl    %eax,%eax
897         movl    12(%esp),%edi
898         movl    16(%esp),%esi
899         movl    20(%esp),%ecx
900         pushl   __win32_segv_handler
901 .byte   100,255,48
902 .byte   100,137,32
903         movl    %esp,%edx
904         addl    $-128,%esp
905         movups  (%edi),%xmm0
906         andl    $-16,%esp
907         movl    16(%edi),%eax
908         movaps  %xmm0,(%esp)
909         movl    %esp,%edi
910         movl    %eax,16(%esp)
911         xorl    %eax,%eax
912 .byte   243,15,166,200
913         movaps  (%esp),%xmm0
914         movl    16(%esp),%eax
915         movl    %edx,%esp
916 .byte   100,143,5,0,0,0,0
917         leal    4(%esp),%esp
918         movl    16(%esp),%edi
919         movups  %xmm0,(%edi)
920         movl    %eax,16(%edi)
921         popl    %esi
922         popl    %edi
923         ret
924 .globl  _padlock_sha1_blocks
925 .def    _padlock_sha1_blocks;   .scl    2;      .type   32;     .endef
926 .align  16
927 _padlock_sha1_blocks:
928 .L_padlock_sha1_blocks_begin:
929         pushl   %edi
930         pushl   %esi
931         movl    12(%esp),%edi
932         movl    16(%esp),%esi
933         movl    %esp,%edx
934         movl    20(%esp),%ecx
935         addl    $-128,%esp
936         movups  (%edi),%xmm0
937         andl    $-16,%esp
938         movl    16(%edi),%eax
939         movaps  %xmm0,(%esp)
940         movl    %esp,%edi
941         movl    %eax,16(%esp)
942         movl    $-1,%eax
943 .byte   243,15,166,200
944         movaps  (%esp),%xmm0
945         movl    16(%esp),%eax
946         movl    %edx,%esp
947         movl    12(%esp),%edi
948         movups  %xmm0,(%edi)
949         movl    %eax,16(%edi)
950         popl    %esi
951         popl    %edi
952         ret
953 .globl  _padlock_sha256_oneshot
954 .def    _padlock_sha256_oneshot;        .scl    2;      .type   32;     .endef
955 .align  16
956 _padlock_sha256_oneshot:
957 .L_padlock_sha256_oneshot_begin:
958         pushl   %edi
959         pushl   %esi
960         xorl    %eax,%eax
961         movl    12(%esp),%edi
962         movl    16(%esp),%esi
963         movl    20(%esp),%ecx
964         pushl   __win32_segv_handler
965 .byte   100,255,48
966 .byte   100,137,32
967         movl    %esp,%edx
968         addl    $-128,%esp
969         movups  (%edi),%xmm0
970         andl    $-16,%esp
971         movups  16(%edi),%xmm1
972         movaps  %xmm0,(%esp)
973         movl    %esp,%edi
974         movaps  %xmm1,16(%esp)
975         xorl    %eax,%eax
976 .byte   243,15,166,208
977         movaps  (%esp),%xmm0
978         movaps  16(%esp),%xmm1
979         movl    %edx,%esp
980 .byte   100,143,5,0,0,0,0
981         leal    4(%esp),%esp
982         movl    16(%esp),%edi
983         movups  %xmm0,(%edi)
984         movups  %xmm1,16(%edi)
985         popl    %esi
986         popl    %edi
987         ret
988 .globl  _padlock_sha256_blocks
989 .def    _padlock_sha256_blocks; .scl    2;      .type   32;     .endef
990 .align  16
991 _padlock_sha256_blocks:
992 .L_padlock_sha256_blocks_begin:
993         pushl   %edi
994         pushl   %esi
995         movl    12(%esp),%edi
996         movl    16(%esp),%esi
997         movl    20(%esp),%ecx
998         movl    %esp,%edx
999         addl    $-128,%esp
1000         movups  (%edi),%xmm0
1001         andl    $-16,%esp
1002         movups  16(%edi),%xmm1
1003         movaps  %xmm0,(%esp)
1004         movl    %esp,%edi
1005         movaps  %xmm1,16(%esp)
1006         movl    $-1,%eax
1007 .byte   243,15,166,208
1008         movaps  (%esp),%xmm0
1009         movaps  16(%esp),%xmm1
1010         movl    %edx,%esp
1011         movl    12(%esp),%edi
1012         movups  %xmm0,(%edi)
1013         movups  %xmm1,16(%edi)
1014         popl    %esi
1015         popl    %edi
1016         ret
1017 .globl  _padlock_sha512_blocks
1018 .def    _padlock_sha512_blocks; .scl    2;      .type   32;     .endef
1019 .align  16
1020 _padlock_sha512_blocks:
1021 .L_padlock_sha512_blocks_begin:
1022         pushl   %edi
1023         pushl   %esi
1024         movl    12(%esp),%edi
1025         movl    16(%esp),%esi
1026         movl    20(%esp),%ecx
1027         movl    %esp,%edx
1028         addl    $-128,%esp
1029         movups  (%edi),%xmm0
1030         andl    $-16,%esp
1031         movups  16(%edi),%xmm1
1032         movups  32(%edi),%xmm2
1033         movups  48(%edi),%xmm3
1034         movaps  %xmm0,(%esp)
1035         movl    %esp,%edi
1036         movaps  %xmm1,16(%esp)
1037         movaps  %xmm2,32(%esp)
1038         movaps  %xmm3,48(%esp)
1039 .byte   243,15,166,224
1040         movaps  (%esp),%xmm0
1041         movaps  16(%esp),%xmm1
1042         movaps  32(%esp),%xmm2
1043         movaps  48(%esp),%xmm3
1044         movl    %edx,%esp
1045         movl    12(%esp),%edi
1046         movups  %xmm0,(%edi)
1047         movups  %xmm1,16(%edi)
1048         movups  %xmm2,32(%edi)
1049         movups  %xmm3,48(%edi)
1050         popl    %esi
1051         popl    %edi
1052         ret
1053 .byte   86,73,65,32,80,97,100,108,111,99,107,32,120,56,54,32
1054 .byte   109,111,100,117,108,101,44,32,67,82,89,80,84,79,71,65
1055 .byte   77,83,32,98,121,32,60,97,112,112,114,111,64,111,112,101
1056 .byte   110,115,115,108,46,111,114,103,62,0
1057 .align  16
1058 .data
1059 .align  4
1060 .Lpadlock_saved_context:
1061 .long   0