summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2009-05-31 23:09:22 +1000
committerHerbert Xu <herbert@gondor.apana.org.au>2009-05-31 23:09:22 +1000
commitd243cdfcd57095cc58b4fa182417c147a1a138c3 (patch)
tree1a98c5fc5f552825bbfec5fa0a7efa4f56a5bb1e
parentf796bc40cc381dfc082ae3ff70023aa70a06621f (diff)
downloadlinux-crypto-d243cdfcd57095cc58b4fa182417c147a1a138c3.tar.gz
linux-crypto-d243cdfcd57095cc58b4fa182417c147a1a138c3.zip
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>
-rw-r--r--crypto/ahash.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/crypto/ahash.c b/crypto/ahash.c
index b2d1ee32..f3476374 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)
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;