From: Gisle S{l. <gi...@ii...> - 2002-04-02 21:58:12
|
Here is a patch to make idea work again - that is - I swaped the code for big endian and little endian handling, and that seemed to be sufficient to get IDEA to work. With this patch it reproduces the test vectors. There is no handling of endianness in the key schedule, so it will probably not work on big endian systems. The thing I wrote about the IDEA key schedule was wrong. I was confused by pointer aritmetrics on the input parameter. Bad coding style, but the code worked. (I have forgotten the password of my sourceforge account) --- cipher-idea.c Tue Apr 2 23:29:54 2002 +++ cipher-idea.new.c Tue Apr 2 23:28:44 2002 @@ -202,9 +202,9 @@ x2 =3D *in++; x3 =3D *in++; x4 =3D *in; -#if defined(__LITTLE_ENDIAN) +#if defined(__BIG_ENDIAN) /* noop */ -#elif defined(__BIG_ENDIAN) +#elif defined(__LITTLE_ENDIAN) x1 =3D (x1 >> 8) | (x1 << 8); x2 =3D (x2 >> 8) | (x2 << 8); x3 =3D (x3 >> 8) | (x3 << 8); @@ -239,12 +239,12 @@ MUL(x4, *key); out =3D (u16 *) outbuf; -#if defined(__LITTLE_ENDIAN) +#if defined(__BIG_ENDIAN) *out++ =3D x1; *out++ =3D x3; *out++ =3D x2; *out =3D x4; -#elif defined(__BIG_ENDIAN) +#elif defined(__LITTLE_ENDIAN) x1 =3D low16(x1); x2 =3D low16(x2); x3 =3D low16(x3); --=20 -- Gisle S=E6lensminde ( gi...@ii... ) With sufficient thrust, pigs fly just fine. However, this is not necessarily a good idea. It is hard to be sure where they are going to land, and it could be dangerous sitting under them as they fly overhead. (from RFC 1925) |