mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-30 14:19:16 +00:00
crypto: seqiv - Use kmemdup in seqiv_aead_encrypt()
Use kmemdup rather than duplicating its implementation Signed-off-by: YueHaibing <yuehaibing@huawei.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
231baecdef
commit
7e33d4d489
1 changed files with 3 additions and 4 deletions
|
@ -89,13 +89,12 @@ static int seqiv_aead_encrypt(struct aead_request *req)
|
||||||
|
|
||||||
if (unlikely(!IS_ALIGNED((unsigned long)info,
|
if (unlikely(!IS_ALIGNED((unsigned long)info,
|
||||||
crypto_aead_alignmask(geniv) + 1))) {
|
crypto_aead_alignmask(geniv) + 1))) {
|
||||||
info = kmalloc(ivsize, req->base.flags &
|
info = kmemdup(req->iv, ivsize, req->base.flags &
|
||||||
CRYPTO_TFM_REQ_MAY_SLEEP ? GFP_KERNEL :
|
CRYPTO_TFM_REQ_MAY_SLEEP ? GFP_KERNEL :
|
||||||
GFP_ATOMIC);
|
GFP_ATOMIC);
|
||||||
if (!info)
|
if (!info)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
memcpy(info, req->iv, ivsize);
|
|
||||||
compl = seqiv_aead_encrypt_complete;
|
compl = seqiv_aead_encrypt_complete;
|
||||||
data = req;
|
data = req;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue