hc
2024-10-16 50a212ec906f7524620675f0c57357691c26c81f
kernel/arch/arm64/crypto/poly1305-glue.c
....@@ -12,6 +12,7 @@
1212 #include <crypto/algapi.h>
1313 #include <crypto/internal/hash.h>
1414 #include <crypto/internal/poly1305.h>
15
+#include <crypto/internal/simd.h>
1516 #include <linux/cpufeature.h>
1617 #include <linux/crypto.h>
1718 #include <linux/jump_label.h>
....@@ -24,7 +25,7 @@
2425
2526 static __ro_after_init DEFINE_STATIC_KEY_FALSE(have_neon);
2627
27
-void poly1305_init_arch(struct poly1305_desc_ctx *dctx, const u8 *key)
28
+void poly1305_init_arch(struct poly1305_desc_ctx *dctx, const u8 key[POLY1305_KEY_SIZE])
2829 {
2930 poly1305_init_arm64(&dctx->h, key);
3031 dctx->s[0] = get_unaligned_le32(key + 16);
....@@ -51,7 +52,7 @@
5152 {
5253 if (unlikely(!dctx->sset)) {
5354 if (!dctx->rset) {
54
- poly1305_init_arch(dctx, src);
55
+ poly1305_init_arm64(&dctx->h, src);
5556 src += POLY1305_BLOCK_SIZE;
5657 len -= POLY1305_BLOCK_SIZE;
5758 dctx->rset = 1;
....@@ -110,7 +111,7 @@
110111 static int neon_poly1305_update(struct shash_desc *desc,
111112 const u8 *src, unsigned int srclen)
112113 {
113
- bool do_neon = may_use_simd() && srclen > 128;
114
+ bool do_neon = crypto_simd_usable() && srclen > 128;
114115 struct poly1305_desc_ctx *dctx = shash_desc_ctx(desc);
115116
116117 if (static_branch_likely(&have_neon) && do_neon)
....@@ -141,7 +142,7 @@
141142 if (likely(nbytes >= POLY1305_BLOCK_SIZE)) {
142143 unsigned int len = round_down(nbytes, POLY1305_BLOCK_SIZE);
143144
144
- if (static_branch_likely(&have_neon) && may_use_simd()) {
145
+ if (static_branch_likely(&have_neon) && crypto_simd_usable()) {
145146 do {
146147 unsigned int todo = min_t(unsigned int, len, SZ_4K);
147148
....@@ -207,7 +208,7 @@
207208
208209 static int __init neon_poly1305_mod_init(void)
209210 {
210
- if (!(elf_hwcap & HWCAP_ASIMD))
211
+ if (!cpu_have_named_feature(ASIMD))
211212 return 0;
212213
213214 static_branch_enable(&have_neon);
....@@ -218,7 +219,7 @@
218219
219220 static void __exit neon_poly1305_mod_exit(void)
220221 {
221
- if (IS_REACHABLE(CONFIG_CRYPTO_HASH) && (elf_hwcap & HWCAP_ASIMD))
222
+ if (IS_REACHABLE(CONFIG_CRYPTO_HASH) && cpu_have_named_feature(ASIMD))
222223 crypto_unregister_shash(&neon_poly1305_alg);
223224 }
224225