mirror of
https://github.com/torvalds/linux.git
synced 2026-11-20 13:03:48 +00:00
crypto: cast6 - use memcpy_and_pad() in __cast6_setkey()
Use memcpy_and_pad() instead of separate memcpy() and memset() calls to simplify __cast6_setkey(). Signed-off-by: Thorsten Blum <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
This commit is contained in:
committed by
Herbert Xu
parent
dfcaf2d961
commit
1dfb15e642
@@ -112,8 +112,7 @@ int __cast6_setkey(struct cast6_ctx *c, const u8 *in_key, unsigned int key_len)
|
||||
if (key_len % 4 != 0)
|
||||
return -EINVAL;
|
||||
|
||||
memset(p_key, 0, 32);
|
||||
memcpy(p_key, in_key, key_len);
|
||||
memcpy_and_pad(p_key, sizeof(p_key), in_key, key_len, 0);
|
||||
|
||||
key[0] = be32_to_cpu(p_key[0]); /* A */
|
||||
key[1] = be32_to_cpu(p_key[1]); /* B */
|
||||
|
||||
Reference in New Issue
Block a user