| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | #include <linux/crc32.h> |
|---|
| 2 | 3 | #include <crypto/internal/hash.h> |
|---|
| 4 | +#include <crypto/internal/simd.h> |
|---|
| 3 | 5 | #include <linux/init.h> |
|---|
| 4 | 6 | #include <linux/module.h> |
|---|
| 5 | 7 | #include <linux/string.h> |
|---|
| 6 | 8 | #include <linux/kernel.h> |
|---|
| 7 | 9 | #include <linux/cpufeature.h> |
|---|
| 10 | +#include <asm/simd.h> |
|---|
| 8 | 11 | #include <asm/switch_to.h> |
|---|
| 9 | 12 | |
|---|
| 10 | 13 | #define CHKSUM_BLOCK_SIZE 1 |
|---|
| .. | .. |
|---|
| 22 | 25 | unsigned int prealign; |
|---|
| 23 | 26 | unsigned int tail; |
|---|
| 24 | 27 | |
|---|
| 25 | | - if (len < (VECTOR_BREAKPOINT + VMX_ALIGN) || in_interrupt()) |
|---|
| 28 | + if (len < (VECTOR_BREAKPOINT + VMX_ALIGN) || !crypto_simd_usable()) |
|---|
| 26 | 29 | return __crc32c_le(crc, p, len); |
|---|
| 27 | 30 | |
|---|
| 28 | 31 | if ((unsigned long)p & VMX_ALIGN_MASK) { |
|---|
| .. | .. |
|---|
| 70 | 73 | { |
|---|
| 71 | 74 | u32 *mctx = crypto_shash_ctx(hash); |
|---|
| 72 | 75 | |
|---|
| 73 | | - if (keylen != sizeof(u32)) { |
|---|
| 74 | | - crypto_shash_set_flags(hash, CRYPTO_TFM_RES_BAD_KEY_LEN); |
|---|
| 76 | + if (keylen != sizeof(u32)) |
|---|
| 75 | 77 | return -EINVAL; |
|---|
| 76 | | - } |
|---|
| 77 | 78 | *mctx = le32_to_cpup((__le32 *)key); |
|---|
| 78 | 79 | return 0; |
|---|
| 79 | 80 | } |
|---|