vpaes-x86.masm 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661
  1. IF @Version LT 800
  2. ECHO MASM version 8.00 or later is strongly recommended.
  3. ENDIF
  4. .686
  5. .XMM
  6. IF @Version LT 800
  7. XMMWORD STRUCT 16
  8. DQ 2 dup (?)
  9. XMMWORD ENDS
  10. ENDIF
  11. .MODEL FLAT
  12. OPTION DOTNAME
  13. IF @Version LT 800
  14. .text$ SEGMENT PAGE 'CODE'
  15. ELSE
  16. .text$ SEGMENT ALIGN(64) 'CODE'
  17. ENDIF
  18. ALIGN 64
  19. $L_vpaes_consts::
  20. DD 218628480,235210255,168496130,67568393
  21. DD 252381056,17041926,33884169,51187212
  22. DD 252645135,252645135,252645135,252645135
  23. DD 1512730624,3266504856,1377990664,3401244816
  24. DD 830229760,1275146365,2969422977,3447763452
  25. DD 3411033600,2979783055,338359620,2782886510
  26. DD 4209124096,907596821,221174255,1006095553
  27. DD 191964160,3799684038,3164090317,1589111125
  28. DD 182528256,1777043520,2877432650,3265356744
  29. DD 1874708224,3503451415,3305285752,363511674
  30. DD 1606117888,3487855781,1093350906,2384367825
  31. DD 197121,67569157,134941193,202313229
  32. DD 67569157,134941193,202313229,197121
  33. DD 134941193,202313229,197121,67569157
  34. DD 202313229,197121,67569157,134941193
  35. DD 33619971,100992007,168364043,235736079
  36. DD 235736079,33619971,100992007,168364043
  37. DD 168364043,235736079,33619971,100992007
  38. DD 100992007,168364043,235736079,33619971
  39. DD 50462976,117835012,185207048,252579084
  40. DD 252314880,51251460,117574920,184942860
  41. DD 184682752,252054788,50987272,118359308
  42. DD 118099200,185467140,251790600,50727180
  43. DD 2946363062,528716217,1300004225,1881839624
  44. DD 1532713819,1532713819,1532713819,1532713819
  45. DD 3602276352,4288629033,3737020424,4153884961
  46. DD 1354558464,32357713,2958822624,3775749553
  47. DD 1201988352,132424512,1572796698,503232858
  48. DD 2213177600,1597421020,4103937655,675398315
  49. DD 2749646592,4273543773,1511898873,121693092
  50. DD 3040248576,1103263732,2871565598,1608280554
  51. DD 2236667136,2588920351,482954393,64377734
  52. DD 3069987328,291237287,2117370568,3650299247
  53. DD 533321216,3573750986,2572112006,1401264716
  54. DD 1339849704,2721158661,548607111,3445553514
  55. DD 2128193280,3054596040,2183486460,1257083700
  56. DD 655635200,1165381986,3923443150,2344132524
  57. DD 190078720,256924420,290342170,357187870
  58. DD 1610966272,2263057382,4103205268,309794674
  59. DD 2592527872,2233205587,1335446729,3402964816
  60. DD 3973531904,3225098121,3002836325,1918774430
  61. DD 3870401024,2102906079,2284471353,4117666579
  62. DD 617007872,1021508343,366931923,691083277
  63. DD 2528395776,3491914898,2968704004,1613121270
  64. DD 3445188352,3247741094,844474987,4093578302
  65. DD 651481088,1190302358,1689581232,574775300
  66. DD 4289380608,206939853,2555985458,2489840491
  67. DD 2130264064,327674451,3566485037,3349835193
  68. DD 2470714624,316102159,3636825756,3393945945
  69. DB 86,101,99,116,111,114,32,80,101,114,109,117,116,97,116,105
  70. DB 111,110,32,65,69,83,32,102,111,114,32,120,56,54,47,83
  71. DB 83,83,69,51,44,32,77,105,107,101,32,72,97,109,98,117
  72. DB 114,103,32,40,83,116,97,110,102,111,114,100,32,85,110,105
  73. DB 118,101,114,115,105,116,121,41,0
  74. ALIGN 64
  75. ALIGN 16
  76. __vpaes_preheat PROC PRIVATE
  77. add ebp,DWORD PTR [esp]
  78. movdqa xmm7,XMMWORD PTR [ebp-48]
  79. movdqa xmm6,XMMWORD PTR [ebp-16]
  80. ret
  81. __vpaes_preheat ENDP
  82. ALIGN 16
  83. __vpaes_encrypt_core PROC PRIVATE
  84. mov ecx,16
  85. mov eax,DWORD PTR 240[edx]
  86. movdqa xmm1,xmm6
  87. movdqa xmm2,XMMWORD PTR [ebp]
  88. pandn xmm1,xmm0
  89. pand xmm0,xmm6
  90. movdqu xmm5,XMMWORD PTR [edx]
  91. DB 102,15,56,0,208
  92. movdqa xmm0,XMMWORD PTR 16[ebp]
  93. pxor xmm2,xmm5
  94. psrld xmm1,4
  95. add edx,16
  96. DB 102,15,56,0,193
  97. lea ebx,DWORD PTR 192[ebp]
  98. pxor xmm0,xmm2
  99. jmp $L000enc_entry
  100. ALIGN 16
  101. $L001enc_loop:
  102. movdqa xmm4,XMMWORD PTR 32[ebp]
  103. movdqa xmm0,XMMWORD PTR 48[ebp]
  104. DB 102,15,56,0,226
  105. DB 102,15,56,0,195
  106. pxor xmm4,xmm5
  107. movdqa xmm5,XMMWORD PTR 64[ebp]
  108. pxor xmm0,xmm4
  109. movdqa xmm1,XMMWORD PTR [ecx*1+ebx-64]
  110. DB 102,15,56,0,234
  111. movdqa xmm2,XMMWORD PTR 80[ebp]
  112. movdqa xmm4,XMMWORD PTR [ecx*1+ebx]
  113. DB 102,15,56,0,211
  114. movdqa xmm3,xmm0
  115. pxor xmm2,xmm5
  116. DB 102,15,56,0,193
  117. add edx,16
  118. pxor xmm0,xmm2
  119. DB 102,15,56,0,220
  120. add ecx,16
  121. pxor xmm3,xmm0
  122. DB 102,15,56,0,193
  123. and ecx,48
  124. sub eax,1
  125. pxor xmm0,xmm3
  126. $L000enc_entry:
  127. movdqa xmm1,xmm6
  128. movdqa xmm5,XMMWORD PTR [ebp-32]
  129. pandn xmm1,xmm0
  130. psrld xmm1,4
  131. pand xmm0,xmm6
  132. DB 102,15,56,0,232
  133. movdqa xmm3,xmm7
  134. pxor xmm0,xmm1
  135. DB 102,15,56,0,217
  136. movdqa xmm4,xmm7
  137. pxor xmm3,xmm5
  138. DB 102,15,56,0,224
  139. movdqa xmm2,xmm7
  140. pxor xmm4,xmm5
  141. DB 102,15,56,0,211
  142. movdqa xmm3,xmm7
  143. pxor xmm2,xmm0
  144. DB 102,15,56,0,220
  145. movdqu xmm5,XMMWORD PTR [edx]
  146. pxor xmm3,xmm1
  147. jnz $L001enc_loop
  148. movdqa xmm4,XMMWORD PTR 96[ebp]
  149. movdqa xmm0,XMMWORD PTR 112[ebp]
  150. DB 102,15,56,0,226
  151. pxor xmm4,xmm5
  152. DB 102,15,56,0,195
  153. movdqa xmm1,XMMWORD PTR 64[ecx*1+ebx]
  154. pxor xmm0,xmm4
  155. DB 102,15,56,0,193
  156. ret
  157. __vpaes_encrypt_core ENDP
  158. ALIGN 16
  159. __vpaes_decrypt_core PROC PRIVATE
  160. lea ebx,DWORD PTR 608[ebp]
  161. mov eax,DWORD PTR 240[edx]
  162. movdqa xmm1,xmm6
  163. movdqa xmm2,XMMWORD PTR [ebx-64]
  164. pandn xmm1,xmm0
  165. mov ecx,eax
  166. psrld xmm1,4
  167. movdqu xmm5,XMMWORD PTR [edx]
  168. shl ecx,4
  169. pand xmm0,xmm6
  170. DB 102,15,56,0,208
  171. movdqa xmm0,XMMWORD PTR [ebx-48]
  172. xor ecx,48
  173. DB 102,15,56,0,193
  174. and ecx,48
  175. pxor xmm2,xmm5
  176. movdqa xmm5,XMMWORD PTR 176[ebp]
  177. pxor xmm0,xmm2
  178. add edx,16
  179. lea ecx,DWORD PTR [ecx*1+ebx-352]
  180. jmp $L002dec_entry
  181. ALIGN 16
  182. $L003dec_loop:
  183. movdqa xmm4,XMMWORD PTR [ebx-32]
  184. movdqa xmm1,XMMWORD PTR [ebx-16]
  185. DB 102,15,56,0,226
  186. DB 102,15,56,0,203
  187. pxor xmm0,xmm4
  188. movdqa xmm4,XMMWORD PTR [ebx]
  189. pxor xmm0,xmm1
  190. movdqa xmm1,XMMWORD PTR 16[ebx]
  191. DB 102,15,56,0,226
  192. DB 102,15,56,0,197
  193. DB 102,15,56,0,203
  194. pxor xmm0,xmm4
  195. movdqa xmm4,XMMWORD PTR 32[ebx]
  196. pxor xmm0,xmm1
  197. movdqa xmm1,XMMWORD PTR 48[ebx]
  198. DB 102,15,56,0,226
  199. DB 102,15,56,0,197
  200. DB 102,15,56,0,203
  201. pxor xmm0,xmm4
  202. movdqa xmm4,XMMWORD PTR 64[ebx]
  203. pxor xmm0,xmm1
  204. movdqa xmm1,XMMWORD PTR 80[ebx]
  205. DB 102,15,56,0,226
  206. DB 102,15,56,0,197
  207. DB 102,15,56,0,203
  208. pxor xmm0,xmm4
  209. add edx,16
  210. DB 102,15,58,15,237,12
  211. pxor xmm0,xmm1
  212. sub eax,1
  213. $L002dec_entry:
  214. movdqa xmm1,xmm6
  215. movdqa xmm2,XMMWORD PTR [ebp-32]
  216. pandn xmm1,xmm0
  217. pand xmm0,xmm6
  218. psrld xmm1,4
  219. DB 102,15,56,0,208
  220. movdqa xmm3,xmm7
  221. pxor xmm0,xmm1
  222. DB 102,15,56,0,217
  223. movdqa xmm4,xmm7
  224. pxor xmm3,xmm2
  225. DB 102,15,56,0,224
  226. pxor xmm4,xmm2
  227. movdqa xmm2,xmm7
  228. DB 102,15,56,0,211
  229. movdqa xmm3,xmm7
  230. pxor xmm2,xmm0
  231. DB 102,15,56,0,220
  232. movdqu xmm0,XMMWORD PTR [edx]
  233. pxor xmm3,xmm1
  234. jnz $L003dec_loop
  235. movdqa xmm4,XMMWORD PTR 96[ebx]
  236. DB 102,15,56,0,226
  237. pxor xmm4,xmm0
  238. movdqa xmm0,XMMWORD PTR 112[ebx]
  239. movdqa xmm2,XMMWORD PTR [ecx]
  240. DB 102,15,56,0,195
  241. pxor xmm0,xmm4
  242. DB 102,15,56,0,194
  243. ret
  244. __vpaes_decrypt_core ENDP
  245. ALIGN 16
  246. __vpaes_schedule_core PROC PRIVATE
  247. add ebp,DWORD PTR [esp]
  248. movdqu xmm0,XMMWORD PTR [esi]
  249. movdqa xmm2,XMMWORD PTR 320[ebp]
  250. movdqa xmm3,xmm0
  251. lea ebx,DWORD PTR [ebp]
  252. movdqa XMMWORD PTR 4[esp],xmm2
  253. call __vpaes_schedule_transform
  254. movdqa xmm7,xmm0
  255. test edi,edi
  256. jnz $L004schedule_am_decrypting
  257. movdqu XMMWORD PTR [edx],xmm0
  258. jmp $L005schedule_go
  259. $L004schedule_am_decrypting:
  260. movdqa xmm1,XMMWORD PTR 256[ecx*1+ebp]
  261. DB 102,15,56,0,217
  262. movdqu XMMWORD PTR [edx],xmm3
  263. xor ecx,48
  264. $L005schedule_go:
  265. cmp eax,192
  266. ja $L006schedule_256
  267. je $L007schedule_192
  268. $L008schedule_128:
  269. mov eax,10
  270. $L009loop_schedule_128:
  271. call __vpaes_schedule_round
  272. dec eax
  273. jz $L010schedule_mangle_last
  274. call __vpaes_schedule_mangle
  275. jmp $L009loop_schedule_128
  276. ALIGN 16
  277. $L007schedule_192:
  278. movdqu xmm0,XMMWORD PTR 8[esi]
  279. call __vpaes_schedule_transform
  280. movdqa xmm6,xmm0
  281. pxor xmm4,xmm4
  282. movhlps xmm6,xmm4
  283. mov eax,4
  284. $L011loop_schedule_192:
  285. call __vpaes_schedule_round
  286. DB 102,15,58,15,198,8
  287. call __vpaes_schedule_mangle
  288. call __vpaes_schedule_192_smear
  289. call __vpaes_schedule_mangle
  290. call __vpaes_schedule_round
  291. dec eax
  292. jz $L010schedule_mangle_last
  293. call __vpaes_schedule_mangle
  294. call __vpaes_schedule_192_smear
  295. jmp $L011loop_schedule_192
  296. ALIGN 16
  297. $L006schedule_256:
  298. movdqu xmm0,XMMWORD PTR 16[esi]
  299. call __vpaes_schedule_transform
  300. mov eax,7
  301. $L012loop_schedule_256:
  302. call __vpaes_schedule_mangle
  303. movdqa xmm6,xmm0
  304. call __vpaes_schedule_round
  305. dec eax
  306. jz $L010schedule_mangle_last
  307. call __vpaes_schedule_mangle
  308. pshufd xmm0,xmm0,255
  309. movdqa XMMWORD PTR 20[esp],xmm7
  310. movdqa xmm7,xmm6
  311. call $L_vpaes_schedule_low_round
  312. movdqa xmm7,XMMWORD PTR 20[esp]
  313. jmp $L012loop_schedule_256
  314. ALIGN 16
  315. $L010schedule_mangle_last:
  316. lea ebx,DWORD PTR 384[ebp]
  317. test edi,edi
  318. jnz $L013schedule_mangle_last_dec
  319. movdqa xmm1,XMMWORD PTR 256[ecx*1+ebp]
  320. DB 102,15,56,0,193
  321. lea ebx,DWORD PTR 352[ebp]
  322. add edx,32
  323. $L013schedule_mangle_last_dec:
  324. add edx,-16
  325. pxor xmm0,XMMWORD PTR 336[ebp]
  326. call __vpaes_schedule_transform
  327. movdqu XMMWORD PTR [edx],xmm0
  328. pxor xmm0,xmm0
  329. pxor xmm1,xmm1
  330. pxor xmm2,xmm2
  331. pxor xmm3,xmm3
  332. pxor xmm4,xmm4
  333. pxor xmm5,xmm5
  334. pxor xmm6,xmm6
  335. pxor xmm7,xmm7
  336. ret
  337. __vpaes_schedule_core ENDP
  338. ALIGN 16
  339. __vpaes_schedule_192_smear PROC PRIVATE
  340. pshufd xmm1,xmm6,128
  341. pshufd xmm0,xmm7,254
  342. pxor xmm6,xmm1
  343. pxor xmm1,xmm1
  344. pxor xmm6,xmm0
  345. movdqa xmm0,xmm6
  346. movhlps xmm6,xmm1
  347. ret
  348. __vpaes_schedule_192_smear ENDP
  349. ALIGN 16
  350. __vpaes_schedule_round PROC PRIVATE
  351. movdqa xmm2,XMMWORD PTR 8[esp]
  352. pxor xmm1,xmm1
  353. DB 102,15,58,15,202,15
  354. DB 102,15,58,15,210,15
  355. pxor xmm7,xmm1
  356. pshufd xmm0,xmm0,255
  357. DB 102,15,58,15,192,1
  358. movdqa XMMWORD PTR 8[esp],xmm2
  359. $L_vpaes_schedule_low_round::
  360. movdqa xmm1,xmm7
  361. pslldq xmm7,4
  362. pxor xmm7,xmm1
  363. movdqa xmm1,xmm7
  364. pslldq xmm7,8
  365. pxor xmm7,xmm1
  366. pxor xmm7,XMMWORD PTR 336[ebp]
  367. movdqa xmm4,XMMWORD PTR [ebp-16]
  368. movdqa xmm5,XMMWORD PTR [ebp-48]
  369. movdqa xmm1,xmm4
  370. pandn xmm1,xmm0
  371. psrld xmm1,4
  372. pand xmm0,xmm4
  373. movdqa xmm2,XMMWORD PTR [ebp-32]
  374. DB 102,15,56,0,208
  375. pxor xmm0,xmm1
  376. movdqa xmm3,xmm5
  377. DB 102,15,56,0,217
  378. pxor xmm3,xmm2
  379. movdqa xmm4,xmm5
  380. DB 102,15,56,0,224
  381. pxor xmm4,xmm2
  382. movdqa xmm2,xmm5
  383. DB 102,15,56,0,211
  384. pxor xmm2,xmm0
  385. movdqa xmm3,xmm5
  386. DB 102,15,56,0,220
  387. pxor xmm3,xmm1
  388. movdqa xmm4,XMMWORD PTR 32[ebp]
  389. DB 102,15,56,0,226
  390. movdqa xmm0,XMMWORD PTR 48[ebp]
  391. DB 102,15,56,0,195
  392. pxor xmm0,xmm4
  393. pxor xmm0,xmm7
  394. movdqa xmm7,xmm0
  395. ret
  396. __vpaes_schedule_round ENDP
  397. ALIGN 16
  398. __vpaes_schedule_transform PROC PRIVATE
  399. movdqa xmm2,XMMWORD PTR [ebp-16]
  400. movdqa xmm1,xmm2
  401. pandn xmm1,xmm0
  402. psrld xmm1,4
  403. pand xmm0,xmm2
  404. movdqa xmm2,XMMWORD PTR [ebx]
  405. DB 102,15,56,0,208
  406. movdqa xmm0,XMMWORD PTR 16[ebx]
  407. DB 102,15,56,0,193
  408. pxor xmm0,xmm2
  409. ret
  410. __vpaes_schedule_transform ENDP
  411. ALIGN 16
  412. __vpaes_schedule_mangle PROC PRIVATE
  413. movdqa xmm4,xmm0
  414. movdqa xmm5,XMMWORD PTR 128[ebp]
  415. test edi,edi
  416. jnz $L014schedule_mangle_dec
  417. add edx,16
  418. pxor xmm4,XMMWORD PTR 336[ebp]
  419. DB 102,15,56,0,229
  420. movdqa xmm3,xmm4
  421. DB 102,15,56,0,229
  422. pxor xmm3,xmm4
  423. DB 102,15,56,0,229
  424. pxor xmm3,xmm4
  425. jmp $L015schedule_mangle_both
  426. ALIGN 16
  427. $L014schedule_mangle_dec:
  428. movdqa xmm2,XMMWORD PTR [ebp-16]
  429. lea esi,DWORD PTR 416[ebp]
  430. movdqa xmm1,xmm2
  431. pandn xmm1,xmm4
  432. psrld xmm1,4
  433. pand xmm4,xmm2
  434. movdqa xmm2,XMMWORD PTR [esi]
  435. DB 102,15,56,0,212
  436. movdqa xmm3,XMMWORD PTR 16[esi]
  437. DB 102,15,56,0,217
  438. pxor xmm3,xmm2
  439. DB 102,15,56,0,221
  440. movdqa xmm2,XMMWORD PTR 32[esi]
  441. DB 102,15,56,0,212
  442. pxor xmm2,xmm3
  443. movdqa xmm3,XMMWORD PTR 48[esi]
  444. DB 102,15,56,0,217
  445. pxor xmm3,xmm2
  446. DB 102,15,56,0,221
  447. movdqa xmm2,XMMWORD PTR 64[esi]
  448. DB 102,15,56,0,212
  449. pxor xmm2,xmm3
  450. movdqa xmm3,XMMWORD PTR 80[esi]
  451. DB 102,15,56,0,217
  452. pxor xmm3,xmm2
  453. DB 102,15,56,0,221
  454. movdqa xmm2,XMMWORD PTR 96[esi]
  455. DB 102,15,56,0,212
  456. pxor xmm2,xmm3
  457. movdqa xmm3,XMMWORD PTR 112[esi]
  458. DB 102,15,56,0,217
  459. pxor xmm3,xmm2
  460. add edx,-16
  461. $L015schedule_mangle_both:
  462. movdqa xmm1,XMMWORD PTR 256[ecx*1+ebp]
  463. DB 102,15,56,0,217
  464. add ecx,-16
  465. and ecx,48
  466. movdqu XMMWORD PTR [edx],xmm3
  467. ret
  468. __vpaes_schedule_mangle ENDP
  469. ALIGN 16
  470. _vpaes_set_encrypt_key PROC PUBLIC
  471. $L_vpaes_set_encrypt_key_begin::
  472. push ebp
  473. push ebx
  474. push esi
  475. push edi
  476. mov esi,DWORD PTR 20[esp]
  477. lea ebx,DWORD PTR [esp-56]
  478. mov eax,DWORD PTR 24[esp]
  479. and ebx,-16
  480. mov edx,DWORD PTR 28[esp]
  481. xchg ebx,esp
  482. mov DWORD PTR 48[esp],ebx
  483. mov ebx,eax
  484. shr ebx,5
  485. add ebx,5
  486. mov DWORD PTR 240[edx],ebx
  487. mov ecx,48
  488. mov edi,0
  489. mov ebp,OFFSET ($L_vpaes_consts+030h-$L016pic_point)
  490. call __vpaes_schedule_core
  491. $L016pic_point:
  492. mov esp,DWORD PTR 48[esp]
  493. xor eax,eax
  494. pop edi
  495. pop esi
  496. pop ebx
  497. pop ebp
  498. ret
  499. _vpaes_set_encrypt_key ENDP
  500. ALIGN 16
  501. _vpaes_set_decrypt_key PROC PUBLIC
  502. $L_vpaes_set_decrypt_key_begin::
  503. push ebp
  504. push ebx
  505. push esi
  506. push edi
  507. mov esi,DWORD PTR 20[esp]
  508. lea ebx,DWORD PTR [esp-56]
  509. mov eax,DWORD PTR 24[esp]
  510. and ebx,-16
  511. mov edx,DWORD PTR 28[esp]
  512. xchg ebx,esp
  513. mov DWORD PTR 48[esp],ebx
  514. mov ebx,eax
  515. shr ebx,5
  516. add ebx,5
  517. mov DWORD PTR 240[edx],ebx
  518. shl ebx,4
  519. lea edx,DWORD PTR 16[ebx*1+edx]
  520. mov edi,1
  521. mov ecx,eax
  522. shr ecx,1
  523. and ecx,32
  524. xor ecx,32
  525. mov ebp,OFFSET ($L_vpaes_consts+030h-$L017pic_point)
  526. call __vpaes_schedule_core
  527. $L017pic_point:
  528. mov esp,DWORD PTR 48[esp]
  529. xor eax,eax
  530. pop edi
  531. pop esi
  532. pop ebx
  533. pop ebp
  534. ret
  535. _vpaes_set_decrypt_key ENDP
  536. ALIGN 16
  537. _vpaes_encrypt PROC PUBLIC
  538. $L_vpaes_encrypt_begin::
  539. push ebp
  540. push ebx
  541. push esi
  542. push edi
  543. mov ebp,OFFSET ($L_vpaes_consts+030h-$L018pic_point)
  544. call __vpaes_preheat
  545. $L018pic_point:
  546. mov esi,DWORD PTR 20[esp]
  547. lea ebx,DWORD PTR [esp-56]
  548. mov edi,DWORD PTR 24[esp]
  549. and ebx,-16
  550. mov edx,DWORD PTR 28[esp]
  551. xchg ebx,esp
  552. mov DWORD PTR 48[esp],ebx
  553. movdqu xmm0,XMMWORD PTR [esi]
  554. call __vpaes_encrypt_core
  555. movdqu XMMWORD PTR [edi],xmm0
  556. mov esp,DWORD PTR 48[esp]
  557. pop edi
  558. pop esi
  559. pop ebx
  560. pop ebp
  561. ret
  562. _vpaes_encrypt ENDP
  563. ALIGN 16
  564. _vpaes_decrypt PROC PUBLIC
  565. $L_vpaes_decrypt_begin::
  566. push ebp
  567. push ebx
  568. push esi
  569. push edi
  570. mov ebp,OFFSET ($L_vpaes_consts+030h-$L019pic_point)
  571. call __vpaes_preheat
  572. $L019pic_point:
  573. mov esi,DWORD PTR 20[esp]
  574. lea ebx,DWORD PTR [esp-56]
  575. mov edi,DWORD PTR 24[esp]
  576. and ebx,-16
  577. mov edx,DWORD PTR 28[esp]
  578. xchg ebx,esp
  579. mov DWORD PTR 48[esp],ebx
  580. movdqu xmm0,XMMWORD PTR [esi]
  581. call __vpaes_decrypt_core
  582. movdqu XMMWORD PTR [edi],xmm0
  583. mov esp,DWORD PTR 48[esp]
  584. pop edi
  585. pop esi
  586. pop ebx
  587. pop ebp
  588. ret
  589. _vpaes_decrypt ENDP
  590. ALIGN 16
  591. _vpaes_cbc_encrypt PROC PUBLIC
  592. $L_vpaes_cbc_encrypt_begin::
  593. push ebp
  594. push ebx
  595. push esi
  596. push edi
  597. mov esi,DWORD PTR 20[esp]
  598. mov edi,DWORD PTR 24[esp]
  599. mov eax,DWORD PTR 28[esp]
  600. mov edx,DWORD PTR 32[esp]
  601. sub eax,16
  602. jc $L020cbc_abort
  603. lea ebx,DWORD PTR [esp-56]
  604. mov ebp,DWORD PTR 36[esp]
  605. and ebx,-16
  606. mov ecx,DWORD PTR 40[esp]
  607. xchg ebx,esp
  608. movdqu xmm1,XMMWORD PTR [ebp]
  609. sub edi,esi
  610. mov DWORD PTR 48[esp],ebx
  611. mov DWORD PTR [esp],edi
  612. mov DWORD PTR 4[esp],edx
  613. mov DWORD PTR 8[esp],ebp
  614. mov edi,eax
  615. mov ebp,OFFSET ($L_vpaes_consts+030h-$L021pic_point)
  616. call __vpaes_preheat
  617. $L021pic_point:
  618. cmp ecx,0
  619. je $L022cbc_dec_loop
  620. jmp $L023cbc_enc_loop
  621. ALIGN 16
  622. $L023cbc_enc_loop:
  623. movdqu xmm0,XMMWORD PTR [esi]
  624. pxor xmm0,xmm1
  625. call __vpaes_encrypt_core
  626. mov ebx,DWORD PTR [esp]
  627. mov edx,DWORD PTR 4[esp]
  628. movdqa xmm1,xmm0
  629. movdqu XMMWORD PTR [esi*1+ebx],xmm0
  630. lea esi,DWORD PTR 16[esi]
  631. sub edi,16
  632. jnc $L023cbc_enc_loop
  633. jmp $L024cbc_done
  634. ALIGN 16
  635. $L022cbc_dec_loop:
  636. movdqu xmm0,XMMWORD PTR [esi]
  637. movdqa XMMWORD PTR 16[esp],xmm1
  638. movdqa XMMWORD PTR 32[esp],xmm0
  639. call __vpaes_decrypt_core
  640. mov ebx,DWORD PTR [esp]
  641. mov edx,DWORD PTR 4[esp]
  642. pxor xmm0,XMMWORD PTR 16[esp]
  643. movdqa xmm1,XMMWORD PTR 32[esp]
  644. movdqu XMMWORD PTR [esi*1+ebx],xmm0
  645. lea esi,DWORD PTR 16[esi]
  646. sub edi,16
  647. jnc $L022cbc_dec_loop
  648. $L024cbc_done:
  649. mov ebx,DWORD PTR 8[esp]
  650. mov esp,DWORD PTR 48[esp]
  651. movdqu XMMWORD PTR [ebx],xmm1
  652. $L020cbc_abort:
  653. pop edi
  654. pop esi
  655. pop ebx
  656. pop ebp
  657. ret
  658. _vpaes_cbc_encrypt ENDP
  659. .text$ ENDS
  660. END