Re: 2.2.9 international patch des.c question/problem

Tom Leete (tleete@access.mountain.net)
Sun, 30 May 1999 23:47:52 -0400


I don't know the patch, but this function appears to reject any key that has
an odd parity byte in it. That's assuming that the array (char* parity)
delivers according to normal semantics. [ Why not a function, btw? Speed?]

Hmmmm....

Tom

> In the linux/crypto/des.c from the 2.2.9 international patch, there is
>a section of code in des_set_key() that always rejects my keys. I was
hoping
>someone could explain the purpose of this bit of code, and maybe why it
>doesnt seem to like any of my keys.
>

...
>
> Here is the code snip: (for all my keys, the conditional is true. If I
>just skip this check, everything seems to work ok.)
>
>
>int des_set_key(struct cipher_context *cx,
> u8 *key, int keybytes)
>{
> register u32 n, w;
> register char * b0, * b1;
> char bits0[56], bits1[56];
>
>.....
>
> /* check for bad parity and weak keys */
> b0 = parity;
> n = b0[key[0]]; n <<= 4;
> n |= b0[key[1]]; n <<= 4;
> n |= b0[key[2]]; n <<= 4;
> n |= b0[key[3]]; n <<= 4;
> n |= b0[key[4]]; n <<= 4;
> n |= b0[key[5]]; n <<= 4;
> n |= b0[key[6]]; n <<= 4;
> n |= b0[key[7]];
> w = 0X88888888L;
> /* report bad parity in key */
> if ( n & w )
> return -1;
>

...
>
>Paul
>set@pobox.com

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/