crypto: skcipher - use scatterwalk_start_at_pos()
authorEric Biggers <ebiggers@google.com>
Wed, 19 Feb 2025 18:23:28 +0000 (10:23 -0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Sun, 2 Mar 2025 07:19:43 +0000 (15:19 +0800)
In skcipher_walk_aead_common(), use scatterwalk_start_at_pos() instead
of a sequence of scatterwalk_start(), scatterwalk_copychunks(..., 2),
and scatterwalk_done().  This is simpler and faster.

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

index cdf0f11..59e33f6 100644 (file)
@@ -363,14 +363,8 @@ static int skcipher_walk_aead_common(struct skcipher_walk *walk,
        if (unlikely(!walk->total))
                return 0;
 
-       scatterwalk_start(&walk->in, req->src);
-       scatterwalk_start(&walk->out, req->dst);
-
-       scatterwalk_copychunks(NULL, &walk->in, req->assoclen, 2);
-       scatterwalk_copychunks(NULL, &walk->out, req->assoclen, 2);
-
-       scatterwalk_done(&walk->in, 0, walk->total);
-       scatterwalk_done(&walk->out, 0, walk->total);
+       scatterwalk_start_at_pos(&walk->in, req->src, req->assoclen);
+       scatterwalk_start_at_pos(&walk->out, req->dst, req->assoclen);
 
        /*
         * Accessing 'alg' directly generates better code than using the