| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * sha2-ce-glue.c - SHA-224/SHA-256 using ARMv8 Crypto Extensions |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (C) 2015 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 <crypto/internal/hash.h> |
|---|
| 9 | +#include <crypto/internal/simd.h> |
|---|
| 12 | 10 | #include <crypto/sha.h> |
|---|
| 13 | 11 | #include <crypto/sha256_base.h> |
|---|
| 14 | 12 | #include <linux/cpufeature.h> |
|---|
| .. | .. |
|---|
| 34 | 32 | { |
|---|
| 35 | 33 | struct sha256_state *sctx = shash_desc_ctx(desc); |
|---|
| 36 | 34 | |
|---|
| 37 | | - if (!may_use_simd() || |
|---|
| 35 | + if (!crypto_simd_usable() || |
|---|
| 38 | 36 | (sctx->count % SHA256_BLOCK_SIZE) + len < SHA256_BLOCK_SIZE) |
|---|
| 39 | 37 | return crypto_sha256_arm_update(desc, data, len); |
|---|
| 40 | 38 | |
|---|
| .. | .. |
|---|
| 49 | 47 | static int sha2_ce_finup(struct shash_desc *desc, const u8 *data, |
|---|
| 50 | 48 | unsigned int len, u8 *out) |
|---|
| 51 | 49 | { |
|---|
| 52 | | - if (!may_use_simd()) |
|---|
| 50 | + if (!crypto_simd_usable()) |
|---|
| 53 | 51 | return crypto_sha256_arm_finup(desc, data, len, out); |
|---|
| 54 | 52 | |
|---|
| 55 | 53 | kernel_neon_begin(); |
|---|