Re: [PATCH v9 4/4] crypto: Add Allwinner Security System crypto accelerator

2015-06-03 Thread Corentin LABBE
Le 23/05/2015 16:35, Boris Brezillon a écrit : > Hi Corentin, > > On Sat, 23 May 2015 15:12:23 +0200 > Corentin LABBE wrote: > >> Le 17/05/2015 10:45, Boris Brezillon a écrit : >>> Hi Corentin, >>> >>> I started to review this new version, and I still think there's >>> something wrong with the

Re: [PATCH v9 4/4] crypto: Add Allwinner Security System crypto accelerator

2015-06-03 Thread Corentin LABBE
Le 23/05/2015 16:35, Boris Brezillon a écrit : Hi Corentin, On Sat, 23 May 2015 15:12:23 +0200 Corentin LABBE clabbe.montj...@gmail.com wrote: Le 17/05/2015 10:45, Boris Brezillon a écrit : Hi Corentin, I started to review this new version, and I still think there's something wrong

Re: [linux-sunxi] Re: [PATCH v9 4/4] crypto: Add Allwinner Security System crypto accelerator

2015-05-24 Thread Herbert Xu
On Sun, May 24, 2015 at 10:04:16AM +0200, Corentin LABBE wrote: > > For aes_cbc it exists a test with 3 SG with .tap = { 496 - 20, 4, 16 } > But my driver handle that. (multiple of 4) > > What do you think about adding a test with 16 SG of 1 byte ? (or 3 + 2 + 3 + > 8 * 1) Sure please send a

Re: [linux-sunxi] Re: [PATCH v9 4/4] crypto: Add Allwinner Security System crypto accelerator

2015-05-24 Thread Corentin LABBE
Le 24/05/2015 05:32, Herbert Xu a écrit : > On Sat, May 23, 2015 at 04:35:36PM +0200, Boris Brezillon wrote: >> >>> Since all SG I get was always a multiple of 16 (AES BLOCK SIZE) it was a >>> sort of confirmation. >>> >>> Herbert ? does am I right or a chunking test is missing for cbc(aes) in

Re: [linux-sunxi] Re: [PATCH v9 4/4] crypto: Add Allwinner Security System crypto accelerator

2015-05-24 Thread Corentin LABBE
Le 24/05/2015 05:32, Herbert Xu a écrit : On Sat, May 23, 2015 at 04:35:36PM +0200, Boris Brezillon wrote: Since all SG I get was always a multiple of 16 (AES BLOCK SIZE) it was a sort of confirmation. Herbert ? does am I right or a chunking test is missing for cbc(aes) in testmgr.h

Re: [linux-sunxi] Re: [PATCH v9 4/4] crypto: Add Allwinner Security System crypto accelerator

2015-05-24 Thread Herbert Xu
On Sun, May 24, 2015 at 10:04:16AM +0200, Corentin LABBE wrote: For aes_cbc it exists a test with 3 SG with .tap = { 496 - 20, 4, 16 } But my driver handle that. (multiple of 4) What do you think about adding a test with 16 SG of 1 byte ? (or 3 + 2 + 3 + 8 * 1) Sure please send a patch.

Re: [PATCH v9 4/4] crypto: Add Allwinner Security System crypto accelerator

2015-05-23 Thread Herbert Xu
On Sat, May 23, 2015 at 04:35:36PM +0200, Boris Brezillon wrote: > > > Since all SG I get was always a multiple of 16 (AES BLOCK SIZE) it was a > > sort of confirmation. > > > > Herbert ? does am I right or a chunking test is missing for cbc(aes) in > > testmgr.h > > Okay, just sharing my

Re: [linux-sunxi] Re: [PATCH v9 4/4] crypto: Add Allwinner Security System crypto accelerator

2015-05-23 Thread Herbert Xu
On Sat, May 23, 2015 at 02:18:06PM +0200, Corentin LABBE wrote: > > What do you think about adding a BUG_ON(in_atomic()) in > crypto_ablkcipher_setkey() ? Just add a might_sleep() to it. Thanks, -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key:

Re: [PATCH v9 4/4] crypto: Add Allwinner Security System crypto accelerator

2015-05-23 Thread Boris Brezillon
Hi Corentin, On Sat, 23 May 2015 15:12:23 +0200 Corentin LABBE wrote: > Le 17/05/2015 10:45, Boris Brezillon a écrit : > > Hi Corentin, > > > > I started to review this new version, and I still think there's > > something wrong with the way your processing crypto requests. > > From my POV this

