hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/arch/arm/crypto/crc32-ce-glue.c
....@@ -1,11 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Accelerated CRC32(C) using ARM CRC, NEON and Crypto Extensions instructions
34 *
45 * Copyright (C) 2016 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/cpufeature.h>
....@@ -16,6 +13,7 @@
1613 #include <linux/string.h>
1714
1815 #include <crypto/internal/hash.h>
16
+#include <crypto/internal/simd.h>
1917
2018 #include <asm/hwcap.h>
2119 #include <asm/neon.h>
....@@ -56,10 +54,8 @@
5654 {
5755 u32 *mctx = crypto_shash_ctx(hash);
5856
59
- if (keylen != sizeof(u32)) {
60
- crypto_shash_set_flags(hash, CRYPTO_TFM_RES_BAD_KEY_LEN);
57
+ if (keylen != sizeof(u32))
6158 return -EINVAL;
62
- }
6359 *mctx = le32_to_cpup((__le32 *)key);
6460 return 0;
6561 }
....@@ -113,7 +109,7 @@
113109 u32 *crc = shash_desc_ctx(desc);
114110 unsigned int l;
115111
116
- if (may_use_simd()) {
112
+ if (crypto_simd_usable()) {
117113 if ((u32)data % SCALE_F) {
118114 l = min_t(u32, length, SCALE_F - ((u32)data % SCALE_F));
119115
....@@ -147,7 +143,7 @@
147143 u32 *crc = shash_desc_ctx(desc);
148144 unsigned int l;
149145
150
- if (may_use_simd()) {
146
+ if (crypto_simd_usable()) {
151147 if ((u32)data % SCALE_F) {
152148 l = min_t(u32, length, SCALE_F - ((u32)data % SCALE_F));
153149