Re: [PATCH v2] crypto: add key wrapping block chaining mode

2015-04-27 Thread Herbert Xu
On Tue, Apr 28, 2015 at 04:35:57AM +0200, Stephan Mueller wrote: > > In this case, shouldn't we just have a loop where: > > 1. from the given endpoint, we go a semiblock back > > 2. now we see how many bytes we get when fetching the SG list till the end, > > 3a. if answer from 2 is semiblock or

Re: [PATCH v2] crypto: add key wrapping block chaining mode

2015-04-27 Thread Stephan Mueller
Am Dienstag, 28. April 2015, 09:10:47 schrieb Herbert Xu: Hi Herbert, > On Mon, Apr 27, 2015 at 04:34:19PM +0200, Stephan Mueller wrote: > > Why do you think that will not work? I thought that the code works when > > the > > non-linear scatterlists are at least broken at an 8 byte boundary. > >

Re: [PATCH v2] crypto: add key wrapping block chaining mode

2015-04-27 Thread Herbert Xu
On Mon, Apr 27, 2015 at 04:58:51PM +0200, Stephan Mueller wrote: > > This memcmp implies that the final block->A from the decrypt is memcpy'ed to > req->creq.info. I wanted to avoid any additional memcpy calls to not hurt > performance even more. I was hoping to directly use req->creq.info in th

Re: [PATCH v2] crypto: add key wrapping block chaining mode

2015-04-27 Thread Herbert Xu
On Mon, Apr 27, 2015 at 04:34:19PM +0200, Stephan Mueller wrote: > > Why do you think that will not work? I thought that the code works when the > non-linear scatterlists are at least broken at an 8 byte boundary. There is no guarantee that SG lists are set at 8-byte boundaries. In fact, you need

Re: [PATCH v2] crypto: add key wrapping block chaining mode

2015-04-27 Thread Stephan Mueller
Am Montag, 27. April 2015, 16:29:35 schrieb Herbert Xu: Hi Herbert, >On Sun, Apr 26, 2015 at 12:08:20AM +0200, Stephan Mueller wrote: >> This patch implements the AES key wrapping as specified in >> NIST SP800-38F and RFC3394. > >This is my attempt at turning kw into a givcipher. The encrypt >pa

Re: [PATCH v2] crypto: add key wrapping block chaining mode

2015-04-27 Thread Stephan Mueller
Am Montag, 27. April 2015, 16:26:07 schrieb Herbert Xu: Hi Herbert, >On Sun, Apr 26, 2015 at 12:08:20AM +0200, Stephan Mueller wrote: >> +/* >> + * Point to the end of the scatterlists to walk them backwards. >> + */ >> +src_walk.offset += src_nbyt

Re: [PATCH v2] crypto: add key wrapping block chaining mode

2015-04-27 Thread Herbert Xu
On Sun, Apr 26, 2015 at 12:08:20AM +0200, Stephan Mueller wrote: > This patch implements the AES key wrapping as specified in > NIST SP800-38F and RFC3394. This is my attempt at turning kw into a givcipher. The encrypt part is complete but untested as I gave up after finding the reverse SG proble

Re: [PATCH v2] crypto: add key wrapping block chaining mode

2015-04-27 Thread Herbert Xu
On Sun, Apr 26, 2015 at 12:08:20AM +0200, Stephan Mueller wrote: > > + /* > + * Point to the end of the scatterlists to walk them backwards. > + */ > + src_walk.offset += src_nbytes; > + dst_walk.offset += dst_nbytes; This doesn't work.