crypto: riscv - add vector crypto accelerated SM4
authorJerry Shih <jerry.shih@sifive.com>
Mon, 22 Jan 2024 00:19:21 +0000 (16:19 -0800)
committerPalmer Dabbelt <palmer@rivosinc.com>
Tue, 23 Jan 2024 01:55:24 +0000 (17:55 -0800)
commitb8d06352bbf397608a262c9d5f2b03ce32a3544a
tree42680d2a50c0fbb53f31f9ff87babe01043e6be1
parent563a5255afa237c961c5c8c8c552425c519b88da
crypto: riscv - add vector crypto accelerated SM4

Add an implementation of SM4 using the Zvksed extension.  The assembly
code is derived from OpenSSL code (openssl/openssl#21923) that was
dual-licensed so that it could be reused in the kernel.  Nevertheless,
the assembly has been significantly reworked for integration with the
kernel, for example by using a regular .S file instead of the so-called
perlasm, using the assembler instead of bare '.inst', and greatly
reducing code duplication.

Co-developed-by: Christoph Müllner <christoph.muellner@vrull.eu>
Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu>
Co-developed-by: Heiko Stuebner <heiko.stuebner@vrull.eu>
Signed-off-by: Heiko Stuebner <heiko.stuebner@vrull.eu>
Signed-off-by: Jerry Shih <jerry.shih@sifive.com>
Co-developed-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Eric Biggers <ebiggers@google.com>
Link: https://lore.kernel.org/r/20240122002024.27477-11-ebiggers@kernel.org
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
arch/riscv/crypto/Kconfig
arch/riscv/crypto/Makefile
arch/riscv/crypto/sm4-riscv64-glue.c [new file with mode: 0644]
arch/riscv/crypto/sm4-riscv64-zvksed-zvkb.S [new file with mode: 0644]