From: Eric Biggers Date: Mon, 5 May 2025 19:10:45 +0000 (-0700) Subject: crypto: null - use memcpy_sglist() X-Git-Tag: v6.16-rc1~206^2~48 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=aeaad5bfb18890cc73ca32d63f1f02feb5f3f651;p=thirdparty%2Fkernel%2Flinux.git crypto: null - use memcpy_sglist() Make null_skcipher_crypt() use memcpy_sglist() instead of the skcipher_walk API, as this is simpler. Signed-off-by: Eric Biggers Signed-off-by: Herbert Xu --- diff --git a/crypto/crypto_null.c b/crypto/crypto_null.c index 48c71b925f375..34588f39fdfc6 100644 --- a/crypto/crypto_null.c +++ b/crypto/crypto_null.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -60,19 +61,9 @@ static void null_crypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) static int null_skcipher_crypt(struct skcipher_request *req) { - struct skcipher_walk walk; - int err; - - err = skcipher_walk_virt(&walk, req, false); - - while (walk.nbytes) { - if (walk.src.virt.addr != walk.dst.virt.addr) - memcpy(walk.dst.virt.addr, walk.src.virt.addr, - walk.nbytes); - err = skcipher_walk_done(&walk, 0); - } - - return err; + if (req->src != req->dst) + memcpy_sglist(req->dst, req->src, req->cryptlen); + return 0; } static struct shash_alg digest_null = {