summaryrefslogtreecommitdiff
path: root/crypto/ahash.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-09-07 14:35:16 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2010-09-07 14:35:16 -0700
commit33963b38a729558a86237f0cb3dc1f3497582c77 (patch)
tree0460284ed98305c679aaf95ff8ef7c9b79fb27d6 /crypto/ahash.c
parent7f111f62221a8721d63a97476abd855464b61d4b (diff)
parentee2047159f936940e33ba7c3a81e95484b162c9a (diff)
downloadlinux-crypto-33963b38a729558a86237f0cb3dc1f3497582c77.tar.gz
linux-crypto-33963b38a729558a86237f0cb3dc1f3497582c77.zip
Merge git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: Revert "hwrng: n2-drv - remove casts from void*" crypto: testmgr - Default to no tests crypto: testmgr - Fix test disabling option crypto: hash - Fix handling of small unaligned buffers
Diffstat (limited to 'crypto/ahash.c')
-rw-r--r--crypto/ahash.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/crypto/ahash.c b/crypto/ahash.c
index b8c59b88..f669822a 100644
--- a/crypto/ahash.c
+++ b/crypto/ahash.c
@@ -47,8 +47,11 @@ static int hash_walk_next(struct crypto_hash_walk *walk)
walk->data = crypto_kmap(walk->pg, 0);
walk->data += offset;
- if (offset & alignmask)
- nbytes = alignmask + 1 - (offset & alignmask);
+ if (offset & alignmask) {
+ unsigned int unaligned = alignmask + 1 - (offset & alignmask);
+ if (nbytes > unaligned)
+ nbytes = unaligned;
+ }
walk->entrylen -= nbytes;
return nbytes;