]> www.infradead.org Git - users/jedix/linux-maple.git/commit
crypto: riscv/chacha - implement library instead of skcipher
authorEric Biggers <ebiggers@google.com>
Sat, 5 Apr 2025 18:26:01 +0000 (11:26 -0700)
committerHerbert Xu <herbert@gondor.apana.org.au>
Mon, 7 Apr 2025 05:22:28 +0000 (13:22 +0800)
commitceba0eda831382864dc420fcab5f6079fbb26ba2
tree2bf529c2a2bff9c962ab04079d23a11cbd7dd311
parent570ef50a15d7caa4d63d66f1e28d967065733f84
crypto: riscv/chacha - implement library instead of skcipher

Currently the RISC-V optimized ChaCha20 is only wired up to the
crypto_skcipher API, which makes it unavailable to users of the library
API.  The crypto_skcipher API for ChaCha20 is going to change to be
implemented on top of the library API, so the library API needs to be
supported.  And of course it's needed anyway to serve the library users.

Therefore, change the RISC-V ChaCha20 code to implement the library API
instead of the crypto_skcipher API.

The library functions take the ChaCha state matrix directly (instead of
key and IV) and support both ChaCha20 and ChaCha12.  To make the RISC-V
code work properly for that, change the assembly code to take the state
matrix directly and add a nrounds parameter.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
arch/riscv/crypto/Kconfig
arch/riscv/crypto/chacha-riscv64-glue.c
arch/riscv/crypto/chacha-riscv64-zvkb.S