From: Eric Biggers <ebiggers@kernel.org>
To: linux-crypto@vger.kernel.org
Subject: [PATCH 8/8] crypto: null - use memcpy_sglist()
Date: Mon, 5 May 2025 12:10:45 -0700 [thread overview]
Message-ID: <20250505191045.763835-9-ebiggers@kernel.org> (raw)
In-Reply-To: <20250505191045.763835-1-ebiggers@kernel.org>
From: Eric Biggers <ebiggers@google.com>
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>
---
crypto/crypto_null.c | 17 ++++-------------
1 file changed, 4 insertions(+), 13 deletions(-)
diff --git a/crypto/crypto_null.c b/crypto/crypto_null.c
index 48c71b925f37..34588f39fdfc 100644
--- a/crypto/crypto_null.c
+++ b/crypto/crypto_null.c
@@ -13,10 +13,11 @@
*/
#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>
static int null_init(struct shash_desc *desc)
@@ -58,23 +59,13 @@ static void null_crypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src)
memcpy(dst, src, NULL_BLOCK_SIZE);
}
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 = {
.digestsize = NULL_DIGEST_SIZE,
.setkey = null_hash_setkey,
--
2.49.0
next prev parent reply other threads:[~2025-05-05 19:11 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-05 19:10 [PATCH 0/8] crypto: use memcpy_sglist() instead of null skcipher Eric Biggers
2025-05-05 19:10 ` [PATCH 1/8] crypto: algif_aead - " Eric Biggers
2025-05-05 19:10 ` [PATCH 2/8] crypto: authenc " Eric Biggers
2025-05-05 19:10 ` [PATCH 3/8] crypto: gcm " Eric Biggers
2025-05-05 19:10 ` [PATCH 4/8] crypto: geniv " Eric Biggers
2025-05-05 19:10 ` [PATCH 5/8] crypto: krb5enc - do not select CRYPTO_NULL Eric Biggers
2025-05-05 19:10 ` [PATCH 6/8] crypto: null - remove the default null skcipher Eric Biggers
2025-05-05 19:10 ` [PATCH 7/8] crypto: null - merge CRYPTO_NULL2 into CRYPTO_NULL Eric Biggers
2025-05-05 19:10 ` Eric Biggers [this message]
2025-05-12 5:46 ` [PATCH 0/8] crypto: use memcpy_sglist() instead of null skcipher Herbert Xu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250505191045.763835-9-ebiggers@kernel.org \
--to=ebiggers@kernel.org \
--cc=linux-crypto@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox