[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <200803051451.m25EpKv8016389@faith.austin.ibm.com>
Date: Wed, 5 Mar 2008 08:51:20 -0600
From: Joy Latten <latten@...tin.ibm.com>
To: linux-crypto@...r.kernel
Cc: davem@...emloft.net, herbert@...dor.apana.org.au,
netdev@...r.kernel.org
Subject: [PATCH]kernel crashes when using aes-xcbc-mac with IPsec
When using aes-xcbc-mac for authentication in IPsec,
the kernel crashes. It seems this algorithm doesn't
account for the space IPsec may make in scatterlist for authtag.
Thus when crypto_xcbc_digest_update2() gets called,
nbytes may be less than sg[i].length.
Since nbytes is an unsigned number, it wraps
at the end of the loop allowing us to go back
into loop and causing crash in memcpy.
I used update function in digest.c to model this fix.
Please let me know if it looks ok.
regards,
Joy
Signed-off-by: Joy Latten <latten@...tin.ibm.com>
diff -urpN net-2.6.26/crypto/xcbc.c net-2.6.26.patch/crypto/xcbc.c
--- net-2.6.26/crypto/xcbc.c 2008-03-04 16:11:32.000000000 -0600
+++ net-2.6.26.patch/crypto/xcbc.c 2008-03-04 18:28:51.000000000 -0600
@@ -124,6 +124,11 @@ static int crypto_xcbc_digest_update2(st
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(st
offset = 0;
pg++;
}
- nbytes-=sg[i].length;
i++;
} while (nbytes>0);
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists