]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
crypto: null - use memcpy_sglist()
authorEric Biggers <ebiggers@google.com>
Mon, 5 May 2025 19:10:45 +0000 (12:10 -0700)
committerHerbert Xu <herbert@gondor.apana.org.au>
Mon, 12 May 2025 05:32:53 +0000 (13:32 +0800)
Make null_skcipher_crypt() use memcpy_sglist() instead of the
skcipher_walk API, as this is simpler.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
crypto/crypto_null.c

index 48c71b925f37544deae32681fdcdf8565f309db2..34588f39fdfc63181a5224ee00ca8fb9009fb4ea 100644 (file)
@@ -15,6 +15,7 @@
 #include <crypto/null.h>
 #include <crypto/internal/hash.h>
 #include <crypto/internal/skcipher.h>
+#include <crypto/scatterwalk.h>
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/string.h>
@@ -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 = {