Lines Matching +full:64 +full:- +full:byte
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * Implement AES algorithm in Intel AES-NI instructions.
5 * The white paper of AES-NI instructions can be downloaded from:
6 * http://softwarecommunity.intel.com/isn/downloads/intelavx/AES-Instructions-Set_WP.pdf
13 * Added RFC4106 AES-GCM support for 128-bit keys under the AEAD
14 * interface for 64-bit kernels.
30 #include <asm/nospec-branch.h>
33 * The following macros are used to move an (un)aligned 16 byte value to/from
37 * since Nehalem (original Core i7) was released. However, the movaps is a byte
104 #define HashKey_k 16*10 // store XOR of High 64 bits and Low 64
107 #define HashKey_2_k 16*11 // store XOR of High 64 bits and Low 64
110 #define HashKey_3_k 16*12 // store XOR of High 64 bits and Low 64
113 #define HashKey_4_k 16*13 // store XOR of High 64 bits and Low 64
252 # Clobbers rax, r10-r13 and xmm0-xmm6, %xmm13
277 # Requires the input data be at least 1 byte long because of READ_PARTIAL_BLOCK
278 # Clobbers rax, r10-r13, and xmm0-xmm15
290 and $-16, %r13 # %r13 = %r13 - (%r13 mod 16)
319 # Main loop - Encrypt/Decrypt remaining blocks
323 sub $64, %r13
329 add $64, %r11
330 sub $64, %r13
345 # Handle the last <16 Byte block separately
366 # receive the last <16 Byte block
373 # adjust the shuffle mask pointer to be able to shift 16-r13 bytes
378 # shift right 16-r13 bytes
390 # get the appropriate mask to mask out top 16-r13 bytes of xmm0
391 pand %xmm1, %xmm0 # mask out top 16-r13 bytes of xmm0
407 # GHASH computation for the last <16 byte block
433 # Clobbers rax, r10-r12, and xmm0, xmm1, xmm5-xmm15
508 * Input: A and B (128-bits each, bit-reflected)
589 mov -1(\DPTR, \DLEN, 1), %al
597 # clobbers r10-11, xmm14
610 pshufb %xmm14, \TMP7 # byte-reflect the AAD data
626 pshufb %xmm14, \TMP7 # byte-reflect the AAD data
637 # Requires the input data be at least 1 byte long due to READ_PARTIAL_BLOCK
639 # Clobbers rax, r10, r12, r13, xmm0-6, xmm9-13
666 # r16-r13 is the number of bytes in plaintext mod 16)
685 movdqu ALL_F-SHIFT_MASK(%r12), %xmm1
698 # GHASH computation for the last <16 Byte block
721 movdqu ALL_F-SHIFT_MASK(%r12), %xmm1
733 # GHASH computation for the last <16 Byte block
812 pshufb %xmm14, %xmm\index # perform a 16 byte swap
817 shr $2,%eax # 128->4, 192->6, 256->8
818 add $5,%eax # 128->9, 192->11, 256->13
867 cmp $64, %r13
878 pshufb %xmm14, \XMM1 # perform a 16 byte swap
882 pshufb %xmm14, \XMM2 # perform a 16 byte swap
886 pshufb %xmm14, \XMM3 # perform a 16 byte swap
890 pshufb %xmm14, \XMM4 # perform a 16 byte swap
913 shr $2,%eax # 128->4, 192->6, 256->8
914 sub $4,%eax # 128->0, 192->2, 256->4
962 add $64, %r11
963 pshufb %xmm14, \XMM1 # perform a 16 byte swap
966 pshufb %xmm14, \XMM2 # perform a 16 byte swap
967 pshufb %xmm14, \XMM3 # perform a 16 byte swap
968 pshufb %xmm14, \XMM4 # perform a 16 byte swap
1004 pshufb %xmm15, \XMM1 # perform a 16 byte swap
1006 pshufb %xmm15, \XMM2 # perform a 16 byte swap
1007 pshufb %xmm15, \XMM3 # perform a 16 byte swap
1008 pshufb %xmm15, \XMM4 # perform a 16 byte swap
1100 shr $2,%eax # 128->4, 192->6, 256->8
1101 sub $4,%eax # 128->0, 192->2, 256->4
1133 pshufb %xmm15, \XMM1 # perform a 16 byte swap
1134 pshufb %xmm15, \XMM2 # perform a 16 byte swap
1135 pshufb %xmm15, \XMM3 # perform a 16 byte swap
1136 pshufb %xmm15, \XMM4 # perform a 16 byte swap
1212 pshufb %xmm15, \XMM1 # perform a 16 byte swap
1214 pshufb %xmm15, \XMM2 # perform a 16 byte swap
1215 pshufb %xmm15, \XMM3 # perform a 16 byte swap
1216 pshufb %xmm15, \XMM4 # perform a 16 byte swap
1308 shr $2,%eax # 128->4, 192->6, 256->8
1309 sub $4,%eax # 128->0, 192->2, 256->4
1345 pshufb %xmm15, \XMM1 # perform a 16 byte swap
1346 pshufb %xmm15, \XMM2 # perform a 16 byte swap
1347 pshufb %xmm15, \XMM3 # perform a 16 byte swap
1348 pshufb %xmm15, \XMM4 # perform a 16 byte swap
1460 # TMP6:XMMDst holds the result of the accumulated carry-less multiplications
1500 shr $2,%eax # 128->4, 192->6, 256->8
1501 add $5,%eax # 128->9, 192->11, 256->13
1515 * void aesni_gcm_dec(void *aes_ctx, // AES Key schedule. Starts on a 16 byte boundary.
1518 * u8 *out, // Plaintext output. Encrypt in-place is allowed.
1521 * u8 *iv, // Pre-counter block j0: 4 byte salt (from Security Associat…
1522 * // concatenated with 8 byte Initialisation Vector (from IPSe…
1523 * // concatenated with 0x00000001. 16-byte aligned pointer.
1524 * u8 *hash_subkey, // H, the Hash sub key input. Data starts on a 16-byte bound…
1535 * keys are pre-expanded and aligned to 16 bytes. we are using the first
1541 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1543 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1546 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1548 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1562 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1564 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1565 * | 32-bit Sequence Number (A0) |
1566 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1568 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1570 * AAD Format with 32-bit Sequence Number
1578 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1580 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1582 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1583 * | 64-bit Extended Sequence Number {A1,A0} |
1585 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1587 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1589 * AAD Format with 64-bit Extended Sequence Number
1606 * void aesni_gcm_enc(void *aes_ctx, // AES Key schedule. Starts on a 16 byte boundary.
1609 * u8 *out, // Ciphertext output. Encrypt in-place is allowed.
1612 * u8 *iv, // Pre-counter block j0: 4 byte salt (from Security Associ…
1613 * // concatenated with 8 byte Initialisation Vector (from IP…
1614 * // concatenated with 0x00000001. 16-byte aligned pointer.
1615 * u8 *hash_subkey, // H, the Hash sub key input. Data starts on a 16-byte bou…
1625 * keys are pre-expanded and aligned to 16 bytes. we are using the
1632 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1634 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1637 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1639 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1653 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1655 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1656 * | 32-bit Sequence Number (A0) |
1657 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1659 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1661 * AAD Format with 32-bit Sequence Number
1669 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1671 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1672 * | 64-bit Extended Sequence Number {A1,A0} |
1674 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1676 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1678 * AAD Format with 64-bit Extended Sequence Number
1694 * void aesni_gcm_init(void *aes_ctx, // AES Key schedule. Starts on a 16 byte boundary.
1697 * u8 *iv, // Pre-counter block j0: 4 byte salt (from Security Assoc…
1698 * // concatenated with 8 byte Initialisation Vector (from I…
1699 * // concatenated with 0x00000001. 16-byte aligned pointer.
1700 * u8 *hash_subkey, // H, the Hash sub key input. Data starts on a 16-byte bo…
1712 * void aesni_gcm_enc_update(void *aes_ctx, // AES Key schedule. Starts on a 16 byte boundary.
1715 * u8 *out, // Ciphertext output. Encrypt in-place is allowed.
1727 * void aesni_gcm_dec_update(void *aes_ctx, // AES Key schedule. Starts on a 16 byte boundary.
1730 * u8 *out, // Ciphertext output. Encrypt in-place is allowed.
1742 * void aesni_gcm_finalize(void *aes_ctx, // AES Key schedule. Starts on a 16 byte boundary.
1925 lea 240-16(TKEYP), UKEYP
1989 movaps -0x60(TKEYP), KEY
1991 movaps -0x50(TKEYP), KEY
1995 movaps -0x40(TKEYP), KEY
1997 movaps -0x30(TKEYP), KEY
2001 movaps -0x20(TKEYP), KEY
2003 movaps -0x10(TKEYP), KEY
2055 movaps -0x60(TKEYP), KEY
2060 movaps -0x50(TKEYP), KEY
2067 movaps -0x40(TKEYP), KEY
2072 movaps -0x30(TKEYP), KEY
2079 movaps -0x20(TKEYP), KEY
2084 movaps -0x10(TKEYP), KEY
2179 movaps -0x60(TKEYP), KEY
2181 movaps -0x50(TKEYP), KEY
2185 movaps -0x40(TKEYP), KEY
2187 movaps -0x30(TKEYP), KEY
2191 movaps -0x20(TKEYP), KEY
2193 movaps -0x10(TKEYP), KEY
2245 movaps -0x60(TKEYP), KEY
2250 movaps -0x50(TKEYP), KEY
2257 movaps -0x40(TKEYP), KEY
2262 movaps -0x30(TKEYP), KEY
2269 movaps -0x20(TKEYP), KEY
2274 movaps -0x10(TKEYP), KEY
2342 cmp $64, LEN
2355 sub $64, LEN
2356 add $64, INP
2357 add $64, OUTP
2358 cmp $64, LEN
2403 cmp $64, LEN
2416 sub $64, LEN
2417 add $64, INP
2418 add $64, OUTP
2419 cmp $64, LEN
2509 cmp $64, LEN
2547 sub $64, LEN
2548 add $64, INP
2549 add $64, OUTP
2550 cmp $64, LEN
2584 .byte 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0
2647 cmp $64, LEN
2672 sub $64, LEN
2673 add $64, INP
2674 add $64, OUTP
2675 cmp $64, LEN
2773 add $64, INP
2774 add $64, OUTP
2775 sub $64, LEN
2841 add $64, INP
2842 add $64, OUTP
2843 sub $64, LEN