hc
2024-01-31 f9004dbfff8a3fbbd7e2a88c8a4327c7f2f8e5b2
kernel/arch/x86/crypto/sha256_ssse3_glue.c
....@@ -30,15 +30,15 @@
3030 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
3131
3232 #include <crypto/internal/hash.h>
33
+#include <crypto/internal/simd.h>
3334 #include <linux/init.h>
3435 #include <linux/module.h>
3536 #include <linux/mm.h>
36
-#include <linux/cryptohash.h>
3737 #include <linux/types.h>
3838 #include <crypto/sha.h>
3939 #include <crypto/sha256_base.h>
40
-#include <asm/fpu/api.h>
4140 #include <linux/string.h>
41
+#include <asm/simd.h>
4242
4343 asmlinkage void sha256_transform_ssse3(struct sha256_state *state,
4444 const u8 *data, int blocks);
....@@ -48,7 +48,7 @@
4848 {
4949 struct sha256_state *sctx = shash_desc_ctx(desc);
5050
51
- if (!irq_fpu_usable() ||
51
+ if (!crypto_simd_usable() ||
5252 (sctx->count % SHA256_BLOCK_SIZE) + len < SHA256_BLOCK_SIZE)
5353 return crypto_sha256_update(desc, data, len);
5454
....@@ -68,7 +68,7 @@
6868 static int sha256_finup(struct shash_desc *desc, const u8 *data,
6969 unsigned int len, u8 *out, sha256_block_fn *sha256_xform)
7070 {
71
- if (!irq_fpu_usable())
71
+ if (!crypto_simd_usable())
7272 return crypto_sha256_finup(desc, data, len, out);
7373
7474 kernel_fpu_begin();
....@@ -143,7 +143,6 @@
143143 ARRAY_SIZE(sha256_ssse3_algs));
144144 }
145145
146
-#ifdef CONFIG_AS_AVX
147146 asmlinkage void sha256_transform_avx(struct sha256_state *state,
148147 const u8 *data, int blocks);
149148
....@@ -220,12 +219,6 @@
220219 ARRAY_SIZE(sha256_avx_algs));
221220 }
222221
223
-#else
224
-static inline int register_sha256_avx(void) { return 0; }
225
-static inline void unregister_sha256_avx(void) { }
226
-#endif
227
-
228
-#if defined(CONFIG_AS_AVX2) && defined(CONFIG_AS_AVX)
229222 asmlinkage void sha256_transform_rorx(struct sha256_state *state,
230223 const u8 *data, int blocks);
231224
....@@ -299,11 +292,6 @@
299292 crypto_unregister_shashes(sha256_avx2_algs,
300293 ARRAY_SIZE(sha256_avx2_algs));
301294 }
302
-
303
-#else
304
-static inline int register_sha256_avx2(void) { return 0; }
305
-static inline void unregister_sha256_avx2(void) { }
306
-#endif
307295
308296 #ifdef CONFIG_AS_SHA256_NI
309297 asmlinkage void sha256_ni_transform(struct sha256_state *digest,