aegis128l-aesni-asm.S 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827
  1. /*
  2. * AES-NI + SSE2 implementation of AEGIS-128L
  3. *
  4. * Copyright (c) 2017-2018 Ondrej Mosnacek <omosnacek@gmail.com>
  5. * Copyright (C) 2017-2018 Red Hat, Inc. All rights reserved.
  6. *
  7. * This program is free software; you can redistribute it and/or modify it
  8. * under the terms of the GNU General Public License version 2 as published
  9. * by the Free Software Foundation.
  10. */
  11. #include <linux/linkage.h>
  12. #include <asm/frame.h>
  13. #define STATE0 %xmm0
  14. #define STATE1 %xmm1
  15. #define STATE2 %xmm2
  16. #define STATE3 %xmm3
  17. #define STATE4 %xmm4
  18. #define STATE5 %xmm5
  19. #define STATE6 %xmm6
  20. #define STATE7 %xmm7
  21. #define MSG0 %xmm8
  22. #define MSG1 %xmm9
  23. #define T0 %xmm10
  24. #define T1 %xmm11
  25. #define T2 %xmm12
  26. #define T3 %xmm13
  27. #define STATEP %rdi
  28. #define LEN %rsi
  29. #define SRC %rdx
  30. #define DST %rcx
  31. .section .rodata.cst16.aegis128l_const, "aM", @progbits, 32
  32. .align 16
  33. .Laegis128l_const_0:
  34. .byte 0x00, 0x01, 0x01, 0x02, 0x03, 0x05, 0x08, 0x0d
  35. .byte 0x15, 0x22, 0x37, 0x59, 0x90, 0xe9, 0x79, 0x62
  36. .Laegis128l_const_1:
  37. .byte 0xdb, 0x3d, 0x18, 0x55, 0x6d, 0xc2, 0x2f, 0xf1
  38. .byte 0x20, 0x11, 0x31, 0x42, 0x73, 0xb5, 0x28, 0xdd
  39. .section .rodata.cst16.aegis128l_counter, "aM", @progbits, 16
  40. .align 16
  41. .Laegis128l_counter0:
  42. .byte 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
  43. .byte 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f
  44. .Laegis128l_counter1:
  45. .byte 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17
  46. .byte 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f
  47. .text
  48. /*
  49. * __load_partial: internal ABI
  50. * input:
  51. * LEN - bytes
  52. * SRC - src
  53. * output:
  54. * MSG0 - first message block
  55. * MSG1 - second message block
  56. * changed:
  57. * T0
  58. * %r8
  59. * %r9
  60. */
  61. __load_partial:
  62. xor %r9d, %r9d
  63. pxor MSG0, MSG0
  64. pxor MSG1, MSG1
  65. mov LEN, %r8
  66. and $0x1, %r8
  67. jz .Lld_partial_1
  68. mov LEN, %r8
  69. and $0x1E, %r8
  70. add SRC, %r8
  71. mov (%r8), %r9b
  72. .Lld_partial_1:
  73. mov LEN, %r8
  74. and $0x2, %r8
  75. jz .Lld_partial_2
  76. mov LEN, %r8
  77. and $0x1C, %r8
  78. add SRC, %r8
  79. shl $0x10, %r9
  80. mov (%r8), %r9w
  81. .Lld_partial_2:
  82. mov LEN, %r8
  83. and $0x4, %r8
  84. jz .Lld_partial_4
  85. mov LEN, %r8
  86. and $0x18, %r8
  87. add SRC, %r8
  88. shl $32, %r9
  89. mov (%r8), %r8d
  90. xor %r8, %r9
  91. .Lld_partial_4:
  92. movq %r9, MSG0
  93. mov LEN, %r8
  94. and $0x8, %r8
  95. jz .Lld_partial_8
  96. mov LEN, %r8
  97. and $0x10, %r8
  98. add SRC, %r8
  99. pslldq $8, MSG0
  100. movq (%r8), T0
  101. pxor T0, MSG0
  102. .Lld_partial_8:
  103. mov LEN, %r8
  104. and $0x10, %r8
  105. jz .Lld_partial_16
  106. movdqa MSG0, MSG1
  107. movdqu (SRC), MSG0
  108. .Lld_partial_16:
  109. ret
  110. ENDPROC(__load_partial)
  111. /*
  112. * __store_partial: internal ABI
  113. * input:
  114. * LEN - bytes
  115. * DST - dst
  116. * output:
  117. * T0 - first message block
  118. * T1 - second message block
  119. * changed:
  120. * %r8
  121. * %r9
  122. * %r10
  123. */
  124. __store_partial:
  125. mov LEN, %r8
  126. mov DST, %r9
  127. cmp $16, %r8
  128. jl .Lst_partial_16
  129. movdqu T0, (%r9)
  130. movdqa T1, T0
  131. sub $16, %r8
  132. add $16, %r9
  133. .Lst_partial_16:
  134. movq T0, %r10
  135. cmp $8, %r8
  136. jl .Lst_partial_8
  137. mov %r10, (%r9)
  138. psrldq $8, T0
  139. movq T0, %r10
  140. sub $8, %r8
  141. add $8, %r9
  142. .Lst_partial_8:
  143. cmp $4, %r8
  144. jl .Lst_partial_4
  145. mov %r10d, (%r9)
  146. shr $32, %r10
  147. sub $4, %r8
  148. add $4, %r9
  149. .Lst_partial_4:
  150. cmp $2, %r8
  151. jl .Lst_partial_2
  152. mov %r10w, (%r9)
  153. shr $0x10, %r10
  154. sub $2, %r8
  155. add $2, %r9
  156. .Lst_partial_2:
  157. cmp $1, %r8
  158. jl .Lst_partial_1
  159. mov %r10b, (%r9)
  160. .Lst_partial_1:
  161. ret
  162. ENDPROC(__store_partial)
  163. .macro update
  164. movdqa STATE7, T0
  165. aesenc STATE0, STATE7
  166. aesenc STATE1, STATE0
  167. aesenc STATE2, STATE1
  168. aesenc STATE3, STATE2
  169. aesenc STATE4, STATE3
  170. aesenc STATE5, STATE4
  171. aesenc STATE6, STATE5
  172. aesenc T0, STATE6
  173. .endm
  174. .macro update0
  175. update
  176. pxor MSG0, STATE7
  177. pxor MSG1, STATE3
  178. .endm
  179. .macro update1
  180. update
  181. pxor MSG0, STATE6
  182. pxor MSG1, STATE2
  183. .endm
  184. .macro update2
  185. update
  186. pxor MSG0, STATE5
  187. pxor MSG1, STATE1
  188. .endm
  189. .macro update3
  190. update
  191. pxor MSG0, STATE4
  192. pxor MSG1, STATE0
  193. .endm
  194. .macro update4
  195. update
  196. pxor MSG0, STATE3
  197. pxor MSG1, STATE7
  198. .endm
  199. .macro update5
  200. update
  201. pxor MSG0, STATE2
  202. pxor MSG1, STATE6
  203. .endm
  204. .macro update6
  205. update
  206. pxor MSG0, STATE1
  207. pxor MSG1, STATE5
  208. .endm
  209. .macro update7
  210. update
  211. pxor MSG0, STATE0
  212. pxor MSG1, STATE4
  213. .endm
  214. .macro state_load
  215. movdqu 0x00(STATEP), STATE0
  216. movdqu 0x10(STATEP), STATE1
  217. movdqu 0x20(STATEP), STATE2
  218. movdqu 0x30(STATEP), STATE3
  219. movdqu 0x40(STATEP), STATE4
  220. movdqu 0x50(STATEP), STATE5
  221. movdqu 0x60(STATEP), STATE6
  222. movdqu 0x70(STATEP), STATE7
  223. .endm
  224. .macro state_store s0 s1 s2 s3 s4 s5 s6 s7
  225. movdqu \s7, 0x00(STATEP)
  226. movdqu \s0, 0x10(STATEP)
  227. movdqu \s1, 0x20(STATEP)
  228. movdqu \s2, 0x30(STATEP)
  229. movdqu \s3, 0x40(STATEP)
  230. movdqu \s4, 0x50(STATEP)
  231. movdqu \s5, 0x60(STATEP)
  232. movdqu \s6, 0x70(STATEP)
  233. .endm
  234. .macro state_store0
  235. state_store STATE0 STATE1 STATE2 STATE3 STATE4 STATE5 STATE6 STATE7
  236. .endm
  237. .macro state_store1
  238. state_store STATE7 STATE0 STATE1 STATE2 STATE3 STATE4 STATE5 STATE6
  239. .endm
  240. .macro state_store2
  241. state_store STATE6 STATE7 STATE0 STATE1 STATE2 STATE3 STATE4 STATE5
  242. .endm
  243. .macro state_store3
  244. state_store STATE5 STATE6 STATE7 STATE0 STATE1 STATE2 STATE3 STATE4
  245. .endm
  246. .macro state_store4
  247. state_store STATE4 STATE5 STATE6 STATE7 STATE0 STATE1 STATE2 STATE3
  248. .endm
  249. .macro state_store5
  250. state_store STATE3 STATE4 STATE5 STATE6 STATE7 STATE0 STATE1 STATE2
  251. .endm
  252. .macro state_store6
  253. state_store STATE2 STATE3 STATE4 STATE5 STATE6 STATE7 STATE0 STATE1
  254. .endm
  255. .macro state_store7
  256. state_store STATE1 STATE2 STATE3 STATE4 STATE5 STATE6 STATE7 STATE0
  257. .endm
  258. /*
  259. * void crypto_aegis128l_aesni_init(void *state, const void *key, const void *iv);
  260. */
  261. ENTRY(crypto_aegis128l_aesni_init)
  262. FRAME_BEGIN
  263. /* load key: */
  264. movdqa (%rsi), MSG1
  265. movdqa MSG1, STATE0
  266. movdqa MSG1, STATE4
  267. movdqa MSG1, STATE5
  268. movdqa MSG1, STATE6
  269. movdqa MSG1, STATE7
  270. /* load IV: */
  271. movdqu (%rdx), MSG0
  272. pxor MSG0, STATE0
  273. pxor MSG0, STATE4
  274. /* load the constants: */
  275. movdqa .Laegis128l_const_0, STATE2
  276. movdqa .Laegis128l_const_1, STATE1
  277. movdqa STATE1, STATE3
  278. pxor STATE2, STATE5
  279. pxor STATE1, STATE6
  280. pxor STATE2, STATE7
  281. /* update 10 times with IV and KEY: */
  282. update0
  283. update1
  284. update2
  285. update3
  286. update4
  287. update5
  288. update6
  289. update7
  290. update0
  291. update1
  292. state_store1
  293. FRAME_END
  294. ret
  295. ENDPROC(crypto_aegis128l_aesni_init)
  296. .macro ad_block a i
  297. movdq\a (\i * 0x20 + 0x00)(SRC), MSG0
  298. movdq\a (\i * 0x20 + 0x10)(SRC), MSG1
  299. update\i
  300. sub $0x20, LEN
  301. cmp $0x20, LEN
  302. jl .Lad_out_\i
  303. .endm
  304. /*
  305. * void crypto_aegis128l_aesni_ad(void *state, unsigned int length,
  306. * const void *data);
  307. */
  308. ENTRY(crypto_aegis128l_aesni_ad)
  309. FRAME_BEGIN
  310. cmp $0x20, LEN
  311. jb .Lad_out
  312. state_load
  313. mov SRC, %r8
  314. and $0xf, %r8
  315. jnz .Lad_u_loop
  316. .align 8
  317. .Lad_a_loop:
  318. ad_block a 0
  319. ad_block a 1
  320. ad_block a 2
  321. ad_block a 3
  322. ad_block a 4
  323. ad_block a 5
  324. ad_block a 6
  325. ad_block a 7
  326. add $0x100, SRC
  327. jmp .Lad_a_loop
  328. .align 8
  329. .Lad_u_loop:
  330. ad_block u 0
  331. ad_block u 1
  332. ad_block u 2
  333. ad_block u 3
  334. ad_block u 4
  335. ad_block u 5
  336. ad_block u 6
  337. ad_block u 7
  338. add $0x100, SRC
  339. jmp .Lad_u_loop
  340. .Lad_out_0:
  341. state_store0
  342. FRAME_END
  343. ret
  344. .Lad_out_1:
  345. state_store1
  346. FRAME_END
  347. ret
  348. .Lad_out_2:
  349. state_store2
  350. FRAME_END
  351. ret
  352. .Lad_out_3:
  353. state_store3
  354. FRAME_END
  355. ret
  356. .Lad_out_4:
  357. state_store4
  358. FRAME_END
  359. ret
  360. .Lad_out_5:
  361. state_store5
  362. FRAME_END
  363. ret
  364. .Lad_out_6:
  365. state_store6
  366. FRAME_END
  367. ret
  368. .Lad_out_7:
  369. state_store7
  370. FRAME_END
  371. ret
  372. .Lad_out:
  373. FRAME_END
  374. ret
  375. ENDPROC(crypto_aegis128l_aesni_ad)
  376. .macro crypt m0 m1 s0 s1 s2 s3 s4 s5 s6 s7
  377. pxor \s1, \m0
  378. pxor \s6, \m0
  379. movdqa \s2, T3
  380. pand \s3, T3
  381. pxor T3, \m0
  382. pxor \s2, \m1
  383. pxor \s5, \m1
  384. movdqa \s6, T3
  385. pand \s7, T3
  386. pxor T3, \m1
  387. .endm
  388. .macro crypt0 m0 m1
  389. crypt \m0 \m1 STATE0 STATE1 STATE2 STATE3 STATE4 STATE5 STATE6 STATE7
  390. .endm
  391. .macro crypt1 m0 m1
  392. crypt \m0 \m1 STATE7 STATE0 STATE1 STATE2 STATE3 STATE4 STATE5 STATE6
  393. .endm
  394. .macro crypt2 m0 m1
  395. crypt \m0 \m1 STATE6 STATE7 STATE0 STATE1 STATE2 STATE3 STATE4 STATE5
  396. .endm
  397. .macro crypt3 m0 m1
  398. crypt \m0 \m1 STATE5 STATE6 STATE7 STATE0 STATE1 STATE2 STATE3 STATE4
  399. .endm
  400. .macro crypt4 m0 m1
  401. crypt \m0 \m1 STATE4 STATE5 STATE6 STATE7 STATE0 STATE1 STATE2 STATE3
  402. .endm
  403. .macro crypt5 m0 m1
  404. crypt \m0 \m1 STATE3 STATE4 STATE5 STATE6 STATE7 STATE0 STATE1 STATE2
  405. .endm
  406. .macro crypt6 m0 m1
  407. crypt \m0 \m1 STATE2 STATE3 STATE4 STATE5 STATE6 STATE7 STATE0 STATE1
  408. .endm
  409. .macro crypt7 m0 m1
  410. crypt \m0 \m1 STATE1 STATE2 STATE3 STATE4 STATE5 STATE6 STATE7 STATE0
  411. .endm
  412. .macro encrypt_block a i
  413. movdq\a (\i * 0x20 + 0x00)(SRC), MSG0
  414. movdq\a (\i * 0x20 + 0x10)(SRC), MSG1
  415. movdqa MSG0, T0
  416. movdqa MSG1, T1
  417. crypt\i T0, T1
  418. movdq\a T0, (\i * 0x20 + 0x00)(DST)
  419. movdq\a T1, (\i * 0x20 + 0x10)(DST)
  420. update\i
  421. sub $0x20, LEN
  422. cmp $0x20, LEN
  423. jl .Lenc_out_\i
  424. .endm
  425. .macro decrypt_block a i
  426. movdq\a (\i * 0x20 + 0x00)(SRC), MSG0
  427. movdq\a (\i * 0x20 + 0x10)(SRC), MSG1
  428. crypt\i MSG0, MSG1
  429. movdq\a MSG0, (\i * 0x20 + 0x00)(DST)
  430. movdq\a MSG1, (\i * 0x20 + 0x10)(DST)
  431. update\i
  432. sub $0x20, LEN
  433. cmp $0x20, LEN
  434. jl .Ldec_out_\i
  435. .endm
  436. /*
  437. * void crypto_aegis128l_aesni_enc(void *state, unsigned int length,
  438. * const void *src, void *dst);
  439. */
  440. ENTRY(crypto_aegis128l_aesni_enc)
  441. FRAME_BEGIN
  442. cmp $0x20, LEN
  443. jb .Lenc_out
  444. state_load
  445. mov SRC, %r8
  446. or DST, %r8
  447. and $0xf, %r8
  448. jnz .Lenc_u_loop
  449. .align 8
  450. .Lenc_a_loop:
  451. encrypt_block a 0
  452. encrypt_block a 1
  453. encrypt_block a 2
  454. encrypt_block a 3
  455. encrypt_block a 4
  456. encrypt_block a 5
  457. encrypt_block a 6
  458. encrypt_block a 7
  459. add $0x100, SRC
  460. add $0x100, DST
  461. jmp .Lenc_a_loop
  462. .align 8
  463. .Lenc_u_loop:
  464. encrypt_block u 0
  465. encrypt_block u 1
  466. encrypt_block u 2
  467. encrypt_block u 3
  468. encrypt_block u 4
  469. encrypt_block u 5
  470. encrypt_block u 6
  471. encrypt_block u 7
  472. add $0x100, SRC
  473. add $0x100, DST
  474. jmp .Lenc_u_loop
  475. .Lenc_out_0:
  476. state_store0
  477. FRAME_END
  478. ret
  479. .Lenc_out_1:
  480. state_store1
  481. FRAME_END
  482. ret
  483. .Lenc_out_2:
  484. state_store2
  485. FRAME_END
  486. ret
  487. .Lenc_out_3:
  488. state_store3
  489. FRAME_END
  490. ret
  491. .Lenc_out_4:
  492. state_store4
  493. FRAME_END
  494. ret
  495. .Lenc_out_5:
  496. state_store5
  497. FRAME_END
  498. ret
  499. .Lenc_out_6:
  500. state_store6
  501. FRAME_END
  502. ret
  503. .Lenc_out_7:
  504. state_store7
  505. FRAME_END
  506. ret
  507. .Lenc_out:
  508. FRAME_END
  509. ret
  510. ENDPROC(crypto_aegis128l_aesni_enc)
  511. /*
  512. * void crypto_aegis128l_aesni_enc_tail(void *state, unsigned int length,
  513. * const void *src, void *dst);
  514. */
  515. ENTRY(crypto_aegis128l_aesni_enc_tail)
  516. FRAME_BEGIN
  517. state_load
  518. /* encrypt message: */
  519. call __load_partial
  520. movdqa MSG0, T0
  521. movdqa MSG1, T1
  522. crypt0 T0, T1
  523. call __store_partial
  524. update0
  525. state_store0
  526. FRAME_END
  527. ret
  528. ENDPROC(crypto_aegis128l_aesni_enc_tail)
  529. /*
  530. * void crypto_aegis128l_aesni_dec(void *state, unsigned int length,
  531. * const void *src, void *dst);
  532. */
  533. ENTRY(crypto_aegis128l_aesni_dec)
  534. FRAME_BEGIN
  535. cmp $0x20, LEN
  536. jb .Ldec_out
  537. state_load
  538. mov SRC, %r8
  539. or DST, %r8
  540. and $0xF, %r8
  541. jnz .Ldec_u_loop
  542. .align 8
  543. .Ldec_a_loop:
  544. decrypt_block a 0
  545. decrypt_block a 1
  546. decrypt_block a 2
  547. decrypt_block a 3
  548. decrypt_block a 4
  549. decrypt_block a 5
  550. decrypt_block a 6
  551. decrypt_block a 7
  552. add $0x100, SRC
  553. add $0x100, DST
  554. jmp .Ldec_a_loop
  555. .align 8
  556. .Ldec_u_loop:
  557. decrypt_block u 0
  558. decrypt_block u 1
  559. decrypt_block u 2
  560. decrypt_block u 3
  561. decrypt_block u 4
  562. decrypt_block u 5
  563. decrypt_block u 6
  564. decrypt_block u 7
  565. add $0x100, SRC
  566. add $0x100, DST
  567. jmp .Ldec_u_loop
  568. .Ldec_out_0:
  569. state_store0
  570. FRAME_END
  571. ret
  572. .Ldec_out_1:
  573. state_store1
  574. FRAME_END
  575. ret
  576. .Ldec_out_2:
  577. state_store2
  578. FRAME_END
  579. ret
  580. .Ldec_out_3:
  581. state_store3
  582. FRAME_END
  583. ret
  584. .Ldec_out_4:
  585. state_store4
  586. FRAME_END
  587. ret
  588. .Ldec_out_5:
  589. state_store5
  590. FRAME_END
  591. ret
  592. .Ldec_out_6:
  593. state_store6
  594. FRAME_END
  595. ret
  596. .Ldec_out_7:
  597. state_store7
  598. FRAME_END
  599. ret
  600. .Ldec_out:
  601. FRAME_END
  602. ret
  603. ENDPROC(crypto_aegis128l_aesni_dec)
  604. /*
  605. * void crypto_aegis128l_aesni_dec_tail(void *state, unsigned int length,
  606. * const void *src, void *dst);
  607. */
  608. ENTRY(crypto_aegis128l_aesni_dec_tail)
  609. FRAME_BEGIN
  610. state_load
  611. /* decrypt message: */
  612. call __load_partial
  613. crypt0 MSG0, MSG1
  614. movdqa MSG0, T0
  615. movdqa MSG1, T1
  616. call __store_partial
  617. /* mask with byte count: */
  618. movq LEN, T0
  619. punpcklbw T0, T0
  620. punpcklbw T0, T0
  621. punpcklbw T0, T0
  622. punpcklbw T0, T0
  623. movdqa T0, T1
  624. movdqa .Laegis128l_counter0, T2
  625. movdqa .Laegis128l_counter1, T3
  626. pcmpgtb T2, T0
  627. pcmpgtb T3, T1
  628. pand T0, MSG0
  629. pand T1, MSG1
  630. update0
  631. state_store0
  632. FRAME_END
  633. ret
  634. ENDPROC(crypto_aegis128l_aesni_dec_tail)
  635. /*
  636. * void crypto_aegis128l_aesni_final(void *state, void *tag_xor,
  637. * u64 assoclen, u64 cryptlen);
  638. */
  639. ENTRY(crypto_aegis128l_aesni_final)
  640. FRAME_BEGIN
  641. state_load
  642. /* prepare length block: */
  643. movq %rdx, MSG0
  644. movq %rcx, T0
  645. pslldq $8, T0
  646. pxor T0, MSG0
  647. psllq $3, MSG0 /* multiply by 8 (to get bit count) */
  648. pxor STATE2, MSG0
  649. movdqa MSG0, MSG1
  650. /* update state: */
  651. update0
  652. update1
  653. update2
  654. update3
  655. update4
  656. update5
  657. update6
  658. /* xor tag: */
  659. movdqu (%rsi), T0
  660. pxor STATE1, T0
  661. pxor STATE2, T0
  662. pxor STATE3, T0
  663. pxor STATE4, T0
  664. pxor STATE5, T0
  665. pxor STATE6, T0
  666. pxor STATE7, T0
  667. movdqu T0, (%rsi)
  668. FRAME_END
  669. ret
  670. ENDPROC(crypto_aegis128l_aesni_final)