summaryrefslogtreecommitdiffstats
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
commit61f953cbaae26f930b8d937366270547e08c1290 (patch)
tree44cefef0fdd172ce4fe2083ed7695d86b76ed257 /crypto/ahash.c
parenta44a553f827f28d46130c9818dbcb95f4262b96c (diff)
parent50b6e71ae83714be509b80727dbf90fa8b1c0717 (diff)
downloadlinux-61f953cbaae26f930b8d937366270547e08c1290.tar.bz2
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 b8c59b889c6e..f669822a7a44 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;