diff options
| author | Thorsten Blum <thorsten.blum@linux.dev> | 2026-07-21 01:22:50 +0200 |
|---|---|---|
| committer | Herbert Xu <herbert@gondor.apana.org.au> | 2026-07-30 17:36:41 +1000 |
| commit | 37b70fa01b909b2d4d247789dbc41eaf4562e2ea (patch) | |
| tree | e63645f1a52ee277876896bd588095a336934596 | |
| parent | 8b1fea9dda01d0ee7ac0b7ec87dbb9fabbf244aa (diff) | |
| download | linux-37b70fa01b909b2d4d247789dbc41eaf4562e2ea.tar.gz linux-37b70fa01b909b2d4d247789dbc41eaf4562e2ea.zip | |
crypto: bcm - use memcpy_and_pad in ahash_hmac_setkey
Use memcpy_and_pad() instead of memcpy() followed by memset() to
simplify ahash_hmac_setkey().
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
| -rw-r--r-- | drivers/crypto/bcm/cipher.c | 4 |
1 files changed, 1 insertions, 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"); |
