mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/5] crypto: cast5 - use memcpy_and_pad() in cast5_setkey()
@ 2026-09-21  6:11 Thorsten Blum
  2026-09-21  6:11 ` [PATCH 2/5] crypto: cast6 - use memcpy_and_pad() in __cast6_setkey() Thorsten Blum
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Thorsten Blum @ 2026-09-21  6:11 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller; +Cc: Thorsten Blum, linux-crypto, linux-kernel

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]);

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-09-21  8:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-21  6:11 [PATCH 1/5] crypto: cast5 - use memcpy_and_pad() in cast5_setkey() Thorsten Blum
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

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®