Re: [2.6 patch] crypto/aes.c: array overrun

From: David McCullough
Date: Tue Mar 14 2006 - 20:13:19 EST



Jivin Herbert Xu lays it down ...
> On Wed, Mar 15, 2006 at 08:54:48AM +1000, David McCullough wrote:
> >
> > struct aes_ctx {
> > int key_length;
> > - u32 E[60];
> > - u32 D[60];
> > + u32 _KEYS[120];
> > };
>
> Looks good. Thanks for this David.
>
> Could you please change the name from _KEYS to buf and patch the x86-64
> version as well?

No problems, attached.

Cheers,
Davidm

--
David McCullough, david_mccullough@xxxxxxxxxxxxxxxxxxxxxx, Ph:+61 734352815
Secure Computing - SnapGear http://www.uCdot.org http://www.cyberguard.com
Index: linux-2.6.x/crypto/aes.c
===================================================================
RCS file: linux-2.6.x/crypto/aes.c,v
retrieving revision 1.1.1.6
diff -u -r1.1.1.6 aes.c
--- linux-2.6.x/crypto/aes.c 31 Aug 2005 00:33:03 -0000 1.1.1.6
+++ linux-2.6.x/crypto/aes.c 15 Mar 2006 01:09:37 -0000
@@ -78,12 +78,11 @@

struct aes_ctx {
int key_length;
- u32 E[60];
- u32 D[60];
+ u32 buf[120];
};

-#define E_KEY ctx->E
-#define D_KEY ctx->D
+#define E_KEY (&ctx->buf[0])
+#define D_KEY (&ctx->buf[60])

static u8 pow_tab[256] __initdata;
static u8 log_tab[256] __initdata;
Index: linux-2.6.x/arch/x86_64/crypto/aes.c
===================================================================
RCS file: linux-2.6.x/arch/x86_64/crypto/aes.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 aes.c
--- linux-2.6.x/arch/x86_64/crypto/aes.c 31 Aug 2005 00:33:07 -0000 1.1.1.1
+++ linux-2.6.x/arch/x86_64/crypto/aes.c 15 Mar 2006 01:09:37 -0000
@@ -79,12 +79,11 @@
struct aes_ctx
{
u32 key_length;
- u32 E[60];
- u32 D[60];
+ u32 buf[120];
};

-#define E_KEY ctx->E
-#define D_KEY ctx->D
+#define E_KEY (&ctx->buf[0])
+#define D_KEY (&ctx->buf[60])

static u8 pow_tab[256] __initdata;
static u8 log_tab[256] __initdata;