hc
2023-12-09 b22da3d8526a935aa31e086e63f60ff3246cb61c
kernel/arch/arm64/crypto/sha1-ce-core.S
....@@ -1,11 +1,8 @@
1
+/* SPDX-License-Identifier: GPL-2.0-only */
12 /*
23 * sha1-ce-core.S - SHA-1 secure hash using ARMv8 Crypto Extensions
34 *
45 * Copyright (C) 2014 Linaro Ltd <ard.biesheuvel@linaro.org>
5
- *
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License version 2 as
8
- * published by the Free Software Foundation.
96 */
107
118 #include <linux/linkage.h>
....@@ -65,40 +62,34 @@
6562 .endm
6663
6764 /*
68
- * void sha1_ce_transform(struct sha1_ce_state *sst, u8 const *src,
69
- * int blocks)
65
+ * int sha1_ce_transform(struct sha1_ce_state *sst, u8 const *src,
66
+ * int blocks)
7067 */
71
-ENTRY(sha1_ce_transform)
72
- frame_push 3
73
-
74
- mov x19, x0
75
- mov x20, x1
76
- mov x21, x2
77
-
68
+SYM_FUNC_START(sha1_ce_transform)
7869 /* load round constants */
79
-0: loadrc k0.4s, 0x5a827999, w6
70
+ loadrc k0.4s, 0x5a827999, w6
8071 loadrc k1.4s, 0x6ed9eba1, w6
8172 loadrc k2.4s, 0x8f1bbcdc, w6
8273 loadrc k3.4s, 0xca62c1d6, w6
8374
8475 /* load state */
85
- ld1 {dgav.4s}, [x19]
86
- ldr dgb, [x19, #16]
76
+ ld1 {dgav.4s}, [x0]
77
+ ldr dgb, [x0, #16]
8778
8879 /* load sha1_ce_state::finalize */
8980 ldr_l w4, sha1_ce_offsetof_finalize, x4
90
- ldr w4, [x19, x4]
81
+ ldr w4, [x0, x4]
9182
9283 /* load input */
93
-1: ld1 {v8.4s-v11.4s}, [x20], #64
94
- sub w21, w21, #1
84
+0: ld1 {v8.4s-v11.4s}, [x1], #64
85
+ sub w2, w2, #1
9586
9687 CPU_LE( rev32 v8.16b, v8.16b )
9788 CPU_LE( rev32 v9.16b, v9.16b )
9889 CPU_LE( rev32 v10.16b, v10.16b )
9990 CPU_LE( rev32 v11.16b, v11.16b )
10091
101
-2: add t0.4s, v8.4s, k0.4s
92
+1: add t0.4s, v8.4s, k0.4s
10293 mov dg0v.16b, dgav.16b
10394
10495 add_update c, ev, k0, 8, 9, 10, 11, dgb
....@@ -129,25 +120,18 @@
129120 add dgbv.2s, dgbv.2s, dg1v.2s
130121 add dgav.4s, dgav.4s, dg0v.4s
131122
132
- cbz w21, 3f
133
-
134
- if_will_cond_yield_neon
135
- st1 {dgav.4s}, [x19]
136
- str dgb, [x19, #16]
137
- do_cond_yield_neon
123
+ cbz w2, 2f
124
+ cond_yield 3f, x5, x6
138125 b 0b
139
- endif_yield_neon
140
-
141
- b 1b
142126
143127 /*
144128 * Final block: add padding and total bit count.
145129 * Skip if the input size was not a round multiple of the block size,
146130 * the padding is handled by the C code in that case.
147131 */
148
-3: cbz x4, 4f
132
+2: cbz x4, 3f
149133 ldr_l w4, sha1_ce_offsetof_count, x4
150
- ldr x4, [x19, x4]
134
+ ldr x4, [x0, x4]
151135 movi v9.2d, #0
152136 mov x8, #0x80000000
153137 movi v10.2d, #0
....@@ -156,11 +140,11 @@
156140 mov x4, #0
157141 mov v11.d[0], xzr
158142 mov v11.d[1], x7
159
- b 2b
143
+ b 1b
160144
161145 /* store new state */
162
-4: st1 {dgav.4s}, [x19]
163
- str dgb, [x19, #16]
164
- frame_pop
146
+3: st1 {dgav.4s}, [x0]
147
+ str dgb, [x0, #16]
148
+ mov w0, w2
165149 ret
166
-ENDPROC(sha1_ce_transform)
150
+SYM_FUNC_END(sha1_ce_transform)