Re: [PATCH v2] crypto: add blkcipher implementation of ARC4

2010-04-07 Thread Pavel Roskin
On Mon, 2010-04-05 at 19:04 +0200, Sebastian Andrzej Siewior wrote: +module_init(arc4_init); +module_exit(arc4_exit); I'm feelings uneasy about using the same module init/exit functions names in arc4blk.c and arc4cip.c. Even though it doesn't break for me on x86_64 (whether I'm compiling

Re: [PATCH v2] crypto: add blkcipher implementation of ARC4

2010-04-07 Thread Sebastian Andrzej Siewior
* Herbert Xu | 2010-04-07 08:31:09 [+0800]: On Tue, Apr 06, 2010 at 10:30:02PM +0200, Sebastian Andrzej Siewior wrote: Good point. All arc4 users don't care about return value of setkey so I think that I just change void to int add the check for the valid key length. Actually, how about

Re: [PATCH v2] crypto: add blkcipher implementation of ARC4

2010-04-07 Thread Sebastian Andrzej Siewior
* Pavel Roskin | 2010-04-07 02:19:55 [-0400]: On Mon, 2010-04-05 at 19:04 +0200, Sebastian Andrzej Siewior wrote: +module_init(arc4_init); +module_exit(arc4_exit); I'm feelings uneasy about using the same module init/exit functions names in arc4blk.c and arc4cip.c. Even though it doesn't

Re: [PATCH v2] crypto: add blkcipher implementation of ARC4

2010-04-07 Thread Herbert Xu
On Wed, Apr 07, 2010 at 10:23:00AM +0200, Sebastian Andrzej Siewior wrote: So arc4_setup_iv() should do what the internal arc4_ivsetup() does and we change void to int and check the keysize in there right? The problem here is that we are bounded to *this* implementation of the algorithm and

Re: [PATCH v2] crypto: add blkcipher implementation of ARC4

2010-04-07 Thread Pavel Roskin
On Wed, 2010-04-07 at 10:29 +0200, Sebastian Andrzej Siewior wrote: * Pavel Roskin | 2010-04-07 02:19:55 [-0400]: On Mon, 2010-04-05 at 19:04 +0200, Sebastian Andrzej Siewior wrote: +module_init(arc4_init); +module_exit(arc4_exit); I'm feelings uneasy about using the same module

Re: [PATCH v2] crypto: add blkcipher implementation of ARC4

2010-04-06 Thread Herbert Xu
On Mon, Apr 05, 2010 at 07:04:06PM +0200, Sebastian Andrzej Siewior wrote: +static void arc4_key_to_iv(const u8 *in_key, u32 key_len, struct arc4_iv *iv) +{ + int i, j = 0, k = 0; + + iv-iv.x = 1; + iv-iv.y = 0; + + for (i = 0; i 256; i++) + iv-iv.S[i] = i;

Re: [PATCH v2] crypto: add blkcipher implementation of ARC4

2010-04-06 Thread Sebastian Andrzej Siewior
* Herbert Xu | 2010-04-06 20:44:12 [+0800]: On Mon, Apr 05, 2010 at 07:04:06PM +0200, Sebastian Andrzej Siewior wrote: +static void arc4_key_to_iv(const u8 *in_key, u32 key_len, struct arc4_iv *iv) +{ +int i, j = 0, k = 0; + +iv-iv.x = 1; +iv-iv.y = 0; + +for (i = 0; i

Re: [PATCH v2] crypto: add blkcipher implementation of ARC4

2010-04-06 Thread Herbert Xu
On Tue, Apr 06, 2010 at 10:30:02PM +0200, Sebastian Andrzej Siewior wrote: Good point. All arc4 users don't care about return value of setkey so I think that I just change void to int add the check for the valid key length. Actually, how about getting arc4_setup_iv to do all the legwork and

[PATCH v2] crypto: add blkcipher implementation of ARC4

2010-04-05 Thread Sebastian Andrzej Siewior
This is a pure blkcipher implementation of ARC4. The internal state is saved within an IV which is supplied by the user. The goal is that the cipher does not change its internal state now, only the iv changes during encryption. Signed-off-by: Sebastian Andrzej Siewior sebast...@breakpoint.cc ---