Re: IV copy strategy

2007-11-26 Thread Sebastian Siewior
* Herbert Xu | 2007-11-16 10:08:51 [+0800]: >On Thu, Nov 15, 2007 at 10:10:05PM +0100, Sebastian Siewior wrote: >> >> In this case, the s390 has the same bug (they copy the IV back after >> blkcipher_walk_done()). Howevere it will probably never get triggered >> because they have an aligment of 0

Re: IV copy strategy

2007-11-20 Thread Evgeniy Polyakov
On Mon, Nov 19, 2007 at 07:56:55PM +0800, Herbert Xu ([EMAIL PROTECTED]) wrote: > > I'm not sure what user will do, when it request chaining, but driver > > will set CRYPTO_ALG_CIPHER_NOCHAIN itself and return wrong/old in > > req->info? > > For IPsec it is not an issue though, but I can not say th

Re: IV copy strategy

2007-11-19 Thread Herbert Xu
On Mon, Nov 19, 2007 at 01:38:41PM +0300, Evgeniy Polyakov wrote: > > > Users requiring chaining would then do > > > > crypto_alloc_blkcipher("foo", 0, CRYPTO_ALG_CIPHER_NOCHAIN) > > Hmm, users who want chaining will set flag _NOCHAIN :) > I would call it something more informative... Yes I

Re: IV copy strategy

2007-11-19 Thread Evgeniy Polyakov
On Sun, Nov 18, 2007 at 02:52:37PM +0800, Herbert Xu ([EMAIL PROTECTED]) wrote: > On Fri, Nov 16, 2007 at 02:11:10PM +0300, Evgeniy Polyakov wrote: > > > > That's a question - should it copy IV back or not? > > Currently it is not required by crypto users. > > OK I've changed my mind :) > > The r

Re: IV copy strategy

2007-11-17 Thread Herbert Xu
On Sun, Nov 18, 2007 at 02:52:37PM +0800, Herbert Xu wrote: > > So my plan is to add a new flag, CRYPTO_ALG_CIPHER_NOCHAIN that > you would set on algorithms that cannot be chained. The semantics > is that everything else remains the same except that on encrypt > calls, the req->info after complet

Re: IV copy strategy

2007-11-17 Thread Herbert Xu
On Fri, Nov 16, 2007 at 02:11:10PM +0300, Evgeniy Polyakov wrote: > > That's a question - should it copy IV back or not? > Currently it is not required by crypto users. OK I've changed my mind :) The reason is CTR, or rather the CTR as used by IPsec. CTR itself should be able to chain, in fact o

Re: IV copy strategy

2007-11-16 Thread Herbert Xu
On Fri, Nov 16, 2007 at 02:42:24PM +0300, Evgeniy Polyakov wrote: > > > Actually on second thought why don't we change the interface > > for ablkcipher so that we allow the IV to be returned by either > > copying it to req->info or replacing the req->info pointer? > > Better copy I think, since ot

Re: IV copy strategy

2007-11-16 Thread Evgeniy Polyakov
On Fri, Nov 16, 2007 at 07:25:30PM +0800, Herbert Xu ([EMAIL PROTECTED]) wrote: > On Fri, Nov 16, 2007 at 02:11:10PM +0300, Evgeniy Polyakov wrote: > > > > That's a question - should it copy IV back or not? > > Currently it is not required by crypto users. > > Well currently we have exactly one cr

Re: IV copy strategy

2007-11-16 Thread Herbert Xu
On Fri, Nov 16, 2007 at 02:11:10PM +0300, Evgeniy Polyakov wrote: > > That's a question - should it copy IV back or not? > Currently it is not required by crypto users. Well currently we have exactly one crypto user of ablkcipher in the tree, and that's tcrypt :) However, looking at the sync cryp

Re: IV copy strategy

2007-11-16 Thread Evgeniy Polyakov
On Fri, Nov 16, 2007 at 10:08:51AM +0800, Herbert Xu ([EMAIL PROTECTED]) wrote: > > So a general question: Is it a must (requirement by the crypto API) to > > copy the IV back or not? I guess not if we move completely to async (one > > day) :) > > You must copy it back to allow chaining. Even whe

Re: IV copy strategy

2007-11-16 Thread Herbert Xu
On Fri, Nov 16, 2007 at 09:19:13AM +0100, Sebastian Siewior wrote: > Not only in hfin. My SPU-AES has the same bug. Do you know someone who > wants to chain? I can remember that you said once "that this is > currently the case but we can change this since IPsec brings a new IV > for ever packet". >

Re: IV copy strategy

2007-11-16 Thread Sebastian Siewior
* Herbert Xu | 2007-11-16 10:08:51 [+0800]: >You must copy it back to allow chaining. Even when we go async >someone may wish to chain. So in that sense you've just found a >bug in the hifn driver :) Not only in hfin. My SPU-AES has the same bug. Do you know someone who wants to chain? I can rem

Re: IV copy strategy

2007-11-15 Thread Herbert Xu
On Thu, Nov 15, 2007 at 10:10:05PM +0100, Sebastian Siewior wrote: > > In this case, the s390 has the same bug (they copy the IV back after > blkcipher_walk_done()). Howevere it will probably never get triggered > because they have an aligment of 0 (what gets pushed to 3 by the crypto > API if I re

Re: IV copy strategy

2007-11-15 Thread Sebastian Siewior
* Herbert Xu | 2007-11-14 22:22:53 [+0800]: >Indeed the last call to blkcipher_walk_done will free the IV if >we had to copy it due to an alignment mismatch. Since geode has >an alignment of 16 bytes, that's almost a given. Ach >You could copy from/to desc->info instead which would solve the >pr

Re: IV copy strategy

2007-11-14 Thread Herbert Xu
On Wed, Nov 14, 2007 at 12:11:32AM +0100, Sebastian Siewior wrote: > > and everything goes back to normal. I checked walk.iv and it doesn't > change, it is still the same pointer. Do you free the walk.iv in the > meantime or is there another BUG I don't see? The IV length is 16 bytes. > Currently