mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-28 01:43:47 -04:00
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>
This commit is contained in:
committed by
Herbert Xu
parent
8b1fea9dda
commit
37b70fa01b
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user