Lines Matching +full:0 +full:- +full:23

1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 # Accelerated AES-GCM stitched implementation for ppc64le.
5 # Copyright 2022- IBM Inc. All rights reserved
22 # Hash keys = v3 - v14
29 # v31 - counter 1
32 # vs0 - vs14 for round keys
35 # This implementation uses stitched AES-GCM approach to improve overall performance.
48 # v15 - v18 - input states
49 # vs1 - vs9 - round keys
102 xxlor 23+32, 9, 9
103 vcipher 15, 15, 23
104 vcipher 16, 16, 23
105 vcipher 17, 17, 23
106 vcipher 18, 18, 23
110 # v15 - v22 - input states
111 # vs1 - vs9 - round keys
114 xxlor 23+32, 1, 1
119 vcipher 15, 15, 23
120 vcipher 16, 16, 23
121 vcipher 17, 17, 23
122 vcipher 18, 18, 23
123 vcipher 19, 19, 23
124 vcipher 20, 20, 23
125 vcipher 21, 21, 23
126 vcipher 22, 22, 23
155 xxlor 23+32, 5, 5
160 vcipher 15, 15, 23
161 vcipher 16, 16, 23
162 vcipher 17, 17, 23
163 vcipher 18, 18, 23
164 vcipher 19, 19, 23
165 vcipher 20, 20, 23
166 vcipher 21, 21, 23
167 vcipher 22, 22, 23
196 xxlor 23+32, 9, 9
197 vcipher 15, 15, 23
198 vcipher 16, 16, 23
199 vcipher 17, 17, 23
200 vcipher 18, 18, 23
201 vcipher 19, 19, 23
202 vcipher 20, 20, 23
203 vcipher 21, 21, 23
204 vcipher 22, 22, 23
236 vxor 15, 15, 0
238 vpmsumd 23, 12, 15 # H4.L * X.L
243 vxor 23, 23, 24
244 vxor 23, 23, 25
245 vxor 23, 23, 26 # L
257 vpmsumd 28, 23, 2 # reduction
262 vxor 23, 23, 26 # mL + L
264 vsldoi 23, 23, 23, 8 # swap
265 vxor 23, 23, 28
279 vsldoi 27, 23, 23, 8 # swap
280 vpmsumd 23, 23, 2
282 vxor 23, 23, 27
284 xxlor 32, 23+32, 23+32 # update hash
290 # v15 - v22 - input blocks
294 vxor 15, 15, 0 # Xi + X
296 vpmsumd 23, 12, 15 # H4.L * X.L
301 vxor 23, 23, 24
302 vxor 23, 23, 25
303 vxor 23, 23, 26 # L
314 vpmsumd 28, 23, 2 # reduction
321 vxor 23, 23, 26 # mL + L
323 vsldoi 23, 23, 23, 8 # swap
324 vxor 23, 23, 28
338 vsldoi 27, 23, 23, 8 # swap
339 vpmsumd 23, 23, 2
341 vxor 27, 23, 27 # 1st Xi
348 vpmsumd 23, 12, 19 # H4.L * X.L
350 vxor 23, 23, 24
351 vxor 23, 23, 25
352 vxor 23, 23, 26 # L
363 vpmsumd 28, 23, 2 # reduction
370 vxor 23, 23, 26 # mL + L
372 vsldoi 23, 23, 23, 8 # swap
373 vxor 23, 23, 28
387 vsldoi 27, 23, 23, 8 # swap
388 vpmsumd 23, 23, 2
390 vxor 23, 23, 27
392 xxlor 32, 23+32, 23+32 # update hash
400 vxor 28, 28, 0
405 vpmsumd 23, 4, 28 # M
410 vsldoi 25, 23, 19, 8 # mL
411 vsldoi 26, 19, 23, 8 # mH
423 vmr 0, 22 # update hash
428 stdu 1,-640(1)
429 mflr 0
446 stvx 23, 9, 1
472 std 0, 656(1)
492 lvx 23, 9, 1
510 ld 0, 656(1)
520 mtlr 0
526 lxvb16x 32, 0, 8 # load Xi
528 # load Hash - h^4, h^3, h^2, h
564 # r3 - inp
565 # r4 - out
566 # r5 - len
567 # r6 - AES round keys
568 # r7 - iv and other data
569 # r8 - Xi, HPoli, hash keys
572 # Xi is at 0 in gcm_table (Xip).
581 # initialize ICB: GHASH( IV ), IV - r7
582 lxvb16x 30+32, 0, 7 # load IV - v30
585 li 11, 0 # block index
593 lxv 0, 0(6)
594 lxv 1, 0x10(6)
595 lxv 2, 0x20(6)
596 lxv 3, 0x30(6)
597 lxv 4, 0x40(6)
598 lxv 5, 0x50(6)
599 lxv 6, 0x60(6)
600 lxv 7, 0x70(6)
601 lxv 8, 0x80(6)
602 lxv 9, 0x90(6)
603 lxv 10, 0xa0(6)
605 # load rounds - 10 (128), 12 (192), 14 (256)
610 xxlor 32+29, 0, 0
611 vxor 15, 30, 29 # IV + round key - add round key 0
617 lxv 11, 0xb0(6)
618 lxv 12, 0xc0(6)
624 lxv 13, 0xd0(6)
625 lxv 14, 0xe0(6)
641 cmpdi 15, 0
650 divdu 10, 12, 10 # n 128 bytes-blocks
651 cmpdi 10, 0
683 lxvb16x 15, 0, 14 # load block
695 xxlor 23+32, 10, 10
703 vcipher 15, 15, 23
704 vcipher 16, 16, 23
705 vcipher 17, 17, 23
706 vcipher 18, 18, 23
707 vcipher 19, 19, 23
708 vcipher 20, 20, 23
709 vcipher 21, 21, 23
710 vcipher 22, 22, 23
721 xxlor 23+32, 12, 12
729 vcipher 15, 15, 23
730 vcipher 16, 16, 23
731 vcipher 17, 17, 23
732 vcipher 18, 18, 23
733 vcipher 19, 19, 23
734 vcipher 20, 20, 23
735 vcipher 21, 21, 23
736 vcipher 22, 22, 23
747 xxlor 23+32, 14, 14
757 vcipherlast 15, 15, 23
758 vcipherlast 16, 16, 23
761 stxvb16x 47, 0, 9 # store output
765 vcipherlast 17, 17, 23
766 vcipherlast 18, 18, 23
773 vcipherlast 19, 19, 23
774 vcipherlast 20, 20, 23
781 vcipherlast 21, 21, 23
782 vcipherlast 22, 22, 23
794 xxlor 27+32, 0, 0
813 addi 12, 12, -128
819 stxvb16x 30+32, 0, 7 # update IV
822 cmpdi 12, 0
837 lxvb16x 15, 0, 14 # load block
841 xxlor 23+32, 10, 10
849 vcipher 15, 15, 23
852 xxlor 23+32, 12, 12
860 vcipher 15, 15, 23
863 xxlor 23+32, 14, 14
869 vcipherlast 15, 15, 23
872 stxvb16x 47, 0, 9 # store output
879 addi 12, 12, -16
881 xxlor 19+32, 0, 0
887 li 15, 0
889 stxvb16x 30+32, 0, 7 # update IV
890 cmpdi 12, 0
897 xxlor 23+32, 10, 10
905 vcipher 15, 15, 23
908 xxlor 23+32, 12, 12
916 vcipher 15, 15, 23
919 xxlor 23+32, 14, 14
925 vcipherlast 15, 15, 23
928 li 21, 0 # encrypt
930 cmpdi 15, 0
934 cmpdi 12, 0
940 lxvb16x 15, 0, 14 # load last block
947 vspltisb 16, -1 # first 16 bytes - 0xffff...ff
948 vspltisb 17, 0 # second 16 bytes - 0x0000...00
964 stxvb16x 30+32, 0, 7 # update IV
968 stxvb16x 32, 0, 8 # write out Xi
976 vspltisb 16, -1 # first 16 bytes - 0xffff...ff
977 vspltisb 17, 0 # second 16 bytes - 0x0000...00
986 lxvb16x \_mask, 0, 10 # load partial block mask
1005 lxvb16x 17+32, 0, 14 # load last block
1007 mtvsrdd 32+16, 0, 16
1012 vxor 0, 0, 0 # clear Xi
1015 cmpdi 21, 0 # encrypt/decrypt ops?
1025 vxor 0, 0, 29
1026 stxvb16x 32, 0, 8 # save Xi
1032 mtvsrdd 32+16, 0, 16
1034 #stxvb16x 15+32, 0, 9 # last block
1037 sub 17, 16, 15 # 16 - partial
1049 addi 10, 9, -1
1069 stxvb16x 30+32, 0, 7 # update IV
1070 xxlor 32+29, 0, 0
1071 vxor 15, 30, 29 # IV + round key - add round key 0
1072 li 15, 0
1073 std 15, 56(7) # partial done - clear
1083 # r9 - output
1084 # r12 - remaining bytes
1085 # v15 - partial input data
1091 addi 10, 9, -1
1095 li 15, 0
1106 stxvb16x 32, 0, 8 # write out Xi
1122 # initialize ICB: GHASH( IV ), IV - r7
1123 lxvb16x 30+32, 0, 7 # load IV - v30
1126 li 11, 0 # block index
1134 lxv 0, 0(6)
1135 lxv 1, 0x10(6)
1136 lxv 2, 0x20(6)
1137 lxv 3, 0x30(6)
1138 lxv 4, 0x40(6)
1139 lxv 5, 0x50(6)
1140 lxv 6, 0x60(6)
1141 lxv 7, 0x70(6)
1142 lxv 8, 0x80(6)
1143 lxv 9, 0x90(6)
1144 lxv 10, 0xa0(6)
1146 # load rounds - 10 (128), 12 (192), 14 (256)
1151 xxlor 32+29, 0, 0
1152 vxor 15, 30, 29 # IV + round key - add round key 0
1158 lxv 11, 0xb0(6)
1159 lxv 12, 0xc0(6)
1165 lxv 13, 0xd0(6)
1166 lxv 14, 0xe0(6)
1182 cmpdi 15, 0
1191 divdu 10, 12, 10 # n 128 bytes-blocks
1192 cmpdi 10, 0
1224 lxvb16x 15, 0, 14 # load block
1236 xxlor 23+32, 10, 10
1244 vcipher 15, 15, 23
1245 vcipher 16, 16, 23
1246 vcipher 17, 17, 23
1247 vcipher 18, 18, 23
1248 vcipher 19, 19, 23
1249 vcipher 20, 20, 23
1250 vcipher 21, 21, 23
1251 vcipher 22, 22, 23
1262 xxlor 23+32, 12, 12
1270 vcipher 15, 15, 23
1271 vcipher 16, 16, 23
1272 vcipher 17, 17, 23
1273 vcipher 18, 18, 23
1274 vcipher 19, 19, 23
1275 vcipher 20, 20, 23
1276 vcipher 21, 21, 23
1277 vcipher 22, 22, 23
1288 xxlor 23+32, 14, 14
1298 vcipherlast 15, 15, 23
1299 vcipherlast 16, 16, 23
1302 stxvb16x 47, 0, 9 # store output
1306 vcipherlast 17, 17, 23
1307 vcipherlast 18, 18, 23
1314 vcipherlast 19, 19, 23
1315 vcipherlast 20, 20, 23
1322 vcipherlast 21, 21, 23
1323 vcipherlast 22, 22, 23
1344 xxlor 27+32, 0, 0
1363 addi 12, 12, -128
1369 stxvb16x 30+32, 0, 7 # update IV
1372 cmpdi 12, 0
1387 lxvb16x 15, 0, 14 # load block
1391 xxlor 23+32, 10, 10
1399 vcipher 15, 15, 23
1402 xxlor 23+32, 12, 12
1410 vcipher 15, 15, 23
1413 xxlor 23+32, 14, 14
1419 vcipherlast 15, 15, 23
1422 stxvb16x 47, 0, 9 # store output
1430 addi 12, 12, -16
1432 xxlor 19+32, 0, 0
1438 li 15, 0
1440 stxvb16x 30+32, 0, 7 # update IV
1441 cmpdi 12, 0
1448 xxlor 23+32, 10, 10
1456 vcipher 15, 15, 23
1459 xxlor 23+32, 12, 12
1467 vcipher 15, 15, 23
1470 xxlor 23+32, 14, 14
1476 vcipherlast 15, 15, 23
1481 cmpdi 15, 0
1484 cmpdi 12, 0
1490 lxvb16x 15, 0, 14 # load last block
1497 vspltisb 16, -1 # first 16 bytes - 0xffff...ff
1498 vspltisb 17, 0 # second 16 bytes - 0x0000...00
1515 stxvb16x 30+32, 0, 7 # update IV
1519 stxvb16x 32, 0, 8 # write out Xi