hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/arch/x86/crypto/sha512_ssse3_glue.c
....@@ -28,16 +28,15 @@
2828 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
2929
3030 #include <crypto/internal/hash.h>
31
+#include <crypto/internal/simd.h>
3132 #include <linux/init.h>
3233 #include <linux/module.h>
3334 #include <linux/mm.h>
34
-#include <linux/cryptohash.h>
35
+#include <linux/string.h>
3536 #include <linux/types.h>
3637 #include <crypto/sha.h>
3738 #include <crypto/sha512_base.h>
38
-#include <asm/fpu/api.h>
39
-
40
-#include <linux/string.h>
39
+#include <asm/simd.h>
4140
4241 asmlinkage void sha512_transform_ssse3(struct sha512_state *state,
4342 const u8 *data, int blocks);
....@@ -47,7 +46,7 @@
4746 {
4847 struct sha512_state *sctx = shash_desc_ctx(desc);
4948
50
- if (!irq_fpu_usable() ||
49
+ if (!crypto_simd_usable() ||
5150 (sctx->count[0] % SHA512_BLOCK_SIZE) + len < SHA512_BLOCK_SIZE)
5251 return crypto_sha512_update(desc, data, len);
5352
....@@ -67,7 +66,7 @@
6766 static int sha512_finup(struct shash_desc *desc, const u8 *data,
6867 unsigned int len, u8 *out, sha512_block_fn *sha512_xform)
6968 {
70
- if (!irq_fpu_usable())
69
+ if (!crypto_simd_usable())
7170 return crypto_sha512_finup(desc, data, len, out);
7271
7372 kernel_fpu_begin();
....@@ -142,7 +141,6 @@
142141 ARRAY_SIZE(sha512_ssse3_algs));
143142 }
144143
145
-#ifdef CONFIG_AS_AVX
146144 asmlinkage void sha512_transform_avx(struct sha512_state *state,
147145 const u8 *data, int blocks);
148146 static bool avx_usable(void)
....@@ -218,12 +216,7 @@
218216 crypto_unregister_shashes(sha512_avx_algs,
219217 ARRAY_SIZE(sha512_avx_algs));
220218 }
221
-#else
222
-static inline int register_sha512_avx(void) { return 0; }
223
-static inline void unregister_sha512_avx(void) { }
224
-#endif
225219
226
-#if defined(CONFIG_AS_AVX2) && defined(CONFIG_AS_AVX)
227220 asmlinkage void sha512_transform_rorx(struct sha512_state *state,
228221 const u8 *data, int blocks);
229222
....@@ -298,10 +291,6 @@
298291 crypto_unregister_shashes(sha512_avx2_algs,
299292 ARRAY_SIZE(sha512_avx2_algs));
300293 }
301
-#else
302
-static inline int register_sha512_avx2(void) { return 0; }
303
-static inline void unregister_sha512_avx2(void) { }
304
-#endif
305294
306295 static int __init sha512_ssse3_mod_init(void)
307296 {