* [PATCH] crypto: bcm - use memcpy_and_pad in ahash_hmac_setkey
@ 2026-07-20 23:22 Thorsten Blum
2026-07-30 7:40 ` Herbert Xu
0 siblings, 1 reply; 2+ messages in thread
From: Thorsten Blum @ 2026-07-20 23:22 UTC (permalink / raw)
To: Herbert Xu, David S. Miller, Kees Cook, Thorsten Blum
Cc: linux-crypto, linux-kernel
Use memcpy_and_pad() instead of memcpy() followed by memset() to
simplify ahash_hmac_setkey().
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
drivers/crypto/bcm/cipher.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/crypto/bcm/cipher.c b/drivers/crypto/bcm/cipher.c
index 240b40ae9cd6..e9d9ca7441b6 100644
--- a/drivers/crypto/bcm/cipher.c
+++ b/drivers/crypto/bcm/cipher.c
@@ -2387,9 +2387,7 @@ static int ahash_hmac_setkey(struct crypto_ahash *ahash, const u8 *key,
* outer hashing in software.
*/
if (iproc_priv.spu.spu_type == SPU_TYPE_SPUM) {
- memcpy(ctx->ipad, ctx->authkey, ctx->authkeylen);
- memset(ctx->ipad + ctx->authkeylen, 0,
- blocksize - ctx->authkeylen);
+ memcpy_and_pad(ctx->ipad, blocksize, ctx->authkey, ctx->authkeylen, 0);
ctx->authkeylen = 0;
unsafe_memcpy(ctx->opad, ctx->ipad, blocksize,
"fortified memcpy causes -Wrestrict warning");
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] crypto: bcm - use memcpy_and_pad in ahash_hmac_setkey
2026-07-20 23:22 [PATCH] crypto: bcm - use memcpy_and_pad in ahash_hmac_setkey Thorsten Blum
@ 2026-07-30 7:40 ` Herbert Xu
0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2026-07-30 7:40 UTC (permalink / raw)
To: Thorsten Blum; +Cc: David S. Miller, Kees Cook, linux-crypto, linux-kernel
On Tue, Jul 21, 2026 at 01:22:50AM +0200, Thorsten Blum wrote:
> Use memcpy_and_pad() instead of memcpy() followed by memset() to
> simplify ahash_hmac_setkey().
>
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
> ---
> drivers/crypto/bcm/cipher.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
Patch applied. Thanks.
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-07-30 7:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-20 23:22 [PATCH] crypto: bcm - use memcpy_and_pad in ahash_hmac_setkey Thorsten Blum
2026-07-30 7:40 ` Herbert Xu
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®