From: Thorsten Blum Date: Sat, 16 May 2026 23:42:12 +0000 (+0200) Subject: crypto: atmel-sha - use memcpy_and_pad to simplify hmac_setup X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=08b0f3a77561550d2358c73ceba59e1c5fa5721a;p=thirdparty%2Fkernel%2Flinux.git 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 Signed-off-by: Herbert Xu --- diff --git a/drivers/crypto/atmel-sha.c b/drivers/crypto/atmel-sha.c index 7e7c83a3d8cda..8e3b8efa8109a 100644 --- a/drivers/crypto/atmel-sha.c +++ b/drivers/crypto/atmel-sha.c @@ -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); }