Re: [PATCH v9 4/4] crypto: Add Allwinner Security System crypto accelerator

2015-05-23 Thread Corentin LABBE
Le 17/05/2015 10:45, Boris Brezillon a écrit : > Hi Corentin, > > I started to review this new version, and I still think there's > something wrong with the way your processing crypto requests. > From my POV this is not asynchronous at all (see my comments inline), > but maybe Herbert can confirm

Re: [linux-sunxi] Re: [PATCH v9 4/4] crypto: Add Allwinner Security System crypto accelerator

2015-05-23 Thread Corentin LABBE
Le 15/05/2015 08:49, Herbert Xu a écrit : > On Thu, May 14, 2015 at 02:59:01PM +0200, LABBE Corentin wrote: >> >> +err = crypto_ablkcipher_setkey(op->fallback, kkey, op->keylen); >> +if (err != 0) { >> +dev_err(ss->dev, "Cannot set key on fallback\n"); >> +return

Re: [PATCH v9 4/4] crypto: Add Allwinner Security System crypto accelerator

2015-05-23 Thread Corentin LABBE
Le 17/05/2015 10:45, Boris Brezillon a écrit : Hi Corentin, I started to review this new version, and I still think there's something wrong with the way your processing crypto requests. From my POV this is not asynchronous at all (see my comments inline), but maybe Herbert can confirm that.

Re: [linux-sunxi] Re: [PATCH v9 4/4] crypto: Add Allwinner Security System crypto accelerator

2015-05-23 Thread Corentin LABBE
Le 15/05/2015 08:49, Herbert Xu a écrit : On Thu, May 14, 2015 at 02:59:01PM +0200, LABBE Corentin wrote: +err = crypto_ablkcipher_setkey(op-fallback, kkey, op-keylen); +if (err != 0) { +dev_err(ss-dev, Cannot set key on fallback\n); +return -EINVAL; +}

Re: [PATCH v9 4/4] crypto: Add Allwinner Security System crypto accelerator

2015-05-23 Thread Boris Brezillon
Hi Corentin, On Sat, 23 May 2015 15:12:23 +0200 Corentin LABBE clabbe.montj...@gmail.com wrote: Le 17/05/2015 10:45, Boris Brezillon a écrit : Hi Corentin, I started to review this new version, and I still think there's something wrong with the way your processing crypto requests.

Re: [linux-sunxi] Re: [PATCH v9 4/4] crypto: Add Allwinner Security System crypto accelerator

2015-05-23 Thread Herbert Xu
On Sat, May 23, 2015 at 02:18:06PM +0200, Corentin LABBE wrote: What do you think about adding a BUG_ON(in_atomic()) in crypto_ablkcipher_setkey() ? Just add a might_sleep() to it. Thanks, -- Email: Herbert Xu herb...@gondor.apana.org.au Home Page: http://gondor.apana.org.au/~herbert/ PGP

Re: [PATCH v9 4/4] crypto: Add Allwinner Security System crypto accelerator

2015-05-23 Thread Herbert Xu
On Sat, May 23, 2015 at 04:35:36PM +0200, Boris Brezillon wrote: Since all SG I get was always a multiple of 16 (AES BLOCK SIZE) it was a sort of confirmation. Herbert ? does am I right or a chunking test is missing for cbc(aes) in testmgr.h Okay, just sharing my vision of this

Re: [PATCH v9 4/4] crypto: Add Allwinner Security System crypto accelerator

2015-05-18 Thread Herbert Xu
On Mon, May 18, 2015 at 09:24:49AM +0200, Boris Brezillon wrote: > > Okay, just to be sure, what does "Asynchronous" mean in ablkcipher or > ahash ? > Is it related to the fact that crypto operations can be done in > multiple steps (e.g.: one set_key + several encrypt chunk operations), > or is

Re: [PATCH v9 4/4] crypto: Add Allwinner Security System crypto accelerator

2015-05-18 Thread Boris Brezillon
Hi Herbert, On Mon, 18 May 2015 08:41:21 +0800 Herbert Xu wrote: > On Sun, May 17, 2015 at 12:48:11PM +0200, Boris Brezillon wrote: > > > > Yep, but then they shouldn't be declared with CRYPTO_ALG_ASYNC and as an not ^ > >

Re: [PATCH v9 4/4] crypto: Add Allwinner Security System crypto accelerator

2015-05-18 Thread Herbert Xu
On Mon, May 18, 2015 at 09:24:49AM +0200, Boris Brezillon wrote: Okay, just to be sure, what does Asynchronous mean in ablkcipher or ahash ? Is it related to the fact that crypto operations can be done in multiple steps (e.g.: one set_key + several encrypt chunk operations), or is this

Re: [PATCH v9 4/4] crypto: Add Allwinner Security System crypto accelerator

2015-05-18 Thread Boris Brezillon
Hi Herbert, On Mon, 18 May 2015 08:41:21 +0800 Herbert Xu herb...@gondor.apana.org.au wrote: On Sun, May 17, 2015 at 12:48:11PM +0200, Boris Brezillon wrote: Yep, but then they shouldn't be declared with CRYPTO_ALG_ASYNC and as an

Re: [PATCH v9 4/4] crypto: Add Allwinner Security System crypto accelerator

2015-05-17 Thread Herbert Xu
On Sun, May 17, 2015 at 12:48:11PM +0200, Boris Brezillon wrote: > > Yep, but then they shouldn't be declared with CRYPTO_ALG_ASYNC and as an > ablkcipher algorithm (*Asynchronous* Block Cipher), right ? Right. They can still use ablkcipher but should clear the ASYNC bit. Cheers, -- Email:

Re: [PATCH v9 4/4] crypto: Add Allwinner Security System crypto accelerator

2015-05-17 Thread Boris Brezillon
Hi Herbert, On Sun, 17 May 2015 18:34:40 +0800 Herbert Xu wrote: > On Sun, May 17, 2015 at 10:45:08AM +0200, Boris Brezillon wrote: > > > > From my POV this is not asynchronous at all (see my comments inline), > > but maybe Herbert can confirm that. > > Well we don't actually require drivers

Re: [PATCH v9 4/4] crypto: Add Allwinner Security System crypto accelerator

2015-05-17 Thread Herbert Xu
On Sun, May 17, 2015 at 10:45:08AM +0200, Boris Brezillon wrote: > > From my POV this is not asynchronous at all (see my comments inline), > but maybe Herbert can confirm that. Well we don't actually require drivers to be asynchronous. It is obviously the preferred method but some hardware may

Re: [PATCH v9 4/4] crypto: Add Allwinner Security System crypto accelerator

2015-05-17 Thread Boris Brezillon
Hi Corentin, I started to review this new version, and I still think there's something wrong with the way your processing crypto requests. >From my POV this is not asynchronous at all (see my comments inline), but maybe Herbert can confirm that. I haven't reviewed the hash part yet, but I guess

Re: [PATCH v9 4/4] crypto: Add Allwinner Security System crypto accelerator

2015-05-17 Thread Boris Brezillon
Hi Corentin, I started to review this new version, and I still think there's something wrong with the way your processing crypto requests. From my POV this is not asynchronous at all (see my comments inline), but maybe Herbert can confirm that. I haven't reviewed the hash part yet, but I guess it

Re: [PATCH v9 4/4] crypto: Add Allwinner Security System crypto accelerator

2015-05-17 Thread Herbert Xu
On Sun, May 17, 2015 at 12:48:11PM +0200, Boris Brezillon wrote: Yep, but then they shouldn't be declared with CRYPTO_ALG_ASYNC and as an ablkcipher algorithm (*Asynchronous* Block Cipher), right ? Right. They can still use ablkcipher but should clear the ASYNC bit. Cheers, -- Email:

Re: [PATCH v9 4/4] crypto: Add Allwinner Security System crypto accelerator

2015-05-17 Thread Herbert Xu
On Sun, May 17, 2015 at 10:45:08AM +0200, Boris Brezillon wrote: From my POV this is not asynchronous at all (see my comments inline), but maybe Herbert can confirm that. Well we don't actually require drivers to be asynchronous. It is obviously the preferred method but some hardware may not

Re: [PATCH v9 4/4] crypto: Add Allwinner Security System crypto accelerator

2015-05-17 Thread Boris Brezillon
Hi Herbert, On Sun, 17 May 2015 18:34:40 +0800 Herbert Xu herb...@gondor.apana.org.au wrote: On Sun, May 17, 2015 at 10:45:08AM +0200, Boris Brezillon wrote: From my POV this is not asynchronous at all (see my comments inline), but maybe Herbert can confirm that. Well we don't actually

Re: [linux-sunxi] Re: [PATCH v9 4/4] crypto: Add Allwinner Security System crypto accelerator

2015-05-16 Thread Herbert Xu
On Sat, May 16, 2015 at 08:09:27PM +0200, Corentin LABBE wrote: > > Incidental question, I need to use the MD5 IV for export_md5 function, but > they are not defined anywhere (unlike SHAxx ones), does this is voluntary or > do you will accept a patch for adding them. Please send a patch to add

Re: [linux-sunxi] Re: [PATCH v9 4/4] crypto: Add Allwinner Security System crypto accelerator

2015-05-16 Thread Corentin LABBE
Le 15/05/2015 08:52, Herbert Xu a écrit : > On Thu, May 14, 2015 at 02:59:01PM +0200, LABBE Corentin wrote: >> >> +int sun4i_hash_export(struct ahash_request *areq, void *out) >> +{ >> +struct sun4i_req_ctx *op = ahash_request_ctx(areq); >> + >> +memcpy(out, op, sizeof(struct

Re: [linux-sunxi] Re: [PATCH v9 4/4] crypto: Add Allwinner Security System crypto accelerator

2015-05-16 Thread Corentin LABBE
Le 15/05/2015 08:52, Herbert Xu a écrit : On Thu, May 14, 2015 at 02:59:01PM +0200, LABBE Corentin wrote: +int sun4i_hash_export(struct ahash_request *areq, void *out) +{ +struct sun4i_req_ctx *op = ahash_request_ctx(areq); + +memcpy(out, op, sizeof(struct sun4i_req_ctx)); +

Re: [linux-sunxi] Re: [PATCH v9 4/4] crypto: Add Allwinner Security System crypto accelerator

2015-05-16 Thread Herbert Xu
On Sat, May 16, 2015 at 08:09:27PM +0200, Corentin LABBE wrote: Incidental question, I need to use the MD5 IV for export_md5 function, but they are not defined anywhere (unlike SHAxx ones), does this is voluntary or do you will accept a patch for adding them. Please send a patch to add

Re: [PATCH v9 4/4] crypto: Add Allwinner Security System crypto accelerator

2015-05-15 Thread Herbert Xu
On Thu, May 14, 2015 at 02:59:01PM +0200, LABBE Corentin wrote: > > +int sun4i_hash_export(struct ahash_request *areq, void *out) > +{ > + struct sun4i_req_ctx *op = ahash_request_ctx(areq); > + > + memcpy(out, op, sizeof(struct sun4i_req_ctx)); > + return 0; > +} > + > +int

Re: [PATCH v9 4/4] crypto: Add Allwinner Security System crypto accelerator

2015-05-15 Thread Herbert Xu
On Thu, May 14, 2015 at 02:59:01PM +0200, LABBE Corentin wrote: > > + err = crypto_ablkcipher_setkey(op->fallback, kkey, op->keylen); > + if (err != 0) { > + dev_err(ss->dev, "Cannot set key on fallback\n"); > + return -EINVAL; > + } You cannot call setkey from

Re: [PATCH v9 4/4] crypto: Add Allwinner Security System crypto accelerator

2015-05-15 Thread Herbert Xu
On Thu, May 14, 2015 at 02:59:01PM +0200, LABBE Corentin wrote: + err = crypto_ablkcipher_setkey(op-fallback, kkey, op-keylen); + if (err != 0) { + dev_err(ss-dev, Cannot set key on fallback\n); + return -EINVAL; + } You cannot call setkey from an atomic

Re: [PATCH v9 4/4] crypto: Add Allwinner Security System crypto accelerator

2015-05-15 Thread Herbert Xu
On Thu, May 14, 2015 at 02:59:01PM +0200, LABBE Corentin wrote: +int sun4i_hash_export(struct ahash_request *areq, void *out) +{ + struct sun4i_req_ctx *op = ahash_request_ctx(areq); + + memcpy(out, op, sizeof(struct sun4i_req_ctx)); + return 0; +} + +int

[PATCH v9 4/4] crypto: Add Allwinner Security System crypto accelerator

2015-05-14 Thread LABBE Corentin
Add support for the Security System included in Allwinner SoC A20. The Security System is a hardware cryptographic accelerator that support: - MD5 and SHA1 hash algorithms - AES block cipher in CBC/ECB mode with 128/196/256bits keys. - DES and 3DES block cipher in CBC/ECB mode Signed-off-by:

[PATCH v9 4/4] crypto: Add Allwinner Security System crypto accelerator

2015-05-14 Thread LABBE Corentin
Add support for the Security System included in Allwinner SoC A20. The Security System is a hardware cryptographic accelerator that support: - MD5 and SHA1 hash algorithms - AES block cipher in CBC/ECB mode with 128/196/256bits keys. - DES and 3DES block cipher in CBC/ECB mode Signed-off-by: