mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson
synced 2025-08-27 06:50:37 +00:00

Instead of exposing the riscv-optimized SHA-512 code via riscv-specific crypto_shash algorithms, instead just implement the sha512_blocks() library function. This is much simpler, it makes the SHA-512 (and SHA-384) library functions be riscv-optimized, and it fixes the longstanding issue where the riscv-optimized SHA-512 code was disabled by default. SHA-512 still remains available through crypto_shash, but individual architectures no longer need to handle it. To match sha512_blocks(), change the type of the nblocks parameter of the assembly function from int to size_t. The assembly function actually already treated it as size_t. Note: to see the diff from arch/riscv/crypto/sha512-riscv64-glue.c to lib/crypto/riscv/sha512.h, view this commit with 'git show -M10'. Acked-by: Ard Biesheuvel <ardb@kernel.org> Link: https://lore.kernel.org/r/20250630160320.2888-12-ebiggers@kernel.org Signed-off-by: Eric Biggers <ebiggers@kernel.org>
61 lines
1.7 KiB
Plaintext
61 lines
1.7 KiB
Plaintext
# SPDX-License-Identifier: GPL-2.0
|
|
|
|
menu "Accelerated Cryptographic Algorithms for CPU (riscv)"
|
|
|
|
config CRYPTO_AES_RISCV64
|
|
tristate "Ciphers: AES, modes: ECB, CBC, CTS, CTR, XTS"
|
|
depends on 64BIT && RISCV_ISA_V && TOOLCHAIN_HAS_VECTOR_CRYPTO
|
|
select CRYPTO_ALGAPI
|
|
select CRYPTO_LIB_AES
|
|
select CRYPTO_SKCIPHER
|
|
help
|
|
Block cipher: AES cipher algorithms
|
|
Length-preserving ciphers: AES with ECB, CBC, CTS, CTR, XTS
|
|
|
|
Architecture: riscv64 using:
|
|
- Zvkned vector crypto extension
|
|
- Zvbb vector extension (XTS)
|
|
- Zvkb vector crypto extension (CTR)
|
|
- Zvkg vector crypto extension (XTS)
|
|
|
|
config CRYPTO_GHASH_RISCV64
|
|
tristate "Hash functions: GHASH"
|
|
depends on 64BIT && RISCV_ISA_V && TOOLCHAIN_HAS_VECTOR_CRYPTO
|
|
select CRYPTO_GCM
|
|
help
|
|
GCM GHASH function (NIST SP 800-38D)
|
|
|
|
Architecture: riscv64 using:
|
|
- Zvkg vector crypto extension
|
|
|
|
config CRYPTO_SM3_RISCV64
|
|
tristate "Hash functions: SM3 (ShangMi 3)"
|
|
depends on 64BIT && RISCV_ISA_V && TOOLCHAIN_HAS_VECTOR_CRYPTO
|
|
select CRYPTO_HASH
|
|
select CRYPTO_LIB_SM3
|
|
help
|
|
SM3 (ShangMi 3) secure hash function (OSCCA GM/T 0004-2012)
|
|
|
|
Architecture: riscv64 using:
|
|
- Zvksh vector crypto extension
|
|
- Zvkb vector crypto extension
|
|
|
|
config CRYPTO_SM4_RISCV64
|
|
tristate "Ciphers: SM4 (ShangMi 4)"
|
|
depends on 64BIT && RISCV_ISA_V && TOOLCHAIN_HAS_VECTOR_CRYPTO
|
|
select CRYPTO_ALGAPI
|
|
select CRYPTO_SM4
|
|
help
|
|
SM4 block cipher algorithm (OSCCA GB/T 32907-2016,
|
|
ISO/IEC 18033-3:2010/Amd 1:2021)
|
|
|
|
SM4 (GBT.32907-2016) is a cryptographic standard issued by the
|
|
Organization of State Commercial Administration of China (OSCCA)
|
|
as an authorized cryptographic algorithm for use within China.
|
|
|
|
Architecture: riscv64 using:
|
|
- Zvksed vector crypto extension
|
|
- Zvkb vector crypto extension
|
|
|
|
endmenu
|