]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
lib/crypto: riscv/aes: Migrate optimized code into library
authorEric Biggers <ebiggers@kernel.org>
Mon, 12 Jan 2026 19:20:12 +0000 (11:20 -0800)
committerEric Biggers <ebiggers@kernel.org>
Mon, 12 Jan 2026 19:39:58 +0000 (11:39 -0800)
commita4e573db06a4e8c519ec4c42f8e1249a0853367a
treed71ce0a761c11903695218dec4e46ec8f791ad0e
parent7cf2082e74ce7f4f4b5e14cbe67a194d75e257ef
lib/crypto: riscv/aes: Migrate optimized code into library

Move the aes_encrypt_zvkned() and aes_decrypt_zvkned() assembly
functions into lib/crypto/, wire them up to the AES library API, and
remove the "aes-riscv64-zvkned" crypto_cipher algorithm.

To make this possible, change the prototypes of these functions to
take (rndkeys, key_len) instead of a pointer to crypto_aes_ctx, and
change the RISC-V AES-XTS code to implement tweak encryption using the
AES library instead of directly calling aes_encrypt_zvkned().

The result is that both the AES library and crypto_cipher APIs use
RISC-V's AES instructions, whereas previously only crypto_cipher did
(and it wasn't enabled by default, which this commit fixes as well).

Acked-by: Ard Biesheuvel <ardb@kernel.org>
Link: https://lore.kernel.org/r/20260112192035.10427-15-ebiggers@kernel.org
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
arch/riscv/crypto/Kconfig
arch/riscv/crypto/aes-macros.S
arch/riscv/crypto/aes-riscv64-glue.c
arch/riscv/crypto/aes-riscv64-zvkned.S
lib/crypto/Kconfig
lib/crypto/Makefile
lib/crypto/riscv/aes-riscv64-zvkned.S [new file with mode: 0644]
lib/crypto/riscv/aes.h [new file with mode: 0644]