Skip to content

Commit

Permalink
crypto: eseqiv - Fix IV generation for sync algorithms
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>
  • Loading branch information
klassert authored and herbertx committed Apr 15, 2009
1 parent 295c01f commit abe5fa7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion crypto/eseqiv.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ static int eseqiv_givencrypt(struct skcipher_givcrypt_request *req)
if (err)
goto out;

eseqiv_complete2(req);
if (giv != req->giv)
eseqiv_complete2(req);

out:
return err;
Expand Down

0 comments on commit abe5fa7

Please sign in to comment.