forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-11 04dd17822334871b23ea2862f7798fb0e0007777
kernel/arch/powerpc/crypto/crc32c-vpmsum_glue.c
....@@ -1,10 +1,13 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 #include <linux/crc32.h>
23 #include <crypto/internal/hash.h>
4
+#include <crypto/internal/simd.h>
35 #include <linux/init.h>
46 #include <linux/module.h>
57 #include <linux/string.h>
68 #include <linux/kernel.h>
79 #include <linux/cpufeature.h>
10
+#include <asm/simd.h>
811 #include <asm/switch_to.h>
912
1013 #define CHKSUM_BLOCK_SIZE 1
....@@ -22,7 +25,7 @@
2225 unsigned int prealign;
2326 unsigned int tail;
2427
25
- if (len < (VECTOR_BREAKPOINT + VMX_ALIGN) || in_interrupt())
28
+ if (len < (VECTOR_BREAKPOINT + VMX_ALIGN) || !crypto_simd_usable())
2629 return __crc32c_le(crc, p, len);
2730
2831 if ((unsigned long)p & VMX_ALIGN_MASK) {
....@@ -70,10 +73,8 @@
7073 {
7174 u32 *mctx = crypto_shash_ctx(hash);
7275
73
- if (keylen != sizeof(u32)) {
74
- crypto_shash_set_flags(hash, CRYPTO_TFM_RES_BAD_KEY_LEN);
76
+ if (keylen != sizeof(u32))
7577 return -EINVAL;
76
- }
7778 *mctx = le32_to_cpup((__le32 *)key);
7879 return 0;
7980 }