aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/ahash.c
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2009-05-31 09:09:22 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2009-05-31 09:09:22 -0400
commitd315a0e09f1c8b833cacd5e72f3edea419978138 (patch)
tree335d0d482ef10584320a1ab6b139fe729f031b5b /crypto/ahash.c
parent3218911f839b6c85acbf872ad264ea69aa4d89ad (diff)
crypto: hash - Fix handling of sg entry that crosses page boundary
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 <martin@strongswan.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/ahash.c')
-rw-r--r--crypto/ahash.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/crypto/ahash.c b/crypto/ahash.c
index b2d1ee32cfe8..f3476374f764 100644
--- a/crypto/ahash.c
+++ b/crypto/ahash.c
@@ -82,10 +82,11 @@ int crypto_hash_walk_done(struct crypto_hash_walk *walk, int err)
82 if (err) 82 if (err)
83 return err; 83 return err;
84 84
85 walk->offset = 0; 85 if (nbytes) {
86 86 walk->offset = 0;
87 if (nbytes) 87 walk->pg++;
88 return hash_walk_next(walk); 88 return hash_walk_next(walk);
89 }
89 90
90 if (!walk->total) 91 if (!walk->total)
91 return 0; 92 return 0;