From: Thorsten Blum <blum@kernel.org>
To: Herbert Xu <herbert@gondor.apana.org.au>,
"David S. Miller" <davem@davemloft.net>
Cc: Thorsten Blum <blum@kernel.org>,
linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 1/5] crypto: cast5 - use memcpy_and_pad() in cast5_setkey()
Date: Mon, 21 Sep 2026 08:11:20 +0200 [thread overview]
Message-ID: <20260921061120.29694-6-blum@kernel.org> (raw)
Use memcpy_and_pad() instead of separate memcpy() and memset() calls to
simplify cast5_setkey().
Signed-off-by: Thorsten Blum <blum@kernel.org>
---
crypto/cast5_generic.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/crypto/cast5_generic.c b/crypto/cast5_generic.c
index f68330793e0c..1de0dc966a03 100644
--- a/crypto/cast5_generic.c
+++ b/crypto/cast5_generic.c
@@ -483,9 +483,7 @@ int cast5_setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int key_len)
c->rr = key_len <= 10 ? 1 : 0;
- memset(p_key, 0, 16);
- memcpy(p_key, key, key_len);
-
+ memcpy_and_pad(p_key, sizeof(p_key), key, key_len, 0);
x[0] = be32_to_cpu(p_key[0]);
x[1] = be32_to_cpu(p_key[1]);
next reply other threads:[~2026-09-21 6:12 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-21 6:11 Thorsten Blum [this message]
2026-09-21 6:11 ` [PATCH 2/5] crypto: cast6 - use memcpy_and_pad() in __cast6_setkey() Thorsten Blum
2026-09-21 6:11 ` [PATCH 3/5] crypto: ixp4xx - use memcpy_and_pad() in register_chain_var() Thorsten Blum
2026-09-21 8:56 ` Linus Walleij
2026-09-21 6:11 ` [PATCH 4/5] crypto: octeontx - use memcpy_and_pad() in aead_hmac_init() Thorsten Blum
2026-09-21 6:11 ` [PATCH 5/5] crypto: octeontx2 " Thorsten Blum
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=20260921061120.29694-6-blum@kernel.org \
--to=blum@kernel.org \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@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
all inboxes | Powered by JetHome®