hc
2024-02-19 1c055e55a242a33e574e48be530e06770a210dcd
kernel/arch/x86/crypto/ghash-clmulni-intel_asm.S
....@@ -1,3 +1,4 @@
1
+/* SPDX-License-Identifier: GPL-2.0-only */
12 /*
23 * Accelerated GHASH implementation with Intel PCLMULQDQ-NI
34 * instructions. This file contains accelerated part of ghash
....@@ -10,14 +11,9 @@
1011 * Vinodh Gopal
1112 * Erdinc Ozturk
1213 * Deniz Karakoyunlu
13
- *
14
- * This program is free software; you can redistribute it and/or modify it
15
- * under the terms of the GNU General Public License version 2 as published
16
- * by the Free Software Foundation.
1714 */
1815
1916 #include <linux/linkage.h>
20
-#include <asm/inst.h>
2117 #include <asm/frame.h>
2218
2319 .section .rodata.cst16.bswap_mask, "aM", @progbits, 16
....@@ -47,16 +43,16 @@
4743 * T2
4844 * T3
4945 */
50
-__clmul_gf128mul_ble:
46
+SYM_FUNC_START_LOCAL(__clmul_gf128mul_ble)
5147 movaps DATA, T1
5248 pshufd $0b01001110, DATA, T2
5349 pshufd $0b01001110, SHASH, T3
5450 pxor DATA, T2
5551 pxor SHASH, T3
5652
57
- PCLMULQDQ 0x00 SHASH DATA # DATA = a0 * b0
58
- PCLMULQDQ 0x11 SHASH T1 # T1 = a1 * b1
59
- PCLMULQDQ 0x00 T3 T2 # T2 = (a1 + a0) * (b1 + b0)
53
+ pclmulqdq $0x00, SHASH, DATA # DATA = a0 * b0
54
+ pclmulqdq $0x11, SHASH, T1 # T1 = a1 * b1
55
+ pclmulqdq $0x00, T3, T2 # T2 = (a1 + a0) * (b1 + b0)
6056 pxor DATA, T2
6157 pxor T1, T2 # T2 = a0 * b1 + a1 * b0
6258
....@@ -89,48 +85,48 @@
8985 psrlq $1, T2
9086 pxor T2, T1
9187 pxor T1, DATA
92
- ret
93
-ENDPROC(__clmul_gf128mul_ble)
88
+ RET
89
+SYM_FUNC_END(__clmul_gf128mul_ble)
9490
9591 /* void clmul_ghash_mul(char *dst, const u128 *shash) */
96
-ENTRY(clmul_ghash_mul)
92
+SYM_FUNC_START(clmul_ghash_mul)
9793 FRAME_BEGIN
9894 movups (%rdi), DATA
9995 movups (%rsi), SHASH
10096 movaps .Lbswap_mask, BSWAP
101
- PSHUFB_XMM BSWAP DATA
97
+ pshufb BSWAP, DATA
10298 call __clmul_gf128mul_ble
103
- PSHUFB_XMM BSWAP DATA
99
+ pshufb BSWAP, DATA
104100 movups DATA, (%rdi)
105101 FRAME_END
106
- ret
107
-ENDPROC(clmul_ghash_mul)
102
+ RET
103
+SYM_FUNC_END(clmul_ghash_mul)
108104
109105 /*
110106 * void clmul_ghash_update(char *dst, const char *src, unsigned int srclen,
111107 * const u128 *shash);
112108 */
113
-ENTRY(clmul_ghash_update)
109
+SYM_FUNC_START(clmul_ghash_update)
114110 FRAME_BEGIN
115111 cmp $16, %rdx
116112 jb .Lupdate_just_ret # check length
117113 movaps .Lbswap_mask, BSWAP
118114 movups (%rdi), DATA
119115 movups (%rcx), SHASH
120
- PSHUFB_XMM BSWAP DATA
116
+ pshufb BSWAP, DATA
121117 .align 4
122118 .Lupdate_loop:
123119 movups (%rsi), IN1
124
- PSHUFB_XMM BSWAP IN1
120
+ pshufb BSWAP, IN1
125121 pxor IN1, DATA
126122 call __clmul_gf128mul_ble
127123 sub $16, %rdx
128124 add $16, %rsi
129125 cmp $16, %rdx
130126 jge .Lupdate_loop
131
- PSHUFB_XMM BSWAP DATA
127
+ pshufb BSWAP, DATA
132128 movups DATA, (%rdi)
133129 .Lupdate_just_ret:
134130 FRAME_END
135
- ret
136
-ENDPROC(clmul_ghash_update)
131
+ RET
132
+SYM_FUNC_END(clmul_ghash_update)