From: Kyle M. <ky...@de...> - 2002-04-02 23:02:57
|
committed. only rc5 left now :) - k On Tue, Apr 02, 2002 at 11:57:57PM +0200, Gisle S{lensminde wrote: >=20 > 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. >=20 > 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. >=20 > (I have forgotten the password of my sourceforge account) >=20 > --- 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); >=20 > 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 >=20 > --=20 > -- > Gisle S=E6lensminde ( gi...@ii... ) >=20 > 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) >=20 >=20 >=20 > _______________________________________________ > CryptoAPI-devel mailing list > Cry...@li... > https://lists.sourceforge.net/lists/listinfo/cryptoapi-devel --=20 copyleft (c) 2002, Kyle McMartin |