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