Skip to content

Commit

Permalink
crypto: echainiv - Copy AD along with plain text
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Herbert Xu committed May 28, 2015
1 parent 6350449 commit 838c9d5
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions crypto/echainiv.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,19 +228,13 @@ static int echainiv_encrypt(struct aead_request *req)
info = req->iv;

if (req->src != req->dst) {
struct scatterlist src[2];
struct scatterlist dst[2];
struct blkcipher_desc desc = {
.tfm = ctx->null,
};

err = crypto_blkcipher_encrypt(
&desc,
scatterwalk_ffwd(dst, req->dst,
req->assoclen + ivsize),
scatterwalk_ffwd(src, req->src,
req->assoclen + ivsize),
req->cryptlen - ivsize);
&desc, req->dst, req->src,
req->assoclen + req->cryptlen);
if (err)
return err;
}
Expand Down

0 comments on commit 838c9d5

Please sign in to comment.