]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
crypto: atmel-sha - use memcpy_and_pad to simplify hmac_setup
authorThorsten Blum <thorsten.blum@linux.dev>
Sat, 16 May 2026 23:42:12 +0000 (01:42 +0200)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 22 May 2026 12:25:30 +0000 (20:25 +0800)
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>
drivers/crypto/atmel-sha.c

index 7e7c83a3d8cda8169bbb5340a74fad674c2308f0..8e3b8efa8109a130da736af8071013c2004788ab 100644 (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);
 }