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
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
|
%ifidn __OUTPUT_FORMAT__,obj
section code use32 class=code align=64
%elifidn __OUTPUT_FORMAT__,win32
%ifdef __YASM_VERSION_ID__
%if __YASM_VERSION_ID__ < 01010000h
%error yasm version 1.1.0 or later needed.
%endif
; Yasm automatically includes .00 and complains about redefining it.
; https://www.tortall.net/projects/yasm/manual/html/objfmt-win32-safeseh.html
%else
$@feat.00 equ 1
%endif
section .text code align=64
%else
section .text code
%endif
;extern _OPENSSL_ia32cap_P
global _aesni_encrypt
align 16
_aesni_encrypt:
L$_aesni_encrypt_begin:
mov eax,DWORD [4+esp]
mov edx,DWORD [12+esp]
movups xmm2,[eax]
mov ecx,DWORD [240+edx]
mov eax,DWORD [8+esp]
movups xmm0,[edx]
movups xmm1,[16+edx]
lea edx,[32+edx]
xorps xmm2,xmm0
L$000enc1_loop_1:
db 102,15,56,220,209
dec ecx
movups xmm1,[edx]
lea edx,[16+edx]
jnz NEAR L$000enc1_loop_1
db 102,15,56,221,209
pxor xmm0,xmm0
pxor xmm1,xmm1
movups [eax],xmm2
pxor xmm2,xmm2
ret
global _aesni_decrypt
align 16
_aesni_decrypt:
L$_aesni_decrypt_begin:
mov eax,DWORD [4+esp]
mov edx,DWORD [12+esp]
movups xmm2,[eax]
mov ecx,DWORD [240+edx]
mov eax,DWORD [8+esp]
movups xmm0,[edx]
movups xmm1,[16+edx]
lea edx,[32+edx]
xorps xmm2,xmm0
L$001dec1_loop_2:
db 102,15,56,222,209
dec ecx
movups xmm1,[edx]
lea edx,[16+edx]
jnz NEAR L$001dec1_loop_2
db 102,15,56,223,209
pxor xmm0,xmm0
pxor xmm1,xmm1
movups [eax],xmm2
pxor xmm2,xmm2
ret
align 16
__aesni_encrypt2:
movups xmm0,[edx]
shl ecx,4
movups xmm1,[16+edx]
xorps xmm2,xmm0
pxor xmm3,xmm0
movups xmm0,[32+edx]
lea edx,[32+ecx*1+edx]
neg ecx
add ecx,16
L$002enc2_loop:
db 102,15,56,220,209
db 102,15,56,220,217
movups xmm1,[ecx*1+edx]
add ecx,32
db 102,15,56,220,208
db 102,15,56,220,216
movups xmm0,[ecx*1+edx-16]
jnz NEAR L$002enc2_loop
db 102,15,56,220,209
db 102,15,56,220,217
db 102,15,56,221,208
db 102,15,56,221,216
ret
align 16
__aesni_decrypt2:
movups xmm0,[edx]
shl ecx,4
movups xmm1,[16+edx]
xorps xmm2,xmm0
pxor xmm3,xmm0
movups xmm0,[32+edx]
lea edx,[32+ecx*1+edx]
neg ecx
add ecx,16
L$003dec2_loop:
db 102,15,56,222,209
db 102,15,56,222,217
movups xmm1,[ecx*1+edx]
add ecx,32
db 102,15,56,222,208
db 102,15,56,222,216
movups xmm0,[ecx*1+edx-16]
jnz NEAR L$003dec2_loop
db 102,15,56,222,209
db 102,15,56,222,217
db 102,15,56,223,208
db 102,15,56,223,216
ret
align 16
__aesni_encrypt3:
movups xmm0,[edx]
shl ecx,4
movups xmm1,[16+edx]
xorps xmm2,xmm0
pxor xmm3,xmm0
pxor xmm4,xmm0
movups xmm0,[32+edx]
lea edx,[32+ecx*1+edx]
neg ecx
add ecx,16
L$004enc3_loop:
db 102,15,56,220,209
db 102,15,56,220,217
db 102,15,56,220,225
movups xmm1,[ecx*1+edx]
add ecx,32
db 102,15,56,220,208
db 102,15,56,220,216
db 102,15,56,220,224
movups xmm0,[ecx*1+edx-16]
jnz NEAR L$004enc3_loop
db 102,15,56,220,209
db 102,15,56,220,217
db 102,15,56,220,225
db 102,15,56,221,208
db 102,15,56,221,216
db 102,15,56,221,224
ret
align 16
__aesni_decrypt3:
movups xmm0,[edx]
shl ecx,4
movups xmm1,[16+edx]
xorps xmm2,xmm0
pxor xmm3,xmm0
pxor xmm4,xmm0
movups xmm0,[32+edx]
lea edx,[32+ecx*1+edx]
neg ecx
add ecx,16
L$005dec3_loop:
db 102,15,56,222,209
db 102,15,56,222,217
db 102,15,56,222,225
movups xmm1,[ecx*1+edx]
add ecx,32
db 102,15,56,222,208
db 102,15,56,222,216
db 102,15,56,222,224
movups xmm0,[ecx*1+edx-16]
jnz NEAR L$005dec3_loop
db 102,15,56,222,209
db 102,15,56,222,217
db 102,15,56,222,225
db 102,15,56,223,208
db 102,15,56,223,216
db 102,15,56,223,224
ret
align 16
__aesni_encrypt4:
movups xmm0,[edx]
movups xmm1,[16+edx]
shl ecx,4
xorps xmm2,xmm0
pxor xmm3,xmm0
pxor xmm4,xmm0
pxor xmm5,xmm0
movups xmm0,[32+edx]
lea edx,[32+ecx*1+edx]
neg ecx
db 15,31,64,0
add ecx,16
L$006enc4_loop:
db 102,15,56,220,209
db 102,15,56,220,217
db 102,15,56,220,225
db 102,15,56,220,233
movups xmm1,[ecx*1+edx]
add ecx,32
db 102,15,56,220,208
db 102,15,56,220,216
db 102,15,56,220,224
db 102,15,56,220,232
movups xmm0,[ecx*1+edx-16]
jnz NEAR L$006enc4_loop
db 102,15,56,220,209
db 102,15,56,220,217
db 102,15,56,220,225
db 102,15,56,220,233
db 102,15,56,221,208
db 102,15,56,221,216
db 102,15,56,221,224
db 102,15,56,221,232
ret
align 16
__aesni_decrypt4:
movups xmm0,[edx]
movups xmm1,[16+edx]
shl ecx,4
xorps xmm2,xmm0
pxor xmm3,xmm0
pxor xmm4,xmm0
pxor xmm5,xmm0
movups xmm0,[32+edx]
lea edx,[32+ecx*1+edx]
neg ecx
db 15,31,64,0
add ecx,16
L$007dec4_loop:
db 102,15,56,222,209
db 102,15,56,222,217
db 102,15,56,222,225
db 102,15,56,222,233
movups xmm1,[ecx*1+edx]
add ecx,32
db 102,15,56,222,208
db 102,15,56,222,216
db 102,15,56,222,224
db 102,15,56,222,232
movups xmm0,[ecx*1+edx-16]
jnz NEAR L$007dec4_loop
db 102,15,56,222,209
db 102,15,56,222,217
db 102,15,56,222,225
db 102,15,56,222,233
db 102,15,56,223,208
db 102,15,56,223,216
db 102,15,56,223,224
db 102,15,56,223,232
ret
align 16
__aesni_encrypt6:
movups xmm0,[edx]
shl ecx,4
movups xmm1,[16+edx]
xorps xmm2,xmm0
pxor xmm3,xmm0
pxor xmm4,xmm0
db 102,15,56,220,209
pxor xmm5,xmm0
pxor xmm6,xmm0
db 102,15,56,220,217
lea edx,[32+ecx*1+edx]
neg ecx
db 102,15,56,220,225
pxor xmm7,xmm0
movups xmm0,[ecx*1+edx]
add ecx,16
jmp NEAR L$008_aesni_encrypt6_inner
align 16
L$009enc6_loop:
db 102,15,56,220,209
db 102,15,56,220,217
db 102,15,56,220,225
L$008_aesni_encrypt6_inner:
db 102,15,56,220,233
db 102,15,56,220,241
db 102,15,56,220,249
L$_aesni_encrypt6_enter:
movups xmm1,[ecx*1+edx]
add ecx,32
db 102,15,56,220,208
db 102,15,56,220,216
db 102,15,56,220,224
db 102,15,56,220,232
db 102,15,56,220,240
db 102,15,56,220,248
movups xmm0,[ecx*1+edx-16]
jnz NEAR L$009enc6_loop
db 102,15,56,220,209
db 102,15,56,220,217
db 102,15,56,220,225
db 102,15,56,220,233
db 102,15,56,220,241
db 102,15,56,220,249
db 102,15,56,221,208
db 102,15,56,221,216
db 102,15,56,221,224
db 102,15,56,221,232
db 102,15,56,221,240
db 102,15,56,221,248
ret
align 16
__aesni_decrypt6:
movups xmm0,[edx]
shl ecx,4
movups xmm1,[16+edx]
xorps xmm2,xmm0
pxor xmm3,xmm0
pxor xmm4,xmm0
db 102,15,56,222,209
pxor xmm5,xmm0
pxor xmm6,xmm0
db 102,15,56,222,217
lea edx,[32+ecx*1+edx]
neg ecx
db 102,15,56,222,225
pxor xmm7,xmm0
movups xmm0,[ecx*1+edx]
add ecx,16
jmp NEAR L$010_aesni_decrypt6_inner
align 16
L$011dec6_loop:
db 102,15,56,222,209
db 102,15,56,222,217
db 102,15,56,222,225
L$010_aesni_decrypt6_inner:
db 102,15,56,222,233
db 102,15,56,222,241
db 102,15,56,222,249
L$_aesni_decrypt6_enter:
movups xmm1,[ecx*1+edx]
add ecx,32
db 102,15,56,222,208
db 102,15,56,222,216
db 102,15,56,222,224
db 102,15,56,222,232
db 102,15,56,222,240
db 102,15,56,222,248
movups xmm0,[ecx*1+edx-16]
jnz NEAR L$011dec6_loop
db 102,15,56,222,209
db 102,15,56,222,217
db 102,15,56,222,225
db 102,15,56,222,233
db 102,15,56,222,241
db 102,15,56,222,249
db 102,15,56,223,208
db 102,15,56,223,216
db 102,15,56,223,224
db 102,15,56,223,232
db 102,15,56,223,240
db 102,15,56,223,248
ret
global _aesni_ecb_encrypt
align 16
_aesni_ecb_encrypt:
L$_aesni_ecb_encrypt_begin:
push ebp
push ebx
push esi
push edi
mov esi,DWORD [20+esp]
mov edi,DWORD [24+esp]
mov eax,DWORD [28+esp]
mov edx,DWORD [32+esp]
mov ebx,DWORD [36+esp]
and eax,-16
jz NEAR L$012ecb_ret
mov ecx,DWORD [240+edx]
test ebx,ebx
jz NEAR L$013ecb_decrypt
mov ebp,edx
mov ebx,ecx
cmp eax,96
jb NEAR L$014ecb_enc_tail
movdqu xmm2,[esi]
movdqu xmm3,[16+esi]
movdqu xmm4,[32+esi]
movdqu xmm5,[48+esi]
movdqu xmm6,[64+esi]
movdqu xmm7,[80+esi]
lea esi,[96+esi]
sub eax,96
jmp NEAR L$015ecb_enc_loop6_enter
align 16
L$016ecb_enc_loop6:
movups [edi],xmm2
movdqu xmm2,[esi]
movups [16+edi],xmm3
movdqu xmm3,[16+esi]
movups [32+edi],xmm4
movdqu xmm4,[32+esi]
movups [48+edi],xmm5
movdqu xmm5,[48+esi]
movups [64+edi],xmm6
movdqu xmm6,[64+esi]
movups [80+edi],xmm7
lea edi,[96+edi]
movdqu xmm7,[80+esi]
lea esi,[96+esi]
L$015ecb_enc_loop6_enter:
call __aesni_encrypt6
mov edx,ebp
mov ecx,ebx
sub eax,96
jnc NEAR L$016ecb_enc_loop6
movups [edi],xmm2
movups [16+edi],xmm3
movups [32+edi],xmm4
movups [48+edi],xmm5
movups [64+edi],xmm6
movups [80+edi],xmm7
lea edi,[96+edi]
add eax,96
jz NEAR L$012ecb_ret
L$014ecb_enc_tail:
movups xmm2,[esi]
cmp eax,32
jb NEAR L$017ecb_enc_one
movups xmm3,[16+esi]
je NEAR L$018ecb_enc_two
movups xmm4,[32+esi]
cmp eax,64
jb NEAR L$019ecb_enc_three
movups xmm5,[48+esi]
je NEAR L$020ecb_enc_four
movups xmm6,[64+esi]
xorps xmm7,xmm7
call __aesni_encrypt6
movups [edi],xmm2
movups [16+edi],xmm3
movups [32+edi],xmm4
movups [48+edi],xmm5
movups [64+edi],xmm6
jmp NEAR L$012ecb_ret
align 16
L$017ecb_enc_one:
movups xmm0,[edx]
movups xmm1,[16+edx]
lea edx,[32+edx]
xorps xmm2,xmm0
L$021enc1_loop_3:
db 102,15,56,220,209
dec ecx
movups xmm1,[edx]
lea edx,[16+edx]
jnz NEAR L$021enc1_loop_3
db 102,15,56,221,209
movups [edi],xmm2
jmp NEAR L$012ecb_ret
align 16
L$018ecb_enc_two:
call __aesni_encrypt2
movups [edi],xmm2
movups [16+edi],xmm3
jmp NEAR L$012ecb_ret
align 16
L$019ecb_enc_three:
call __aesni_encrypt3
movups [edi],xmm2
movups [16+edi],xmm3
movups [32+edi],xmm4
jmp NEAR L$012ecb_ret
align 16
L$020ecb_enc_four:
call __aesni_encrypt4
movups [edi],xmm2
movups [16+edi],xmm3
movups [32+edi],xmm4
movups [48+edi],xmm5
jmp NEAR L$012ecb_ret
align 16
L$013ecb_decrypt:
mov ebp,edx
mov ebx,ecx
cmp eax,96
jb NEAR L$022ecb_dec_tail
movdqu xmm2,[esi]
movdqu xmm3,[16+esi]
movdqu xmm4,[32+esi]
movdqu xmm5,[48+esi]
movdqu xmm6,[64+esi]
movdqu xmm7,[80+esi]
lea esi,[96+esi]
sub eax,96
jmp NEAR L$023ecb_dec_loop6_enter
align 16
L$024ecb_dec_loop6:
movups [edi],xmm2
movdqu xmm2,[esi]
movups [16+edi],xmm3
movdqu xmm3,[16+esi]
movups [32+edi],xmm4
movdqu xmm4,[32+esi]
movups [48+edi],xmm5
movdqu xmm5,[48+esi]
movups [64+edi],xmm6
movdqu xmm6,[64+esi]
movups [80+edi],xmm7
lea edi,[96+edi]
movdqu xmm7,[80+esi]
lea esi,[96+esi]
L$023ecb_dec_loop6_enter:
call __aesni_decrypt6
mov edx,ebp
mov ecx,ebx
sub eax,96
jnc NEAR L$024ecb_dec_loop6
movups [edi],xmm2
movups [16+edi],xmm3
movups [32+edi],xmm4
movups [48+edi],xmm5
movups [64+edi],xmm6
movups [80+edi],xmm7
lea edi,[96+edi]
add eax,96
jz NEAR L$012ecb_ret
L$022ecb_dec_tail:
movups xmm2,[esi]
cmp eax,32
jb NEAR L$025ecb_dec_one
movups xmm3,[16+esi]
je NEAR L$026ecb_dec_two
movups xmm4,[32+esi]
cmp eax,64
jb NEAR L$027ecb_dec_three
movups xmm5,[48+esi]
je NEAR L$028ecb_dec_four
movups xmm6,[64+esi]
xorps xmm7,xmm7
call __aesni_decrypt6
movups [edi],xmm2
movups [16+edi],xmm3
movups [32+edi],xmm4
movups [48+edi],xmm5
movups [64+edi],xmm6
jmp NEAR L$012ecb_ret
align 16
L$025ecb_dec_one:
movups xmm0,[edx]
movups xmm1,[16+edx]
lea edx,[32+edx]
xorps xmm2,xmm0
L$029dec1_loop_4:
db 102,15,56,222,209
dec ecx
movups xmm1,[edx]
lea edx,[16+edx]
jnz NEAR L$029dec1_loop_4
db 102,15,56,223,209
movups [edi],xmm2
jmp NEAR L$012ecb_ret
align 16
L$026ecb_dec_two:
call __aesni_decrypt2
movups [edi],xmm2
movups [16+edi],xmm3
jmp NEAR L$012ecb_ret
align 16
L$027ecb_dec_three:
call __aesni_decrypt3
movups [edi],xmm2
movups [16+edi],xmm3
movups [32+edi],xmm4
jmp NEAR L$012ecb_ret
align 16
L$028ecb_dec_four:
call __aesni_decrypt4
movups [edi],xmm2
movups [16+edi],xmm3
movups [32+edi],xmm4
movups [48+edi],xmm5
L$012ecb_ret:
pxor xmm0,xmm0
pxor xmm1,xmm1
pxor xmm2,xmm2
pxor xmm3,xmm3
pxor xmm4,xmm4
pxor xmm5,xmm5
pxor xmm6,xmm6
pxor xmm7,xmm7
pop edi
pop esi
pop ebx
pop ebp
ret
global _aesni_ccm64_encrypt_blocks
align 16
_aesni_ccm64_encrypt_blocks:
L$_aesni_ccm64_encrypt_blocks_begin:
push ebp
push ebx
push esi
push edi
mov esi,DWORD [20+esp]
mov edi,DWORD [24+esp]
mov eax,DWORD [28+esp]
mov edx,DWORD [32+esp]
mov ebx,DWORD [36+esp]
mov ecx,DWORD [40+esp]
mov ebp,esp
sub esp,60
and esp,-16
mov DWORD [48+esp],ebp
movdqu xmm7,[ebx]
movdqu xmm3,[ecx]
mov ecx,DWORD [240+edx]
mov DWORD [esp],202182159
mov DWORD [4+esp],134810123
mov DWORD [8+esp],67438087
mov DWORD [12+esp],66051
mov ebx,1
xor ebp,ebp
mov DWORD [16+esp],ebx
mov DWORD [20+esp],ebp
mov DWORD [24+esp],ebp
mov DWORD [28+esp],ebp
shl ecx,4
mov ebx,16
lea ebp,[edx]
movdqa xmm5,[esp]
movdqa xmm2,xmm7
lea edx,[32+ecx*1+edx]
sub ebx,ecx
db 102,15,56,0,253
L$030ccm64_enc_outer:
movups xmm0,[ebp]
mov ecx,ebx
movups xmm6,[esi]
xorps xmm2,xmm0
movups xmm1,[16+ebp]
xorps xmm0,xmm6
xorps xmm3,xmm0
movups xmm0,[32+ebp]
L$031ccm64_enc2_loop:
db 102,15,56,220,209
db 102,15,56,220,217
movups xmm1,[ecx*1+edx]
add ecx,32
db 102,15,56,220,208
db 102,15,56,220,216
movups xmm0,[ecx*1+edx-16]
jnz NEAR L$031ccm64_enc2_loop
db 102,15,56,220,209
db 102,15,56,220,217
paddq xmm7,[16+esp]
dec eax
db 102,15,56,221,208
db 102,15,56,221,216
lea esi,[16+esi]
xorps xmm6,xmm2
movdqa xmm2,xmm7
movups [edi],xmm6
db 102,15,56,0,213
lea edi,[16+edi]
jnz NEAR L$030ccm64_enc_outer
mov esp,DWORD [48+esp]
mov edi,DWORD [40+esp]
movups [edi],xmm3
pxor xmm0,xmm0
pxor xmm1,xmm1
pxor xmm2,xmm2
pxor xmm3,xmm3
pxor xmm4,xmm4
pxor xmm5,xmm5
pxor xmm6,xmm6
pxor xmm7,xmm7
pop edi
pop esi
pop ebx
pop ebp
ret
global _aesni_ccm64_decrypt_blocks
align 16
_aesni_ccm64_decrypt_blocks:
L$_aesni_ccm64_decrypt_blocks_begin:
push ebp
push ebx
push esi
push edi
mov esi,DWORD [20+esp]
mov edi,DWORD [24+esp]
mov eax,DWORD [28+esp]
mov edx,DWORD [32+esp]
mov ebx,DWORD [36+esp]
mov ecx,DWORD [40+esp]
mov ebp,esp
sub esp,60
and esp,-16
mov DWORD [48+esp],ebp
movdqu xmm7,[ebx]
movdqu xmm3,[ecx]
mov ecx,DWORD [240+edx]
mov DWORD [esp],202182159
mov DWORD [4+esp],134810123
mov DWORD [8+esp],67438087
mov DWORD [12+esp],66051
mov ebx,1
xor ebp,ebp
mov DWORD [16+esp],ebx
mov DWORD [20+esp],ebp
mov DWORD [24+esp],ebp
mov DWORD [28+esp],ebp
movdqa xmm5,[esp]
movdqa xmm2,xmm7
mov ebp,edx
mov ebx,ecx
db 102,15,56,0,253
movups xmm0,[edx]
movups xmm1,[16+edx]
lea edx,[32+edx]
xorps xmm2,xmm0
L$032enc1_loop_5:
db 102,15,56,220,209
dec ecx
movups xmm1,[edx]
lea edx,[16+edx]
jnz NEAR L$032enc1_loop_5
db 102,15,56,221,209
shl ebx,4
mov ecx,16
movups xmm6,[esi]
paddq xmm7,[16+esp]
lea esi,[16+esi]
sub ecx,ebx
lea edx,[32+ebx*1+ebp]
mov ebx,ecx
jmp NEAR L$033ccm64_dec_outer
align 16
L$033ccm64_dec_outer:
xorps xmm6,xmm2
movdqa xmm2,xmm7
movups [edi],xmm6
lea edi,[16+edi]
db 102,15,56,0,213
sub eax,1
jz NEAR L$034ccm64_dec_break
movups xmm0,[ebp]
mov ecx,ebx
movups xmm1,[16+ebp]
xorps xmm6,xmm0
xorps xmm2,xmm0
xorps xmm3,xmm6
movups xmm0,[32+ebp]
L$035ccm64_dec2_loop:
db 102,15,56,220,209
db 102,15,56,220,217
movups xmm1,[ecx*1+edx]
add ecx,32
db 102,15,56,220,208
db 102,15,56,220,216
movups xmm0,[ecx*1+edx-16]
jnz NEAR L$035ccm64_dec2_loop
movups xmm6,[esi]
paddq xmm7,[16+esp]
db 102,15,56,220,209
db 102,15,56,220,217
db 102,15,56,221,208
db 102,15,56,221,216
lea esi,[16+esi]
jmp NEAR L$033ccm64_dec_outer
align 16
L$034ccm64_dec_break:
mov ecx,DWORD [240+ebp]
mov edx,ebp
movups xmm0,[edx]
movups xmm1,[16+edx]
xorps xmm6,xmm0
lea edx,[32+edx]
xorps xmm3,xmm6
L$036enc1_loop_6:
db 102,15,56,220,217
dec ecx
movups xmm1,[edx]
lea edx,[16+edx]
jnz NEAR L$036enc1_loop_6
db 102,15,56,221,217
mov esp,DWORD [48+esp]
mov edi,DWORD [40+esp]
movups [edi],xmm3
pxor xmm0,xmm0
pxor xmm1,xmm1
pxor xmm2,xmm2
pxor xmm3,xmm3
pxor xmm4,xmm4
pxor xmm5,xmm5
pxor xmm6,xmm6
pxor xmm7,xmm7
pop edi
pop esi
pop ebx
pop ebp
ret
global _aesni_ctr32_encrypt_blocks
align 16
_aesni_ctr32_encrypt_blocks:
L$_aesni_ctr32_encrypt_blocks_begin:
push ebp
push ebx
push esi
push edi
mov esi,DWORD [20+esp]
mov edi,DWORD [24+esp]
mov eax,DWORD [28+esp]
mov edx,DWORD [32+esp]
mov ebx,DWORD [36+esp]
mov ebp,esp
sub esp,88
and esp,-16
mov DWORD [80+esp],ebp
cmp eax,1
je NEAR L$037ctr32_one_shortcut
movdqu xmm7,[ebx]
mov DWORD [esp],202182159
mov DWORD [4+esp],134810123
mov DWORD [8+esp],67438087
mov DWORD [12+esp],66051
mov ecx,6
xor ebp,ebp
mov DWORD [16+esp],ecx
mov DWORD [20+esp],ecx
mov DWORD [24+esp],ecx
mov DWORD [28+esp],ebp
db 102,15,58,22,251,3
db 102,15,58,34,253,3
mov ecx,DWORD [240+edx]
bswap ebx
pxor xmm0,xmm0
pxor xmm1,xmm1
movdqa xmm2,[esp]
db 102,15,58,34,195,0
lea ebp,[3+ebx]
db 102,15,58,34,205,0
inc ebx
db 102,15,58,34,195,1
inc ebp
db 102,15,58,34,205,1
inc ebx
db 102,15,58,34,195,2
inc ebp
db 102,15,58,34,205,2
movdqa [48+esp],xmm0
db 102,15,56,0,194
movdqu xmm6,[edx]
movdqa [64+esp],xmm1
db 102,15,56,0,202
pshufd xmm2,xmm0,192
pshufd xmm3,xmm0,128
cmp eax,6
jb NEAR L$038ctr32_tail
pxor xmm7,xmm6
shl ecx,4
mov ebx,16
movdqa [32+esp],xmm7
mov ebp,edx
sub ebx,ecx
lea edx,[32+ecx*1+edx]
sub eax,6
jmp NEAR L$039ctr32_loop6
align 16
L$039ctr32_loop6:
pshufd xmm4,xmm0,64
movdqa xmm0,[32+esp]
pshufd xmm5,xmm1,192
pxor xmm2,xmm0
pshufd xmm6,xmm1,128
pxor xmm3,xmm0
pshufd xmm7,xmm1,64
movups xmm1,[16+ebp]
pxor xmm4,xmm0
pxor xmm5,xmm0
db 102,15,56,220,209
pxor xmm6,xmm0
pxor xmm7,xmm0
db 102,15,56,220,217
movups xmm0,[32+ebp]
mov ecx,ebx
db 102,15,56,220,225
db 102,15,56,220,233
db 102,15,56,220,241
db 102,15,56,220,249
call L$_aesni_encrypt6_enter
movups xmm1,[esi]
movups xmm0,[16+esi]
xorps xmm2,xmm1
movups xmm1,[32+esi]
xorps xmm3,xmm0
movups [edi],xmm2
movdqa xmm0,[16+esp]
xorps xmm4,xmm1
movdqa xmm1,[64+esp]
movups [16+edi],xmm3
movups [32+edi],xmm4
paddd xmm1,xmm0
paddd xmm0,[48+esp]
movdqa xmm2,[esp]
movups xmm3,[48+esi]
movups xmm4,[64+esi]
xorps xmm5,xmm3
movups xmm3,[80+esi]
lea esi,[96+esi]
movdqa [48+esp],xmm0
db 102,15,56,0,194
xorps xmm6,xmm4
movups [48+edi],xmm5
xorps xmm7,xmm3
movdqa [64+esp],xmm1
db 102,15,56,0,202
movups [64+edi],xmm6
pshufd xmm2,xmm0,192
movups [80+edi],xmm7
lea edi,[96+edi]
pshufd xmm3,xmm0,128
sub eax,6
jnc NEAR L$039ctr32_loop6
add eax,6
jz NEAR L$040ctr32_ret
movdqu xmm7,[ebp]
mov edx,ebp
pxor xmm7,[32+esp]
mov ecx,DWORD [240+ebp]
L$038ctr32_tail:
por xmm2,xmm7
cmp eax,2
jb NEAR L$041ctr32_one
pshufd xmm4,xmm0,64
por xmm3,xmm7
je NEAR L$042ctr32_two
pshufd xmm5,xmm1,192
por xmm4,xmm7
cmp eax,4
jb NEAR L$043ctr32_three
pshufd xmm6,xmm1,128
por xmm5,xmm7
je NEAR L$044ctr32_four
por xmm6,xmm7
call __aesni_encrypt6
movups xmm1,[esi]
movups xmm0,[16+esi]
xorps xmm2,xmm1
movups xmm1,[32+esi]
xorps xmm3,xmm0
movups xmm0,[48+esi]
xorps xmm4,xmm1
movups xmm1,[64+esi]
xorps xmm5,xmm0
movups [edi],xmm2
xorps xmm6,xmm1
movups [16+edi],xmm3
movups [32+edi],xmm4
movups [48+edi],xmm5
movups [64+edi],xmm6
jmp NEAR L$040ctr32_ret
align 16
L$037ctr32_one_shortcut:
movups xmm2,[ebx]
mov ecx,DWORD [240+edx]
L$041ctr32_one:
movups xmm0,[edx]
movups xmm1,[16+edx]
lea edx,[32+edx]
xorps xmm2,xmm0
L$045enc1_loop_7:
db 102,15,56,220,209
dec ecx
movups xmm1,[edx]
lea edx,[16+edx]
jnz NEAR L$045enc1_loop_7
db 102,15,56,221,209
movups xmm6,[esi]
xorps xmm6,xmm2
movups [edi],xmm6
jmp NEAR L$040ctr32_ret
align 16
L$042ctr32_two:
call __aesni_encrypt2
movups xmm5,[esi]
movups xmm6,[16+esi]
xorps xmm2,xmm5
xorps xmm3,xmm6
movups [edi],xmm2
movups [16+edi],xmm3
jmp NEAR L$040ctr32_ret
align 16
L$043ctr32_three:
call __aesni_encrypt3
movups xmm5,[esi]
movups xmm6,[16+esi]
xorps xmm2,xmm5
movups xmm7,[32+esi]
xorps xmm3,xmm6
movups [edi],xmm2
xorps xmm4,xmm7
movups [16+edi],xmm3
movups [32+edi],xmm4
jmp NEAR L$040ctr32_ret
align 16
L$044ctr32_four:
call __aesni_encrypt4
movups xmm6,[esi]
movups xmm7,[16+esi]
movups xmm1,[32+esi]
xorps xmm2,xmm6
movups xmm0,[48+esi]
xorps xmm3,xmm7
movups [edi],xmm2
xorps xmm4,xmm1
movups [16+edi],xmm3
xorps xmm5,xmm0
movups [32+edi],xmm4
movups [48+edi],xmm5
L$040ctr32_ret:
pxor xmm0,xmm0
pxor xmm1,xmm1
pxor xmm2,xmm2
pxor xmm3,xmm3
pxor xmm4,xmm4
movdqa [32+esp],xmm0
pxor xmm5,xmm5
movdqa [48+esp],xmm0
pxor xmm6,xmm6
movdqa [64+esp],xmm0
pxor xmm7,xmm7
mov esp,DWORD [80+esp]
pop edi
pop esi
pop ebx
pop ebp
ret
global _aesni_xts_encrypt
align 16
_aesni_xts_encrypt:
L$_aesni_xts_encrypt_begin:
push ebp
push ebx
push esi
push edi
mov edx,DWORD [36+esp]
mov esi,DWORD [40+esp]
mov ecx,DWORD [240+edx]
movups xmm2,[esi]
movups xmm0,[edx]
movups xmm1,[16+edx]
lea edx,[32+edx]
xorps xmm2,xmm0
L$046enc1_loop_8:
db 102,15,56,220,209
dec ecx
movups xmm1,[edx]
lea edx,[16+edx]
jnz NEAR L$046enc1_loop_8
db 102,15,56,221,209
mov esi,DWORD [20+esp]
mov edi,DWORD [24+esp]
mov eax,DWORD [28+esp]
mov edx,DWORD [32+esp]
mov ebp,esp
sub esp,120
mov ecx,DWORD [240+edx]
and esp,-16
mov DWORD [96+esp],135
mov DWORD [100+esp],0
mov DWORD [104+esp],1
mov DWORD [108+esp],0
mov DWORD [112+esp],eax
mov DWORD [116+esp],ebp
movdqa xmm1,xmm2
pxor xmm0,xmm0
movdqa xmm3,[96+esp]
pcmpgtd xmm0,xmm1
and eax,-16
mov ebp,edx
mov ebx,ecx
sub eax,96
jc NEAR L$047xts_enc_short
shl ecx,4
mov ebx,16
sub ebx,ecx
lea edx,[32+ecx*1+edx]
jmp NEAR L$048xts_enc_loop6
align 16
L$048xts_enc_loop6:
pshufd xmm2,xmm0,19
pxor xmm0,xmm0
movdqa [esp],xmm1
paddq xmm1,xmm1
pand xmm2,xmm3
pcmpgtd xmm0,xmm1
pxor xmm1,xmm2
pshufd xmm2,xmm0,19
pxor xmm0,xmm0
movdqa [16+esp],xmm1
paddq xmm1,xmm1
pand xmm2,xmm3
pcmpgtd xmm0,xmm1
pxor xmm1,xmm2
pshufd xmm2,xmm0,19
pxor xmm0,xmm0
movdqa [32+esp],xmm1
paddq xmm1,xmm1
pand xmm2,xmm3
pcmpgtd xmm0,xmm1
pxor xmm1,xmm2
pshufd xmm2,xmm0,19
pxor xmm0,xmm0
movdqa [48+esp],xmm1
paddq xmm1,xmm1
pand xmm2,xmm3
pcmpgtd xmm0,xmm1
pxor xmm1,xmm2
pshufd xmm7,xmm0,19
movdqa [64+esp],xmm1
paddq xmm1,xmm1
movups xmm0,[ebp]
pand xmm7,xmm3
movups xmm2,[esi]
pxor xmm7,xmm1
mov ecx,ebx
movdqu xmm3,[16+esi]
xorps xmm2,xmm0
movdqu xmm4,[32+esi]
pxor xmm3,xmm0
movdqu xmm5,[48+esi]
pxor xmm4,xmm0
movdqu xmm6,[64+esi]
pxor xmm5,xmm0
movdqu xmm1,[80+esi]
pxor xmm6,xmm0
lea esi,[96+esi]
pxor xmm2,[esp]
movdqa [80+esp],xmm7
pxor xmm7,xmm1
movups xmm1,[16+ebp]
pxor xmm3,[16+esp]
pxor xmm4,[32+esp]
db 102,15,56,220,209
pxor xmm5,[48+esp]
pxor xmm6,[64+esp]
db 102,15,56,220,217
pxor xmm7,xmm0
movups xmm0,[32+ebp]
db 102,15,56,220,225
db 102,15,56,220,233
db 102,15,56,220,241
db 102,15,56,220,249
call L$_aesni_encrypt6_enter
movdqa xmm1,[80+esp]
pxor xmm0,xmm0
xorps xmm2,[esp]
pcmpgtd xmm0,xmm1
xorps xmm3,[16+esp]
movups [edi],xmm2
xorps xmm4,[32+esp]
movups [16+edi],xmm3
xorps xmm5,[48+esp]
movups [32+edi],xmm4
xorps xmm6,[64+esp]
movups [48+edi],xmm5
xorps xmm7,xmm1
movups [64+edi],xmm6
pshufd xmm2,xmm0,19
movups [80+edi],xmm7
lea edi,[96+edi]
movdqa xmm3,[96+esp]
pxor xmm0,xmm0
paddq xmm1,xmm1
pand xmm2,xmm3
pcmpgtd xmm0,xmm1
pxor xmm1,xmm2
sub eax,96
jnc NEAR L$048xts_enc_loop6
mov ecx,DWORD [240+ebp]
mov edx,ebp
mov ebx,ecx
L$047xts_enc_short:
add eax,96
jz NEAR L$049xts_enc_done6x
movdqa xmm5,xmm1
cmp eax,32
jb NEAR L$050xts_enc_one
pshufd xmm2,xmm0,19
pxor xmm0,xmm0
paddq xmm1,xmm1
pand xmm2,xmm3
pcmpgtd xmm0,xmm1
pxor xmm1,xmm2
je NEAR L$051xts_enc_two
pshufd xmm2,xmm0,19
pxor xmm0,xmm0
movdqa xmm6,xmm1
paddq xmm1,xmm1
pand xmm2,xmm3
pcmpgtd xmm0,xmm1
pxor xmm1,xmm2
cmp eax,64
jb NEAR L$052xts_enc_three
pshufd xmm2,xmm0,19
pxor xmm0,xmm0
movdqa xmm7,xmm1
paddq xmm1,xmm1
pand xmm2,xmm3
pcmpgtd xmm0,xmm1
pxor xmm1,xmm2
movdqa [esp],xmm5
movdqa [16+esp],xmm6
je NEAR L$053xts_enc_four
movdqa [32+esp],xmm7
pshufd xmm7,xmm0,19
movdqa [48+esp],xmm1
paddq xmm1,xmm1
pand xmm7,xmm3
pxor xmm7,xmm1
movdqu xmm2,[esi]
movdqu xmm3,[16+esi]
movdqu xmm4,[32+esi]
pxor xmm2,[esp]
movdqu xmm5,[48+esi]
pxor xmm3,[16+esp]
movdqu xmm6,[64+esi]
pxor xmm4,[32+esp]
lea esi,[80+esi]
pxor xmm5,[48+esp]
movdqa [64+esp],xmm7
pxor xmm6,xmm7
call __aesni_encrypt6
movaps xmm1,[64+esp]
xorps xmm2,[esp]
xorps xmm3,[16+esp]
xorps xmm4,[32+esp]
movups [edi],xmm2
xorps xmm5,[48+esp]
movups [16+edi],xmm3
xorps xmm6,xmm1
movups [32+edi],xmm4
movups [48+edi],xmm5
movups [64+edi],xmm6
lea edi,[80+edi]
jmp NEAR L$054xts_enc_done
align 16
L$050xts_enc_one:
movups xmm2,[esi]
lea esi,[16+esi]
xorps xmm2,xmm5
movups xmm0,[edx]
movups xmm1,[16+edx]
lea edx,[32+edx]
xorps xmm2,xmm0
L$055enc1_loop_9:
db 102,15,56,220,209
dec ecx
movups xmm1,[edx]
lea edx,[16+edx]
jnz NEAR L$055enc1_loop_9
db 102,15,56,221,209
xorps xmm2,xmm5
movups [edi],xmm2
lea edi,[16+edi]
movdqa xmm1,xmm5
jmp NEAR L$054xts_enc_done
align 16
L$051xts_enc_two:
movaps xmm6,xmm1
movups xmm2,[esi]
movups xmm3,[16+esi]
lea esi,[32+esi]
xorps xmm2,xmm5
xorps xmm3,xmm6
call __aesni_encrypt2
xorps xmm2,xmm5
xorps xmm3,xmm6
movups [edi],xmm2
movups [16+edi],xmm3
lea edi,[32+edi]
movdqa xmm1,xmm6
jmp NEAR L$054xts_enc_done
align 16
L$052xts_enc_three:
movaps xmm7,xmm1
movups xmm2,[esi]
movups xmm3,[16+esi]
movups xmm4,[32+esi]
lea esi,[48+esi]
xorps xmm2,xmm5
xorps xmm3,xmm6
xorps xmm4,xmm7
call __aesni_encrypt3
xorps xmm2,xmm5
xorps xmm3,xmm6
xorps xmm4,xmm7
movups [edi],xmm2
movups [16+edi],xmm3
movups [32+edi],xmm4
lea edi,[48+edi]
movdqa xmm1,xmm7
jmp NEAR L$054xts_enc_done
align 16
L$053xts_enc_four:
movaps xmm6,xmm1
movups xmm2,[esi]
movups xmm3,[16+esi]
movups xmm4,[32+esi]
xorps xmm2,[esp]
movups xmm5,[48+esi]
lea esi,[64+esi]
xorps xmm3,[16+esp]
xorps xmm4,xmm7
xorps xmm5,xmm6
call __aesni_encrypt4
xorps xmm2,[esp]
xorps xmm3,[16+esp]
xorps xmm4,xmm7
movups [edi],xmm2
xorps xmm5,xmm6
movups [16+edi],xmm3
movups [32+edi],xmm4
movups [48+edi],xmm5
lea edi,[64+edi]
movdqa xmm1,xmm6
jmp NEAR L$054xts_enc_done
align 16
L$049xts_enc_done6x:
mov eax,DWORD [112+esp]
and eax,15
jz NEAR L$056xts_enc_ret
movdqa xmm5,xmm1
mov DWORD [112+esp],eax
jmp NEAR L$057xts_enc_steal
align 16
L$054xts_enc_done:
mov eax,DWORD [112+esp]
pxor xmm0,xmm0
and eax,15
jz NEAR L$056xts_enc_ret
pcmpgtd xmm0,xmm1
mov DWORD [112+esp],eax
pshufd xmm5,xmm0,19
paddq xmm1,xmm1
pand xmm5,[96+esp]
pxor xmm5,xmm1
L$057xts_enc_steal:
movzx ecx,BYTE [esi]
movzx edx,BYTE [edi-16]
lea esi,[1+esi]
mov BYTE [edi-16],cl
mov BYTE [edi],dl
lea edi,[1+edi]
sub eax,1
jnz NEAR L$057xts_enc_steal
sub edi,DWORD [112+esp]
mov edx,ebp
mov ecx,ebx
movups xmm2,[edi-16]
xorps xmm2,xmm5
movups xmm0,[edx]
movups xmm1,[16+edx]
lea edx,[32+edx]
xorps xmm2,xmm0
L$058enc1_loop_10:
db 102,15,56,220,209
dec ecx
movups xmm1,[edx]
lea edx,[16+edx]
jnz NEAR L$058enc1_loop_10
db 102,15,56,221,209
xorps xmm2,xmm5
movups [edi-16],xmm2
L$056xts_enc_ret:
pxor xmm0,xmm0
pxor xmm1,xmm1
pxor xmm2,xmm2
movdqa [esp],xmm0
pxor xmm3,xmm3
movdqa [16+esp],xmm0
pxor xmm4,xmm4
movdqa [32+esp],xmm0
pxor xmm5,xmm5
movdqa [48+esp],xmm0
pxor xmm6,xmm6
movdqa [64+esp],xmm0
pxor xmm7,xmm7
movdqa [80+esp],xmm0
mov esp,DWORD [116+esp]
pop edi
pop esi
pop ebx
pop ebp
ret
global _aesni_xts_decrypt
align 16
_aesni_xts_decrypt:
L$_aesni_xts_decrypt_begin:
push ebp
push ebx
push esi
push edi
mov edx,DWORD [36+esp]
mov esi,DWORD [40+esp]
mov ecx,DWORD [240+edx]
movups xmm2,[esi]
movups xmm0,[edx]
movups xmm1,[16+edx]
lea edx,[32+edx]
xorps xmm2,xmm0
L$059enc1_loop_11:
db 102,15,56,220,209
dec ecx
movups xmm1,[edx]
lea edx,[16+edx]
jnz NEAR L$059enc1_loop_11
db 102,15,56,221,209
mov esi,DWORD [20+esp]
mov edi,DWORD [24+esp]
mov eax,DWORD [28+esp]
mov edx,DWORD [32+esp]
mov ebp,esp
sub esp,120
and esp,-16
xor ebx,ebx
test eax,15
setnz bl
shl ebx,4
sub eax,ebx
mov DWORD [96+esp],135
mov DWORD [100+esp],0
mov DWORD [104+esp],1
mov DWORD [108+esp],0
mov DWORD [112+esp],eax
mov DWORD [116+esp],ebp
mov ecx,DWORD [240+edx]
mov ebp,edx
mov ebx,ecx
movdqa xmm1,xmm2
pxor xmm0,xmm0
movdqa xmm3,[96+esp]
pcmpgtd xmm0,xmm1
and eax,-16
sub eax,96
jc NEAR L$060xts_dec_short
shl ecx,4
mov ebx,16
sub ebx,ecx
lea edx,[32+ecx*1+edx]
jmp NEAR L$061xts_dec_loop6
align 16
L$061xts_dec_loop6:
pshufd xmm2,xmm0,19
pxor xmm0,xmm0
movdqa [esp],xmm1
paddq xmm1,xmm1
pand xmm2,xmm3
pcmpgtd xmm0,xmm1
pxor xmm1,xmm2
pshufd xmm2,xmm0,19
pxor xmm0,xmm0
movdqa [16+esp],xmm1
paddq xmm1,xmm1
pand xmm2,xmm3
pcmpgtd xmm0,xmm1
pxor xmm1,xmm2
pshufd xmm2,xmm0,19
pxor xmm0,xmm0
movdqa [32+esp],xmm1
paddq xmm1,xmm1
pand xmm2,xmm3
pcmpgtd xmm0,xmm1
pxor xmm1,xmm2
pshufd xmm2,xmm0,19
pxor xmm0,xmm0
movdqa [48+esp],xmm1
paddq xmm1,xmm1
pand xmm2,xmm3
pcmpgtd xmm0,xmm1
pxor xmm1,xmm2
pshufd xmm7,xmm0,19
movdqa [64+esp],xmm1
paddq xmm1,xmm1
movups xmm0,[ebp]
pand xmm7,xmm3
movups xmm2,[esi]
pxor xmm7,xmm1
mov ecx,ebx
movdqu xmm3,[16+esi]
xorps xmm2,xmm0
movdqu xmm4,[32+esi]
pxor xmm3,xmm0
movdqu xmm5,[48+esi]
pxor xmm4,xmm0
movdqu xmm6,[64+esi]
pxor xmm5,xmm0
movdqu xmm1,[80+esi]
pxor xmm6,xmm0
lea esi,[96+esi]
pxor xmm2,[esp]
movdqa [80+esp],xmm7
pxor xmm7,xmm1
movups xmm1,[16+ebp]
pxor xmm3,[16+esp]
pxor xmm4,[32+esp]
db 102,15,56,222,209
pxor xmm5,[48+esp]
pxor xmm6,[64+esp]
db 102,15,56,222,217
pxor xmm7,xmm0
movups xmm0,[32+ebp]
db 102,15,56,222,225
db 102,15,56,222,233
db 102,15,56,222,241
db 102,15,56,222,249
call L$_aesni_decrypt6_enter
movdqa xmm1,[80+esp]
pxor xmm0,xmm0
xorps xmm2,[esp]
pcmpgtd xmm0,xmm1
xorps xmm3,[16+esp]
movups [edi],xmm2
xorps xmm4,[32+esp]
movups [16+edi],xmm3
xorps xmm5,[48+esp]
movups [32+edi],xmm4
xorps xmm6,[64+esp]
movups [48+edi],xmm5
xorps xmm7,xmm1
movups [64+edi],xmm6
pshufd xmm2,xmm0,19
movups [80+edi],xmm7
lea edi,[96+edi]
movdqa xmm3,[96+esp]
pxor xmm0,xmm0
paddq xmm1,xmm1
pand xmm2,xmm3
pcmpgtd xmm0,xmm1
pxor xmm1,xmm2
sub eax,96
jnc NEAR L$061xts_dec_loop6
mov ecx,DWORD [240+ebp]
mov edx,ebp
mov ebx,ecx
L$060xts_dec_short:
add eax,96
jz NEAR L$062xts_dec_done6x
movdqa xmm5,xmm1
cmp eax,32
jb NEAR L$063xts_dec_one
pshufd xmm2,xmm0,19
pxor xmm0,xmm0
paddq xmm1,xmm1
pand xmm2,xmm3
pcmpgtd xmm0,xmm1
pxor xmm1,xmm2
je NEAR L$064xts_dec_two
pshufd xmm2,xmm0,19
pxor xmm0,xmm0
movdqa xmm6,xmm1
paddq xmm1,xmm1
pand xmm2,xmm3
pcmpgtd xmm0,xmm1
pxor xmm1,xmm2
cmp eax,64
jb NEAR L$065xts_dec_three
pshufd xmm2,xmm0,19
pxor xmm0,xmm0
movdqa xmm7,xmm1
paddq xmm1,xmm1
pand xmm2,xmm3
pcmpgtd xmm0,xmm1
pxor xmm1,xmm2
movdqa [esp],xmm5
movdqa [16+esp],xmm6
je NEAR L$066xts_dec_four
movdqa [32+esp],xmm7
pshufd xmm7,xmm0,19
movdqa [48+esp],xmm1
paddq xmm1,xmm1
pand xmm7,xmm3
pxor xmm7,xmm1
movdqu xmm2,[esi]
movdqu xmm3,[16+esi]
movdqu xmm4,[32+esi]
pxor xmm2,[esp]
movdqu xmm5,[48+esi]
pxor xmm3,[16+esp]
movdqu xmm6,[64+esi]
pxor xmm4,[32+esp]
lea esi,[80+esi]
pxor xmm5,[48+esp]
movdqa [64+esp],xmm7
pxor xmm6,xmm7
call __aesni_decrypt6
movaps xmm1,[64+esp]
xorps xmm2,[esp]
xorps xmm3,[16+esp]
xorps xmm4,[32+esp]
movups [edi],xmm2
xorps xmm5,[48+esp]
movups [16+edi],xmm3
xorps xmm6,xmm1
movups [32+edi],xmm4
movups [48+edi],xmm5
movups [64+edi],xmm6
lea edi,[80+edi]
jmp NEAR L$067xts_dec_done
align 16
L$063xts_dec_one:
movups xmm2,[esi]
lea esi,[16+esi]
xorps xmm2,xmm5
movups xmm0,[edx]
movups xmm1,[16+edx]
lea edx,[32+edx]
xorps xmm2,xmm0
L$068dec1_loop_12:
db 102,15,56,222,209
dec ecx
movups xmm1,[edx]
lea edx,[16+edx]
jnz NEAR L$068dec1_loop_12
db 102,15,56,223,209
xorps xmm2,xmm5
movups [edi],xmm2
lea edi,[16+edi]
movdqa xmm1,xmm5
jmp NEAR L$067xts_dec_done
align 16
L$064xts_dec_two:
movaps xmm6,xmm1
movups xmm2,[esi]
movups xmm3,[16+esi]
lea esi,[32+esi]
xorps xmm2,xmm5
xorps xmm3,xmm6
call __aesni_decrypt2
xorps xmm2,xmm5
xorps xmm3,xmm6
movups [edi],xmm2
movups [16+edi],xmm3
lea edi,[32+edi]
movdqa xmm1,xmm6
jmp NEAR L$067xts_dec_done
align 16
L$065xts_dec_three:
movaps xmm7,xmm1
movups xmm2,[esi]
movups xmm3,[16+esi]
movups xmm4,[32+esi]
lea esi,[48+esi]
xorps xmm2,xmm5
xorps xmm3,xmm6
xorps xmm4,xmm7
call __aesni_decrypt3
xorps xmm2,xmm5
xorps xmm3,xmm6
xorps xmm4,xmm7
movups [edi],xmm2
movups [16+edi],xmm3
movups [32+edi],xmm4
lea edi,[48+edi]
movdqa xmm1,xmm7
jmp NEAR L$067xts_dec_done
align 16
L$066xts_dec_four:
movaps xmm6,xmm1
movups xmm2,[esi]
movups xmm3,[16+esi]
movups xmm4,[32+esi]
xorps xmm2,[esp]
movups xmm5,[48+esi]
lea esi,[64+esi]
xorps xmm3,[16+esp]
xorps xmm4,xmm7
xorps xmm5,xmm6
call __aesni_decrypt4
xorps xmm2,[esp]
xorps xmm3,[16+esp]
xorps xmm4,xmm7
movups [edi],xmm2
xorps xmm5,xmm6
movups [16+edi],xmm3
movups [32+edi],xmm4
movups [48+edi],xmm5
lea edi,[64+edi]
movdqa xmm1,xmm6
jmp NEAR L$067xts_dec_done
align 16
L$062xts_dec_done6x:
mov eax,DWORD [112+esp]
and eax,15
jz NEAR L$069xts_dec_ret
mov DWORD [112+esp],eax
jmp NEAR L$070xts_dec_only_one_more
align 16
L$067xts_dec_done:
mov eax,DWORD [112+esp]
pxor xmm0,xmm0
and eax,15
jz NEAR L$069xts_dec_ret
pcmpgtd xmm0,xmm1
mov DWORD [112+esp],eax
pshufd xmm2,xmm0,19
pxor xmm0,xmm0
movdqa xmm3,[96+esp]
paddq xmm1,xmm1
pand xmm2,xmm3
pcmpgtd xmm0,xmm1
pxor xmm1,xmm2
L$070xts_dec_only_one_more:
pshufd xmm5,xmm0,19
movdqa xmm6,xmm1
paddq xmm1,xmm1
pand xmm5,xmm3
pxor xmm5,xmm1
mov edx,ebp
mov ecx,ebx
movups xmm2,[esi]
xorps xmm2,xmm5
movups xmm0,[edx]
movups xmm1,[16+edx]
lea edx,[32+edx]
xorps xmm2,xmm0
L$071dec1_loop_13:
db 102,15,56,222,209
dec ecx
movups xmm1,[edx]
lea edx,[16+edx]
jnz NEAR L$071dec1_loop_13
db 102,15,56,223,209
xorps xmm2,xmm5
movups [edi],xmm2
L$072xts_dec_steal:
movzx ecx,BYTE [16+esi]
movzx edx,BYTE [edi]
lea esi,[1+esi]
mov BYTE [edi],cl
mov BYTE [16+edi],dl
lea edi,[1+edi]
sub eax,1
jnz NEAR L$072xts_dec_steal
sub edi,DWORD [112+esp]
mov edx,ebp
mov ecx,ebx
movups xmm2,[edi]
xorps xmm2,xmm6
movups xmm0,[edx]
movups xmm1,[16+edx]
lea edx,[32+edx]
xorps xmm2,xmm0
L$073dec1_loop_14:
db 102,15,56,222,209
dec ecx
movups xmm1,[edx]
lea edx,[16+edx]
jnz NEAR L$073dec1_loop_14
db 102,15,56,223,209
xorps xmm2,xmm6
movups [edi],xmm2
L$069xts_dec_ret:
pxor xmm0,xmm0
pxor xmm1,xmm1
pxor xmm2,xmm2
movdqa [esp],xmm0
pxor xmm3,xmm3
movdqa [16+esp],xmm0
pxor xmm4,xmm4
movdqa [32+esp],xmm0
pxor xmm5,xmm5
movdqa [48+esp],xmm0
pxor xmm6,xmm6
movdqa [64+esp],xmm0
pxor xmm7,xmm7
movdqa [80+esp],xmm0
mov esp,DWORD [116+esp]
pop edi
pop esi
pop ebx
pop ebp
ret
global _aesni_cbc_encrypt
align 16
_aesni_cbc_encrypt:
L$_aesni_cbc_encrypt_begin:
push ebp
push ebx
push esi
push edi
mov esi,DWORD [20+esp]
mov ebx,esp
mov edi,DWORD [24+esp]
sub ebx,24
mov eax,DWORD [28+esp]
and ebx,-16
mov edx,DWORD [32+esp]
mov ebp,DWORD [36+esp]
test eax,eax
jz NEAR L$074cbc_abort
cmp DWORD [40+esp],0
xchg ebx,esp
movups xmm7,[ebp]
mov ecx,DWORD [240+edx]
mov ebp,edx
mov DWORD [16+esp],ebx
mov ebx,ecx
je NEAR L$075cbc_decrypt
movaps xmm2,xmm7
cmp eax,16
jb NEAR L$076cbc_enc_tail
sub eax,16
jmp NEAR L$077cbc_enc_loop
align 16
L$077cbc_enc_loop:
movups xmm7,[esi]
lea esi,[16+esi]
movups xmm0,[edx]
movups xmm1,[16+edx]
xorps xmm7,xmm0
lea edx,[32+edx]
xorps xmm2,xmm7
L$078enc1_loop_15:
db 102,15,56,220,209
dec ecx
movups xmm1,[edx]
lea edx,[16+edx]
jnz NEAR L$078enc1_loop_15
db 102,15,56,221,209
mov ecx,ebx
mov edx,ebp
movups [edi],xmm2
lea edi,[16+edi]
sub eax,16
jnc NEAR L$077cbc_enc_loop
add eax,16
jnz NEAR L$076cbc_enc_tail
movaps xmm7,xmm2
pxor xmm2,xmm2
jmp NEAR L$079cbc_ret
L$076cbc_enc_tail:
mov ecx,eax
dd 2767451785
mov ecx,16
sub ecx,eax
xor eax,eax
dd 2868115081
lea edi,[edi-16]
mov ecx,ebx
mov esi,edi
mov edx,ebp
jmp NEAR L$077cbc_enc_loop
align 16
L$075cbc_decrypt:
cmp eax,80
jbe NEAR L$080cbc_dec_tail
movaps [esp],xmm7
sub eax,80
jmp NEAR L$081cbc_dec_loop6_enter
align 16
L$082cbc_dec_loop6:
movaps [esp],xmm0
movups [edi],xmm7
lea edi,[16+edi]
L$081cbc_dec_loop6_enter:
movdqu xmm2,[esi]
movdqu xmm3,[16+esi]
movdqu xmm4,[32+esi]
movdqu xmm5,[48+esi]
movdqu xmm6,[64+esi]
movdqu xmm7,[80+esi]
call __aesni_decrypt6
movups xmm1,[esi]
movups xmm0,[16+esi]
xorps xmm2,[esp]
xorps xmm3,xmm1
movups xmm1,[32+esi]
xorps xmm4,xmm0
movups xmm0,[48+esi]
xorps xmm5,xmm1
movups xmm1,[64+esi]
xorps xmm6,xmm0
movups xmm0,[80+esi]
xorps xmm7,xmm1
movups [edi],xmm2
movups [16+edi],xmm3
lea esi,[96+esi]
movups [32+edi],xmm4
mov ecx,ebx
movups [48+edi],xmm5
mov edx,ebp
movups [64+edi],xmm6
lea edi,[80+edi]
sub eax,96
ja NEAR L$082cbc_dec_loop6
movaps xmm2,xmm7
movaps xmm7,xmm0
add eax,80
jle NEAR L$083cbc_dec_clear_tail_collected
movups [edi],xmm2
lea edi,[16+edi]
L$080cbc_dec_tail:
movups xmm2,[esi]
movaps xmm6,xmm2
cmp eax,16
jbe NEAR L$084cbc_dec_one
movups xmm3,[16+esi]
movaps xmm5,xmm3
cmp eax,32
jbe NEAR L$085cbc_dec_two
movups xmm4,[32+esi]
cmp eax,48
jbe NEAR L$086cbc_dec_three
movups xmm5,[48+esi]
cmp eax,64
jbe NEAR L$087cbc_dec_four
movups xmm6,[64+esi]
movaps [esp],xmm7
movups xmm2,[esi]
xorps xmm7,xmm7
call __aesni_decrypt6
movups xmm1,[esi]
movups xmm0,[16+esi]
xorps xmm2,[esp]
xorps xmm3,xmm1
movups xmm1,[32+esi]
xorps xmm4,xmm0
movups xmm0,[48+esi]
xorps xmm5,xmm1
movups xmm7,[64+esi]
xorps xmm6,xmm0
movups [edi],xmm2
movups [16+edi],xmm3
pxor xmm3,xmm3
movups [32+edi],xmm4
pxor xmm4,xmm4
movups [48+edi],xmm5
pxor xmm5,xmm5
lea edi,[64+edi]
movaps xmm2,xmm6
pxor xmm6,xmm6
sub eax,80
jmp NEAR L$088cbc_dec_tail_collected
align 16
L$084cbc_dec_one:
movups xmm0,[edx]
movups xmm1,[16+edx]
lea edx,[32+edx]
xorps xmm2,xmm0
L$089dec1_loop_16:
db 102,15,56,222,209
dec ecx
movups xmm1,[edx]
lea edx,[16+edx]
jnz NEAR L$089dec1_loop_16
db 102,15,56,223,209
xorps xmm2,xmm7
movaps xmm7,xmm6
sub eax,16
jmp NEAR L$088cbc_dec_tail_collected
align 16
L$085cbc_dec_two:
call __aesni_decrypt2
xorps xmm2,xmm7
xorps xmm3,xmm6
movups [edi],xmm2
movaps xmm2,xmm3
pxor xmm3,xmm3
lea edi,[16+edi]
movaps xmm7,xmm5
sub eax,32
jmp NEAR L$088cbc_dec_tail_collected
align 16
L$086cbc_dec_three:
call __aesni_decrypt3
xorps xmm2,xmm7
xorps xmm3,xmm6
xorps xmm4,xmm5
movups [edi],xmm2
movaps xmm2,xmm4
pxor xmm4,xmm4
movups [16+edi],xmm3
pxor xmm3,xmm3
lea edi,[32+edi]
movups xmm7,[32+esi]
sub eax,48
jmp NEAR L$088cbc_dec_tail_collected
align 16
L$087cbc_dec_four:
call __aesni_decrypt4
movups xmm1,[16+esi]
movups xmm0,[32+esi]
xorps xmm2,xmm7
movups xmm7,[48+esi]
xorps xmm3,xmm6
movups [edi],xmm2
xorps xmm4,xmm1
movups [16+edi],xmm3
pxor xmm3,xmm3
xorps xmm5,xmm0
movups [32+edi],xmm4
pxor xmm4,xmm4
lea edi,[48+edi]
movaps xmm2,xmm5
pxor xmm5,xmm5
sub eax,64
jmp NEAR L$088cbc_dec_tail_collected
align 16
L$083cbc_dec_clear_tail_collected:
pxor xmm3,xmm3
pxor xmm4,xmm4
pxor xmm5,xmm5
pxor xmm6,xmm6
L$088cbc_dec_tail_collected:
and eax,15
jnz NEAR L$090cbc_dec_tail_partial
movups [edi],xmm2
pxor xmm0,xmm0
jmp NEAR L$079cbc_ret
align 16
L$090cbc_dec_tail_partial:
movaps [esp],xmm2
pxor xmm0,xmm0
mov ecx,16
mov esi,esp
sub ecx,eax
dd 2767451785
movdqa [esp],xmm2
L$079cbc_ret:
mov esp,DWORD [16+esp]
mov ebp,DWORD [36+esp]
pxor xmm2,xmm2
pxor xmm1,xmm1
movups [ebp],xmm7
pxor xmm7,xmm7
L$074cbc_abort:
pop edi
pop esi
pop ebx
pop ebp
ret
align 16
__aesni_set_encrypt_key:
push ebp
push ebx
test eax,eax
jz NEAR L$091bad_pointer
test edx,edx
jz NEAR L$091bad_pointer
call L$092pic
L$092pic:
pop ebx
lea ebx,[(L$key_const-L$092pic)+ebx]
lea ebp,[_OPENSSL_ia32cap_P]
movups xmm0,[eax]
xorps xmm4,xmm4
mov ebp,DWORD [4+ebp]
lea edx,[16+edx]
and ebp,268437504
cmp ecx,256
je NEAR L$09314rounds
cmp ecx,192
je NEAR L$09412rounds
cmp ecx,128
jne NEAR L$095bad_keybits
align 16
L$09610rounds:
cmp ebp,268435456
je NEAR L$09710rounds_alt
mov ecx,9
movups [edx-16],xmm0
db 102,15,58,223,200,1
call L$098key_128_cold
db 102,15,58,223,200,2
call L$099key_128
db 102,15,58,223,200,4
call L$099key_128
db 102,15,58,223,200,8
call L$099key_128
db 102,15,58,223,200,16
call L$099key_128
db 102,15,58,223,200,32
call L$099key_128
db 102,15,58,223,200,64
call L$099key_128
db 102,15,58,223,200,128
call L$099key_128
db 102,15,58,223,200,27
call L$099key_128
db 102,15,58,223,200,54
call L$099key_128
movups [edx],xmm0
mov DWORD [80+edx],ecx
jmp NEAR L$100good_key
align 16
L$099key_128:
movups [edx],xmm0
lea edx,[16+edx]
L$098key_128_cold:
shufps xmm4,xmm0,16
xorps xmm0,xmm4
shufps xmm4,xmm0,140
xorps xmm0,xmm4
shufps xmm1,xmm1,255
xorps xmm0,xmm1
ret
align 16
L$09710rounds_alt:
movdqa xmm5,[ebx]
mov ecx,8
movdqa xmm4,[32+ebx]
movdqa xmm2,xmm0
movdqu [edx-16],xmm0
L$101loop_key128:
db 102,15,56,0,197
db 102,15,56,221,196
pslld xmm4,1
lea edx,[16+edx]
movdqa xmm3,xmm2
pslldq xmm2,4
pxor xmm3,xmm2
pslldq xmm2,4
pxor xmm3,xmm2
pslldq xmm2,4
pxor xmm2,xmm3
pxor xmm0,xmm2
movdqu [edx-16],xmm0
movdqa xmm2,xmm0
dec ecx
jnz NEAR L$101loop_key128
movdqa xmm4,[48+ebx]
db 102,15,56,0,197
db 102,15,56,221,196
pslld xmm4,1
movdqa xmm3,xmm2
pslldq xmm2,4
pxor xmm3,xmm2
pslldq xmm2,4
pxor xmm3,xmm2
pslldq xmm2,4
pxor xmm2,xmm3
pxor xmm0,xmm2
movdqu [edx],xmm0
movdqa xmm2,xmm0
db 102,15,56,0,197
db 102,15,56,221,196
movdqa xmm3,xmm2
pslldq xmm2,4
pxor xmm3,xmm2
pslldq xmm2,4
pxor xmm3,xmm2
pslldq xmm2,4
pxor xmm2,xmm3
pxor xmm0,xmm2
movdqu [16+edx],xmm0
mov ecx,9
mov DWORD [96+edx],ecx
jmp NEAR L$100good_key
align 16
L$09412rounds:
movq xmm2,[16+eax]
cmp ebp,268435456
je NEAR L$10212rounds_alt
mov ecx,11
movups [edx-16],xmm0
db 102,15,58,223,202,1
call L$103key_192a_cold
db 102,15,58,223,202,2
call L$104key_192b
db 102,15,58,223,202,4
call L$105key_192a
db 102,15,58,223,202,8
call L$104key_192b
db 102,15,58,223,202,16
call L$105key_192a
db 102,15,58,223,202,32
call L$104key_192b
db 102,15,58,223,202,64
call L$105key_192a
db 102,15,58,223,202,128
call L$104key_192b
movups [edx],xmm0
mov DWORD [48+edx],ecx
jmp NEAR L$100good_key
align 16
L$105key_192a:
movups [edx],xmm0
lea edx,[16+edx]
align 16
L$103key_192a_cold:
movaps xmm5,xmm2
L$106key_192b_warm:
shufps xmm4,xmm0,16
movdqa xmm3,xmm2
xorps xmm0,xmm4
shufps xmm4,xmm0,140
pslldq xmm3,4
xorps xmm0,xmm4
pshufd xmm1,xmm1,85
pxor xmm2,xmm3
pxor xmm0,xmm1
pshufd xmm3,xmm0,255
pxor xmm2,xmm3
ret
align 16
L$104key_192b:
movaps xmm3,xmm0
shufps xmm5,xmm0,68
movups [edx],xmm5
shufps xmm3,xmm2,78
movups [16+edx],xmm3
lea edx,[32+edx]
jmp NEAR L$106key_192b_warm
align 16
L$10212rounds_alt:
movdqa xmm5,[16+ebx]
movdqa xmm4,[32+ebx]
mov ecx,8
movdqu [edx-16],xmm0
L$107loop_key192:
movq [edx],xmm2
movdqa xmm1,xmm2
db 102,15,56,0,213
db 102,15,56,221,212
pslld xmm4,1
lea edx,[24+edx]
movdqa xmm3,xmm0
pslldq xmm0,4
pxor xmm3,xmm0
pslldq xmm0,4
pxor xmm3,xmm0
pslldq xmm0,4
pxor xmm0,xmm3
pshufd xmm3,xmm0,255
pxor xmm3,xmm1
pslldq xmm1,4
pxor xmm3,xmm1
pxor xmm0,xmm2
pxor xmm2,xmm3
movdqu [edx-16],xmm0
dec ecx
jnz NEAR L$107loop_key192
mov ecx,11
mov DWORD [32+edx],ecx
jmp NEAR L$100good_key
align 16
L$09314rounds:
movups xmm2,[16+eax]
lea edx,[16+edx]
cmp ebp,268435456
je NEAR L$10814rounds_alt
mov ecx,13
movups [edx-32],xmm0
movups [edx-16],xmm2
db 102,15,58,223,202,1
call L$109key_256a_cold
db 102,15,58,223,200,1
call L$110key_256b
db 102,15,58,223,202,2
call L$111key_256a
db 102,15,58,223,200,2
call L$110key_256b
db 102,15,58,223,202,4
call L$111key_256a
db 102,15,58,223,200,4
call L$110key_256b
db 102,15,58,223,202,8
call L$111key_256a
db 102,15,58,223,200,8
call L$110key_256b
db 102,15,58,223,202,16
call L$111key_256a
db 102,15,58,223,200,16
call L$110key_256b
db 102,15,58,223,202,32
call L$111key_256a
db 102,15,58,223,200,32
call L$110key_256b
db 102,15,58,223,202,64
call L$111key_256a
movups [edx],xmm0
mov DWORD [16+edx],ecx
xor eax,eax
jmp NEAR L$100good_key
align 16
L$111key_256a:
movups [edx],xmm2
lea edx,[16+edx]
L$109key_256a_cold:
shufps xmm4,xmm0,16
xorps xmm0,xmm4
shufps xmm4,xmm0,140
xorps xmm0,xmm4
shufps xmm1,xmm1,255
xorps xmm0,xmm1
ret
align 16
L$110key_256b:
movups [edx],xmm0
lea edx,[16+edx]
shufps xmm4,xmm2,16
xorps xmm2,xmm4
shufps xmm4,xmm2,140
xorps xmm2,xmm4
shufps xmm1,xmm1,170
xorps xmm2,xmm1
ret
align 16
L$10814rounds_alt:
movdqa xmm5,[ebx]
movdqa xmm4,[32+ebx]
mov ecx,7
movdqu [edx-32],xmm0
movdqa xmm1,xmm2
movdqu [edx-16],xmm2
L$112loop_key256:
db 102,15,56,0,213
db 102,15,56,221,212
movdqa xmm3,xmm0
pslldq xmm0,4
pxor xmm3,xmm0
pslldq xmm0,4
pxor xmm3,xmm0
pslldq xmm0,4
pxor xmm0,xmm3
pslld xmm4,1
pxor xmm0,xmm2
movdqu [edx],xmm0
dec ecx
jz NEAR L$113done_key256
pshufd xmm2,xmm0,255
pxor xmm3,xmm3
db 102,15,56,221,211
movdqa xmm3,xmm1
pslldq xmm1,4
pxor xmm3,xmm1
pslldq xmm1,4
pxor xmm3,xmm1
pslldq xmm1,4
pxor xmm1,xmm3
pxor xmm2,xmm1
movdqu [16+edx],xmm2
lea edx,[32+edx]
movdqa xmm1,xmm2
jmp NEAR L$112loop_key256
L$113done_key256:
mov ecx,13
mov DWORD [16+edx],ecx
L$100good_key:
pxor xmm0,xmm0
pxor xmm1,xmm1
pxor xmm2,xmm2
pxor xmm3,xmm3
pxor xmm4,xmm4
pxor xmm5,xmm5
xor eax,eax
pop ebx
pop ebp
ret
align 4
L$091bad_pointer:
mov eax,-1
pop ebx
pop ebp
ret
align 4
L$095bad_keybits:
pxor xmm0,xmm0
mov eax,-2
pop ebx
pop ebp
ret
global _aesni_set_encrypt_key
align 16
_aesni_set_encrypt_key:
L$_aesni_set_encrypt_key_begin:
mov eax,DWORD [4+esp]
mov ecx,DWORD [8+esp]
mov edx,DWORD [12+esp]
call __aesni_set_encrypt_key
ret
global _aesni_set_decrypt_key
align 16
_aesni_set_decrypt_key:
L$_aesni_set_decrypt_key_begin:
mov eax,DWORD [4+esp]
mov ecx,DWORD [8+esp]
mov edx,DWORD [12+esp]
call __aesni_set_encrypt_key
mov edx,DWORD [12+esp]
shl ecx,4
test eax,eax
jnz NEAR L$114dec_key_ret
lea eax,[16+ecx*1+edx]
movups xmm0,[edx]
movups xmm1,[eax]
movups [eax],xmm0
movups [edx],xmm1
lea edx,[16+edx]
lea eax,[eax-16]
L$115dec_key_inverse:
movups xmm0,[edx]
movups xmm1,[eax]
db 102,15,56,219,192
db 102,15,56,219,201
lea edx,[16+edx]
lea eax,[eax-16]
movups [16+eax],xmm0
movups [edx-16],xmm1
cmp eax,edx
ja NEAR L$115dec_key_inverse
movups xmm0,[edx]
db 102,15,56,219,192
movups [edx],xmm0
pxor xmm0,xmm0
pxor xmm1,xmm1
xor eax,eax
L$114dec_key_ret:
ret
align 64
L$key_const:
dd 202313229,202313229,202313229,202313229
dd 67569157,67569157,67569157,67569157
dd 1,1,1,1
dd 27,27,27,27
db 65,69,83,32,102,111,114,32,73,110,116,101,108,32,65,69
db 83,45,78,73,44,32,67,82,89,80,84,79,71,65,77,83
db 32,98,121,32,60,97,112,112,114,111,64,111,112,101,110,115
db 115,108,46,111,114,103,62,0
segment .bss
common _OPENSSL_ia32cap_P 16
|