updated licenses
[gnutls.git] / lib / accelerated / x86 / macosx / padlock-x86-macosx.s
blob02b427e6a83f0309be75e8ce5fb002cb8b7e5c67
1 # Copyright (c) 2011-2012, Andy Polyakov <appro@openssl.org>
2 # All rights reserved.
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.
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.
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.
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.
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.
38 # *** This file is auto-generated ***
40 .file "devel/perlasm/e_padlock-x86.s"
41 .text
42 .globl _padlock_capability
43 .align 4
44 _padlock_capability:
45 L_padlock_capability_begin:
46 pushl %ebx
47 pushfl
48 popl %eax
49 movl %eax,%ecx
50 xorl $2097152,%eax
51 pushl %eax
52 popfl
53 pushfl
54 popl %eax
55 xorl %eax,%ecx
56 xorl %eax,%eax
57 btl $21,%ecx
58 jnc L000noluck
59 .byte 0x0f,0xa2
60 xorl %eax,%eax
61 cmpl $0x746e6543,%ebx
62 jne L000noluck
63 cmpl $0x48727561,%edx
64 jne L000noluck
65 cmpl $0x736c7561,%ecx
66 jne L000noluck
67 movl $3221225472,%eax
68 .byte 0x0f,0xa2
69 movl %eax,%edx
70 xorl %eax,%eax
71 cmpl $3221225473,%edx
72 jb L000noluck
73 movl $1,%eax
74 .byte 0x0f,0xa2
75 orl $15,%eax
76 xorl %ebx,%ebx
77 andl $4095,%eax
78 cmpl $1791,%eax
79 sete %bl
80 movl $3221225473,%eax
81 pushl %ebx
82 .byte 0x0f,0xa2
83 popl %ebx
84 movl %edx,%eax
85 shll $4,%ebx
86 andl $4294967279,%eax
87 orl %ebx,%eax
88 L000noluck:
89 popl %ebx
90 ret
91 .globl _padlock_key_bswap
92 .align 4
93 _padlock_key_bswap:
94 L_padlock_key_bswap_begin:
95 movl 4(%esp),%edx
96 movl 240(%edx),%ecx
97 L001bswap_loop:
98 movl (%edx),%eax
99 bswap %eax
100 movl %eax,(%edx)
101 leal 4(%edx),%edx
102 subl $1,%ecx
103 jnz L001bswap_loop
105 .globl _padlock_verify_context
106 .align 4
107 _padlock_verify_context:
108 L_padlock_verify_context_begin:
109 movl 4(%esp),%edx
110 leal Lpadlock_saved_context-L002verify_pic_point,%eax
111 pushfl
112 call __padlock_verify_ctx
113 L002verify_pic_point:
114 leal 4(%esp),%esp
116 .align 4
117 __padlock_verify_ctx:
118 addl (%esp),%eax
119 btl $30,4(%esp)
120 jnc L003verified
121 cmpl (%eax),%edx
122 je L003verified
123 pushfl
124 popfl
125 L003verified:
126 movl %edx,(%eax)
128 .globl _padlock_reload_key
129 .align 4
130 _padlock_reload_key:
131 L_padlock_reload_key_begin:
132 pushfl
133 popfl
135 .globl _padlock_aes_block
136 .align 4
137 _padlock_aes_block:
138 L_padlock_aes_block_begin:
139 pushl %edi
140 pushl %esi
141 pushl %ebx
142 movl 16(%esp),%edi
143 movl 20(%esp),%esi
144 movl 24(%esp),%edx
145 movl $1,%ecx
146 leal 32(%edx),%ebx
147 leal 16(%edx),%edx
148 .byte 243,15,167,200
149 popl %ebx
150 popl %esi
151 popl %edi
153 .globl _padlock_ecb_encrypt
154 .align 4
155 _padlock_ecb_encrypt:
156 L_padlock_ecb_encrypt_begin:
157 pushl %ebp
158 pushl %ebx
159 pushl %esi
160 pushl %edi
161 movl 20(%esp),%edi
162 movl 24(%esp),%esi
163 movl 28(%esp),%edx
164 movl 32(%esp),%ecx
165 testl $15,%edx
166 jnz L004ecb_abort
167 testl $15,%ecx
168 jnz L004ecb_abort
169 leal Lpadlock_saved_context-L005ecb_pic_point,%eax
170 pushfl
172 call __padlock_verify_ctx
173 L005ecb_pic_point:
174 leal 16(%edx),%edx
175 xorl %eax,%eax
176 xorl %ebx,%ebx
177 cmpl $128,%ecx
178 jbe L006ecb_short
179 testl $32,(%edx)
180 jnz L007ecb_aligned
181 testl $15,%edi
182 setz %al
183 testl $15,%esi
184 setz %bl
185 testl %ebx,%eax
186 jnz L007ecb_aligned
187 negl %eax
188 movl $512,%ebx
189 notl %eax
190 leal -24(%esp),%ebp
191 cmpl %ebx,%ecx
192 cmovcl %ecx,%ebx
193 andl %ebx,%eax
194 movl %ecx,%ebx
195 negl %eax
196 andl $511,%ebx
197 leal (%eax,%ebp,1),%esp
198 andl $-16,%esp
199 jmp L008ecb_loop
200 .align 4,0x90
201 L008ecb_loop:
202 movl %edi,(%ebp)
203 movl %esi,4(%ebp)
204 movl %ecx,8(%ebp)
205 movl %ebx,%ecx
206 movl %ebx,12(%ebp)
207 testl $15,%edi
208 cmovnzl %esp,%edi
209 testl $15,%esi
210 jz L009ecb_inp_aligned
211 shrl $2,%ecx
212 .byte 243,165
213 subl %ebx,%edi
214 movl %ebx,%ecx
215 movl %edi,%esi
216 L009ecb_inp_aligned:
217 leal -16(%edx),%eax
218 leal 16(%edx),%ebx
219 shrl $4,%ecx
220 .byte 243,15,167,200
221 movl (%ebp),%edi
222 movl 12(%ebp),%ebx
223 testl $15,%edi
224 jz L010ecb_out_aligned
225 movl %ebx,%ecx
226 shrl $2,%ecx
227 leal (%esp),%esi
228 .byte 243,165
229 subl %ebx,%edi
230 L010ecb_out_aligned:
231 movl 4(%ebp),%esi
232 movl 8(%ebp),%ecx
233 addl %ebx,%edi
234 addl %ebx,%esi
235 subl %ebx,%ecx
236 movl $512,%ebx
237 jnz L008ecb_loop
238 cmpl %ebp,%esp
239 je L011ecb_done
240 pxor %xmm0,%xmm0
241 leal (%esp),%eax
242 L012ecb_bzero:
243 movaps %xmm0,(%eax)
244 leal 16(%eax),%eax
245 cmpl %eax,%ebp
246 ja L012ecb_bzero
247 L011ecb_done:
248 leal 24(%ebp),%esp
249 jmp L013ecb_exit
250 .align 4,0x90
251 L006ecb_short:
252 xorl %eax,%eax
253 leal -24(%esp),%ebp
254 subl %ecx,%eax
255 leal (%eax,%ebp,1),%esp
256 andl $-16,%esp
257 xorl %ebx,%ebx
258 L014ecb_short_copy:
259 movups (%esi,%ebx,1),%xmm0
260 leal 16(%ebx),%ebx
261 cmpl %ebx,%ecx
262 movaps %xmm0,-16(%esp,%ebx,1)
263 ja L014ecb_short_copy
264 movl %esp,%esi
265 movl %ecx,%ebx
266 jmp L008ecb_loop
267 .align 4,0x90
268 L007ecb_aligned:
269 leal -16(%edx),%eax
270 leal 16(%edx),%ebx
271 shrl $4,%ecx
272 .byte 243,15,167,200
273 L013ecb_exit:
274 movl $1,%eax
275 leal 4(%esp),%esp
276 L004ecb_abort:
277 popl %edi
278 popl %esi
279 popl %ebx
280 popl %ebp
282 .globl _padlock_cbc_encrypt
283 .align 4
284 _padlock_cbc_encrypt:
285 L_padlock_cbc_encrypt_begin:
286 pushl %ebp
287 pushl %ebx
288 pushl %esi
289 pushl %edi
290 movl 20(%esp),%edi
291 movl 24(%esp),%esi
292 movl 28(%esp),%edx
293 movl 32(%esp),%ecx
294 testl $15,%edx
295 jnz L015cbc_abort
296 testl $15,%ecx
297 jnz L015cbc_abort
298 leal Lpadlock_saved_context-L016cbc_pic_point,%eax
299 pushfl
301 call __padlock_verify_ctx
302 L016cbc_pic_point:
303 leal 16(%edx),%edx
304 xorl %eax,%eax
305 xorl %ebx,%ebx
306 cmpl $64,%ecx
307 jbe L017cbc_short
308 testl $32,(%edx)
309 jnz L018cbc_aligned
310 testl $15,%edi
311 setz %al
312 testl $15,%esi
313 setz %bl
314 testl %ebx,%eax
315 jnz L018cbc_aligned
316 negl %eax
317 movl $512,%ebx
318 notl %eax
319 leal -24(%esp),%ebp
320 cmpl %ebx,%ecx
321 cmovcl %ecx,%ebx
322 andl %ebx,%eax
323 movl %ecx,%ebx
324 negl %eax
325 andl $511,%ebx
326 leal (%eax,%ebp,1),%esp
327 andl $-16,%esp
328 jmp L019cbc_loop
329 .align 4,0x90
330 L019cbc_loop:
331 movl %edi,(%ebp)
332 movl %esi,4(%ebp)
333 movl %ecx,8(%ebp)
334 movl %ebx,%ecx
335 movl %ebx,12(%ebp)
336 testl $15,%edi
337 cmovnzl %esp,%edi
338 testl $15,%esi
339 jz L020cbc_inp_aligned
340 shrl $2,%ecx
341 .byte 243,165
342 subl %ebx,%edi
343 movl %ebx,%ecx
344 movl %edi,%esi
345 L020cbc_inp_aligned:
346 leal -16(%edx),%eax
347 leal 16(%edx),%ebx
348 shrl $4,%ecx
349 .byte 243,15,167,208
350 movaps (%eax),%xmm0
351 movaps %xmm0,-16(%edx)
352 movl (%ebp),%edi
353 movl 12(%ebp),%ebx
354 testl $15,%edi
355 jz L021cbc_out_aligned
356 movl %ebx,%ecx
357 shrl $2,%ecx
358 leal (%esp),%esi
359 .byte 243,165
360 subl %ebx,%edi
361 L021cbc_out_aligned:
362 movl 4(%ebp),%esi
363 movl 8(%ebp),%ecx
364 addl %ebx,%edi
365 addl %ebx,%esi
366 subl %ebx,%ecx
367 movl $512,%ebx
368 jnz L019cbc_loop
369 cmpl %ebp,%esp
370 je L022cbc_done
371 pxor %xmm0,%xmm0
372 leal (%esp),%eax
373 L023cbc_bzero:
374 movaps %xmm0,(%eax)
375 leal 16(%eax),%eax
376 cmpl %eax,%ebp
377 ja L023cbc_bzero
378 L022cbc_done:
379 leal 24(%ebp),%esp
380 jmp L024cbc_exit
381 .align 4,0x90
382 L017cbc_short:
383 xorl %eax,%eax
384 leal -24(%esp),%ebp
385 subl %ecx,%eax
386 leal (%eax,%ebp,1),%esp
387 andl $-16,%esp
388 xorl %ebx,%ebx
389 L025cbc_short_copy:
390 movups (%esi,%ebx,1),%xmm0
391 leal 16(%ebx),%ebx
392 cmpl %ebx,%ecx
393 movaps %xmm0,-16(%esp,%ebx,1)
394 ja L025cbc_short_copy
395 movl %esp,%esi
396 movl %ecx,%ebx
397 jmp L019cbc_loop
398 .align 4,0x90
399 L018cbc_aligned:
400 leal -16(%edx),%eax
401 leal 16(%edx),%ebx
402 shrl $4,%ecx
403 .byte 243,15,167,208
404 movaps (%eax),%xmm0
405 movaps %xmm0,-16(%edx)
406 L024cbc_exit:
407 movl $1,%eax
408 leal 4(%esp),%esp
409 L015cbc_abort:
410 popl %edi
411 popl %esi
412 popl %ebx
413 popl %ebp
415 .globl _padlock_xstore
416 .align 4
417 _padlock_xstore:
418 L_padlock_xstore_begin:
419 pushl %edi
420 movl 8(%esp),%edi
421 movl 12(%esp),%edx
422 .byte 15,167,192
423 popl %edi
425 .align 4
426 __win32_segv_handler:
427 movl $1,%eax
428 movl 4(%esp),%edx
429 movl 12(%esp),%ecx
430 cmpl $3221225477,(%edx)
431 jne L026ret
432 addl $4,184(%ecx)
433 movl $0,%eax
434 L026ret:
436 .globl _padlock_sha1_oneshot
437 .align 4
438 _padlock_sha1_oneshot:
439 L_padlock_sha1_oneshot_begin:
440 pushl %edi
441 pushl %esi
442 xorl %eax,%eax
443 movl 12(%esp),%edi
444 movl 16(%esp),%esi
445 movl 20(%esp),%ecx
446 movl %esp,%edx
447 addl $-128,%esp
448 movups (%edi),%xmm0
449 andl $-16,%esp
450 movl 16(%edi),%eax
451 movaps %xmm0,(%esp)
452 movl %esp,%edi
453 movl %eax,16(%esp)
454 xorl %eax,%eax
455 .byte 243,15,166,200
456 movaps (%esp),%xmm0
457 movl 16(%esp),%eax
458 movl %edx,%esp
459 movl 12(%esp),%edi
460 movups %xmm0,(%edi)
461 movl %eax,16(%edi)
462 popl %esi
463 popl %edi
465 .globl _padlock_sha1_blocks
466 .align 4
467 _padlock_sha1_blocks:
468 L_padlock_sha1_blocks_begin:
469 pushl %edi
470 pushl %esi
471 movl 12(%esp),%edi
472 movl 16(%esp),%esi
473 movl %esp,%edx
474 movl 20(%esp),%ecx
475 addl $-128,%esp
476 movups (%edi),%xmm0
477 andl $-16,%esp
478 movl 16(%edi),%eax
479 movaps %xmm0,(%esp)
480 movl %esp,%edi
481 movl %eax,16(%esp)
482 movl $-1,%eax
483 .byte 243,15,166,200
484 movaps (%esp),%xmm0
485 movl 16(%esp),%eax
486 movl %edx,%esp
487 movl 12(%esp),%edi
488 movups %xmm0,(%edi)
489 movl %eax,16(%edi)
490 popl %esi
491 popl %edi
493 .globl _padlock_sha256_oneshot
494 .align 4
495 _padlock_sha256_oneshot:
496 L_padlock_sha256_oneshot_begin:
497 pushl %edi
498 pushl %esi
499 xorl %eax,%eax
500 movl 12(%esp),%edi
501 movl 16(%esp),%esi
502 movl 20(%esp),%ecx
503 movl %esp,%edx
504 addl $-128,%esp
505 movups (%edi),%xmm0
506 andl $-16,%esp
507 movups 16(%edi),%xmm1
508 movaps %xmm0,(%esp)
509 movl %esp,%edi
510 movaps %xmm1,16(%esp)
511 xorl %eax,%eax
512 .byte 243,15,166,208
513 movaps (%esp),%xmm0
514 movaps 16(%esp),%xmm1
515 movl %edx,%esp
516 movl 12(%esp),%edi
517 movups %xmm0,(%edi)
518 movups %xmm1,16(%edi)
519 popl %esi
520 popl %edi
522 .globl _padlock_sha256_blocks
523 .align 4
524 _padlock_sha256_blocks:
525 L_padlock_sha256_blocks_begin:
526 pushl %edi
527 pushl %esi
528 movl 12(%esp),%edi
529 movl 16(%esp),%esi
530 movl 20(%esp),%ecx
531 movl %esp,%edx
532 addl $-128,%esp
533 movups (%edi),%xmm0
534 andl $-16,%esp
535 movups 16(%edi),%xmm1
536 movaps %xmm0,(%esp)
537 movl %esp,%edi
538 movaps %xmm1,16(%esp)
539 movl $-1,%eax
540 .byte 243,15,166,208
541 movaps (%esp),%xmm0
542 movaps 16(%esp),%xmm1
543 movl %edx,%esp
544 movl 12(%esp),%edi
545 movups %xmm0,(%edi)
546 movups %xmm1,16(%edi)
547 popl %esi
548 popl %edi
550 .globl _padlock_sha512_blocks
551 .align 4
552 _padlock_sha512_blocks:
553 L_padlock_sha512_blocks_begin:
554 pushl %edi
555 pushl %esi
556 movl 12(%esp),%edi
557 movl 16(%esp),%esi
558 movl 20(%esp),%ecx
559 movl %esp,%edx
560 addl $-128,%esp
561 movups (%edi),%xmm0
562 andl $-16,%esp
563 movups 16(%edi),%xmm1
564 movups 32(%edi),%xmm2
565 movups 48(%edi),%xmm3
566 movaps %xmm0,(%esp)
567 movl %esp,%edi
568 movaps %xmm1,16(%esp)
569 movaps %xmm2,32(%esp)
570 movaps %xmm3,48(%esp)
571 .byte 243,15,166,224
572 movaps (%esp),%xmm0
573 movaps 16(%esp),%xmm1
574 movaps 32(%esp),%xmm2
575 movaps 48(%esp),%xmm3
576 movl %edx,%esp
577 movl 12(%esp),%edi
578 movups %xmm0,(%edi)
579 movups %xmm1,16(%edi)
580 movups %xmm2,32(%edi)
581 movups %xmm3,48(%edi)
582 popl %esi
583 popl %edi
585 .byte 86,73,65,32,80,97,100,108,111,99,107,32,120,56,54,32
586 .byte 109,111,100,117,108,101,44,32,67,82,89,80,84,79,71,65
587 .byte 77,83,32,98,121,32,60,97,112,112,114,111,64,111,112,101
588 .byte 110,115,115,108,46,111,114,103,62,0
589 .align 4,0x90
590 .data
591 .align 2,0x90
592 Lpadlock_saved_context:
593 .long 0