summaryrefslogtreecommitdiffstats
path: root/crypto/xcbc.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2008-03-06 08:14:18 -0800
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-03-06 08:14:18 -0800
commitb881502666783b2d9ca2fc7a056d0f773073a808 (patch)
treeb5ebcd71f8ffdb5f994e39d4808dfee6bb93576e /crypto/xcbc.c
parent910da1a48eeb3be53a8247f6c494aa9d67ab1422 (diff)
parent2f40a178e70030c4712fe63807c883f34c3645eb (diff)
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: [CRYPTO] xcbc: Fix crash with IPsec [CRYPTO] xts: Use proper alignment [CRYPTO] digest: Include internal.h for prototypes [CRYPTO] authenc: Add missing Kconfig dependency on BLKCIPHER [CRYPTO] skcipher: Move chainiv/seqiv into crypto_blkcipher module
Diffstat (limited to 'crypto/xcbc.c')
-rw-r--r--crypto/xcbc.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/crypto/xcbc.c b/crypto/xcbc.c
index 86727403e5a..2feb0f239c3 100644
--- a/crypto/xcbc.c
+++ b/crypto/xcbc.c
@@ -124,6 +124,11 @@ static int crypto_xcbc_digest_update2(struct hash_desc *pdesc,
unsigned int offset = sg[i].offset;
unsigned int slen = sg[i].length;
+ if (unlikely(slen > nbytes))
+ slen = nbytes;
+
+ nbytes -= slen;
+
while (slen > 0) {
unsigned int len = min(slen, ((unsigned int)(PAGE_SIZE)) - offset);
char *p = crypto_kmap(pg, 0) + offset;
@@ -177,7 +182,6 @@ static int crypto_xcbc_digest_update2(struct hash_desc *pdesc,
offset = 0;
pg++;
}
- nbytes-=sg[i].length;
i++;
} while (nbytes>0);