Skip to content

Commit

Permalink
crypto: blkcipher - Fix WARN_ON handling in walk_done
Browse files Browse the repository at this point in the history
When we get left-over bits from a slow walk, it means that the
underlying cipher has gone troppo.  However, as we're handling
that case we should ensure that the caller terminates the walk.

This patch does this by setting walk->nbytes to zero.

Reported-by: Roel Kluin <[email protected]>
Reported-by: Huang Ying <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>
  • Loading branch information
herbertx committed Jan 27, 2009
1 parent 29b37f4 commit bac1b5c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion crypto/blkcipher.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ int blkcipher_walk_done(struct blkcipher_desc *desc,
scatterwalk_done(&walk->in, 0, nbytes);
scatterwalk_done(&walk->out, 1, nbytes);

err:
walk->total = nbytes;
walk->nbytes = nbytes;

Expand All @@ -132,7 +133,6 @@ int blkcipher_walk_done(struct blkcipher_desc *desc,
return blkcipher_walk_next(desc, walk);
}

err:
if (walk->iv != desc->info)
memcpy(desc->info, walk->iv, crypto_blkcipher_ivsize(tfm));
if (walk->buffer != walk->page)
Expand Down

0 comments on commit bac1b5c

Please sign in to comment.