| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * sm3-ce-glue.c - SM3 secure hash using ARMv8.2 Crypto Extensions |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (C) 2018 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. |
|---|
| 9 | 6 | */ |
|---|
| 10 | 7 | |
|---|
| 11 | 8 | #include <asm/neon.h> |
|---|
| 12 | 9 | #include <asm/simd.h> |
|---|
| 13 | 10 | #include <asm/unaligned.h> |
|---|
| 14 | 11 | #include <crypto/internal/hash.h> |
|---|
| 12 | +#include <crypto/internal/simd.h> |
|---|
| 15 | 13 | #include <crypto/sm3.h> |
|---|
| 16 | 14 | #include <crypto/sm3_base.h> |
|---|
| 17 | 15 | #include <linux/cpufeature.h> |
|---|
| .. | .. |
|---|
| 28 | 26 | static int sm3_ce_update(struct shash_desc *desc, const u8 *data, |
|---|
| 29 | 27 | unsigned int len) |
|---|
| 30 | 28 | { |
|---|
| 31 | | - if (!may_use_simd()) |
|---|
| 29 | + if (!crypto_simd_usable()) |
|---|
| 32 | 30 | return crypto_sm3_update(desc, data, len); |
|---|
| 33 | 31 | |
|---|
| 34 | 32 | kernel_neon_begin(); |
|---|
| .. | .. |
|---|
| 40 | 38 | |
|---|
| 41 | 39 | static int sm3_ce_final(struct shash_desc *desc, u8 *out) |
|---|
| 42 | 40 | { |
|---|
| 43 | | - if (!may_use_simd()) |
|---|
| 41 | + if (!crypto_simd_usable()) |
|---|
| 44 | 42 | return crypto_sm3_finup(desc, NULL, 0, out); |
|---|
| 45 | 43 | |
|---|
| 46 | 44 | kernel_neon_begin(); |
|---|
| .. | .. |
|---|
| 53 | 51 | static int sm3_ce_finup(struct shash_desc *desc, const u8 *data, |
|---|
| 54 | 52 | unsigned int len, u8 *out) |
|---|
| 55 | 53 | { |
|---|
| 56 | | - if (!may_use_simd()) |
|---|
| 54 | + if (!crypto_simd_usable()) |
|---|
| 57 | 55 | return crypto_sm3_finup(desc, data, len, out); |
|---|
| 58 | 56 | |
|---|
| 59 | 57 | kernel_neon_begin(); |
|---|