Skip to content

Commit abe5fa7

Browse files
klassertherbertx
authored andcommitted
crypto: eseqiv - Fix IV generation for sync algorithms
If crypto_ablkcipher_encrypt() returns synchronous, eseqiv_complete2() is called even if req->giv is already the pointer to the generated IV. The generated IV is overwritten with some random data in this case. This patch fixes this by calling eseqiv_complete2() just if the generated IV has to be copied to req->giv. Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent 295c01f commit abe5fa7

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎crypto/eseqiv.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,8 @@ static int eseqiv_givencrypt(struct skcipher_givcrypt_request *req)
153153
if (err)
154154
goto out;
155155

156-
eseqiv_complete2(req);
156+
if (giv != req->giv)
157+
eseqiv_complete2(req);
157158

158159
out:
159160
return err;

0 commit comments

Comments
 (0)