pcl_vpaes-x86_64.s 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770
  1. /*
  2. * Copyright (C) 2011-2017 Intel Corporation. All rights reserved.
  3. *
  4. * Redistribution and use in source and binary forms, with or without
  5. * modification, are permitted provided that the following conditions
  6. * are met:
  7. *
  8. * * Redistributions of source code must retain the above copyright
  9. * notice, this list of conditions and the following disclaimer.
  10. * * Redistributions in binary form must reproduce the above copyright
  11. * notice, this list of conditions and the following disclaimer in
  12. * the documentation and/or other materials provided with the
  13. * distribution.
  14. * * Neither the name of Intel Corporation nor the names of its
  15. * contributors may be used to endorse or promote products derived
  16. * from this software without specific prior written permission.
  17. *
  18. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  19. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  20. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  21. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  22. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  23. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  24. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  25. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  26. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  27. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  28. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  29. *
  30. */
  31. /* ====================================================================
  32. * Copyright (c) 1998-2017 The OpenSSL Project. All rights reserved.
  33. *
  34. * Redistribution and use in source and binary forms, with or without
  35. * modification, are permitted provided that the following conditions
  36. * are met:
  37. *
  38. * 1. Redistributions of source code must retain the above copyright
  39. * notice, this list of conditions and the following disclaimer.
  40. *
  41. * 2. Redistributions in binary form must reproduce the above copyright
  42. * notice, this list of conditions and the following disclaimer in
  43. * the documentation and/or other materials provided with the
  44. * distribution.
  45. *
  46. * 3. All advertising materials mentioning features or use of this
  47. * software must display the following acknowledgment:
  48. * "This product includes software developed by the OpenSSL Project
  49. * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
  50. *
  51. * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
  52. * endorse or promote products derived from this software without
  53. * prior written permission. For written permission, please contact
  54. * openssl-core@openssl.org.
  55. *
  56. * 5. Products derived from this software may not be called "OpenSSL"
  57. * nor may "OpenSSL" appear in their names without prior written
  58. * permission of the OpenSSL Project.
  59. *
  60. * 6. Redistributions of any form whatsoever must retain the following
  61. * acknowledgment:
  62. * "This product includes software developed by the OpenSSL Project
  63. * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
  64. *
  65. * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
  66. * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  67. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  68. * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
  69. * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  70. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  71. * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  72. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  73. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  74. * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  75. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
  76. * OF THE POSSIBILITY OF SUCH DAMAGE.
  77. * ====================================================================
  78. *
  79. * This product includes cryptographic software written by Eric Young
  80. * (eay@cryptsoft.com). This product includes software written by Tim
  81. * Hudson (tjh@cryptsoft.com).
  82. *
  83. */
  84. /*
  85. * Content from openssl-1.1.0e/crypto/aes/vpaes-x86_64.s
  86. * which is auto-generated by openssl-1.1.0e/crypto/aes/asm/vpaes-x86_64.pl
  87. */
  88. .text
  89. .type _pcl_vpaes_encrypt_core,@function
  90. .align 16
  91. _pcl_vpaes_encrypt_core:
  92. movq %rdx,%r9
  93. movq $16,%r11
  94. movl 240(%rdx),%eax
  95. movdqa %xmm9,%xmm1
  96. movdqa .Lk_ipt(%rip),%xmm2
  97. pandn %xmm0,%xmm1
  98. movdqu (%r9),%xmm5
  99. psrld $4,%xmm1
  100. pand %xmm9,%xmm0
  101. .byte 102,15,56,0,208
  102. movdqa .Lk_ipt+16(%rip),%xmm0
  103. .byte 102,15,56,0,193
  104. pxor %xmm5,%xmm2
  105. addq $16,%r9
  106. pxor %xmm2,%xmm0
  107. leaq .Lk_mc_backward(%rip),%r10
  108. jmp .Lenc_entry
  109. .align 16
  110. .Lenc_loop:
  111. movdqa %xmm13,%xmm4
  112. movdqa %xmm12,%xmm0
  113. .byte 102,15,56,0,226
  114. .byte 102,15,56,0,195
  115. pxor %xmm5,%xmm4
  116. movdqa %xmm15,%xmm5
  117. pxor %xmm4,%xmm0
  118. movdqa -64(%r11,%r10,1),%xmm1
  119. .byte 102,15,56,0,234
  120. movdqa (%r11,%r10,1),%xmm4
  121. movdqa %xmm14,%xmm2
  122. .byte 102,15,56,0,211
  123. movdqa %xmm0,%xmm3
  124. pxor %xmm5,%xmm2
  125. .byte 102,15,56,0,193
  126. addq $16,%r9
  127. pxor %xmm2,%xmm0
  128. .byte 102,15,56,0,220
  129. addq $16,%r11
  130. pxor %xmm0,%xmm3
  131. .byte 102,15,56,0,193
  132. andq $0x30,%r11
  133. subq $1,%rax
  134. pxor %xmm3,%xmm0
  135. .Lenc_entry:
  136. movdqa %xmm9,%xmm1
  137. movdqa %xmm11,%xmm5
  138. pandn %xmm0,%xmm1
  139. psrld $4,%xmm1
  140. pand %xmm9,%xmm0
  141. .byte 102,15,56,0,232
  142. movdqa %xmm10,%xmm3
  143. pxor %xmm1,%xmm0
  144. .byte 102,15,56,0,217
  145. movdqa %xmm10,%xmm4
  146. pxor %xmm5,%xmm3
  147. .byte 102,15,56,0,224
  148. movdqa %xmm10,%xmm2
  149. pxor %xmm5,%xmm4
  150. .byte 102,15,56,0,211
  151. movdqa %xmm10,%xmm3
  152. pxor %xmm0,%xmm2
  153. .byte 102,15,56,0,220
  154. movdqu (%r9),%xmm5
  155. pxor %xmm1,%xmm3
  156. jnz .Lenc_loop
  157. movdqa -96(%r10),%xmm4
  158. movdqa -80(%r10),%xmm0
  159. .byte 102,15,56,0,226
  160. pxor %xmm5,%xmm4
  161. .byte 102,15,56,0,195
  162. movdqa 64(%r11,%r10,1),%xmm1
  163. pxor %xmm4,%xmm0
  164. .byte 102,15,56,0,193
  165. .byte 0xf3,0xc3
  166. .size _pcl_vpaes_encrypt_core,.-_pcl_vpaes_encrypt_core
  167. .type _pcl_vpaes_decrypt_core,@function
  168. .align 16
  169. _pcl_vpaes_decrypt_core:
  170. movq %rdx,%r9
  171. movl 240(%rdx),%eax
  172. movdqa %xmm9,%xmm1
  173. movdqa .Lk_dipt(%rip),%xmm2
  174. pandn %xmm0,%xmm1
  175. movq %rax,%r11
  176. psrld $4,%xmm1
  177. movdqu (%r9),%xmm5
  178. shlq $4,%r11
  179. pand %xmm9,%xmm0
  180. .byte 102,15,56,0,208
  181. movdqa .Lk_dipt+16(%rip),%xmm0
  182. xorq $0x30,%r11
  183. leaq .Lk_dsbd(%rip),%r10
  184. .byte 102,15,56,0,193
  185. andq $0x30,%r11
  186. pxor %xmm5,%xmm2
  187. movdqa .Lk_mc_forward+48(%rip),%xmm5
  188. pxor %xmm2,%xmm0
  189. addq $16,%r9
  190. addq %r10,%r11
  191. jmp .Ldec_entry
  192. .align 16
  193. .Ldec_loop:
  194. movdqa -32(%r10),%xmm4
  195. movdqa -16(%r10),%xmm1
  196. .byte 102,15,56,0,226
  197. .byte 102,15,56,0,203
  198. pxor %xmm4,%xmm0
  199. movdqa 0(%r10),%xmm4
  200. pxor %xmm1,%xmm0
  201. movdqa 16(%r10),%xmm1
  202. .byte 102,15,56,0,226
  203. .byte 102,15,56,0,197
  204. .byte 102,15,56,0,203
  205. pxor %xmm4,%xmm0
  206. movdqa 32(%r10),%xmm4
  207. pxor %xmm1,%xmm0
  208. movdqa 48(%r10),%xmm1
  209. .byte 102,15,56,0,226
  210. .byte 102,15,56,0,197
  211. .byte 102,15,56,0,203
  212. pxor %xmm4,%xmm0
  213. movdqa 64(%r10),%xmm4
  214. pxor %xmm1,%xmm0
  215. movdqa 80(%r10),%xmm1
  216. .byte 102,15,56,0,226
  217. .byte 102,15,56,0,197
  218. .byte 102,15,56,0,203
  219. pxor %xmm4,%xmm0
  220. addq $16,%r9
  221. .byte 102,15,58,15,237,12
  222. pxor %xmm1,%xmm0
  223. subq $1,%rax
  224. .Ldec_entry:
  225. movdqa %xmm9,%xmm1
  226. pandn %xmm0,%xmm1
  227. movdqa %xmm11,%xmm2
  228. psrld $4,%xmm1
  229. pand %xmm9,%xmm0
  230. .byte 102,15,56,0,208
  231. movdqa %xmm10,%xmm3
  232. pxor %xmm1,%xmm0
  233. .byte 102,15,56,0,217
  234. movdqa %xmm10,%xmm4
  235. pxor %xmm2,%xmm3
  236. .byte 102,15,56,0,224
  237. pxor %xmm2,%xmm4
  238. movdqa %xmm10,%xmm2
  239. .byte 102,15,56,0,211
  240. movdqa %xmm10,%xmm3
  241. pxor %xmm0,%xmm2
  242. .byte 102,15,56,0,220
  243. movdqu (%r9),%xmm0
  244. pxor %xmm1,%xmm3
  245. jnz .Ldec_loop
  246. movdqa 96(%r10),%xmm4
  247. .byte 102,15,56,0,226
  248. pxor %xmm0,%xmm4
  249. movdqa 112(%r10),%xmm0
  250. movdqa -352(%r11),%xmm2
  251. .byte 102,15,56,0,195
  252. pxor %xmm4,%xmm0
  253. .byte 102,15,56,0,194
  254. .byte 0xf3,0xc3
  255. .size _pcl_vpaes_decrypt_core,.-_pcl_vpaes_decrypt_core
  256. .type _pcl_vpaes_schedule_core,@function
  257. .align 16
  258. _pcl_vpaes_schedule_core:
  259. call _pcl_vpaes_preheat
  260. movdqa .Lk_rcon(%rip),%xmm8
  261. movdqu (%rdi),%xmm0
  262. movdqa %xmm0,%xmm3
  263. leaq .Lk_ipt(%rip),%r11
  264. call _pcl_vpaes_schedule_transform
  265. movdqa %xmm0,%xmm7
  266. leaq .Lk_sr(%rip),%r10
  267. testq %rcx,%rcx
  268. jnz .Lschedule_am_decrypting
  269. movdqu %xmm0,(%rdx)
  270. jmp .Lschedule_go
  271. .Lschedule_am_decrypting:
  272. movdqa (%r8,%r10,1),%xmm1
  273. .byte 102,15,56,0,217
  274. movdqu %xmm3,(%rdx)
  275. xorq $0x30,%r8
  276. .Lschedule_go:
  277. cmpl $192,%esi
  278. ja .Lschedule_256
  279. je .Lschedule_192
  280. .Lschedule_128:
  281. movl $10,%esi
  282. .Loop_schedule_128:
  283. call _pcl_vpaes_schedule_round
  284. decq %rsi
  285. jz .Lschedule_mangle_last
  286. call _pcl_vpaes_schedule_mangle
  287. jmp .Loop_schedule_128
  288. .align 16
  289. .Lschedule_192:
  290. movdqu 8(%rdi),%xmm0
  291. call _pcl_vpaes_schedule_transform
  292. movdqa %xmm0,%xmm6
  293. pxor %xmm4,%xmm4
  294. movhlps %xmm4,%xmm6
  295. movl $4,%esi
  296. .Loop_schedule_192:
  297. call _pcl_vpaes_schedule_round
  298. .byte 102,15,58,15,198,8
  299. call _pcl_vpaes_schedule_mangle
  300. call _pcl_vpaes_schedule_192_smear
  301. call _pcl_vpaes_schedule_mangle
  302. call _pcl_vpaes_schedule_round
  303. decq %rsi
  304. jz .Lschedule_mangle_last
  305. call _pcl_vpaes_schedule_mangle
  306. call _pcl_vpaes_schedule_192_smear
  307. jmp .Loop_schedule_192
  308. .align 16
  309. .Lschedule_256:
  310. movdqu 16(%rdi),%xmm0
  311. call _pcl_vpaes_schedule_transform
  312. movl $7,%esi
  313. .Loop_schedule_256:
  314. call _pcl_vpaes_schedule_mangle
  315. movdqa %xmm0,%xmm6
  316. call _pcl_vpaes_schedule_round
  317. decq %rsi
  318. jz .Lschedule_mangle_last
  319. call _pcl_vpaes_schedule_mangle
  320. pshufd $0xFF,%xmm0,%xmm0
  321. movdqa %xmm7,%xmm5
  322. movdqa %xmm6,%xmm7
  323. call _pcl_vpaes_schedule_low_round
  324. movdqa %xmm5,%xmm7
  325. jmp .Loop_schedule_256
  326. .align 16
  327. .Lschedule_mangle_last:
  328. leaq .Lk_deskew(%rip),%r11
  329. testq %rcx,%rcx
  330. jnz .Lschedule_mangle_last_dec
  331. movdqa (%r8,%r10,1),%xmm1
  332. .byte 102,15,56,0,193
  333. leaq .Lk_opt(%rip),%r11
  334. addq $32,%rdx
  335. .Lschedule_mangle_last_dec:
  336. addq $-16,%rdx
  337. pxor .Lk_s63(%rip),%xmm0
  338. call _pcl_vpaes_schedule_transform
  339. movdqu %xmm0,(%rdx)
  340. pxor %xmm0,%xmm0
  341. pxor %xmm1,%xmm1
  342. pxor %xmm2,%xmm2
  343. pxor %xmm3,%xmm3
  344. pxor %xmm4,%xmm4
  345. pxor %xmm5,%xmm5
  346. pxor %xmm6,%xmm6
  347. pxor %xmm7,%xmm7
  348. .byte 0xf3,0xc3
  349. .size _pcl_vpaes_schedule_core,.-_pcl_vpaes_schedule_core
  350. .type _pcl_vpaes_schedule_192_smear,@function
  351. .align 16
  352. _pcl_vpaes_schedule_192_smear:
  353. pshufd $0x80,%xmm6,%xmm1
  354. pshufd $0xFE,%xmm7,%xmm0
  355. pxor %xmm1,%xmm6
  356. pxor %xmm1,%xmm1
  357. pxor %xmm0,%xmm6
  358. movdqa %xmm6,%xmm0
  359. movhlps %xmm1,%xmm6
  360. .byte 0xf3,0xc3
  361. .size _pcl_vpaes_schedule_192_smear,.-_pcl_vpaes_schedule_192_smear
  362. .type _pcl_vpaes_schedule_round,@function
  363. .align 16
  364. _pcl_vpaes_schedule_round:
  365. pxor %xmm1,%xmm1
  366. .byte 102,65,15,58,15,200,15
  367. .byte 102,69,15,58,15,192,15
  368. pxor %xmm1,%xmm7
  369. pshufd $0xFF,%xmm0,%xmm0
  370. .byte 102,15,58,15,192,1
  371. _pcl_vpaes_schedule_low_round:
  372. movdqa %xmm7,%xmm1
  373. pslldq $4,%xmm7
  374. pxor %xmm1,%xmm7
  375. movdqa %xmm7,%xmm1
  376. pslldq $8,%xmm7
  377. pxor %xmm1,%xmm7
  378. pxor .Lk_s63(%rip),%xmm7
  379. movdqa %xmm9,%xmm1
  380. pandn %xmm0,%xmm1
  381. psrld $4,%xmm1
  382. pand %xmm9,%xmm0
  383. movdqa %xmm11,%xmm2
  384. .byte 102,15,56,0,208
  385. pxor %xmm1,%xmm0
  386. movdqa %xmm10,%xmm3
  387. .byte 102,15,56,0,217
  388. pxor %xmm2,%xmm3
  389. movdqa %xmm10,%xmm4
  390. .byte 102,15,56,0,224
  391. pxor %xmm2,%xmm4
  392. movdqa %xmm10,%xmm2
  393. .byte 102,15,56,0,211
  394. pxor %xmm0,%xmm2
  395. movdqa %xmm10,%xmm3
  396. .byte 102,15,56,0,220
  397. pxor %xmm1,%xmm3
  398. movdqa %xmm13,%xmm4
  399. .byte 102,15,56,0,226
  400. movdqa %xmm12,%xmm0
  401. .byte 102,15,56,0,195
  402. pxor %xmm4,%xmm0
  403. pxor %xmm7,%xmm0
  404. movdqa %xmm0,%xmm7
  405. .byte 0xf3,0xc3
  406. .size _pcl_vpaes_schedule_round,.-_pcl_vpaes_schedule_round
  407. .type _pcl_vpaes_schedule_transform,@function
  408. .align 16
  409. _pcl_vpaes_schedule_transform:
  410. movdqa %xmm9,%xmm1
  411. pandn %xmm0,%xmm1
  412. psrld $4,%xmm1
  413. pand %xmm9,%xmm0
  414. movdqa (%r11),%xmm2
  415. .byte 102,15,56,0,208
  416. movdqa 16(%r11),%xmm0
  417. .byte 102,15,56,0,193
  418. pxor %xmm2,%xmm0
  419. .byte 0xf3,0xc3
  420. .size _pcl_vpaes_schedule_transform,.-_pcl_vpaes_schedule_transform
  421. .type _pcl_vpaes_schedule_mangle,@function
  422. .align 16
  423. _pcl_vpaes_schedule_mangle:
  424. movdqa %xmm0,%xmm4
  425. movdqa .Lk_mc_forward(%rip),%xmm5
  426. testq %rcx,%rcx
  427. jnz .Lschedule_mangle_dec
  428. addq $16,%rdx
  429. pxor .Lk_s63(%rip),%xmm4
  430. .byte 102,15,56,0,229
  431. movdqa %xmm4,%xmm3
  432. .byte 102,15,56,0,229
  433. pxor %xmm4,%xmm3
  434. .byte 102,15,56,0,229
  435. pxor %xmm4,%xmm3
  436. jmp .Lschedule_mangle_both
  437. .align 16
  438. .Lschedule_mangle_dec:
  439. leaq .Lk_dksd(%rip),%r11
  440. movdqa %xmm9,%xmm1
  441. pandn %xmm4,%xmm1
  442. psrld $4,%xmm1
  443. pand %xmm9,%xmm4
  444. movdqa 0(%r11),%xmm2
  445. .byte 102,15,56,0,212
  446. movdqa 16(%r11),%xmm3
  447. .byte 102,15,56,0,217
  448. pxor %xmm2,%xmm3
  449. .byte 102,15,56,0,221
  450. movdqa 32(%r11),%xmm2
  451. .byte 102,15,56,0,212
  452. pxor %xmm3,%xmm2
  453. movdqa 48(%r11),%xmm3
  454. .byte 102,15,56,0,217
  455. pxor %xmm2,%xmm3
  456. .byte 102,15,56,0,221
  457. movdqa 64(%r11),%xmm2
  458. .byte 102,15,56,0,212
  459. pxor %xmm3,%xmm2
  460. movdqa 80(%r11),%xmm3
  461. .byte 102,15,56,0,217
  462. pxor %xmm2,%xmm3
  463. .byte 102,15,56,0,221
  464. movdqa 96(%r11),%xmm2
  465. .byte 102,15,56,0,212
  466. pxor %xmm3,%xmm2
  467. movdqa 112(%r11),%xmm3
  468. .byte 102,15,56,0,217
  469. pxor %xmm2,%xmm3
  470. addq $-16,%rdx
  471. .Lschedule_mangle_both:
  472. movdqa (%r8,%r10,1),%xmm1
  473. .byte 102,15,56,0,217
  474. addq $-16,%r8
  475. andq $0x30,%r8
  476. movdqu %xmm3,(%rdx)
  477. .byte 0xf3,0xc3
  478. .size _pcl_vpaes_schedule_mangle,.-_pcl_vpaes_schedule_mangle
  479. .globl pcl_vpaes_set_encrypt_key
  480. .type pcl_vpaes_set_encrypt_key,@function
  481. .align 16
  482. pcl_vpaes_set_encrypt_key:
  483. movl %esi,%eax
  484. shrl $5,%eax
  485. addl $5,%eax
  486. movl %eax,240(%rdx)
  487. movl $0,%ecx
  488. movl $0x30,%r8d
  489. call _pcl_vpaes_schedule_core
  490. xorl %eax,%eax
  491. .byte 0xf3,0xc3
  492. .size pcl_vpaes_set_encrypt_key,.-pcl_vpaes_set_encrypt_key
  493. .globl pcl_vpaes_set_decrypt_key
  494. .type pcl_vpaes_set_decrypt_key,@function
  495. .align 16
  496. pcl_vpaes_set_decrypt_key:
  497. movl %esi,%eax
  498. shrl $5,%eax
  499. addl $5,%eax
  500. movl %eax,240(%rdx)
  501. shll $4,%eax
  502. leaq 16(%rdx,%rax,1),%rdx
  503. movl $1,%ecx
  504. movl %esi,%r8d
  505. shrl $1,%r8d
  506. andl $32,%r8d
  507. xorl $32,%r8d
  508. call _pcl_vpaes_schedule_core
  509. xorl %eax,%eax
  510. .byte 0xf3,0xc3
  511. .size pcl_vpaes_set_decrypt_key,.-pcl_vpaes_set_decrypt_key
  512. .globl pcl_vpaes_encrypt
  513. .type pcl_vpaes_encrypt,@function
  514. .align 16
  515. pcl_vpaes_encrypt:
  516. movdqu (%rdi),%xmm0
  517. call _pcl_vpaes_preheat
  518. call _pcl_vpaes_encrypt_core
  519. movdqu %xmm0,(%rsi)
  520. .byte 0xf3,0xc3
  521. .size pcl_vpaes_encrypt,.-pcl_vpaes_encrypt
  522. .globl pcl_vpaes_decrypt
  523. .type pcl_vpaes_decrypt,@function
  524. .align 16
  525. pcl_vpaes_decrypt:
  526. movdqu (%rdi),%xmm0
  527. call _pcl_vpaes_preheat
  528. call _pcl_vpaes_decrypt_core
  529. movdqu %xmm0,(%rsi)
  530. .byte 0xf3,0xc3
  531. .size pcl_vpaes_decrypt,.-pcl_vpaes_decrypt
  532. .globl pcl_vpaes_cbc_encrypt
  533. .type pcl_vpaes_cbc_encrypt,@function
  534. .align 16
  535. pcl_vpaes_cbc_encrypt:
  536. xchgq %rcx,%rdx
  537. subq $16,%rcx
  538. jc .Lcbc_abort
  539. movdqu (%r8),%xmm6
  540. subq %rdi,%rsi
  541. call _pcl_vpaes_preheat
  542. cmpl $0,%r9d
  543. je .Lcbc_dec_loop
  544. jmp .Lcbc_enc_loop
  545. .align 16
  546. .Lcbc_enc_loop:
  547. movdqu (%rdi),%xmm0
  548. pxor %xmm6,%xmm0
  549. call _pcl_vpaes_encrypt_core
  550. movdqa %xmm0,%xmm6
  551. movdqu %xmm0,(%rsi,%rdi,1)
  552. leaq 16(%rdi),%rdi
  553. subq $16,%rcx
  554. jnc .Lcbc_enc_loop
  555. jmp .Lcbc_done
  556. .align 16
  557. .Lcbc_dec_loop:
  558. movdqu (%rdi),%xmm0
  559. movdqa %xmm0,%xmm7
  560. call _pcl_vpaes_decrypt_core
  561. pxor %xmm6,%xmm0
  562. movdqa %xmm7,%xmm6
  563. movdqu %xmm0,(%rsi,%rdi,1)
  564. leaq 16(%rdi),%rdi
  565. subq $16,%rcx
  566. jnc .Lcbc_dec_loop
  567. .Lcbc_done:
  568. movdqu %xmm6,(%r8)
  569. .Lcbc_abort:
  570. .byte 0xf3,0xc3
  571. .size pcl_vpaes_cbc_encrypt,.-pcl_vpaes_cbc_encrypt
  572. .type _pcl_vpaes_preheat,@function
  573. .align 16
  574. _pcl_vpaes_preheat:
  575. leaq .Lk_s0F(%rip),%r10
  576. movdqa -32(%r10),%xmm10
  577. movdqa -16(%r10),%xmm11
  578. movdqa 0(%r10),%xmm9
  579. movdqa 48(%r10),%xmm13
  580. movdqa 64(%r10),%xmm12
  581. movdqa 80(%r10),%xmm15
  582. movdqa 96(%r10),%xmm14
  583. .byte 0xf3,0xc3
  584. .size _pcl_vpaes_preheat,.-_pcl_vpaes_preheat
  585. .type _pcl_vpaes_consts,@object
  586. .align 64
  587. _pcl_vpaes_consts:
  588. .Lk_inv:
  589. .quad 0x0E05060F0D080180, 0x040703090A0B0C02
  590. .quad 0x01040A060F0B0780, 0x030D0E0C02050809
  591. .Lk_s0F:
  592. .quad 0x0F0F0F0F0F0F0F0F, 0x0F0F0F0F0F0F0F0F
  593. .Lk_ipt:
  594. .quad 0xC2B2E8985A2A7000, 0xCABAE09052227808
  595. .quad 0x4C01307D317C4D00, 0xCD80B1FCB0FDCC81
  596. .Lk_sb1:
  597. .quad 0xB19BE18FCB503E00, 0xA5DF7A6E142AF544
  598. .quad 0x3618D415FAE22300, 0x3BF7CCC10D2ED9EF
  599. .Lk_sb2:
  600. .quad 0xE27A93C60B712400, 0x5EB7E955BC982FCD
  601. .quad 0x69EB88400AE12900, 0xC2A163C8AB82234A
  602. .Lk_sbo:
  603. .quad 0xD0D26D176FBDC700, 0x15AABF7AC502A878
  604. .quad 0xCFE474A55FBB6A00, 0x8E1E90D1412B35FA
  605. .Lk_mc_forward:
  606. .quad 0x0407060500030201, 0x0C0F0E0D080B0A09
  607. .quad 0x080B0A0904070605, 0x000302010C0F0E0D
  608. .quad 0x0C0F0E0D080B0A09, 0x0407060500030201
  609. .quad 0x000302010C0F0E0D, 0x080B0A0904070605
  610. .Lk_mc_backward:
  611. .quad 0x0605040702010003, 0x0E0D0C0F0A09080B
  612. .quad 0x020100030E0D0C0F, 0x0A09080B06050407
  613. .quad 0x0E0D0C0F0A09080B, 0x0605040702010003
  614. .quad 0x0A09080B06050407, 0x020100030E0D0C0F
  615. .Lk_sr:
  616. .quad 0x0706050403020100, 0x0F0E0D0C0B0A0908
  617. .quad 0x030E09040F0A0500, 0x0B06010C07020D08
  618. .quad 0x0F060D040B020900, 0x070E050C030A0108
  619. .quad 0x0B0E0104070A0D00, 0x0306090C0F020508
  620. .Lk_rcon:
  621. .quad 0x1F8391B9AF9DEEB6, 0x702A98084D7C7D81
  622. .Lk_s63:
  623. .quad 0x5B5B5B5B5B5B5B5B, 0x5B5B5B5B5B5B5B5B
  624. .Lk_opt:
  625. .quad 0xFF9F4929D6B66000, 0xF7974121DEBE6808
  626. .quad 0x01EDBD5150BCEC00, 0xE10D5DB1B05C0CE0
  627. .Lk_deskew:
  628. .quad 0x07E4A34047A4E300, 0x1DFEB95A5DBEF91A
  629. .quad 0x5F36B5DC83EA6900, 0x2841C2ABF49D1E77
  630. .Lk_dksd:
  631. .quad 0xFEB91A5DA3E44700, 0x0740E3A45A1DBEF9
  632. .quad 0x41C277F4B5368300, 0x5FDC69EAAB289D1E
  633. .Lk_dksb:
  634. .quad 0x9A4FCA1F8550D500, 0x03D653861CC94C99
  635. .quad 0x115BEDA7B6FC4A00, 0xD993256F7E3482C8
  636. .Lk_dkse:
  637. .quad 0xD5031CCA1FC9D600, 0x53859A4C994F5086
  638. .quad 0xA23196054FDC7BE8, 0xCD5EF96A20B31487
  639. .Lk_dks9:
  640. .quad 0xB6116FC87ED9A700, 0x4AED933482255BFC
  641. .quad 0x4576516227143300, 0x8BB89FACE9DAFDCE
  642. .Lk_dipt:
  643. .quad 0x0F505B040B545F00, 0x154A411E114E451A
  644. .quad 0x86E383E660056500, 0x12771772F491F194
  645. .Lk_dsb9:
  646. .quad 0x851C03539A86D600, 0xCAD51F504F994CC9
  647. .quad 0xC03B1789ECD74900, 0x725E2C9EB2FBA565
  648. .Lk_dsbd:
  649. .quad 0x7D57CCDFE6B1A200, 0xF56E9B13882A4439
  650. .quad 0x3CE2FAF724C6CB00, 0x2931180D15DEEFD3
  651. .Lk_dsbb:
  652. .quad 0xD022649296B44200, 0x602646F6B0F2D404
  653. .quad 0xC19498A6CD596700, 0xF3FF0C3E3255AA6B
  654. .Lk_dsbe:
  655. .quad 0x46F2929626D4D000, 0x2242600464B4F6B0
  656. .quad 0x0C55A6CDFFAAC100, 0x9467F36B98593E32
  657. .Lk_dsbo:
  658. .quad 0x1387EA537EF94000, 0xC7AA6DB9D4943E2D
  659. .quad 0x12D7560F93441D00, 0xCA4B8159D8C58E9C
  660. .byte 86,101,99,116,111,114,32,80,101,114,109,117,116,97,116,105,111,110,32,65,69,83,32,102,111,114,32,120,56,54,95,54,52,47,83,83,83,69,51,44,32,77,105,107,101,32,72,97,109,98,117,114,103,32,40,83,116,97,110,102,111,114,100,32,85,110,105,118,101,114,115,105,116,121,41,0
  661. .align 64
  662. .size _pcl_vpaes_consts,.-_pcl_vpaes_consts