crypto: atmel-sha - use memcpy_and_pad to simplify hmac_setup

Use memcpy_and_pad() instead of memcpy() followed by memset() to
simplify atmel_sha_hmac_setup().

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
Thorsten Blum 2026-05-17 01:42:12 +02:00 committed by Herbert Xu
parent 2b7b16c905
commit 08b0f3a775

View File

@ -1724,8 +1724,7 @@ static int atmel_sha_hmac_setup(struct atmel_sha_dev *dd,
return atmel_sha_hmac_prehash_key(dd, key, keylen);
/* Prepare ipad. */
memcpy((u8 *)hmac->ipad, key, keylen);
memset((u8 *)hmac->ipad + keylen, 0, bs - keylen);
memcpy_and_pad(hmac->ipad, bs, key, keylen, 0);
return atmel_sha_hmac_compute_ipad_hash(dd);
}