Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 838c9d56 authored by Herbert Xu's avatar Herbert Xu
Browse files

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: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 6350449f
Loading
Loading
Loading
Loading
+2 −8
Original line number Diff line number Diff line
@@ -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;
	}