mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-03 09:04:21 +08:00
crypto: echainiv - Copy AD along with plain text
As the AD does not necessarily exist in the destination buffer it must be copied along with the plain text. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
6350449fbf
commit
838c9d561a
@ -228,19 +228,13 @@ static int echainiv_encrypt(struct aead_request *req)
|
|||||||
info = req->iv;
|
info = req->iv;
|
||||||
|
|
||||||
if (req->src != req->dst) {
|
if (req->src != req->dst) {
|
||||||
struct scatterlist src[2];
|
|
||||||
struct scatterlist dst[2];
|
|
||||||
struct blkcipher_desc desc = {
|
struct blkcipher_desc desc = {
|
||||||
.tfm = ctx->null,
|
.tfm = ctx->null,
|
||||||
};
|
};
|
||||||
|
|
||||||
err = crypto_blkcipher_encrypt(
|
err = crypto_blkcipher_encrypt(
|
||||||
&desc,
|
&desc, req->dst, req->src,
|
||||||
scatterwalk_ffwd(dst, req->dst,
|
req->assoclen + req->cryptlen);
|
||||||
req->assoclen + ivsize),
|
|
||||||
scatterwalk_ffwd(src, req->src,
|
|
||||||
req->assoclen + ivsize),
|
|
||||||
req->cryptlen - ivsize);
|
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user