Re: [PATCH 1/1]: Revised CTR mode implementation

2007-10-11 Thread Herbert Xu
On Wed, Oct 10, 2007 at 11:08:26AM -0500, Joy Latten wrote: > > This patch implements CTR mode for IPsec. > It is based off of RFC 3686. Thanks! I've just applied it to cryptodev-2.6 and will push it out soon. Cheers, -- Visit Openswan at http://www.openswan.org/ Email: Herbert Xu ~{PmV>HI~} <[E

Re: [PATCH 1/1]: Revised CTR mode implementation

2007-10-10 Thread Joy Latten
On Wed, 2007-10-10 at 23:17 +0800, Herbert Xu wrote: > On Tue, Oct 09, 2007 at 02:44:40PM -0500, Joy Latten wrote: > > This should contain the geniv as well as all the > > improvements discussed. All the testcases pass. > > This looks pretty good! > > I'm going to apply this once I fix up the gen

Re: [PATCH 1/1]: Revised CTR mode implementation

2007-10-10 Thread Joy Latten
On Wed, 2007-10-10 at 23:17 +0800, Herbert Xu wrote: > On Tue, Oct 09, 2007 at 02:44:40PM -0500, Joy Latten wrote: > > This should contain the geniv as well as all the > > improvements discussed. All the testcases pass. > > This looks pretty good! > > I'm going to apply this once I fix up the gen

Re: [PATCH 1/1]: Revised CTR mode implementation

2007-10-10 Thread Herbert Xu
On Tue, Oct 09, 2007 at 02:44:40PM -0500, Joy Latten wrote: > This should contain the geniv as well as all the > improvements discussed. All the testcases pass. This looks pretty good! I'm going to apply this once I fix up the geniv problems found by Sebastian. BTW, could you please send me a fi

Re: [PATCH 1/1]: Revised CTR mode implementation

2007-10-09 Thread Joy Latten
This should contain the geniv as well as all the improvements discussed. All the testcases pass. Regards, Joy diff -urpN linux-2.6.22.aead/crypto/ctr.c linux-2.6.22.aead.patch/crypto/ctr.c --- linux-2.6.22.aead/crypto/ctr.c 1969-12-31 18:00:00.0 -0600 +++ linux-2.6.22.aead.patch/cryp

Re: [PATCH 1/1]: Revised CTR mode implementation

2007-10-04 Thread Herbert Xu
On Wed, Oct 03, 2007 at 06:17:08PM -0500, Joy Latten wrote: > > Since the last block of data to CTR may be a partial block, I changed > the following in crypto_ctr_crypt_segment(), Good catch. In that case we can probably merge in_place and _segment into one function. > while (walk.nbytes) { >

Re: [PATCH 1/1]: Revised CTR mode implementation

2007-10-03 Thread Herbert Xu
On Wed, Oct 03, 2007 at 03:43:58PM -0500, Joy Latten wrote: > On Wed, 2007-10-03 at 18:28 +0800, Herbert Xu wrote: > > On Wed, Oct 03, 2007 at 06:21:49PM +0800, Herbert Xu wrote: > > > > > static void __ctr_inc_byte(u8 *a, int size) > > > { > > > __be8 *b = (__be8 *)(a + size); > > > u8 c; > >

Re: [PATCH 1/1]: Revised CTR mode implementation

2007-10-03 Thread Joy Latten
On Wed, 2007-10-03 at 18:21 +0800, Herbert Xu wrote: > We can't assume that the counter block is always 16 bytes > since that depends on the underlying block size. It's probably > easiest if the caller computes the correct counter position and > gives that to us. > > BTW, it isn't that hard to su

Re: [PATCH 1/1]: Revised CTR mode implementation

2007-10-03 Thread Joy Latten
On Wed, 2007-10-03 at 18:28 +0800, Herbert Xu wrote: > On Wed, Oct 03, 2007 at 06:21:49PM +0800, Herbert Xu wrote: > > > static void __ctr_inc_byte(u8 *a, int size) > > { > > __be8 *b = (__be8 *)(a + size); > > u8 c; > > > > do { > > c = be8_to_cpu(*--b) + 1; > >

Re: [PATCH 1/1]: Revised CTR mode implementation

2007-10-03 Thread Herbert Xu
On Wed, Oct 03, 2007 at 06:21:49PM +0800, Herbert Xu wrote: > static void __ctr_inc_byte(u8 *a, int size) > { > __be8 *b = (__be8 *)(a + size); > u8 c; > > do { > c = be8_to_cpu(*--b) + 1; > *b = cpu_to_be8(c); > if (c) >

Re: [PATCH 1/1]: Revised CTR mode implementation

2007-10-03 Thread Herbert Xu
Hi Joy: On Tue, Oct 02, 2007 at 12:47:09AM -0500, Joy Latten wrote: > > So, the correct way to say it is that my plaintext should be > multiple of cipher's blocksize, not CTR's blocksize? It won't be. CTR is a stream cipher which means that it can deal with any plain text without padding it to

Re: [PATCH 1/1]: Revised CTR mode implementation

2007-10-01 Thread Joy Latten
>On Thu, Sep 27, 2007 at 03:54:51PM -0500, Joy Latten wrote: >> >>So, for example, >> >> ctr(aes,4,8) >> >>specifies the counter block will be composed of 4 bytes from a >>nonce and 8 bytes from the IV and 4 bytes for counter, which is set. > >Could you please add a check

Re: [PATCH 1/1]: Revised CTR mode implementation

2007-09-29 Thread Herbert Xu
On Thu, Sep 27, 2007 at 03:54:51PM -0500, Joy Latten wrote: > >So, for example, > > ctr(aes,4,8) > >specifies the counter block will be composed of 4 bytes from a >nonce and 8 bytes from the IV and 4 bytes for counter, which is set. Could you please add a check to verif

[PATCH 1/1]: Revised CTR mode implementation

2007-09-27 Thread Joy Latten
This patch implements CTR mode for IPSec and includes improvements pointed out in review. It is based off of RFC 3686. Please note: 1. The CTR mode counterblock is composed of, nonce + IV + counter. The size of counterblock is equivalent to the blocksize of the cipher.