Skip to content

Commit

Permalink
crypto: hash - Fix handling of sg entry that crosses page boundary
Browse files Browse the repository at this point in the history
A quirk that we've always supported is having an sg entry that's
bigger than a page, or more generally an sg entry that crosses
page boundaries.  Even though it would be better to explicitly have
to sg entries for this, we need to support it for the existing users,
in particular, IPsec.

The new ahash sg walking code did try to handle this, but there was
a bug where we didn't increment the page so kept on walking on the
first page over an dover again.

This patch fixes it.

Tested-by: Martin Willi <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>
  • Loading branch information
herbertx committed May 31, 2009
1 parent 3218911 commit d315a0e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions crypto/ahash.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,11 @@ int crypto_hash_walk_done(struct crypto_hash_walk *walk, int err)
if (err)
return err;

walk->offset = 0;

if (nbytes)
if (nbytes) {
walk->offset = 0;
walk->pg++;
return hash_walk_next(walk);
}

if (!walk->total)
return 0;
Expand Down

0 comments on commit d315a0e

Please sign in to comment.