Re: [PATCH v5 05/14] crypto: marvell/CESA: add TDMA support

2015-06-17 Thread Boris Brezillon
On Wed, 17 Jun 2015 13:56:33 +0800 Herbert Xu wrote: > On Wed, Jun 17, 2015 at 01:05:27PM +0800, Herbert Xu wrote: > > On Tue, Jun 16, 2015 at 11:58:59AM +0200, Boris Brezillon wrote: > > > > > > + ret = dma_map_sg(cesa_dev->dev, req->src, creq->src_nents, > > > + DMA_TO_DEVICE);

Re: [PATCH v5 04/14] crypto: add a new driver for Marvell's CESA

2015-06-17 Thread Boris Brezillon
On Wed, 17 Jun 2015 13:58:24 +0800 Herbert Xu wrote: > On Tue, Jun 16, 2015 at 11:58:58AM +0200, Boris Brezillon wrote: > > > > +config CRYPTO_DEV_MARVELL_CESA > > + tristate "New Marvell's Cryptographic Engine driver" > > + depends on (PLAT_ORION || ARCH_MVEBU || COMPILE_TEST) && HAS_DMA &&

Re: [PATCH v5 05/14] crypto: marvell/CESA: add TDMA support

2015-06-17 Thread Herbert Xu
On Wed, Jun 17, 2015 at 09:15:03AM +0200, Boris Brezillon wrote: > > Anyway, now I'm doing the following test: > > if (creq->src_nents && !ret) > return -ENOMEM; Best not call dma_map_sg at all in the !src_nents case as I think some architectures will WARN or BUG if you give it a zero-lengt

Re: [PATCH RFC 06/11] crypto: caam - Enable MXC devices to select CAAM driver in Kconfig

2015-06-17 Thread Steffen Trumtrar
On Mon, Jun 15, 2015 at 04:52:54PM -0700, Victoria Milhoan wrote: > From: Steve Cornelius > > Allow CAAM to be selected in the kernel for Freescale i.MX6 devices if > ARCH_MXC is enabled. > > Signed-off-by: Steve Cornelius > Signed-off-by: Victoria Milhoan > --- > drivers/crypto/caam/Kconfig

Re: [PATCH v5 05/14] crypto: marvell/CESA: add TDMA support

2015-06-17 Thread Boris Brezillon
On Wed, 17 Jun 2015 15:18:29 +0800 Herbert Xu wrote: > On Wed, Jun 17, 2015 at 09:15:03AM +0200, Boris Brezillon wrote: > > > > Anyway, now I'm doing the following test: > > > > if (creq->src_nents && !ret) > > return -ENOMEM; > > Best not call dma_map_sg at all in the !src_nents case as I

Re: [PATCH RFC 05/11] crypto: caam - Add cache coherency support to Freescale CAAM scatterlist implementation

2015-06-17 Thread Steffen Trumtrar
On Mon, Jun 15, 2015 at 04:52:53PM -0700, Victoria Milhoan wrote: > Add cache coherency support to the CAAM scatterlist implementation. > > Signed-off-by: Victoria Milhoan > --- > drivers/crypto/caam/sg_sw_sec4.h | 12 ++-- > 1 file changed, 10 insertions(+), 2 deletions(-) > > diff --g

[PATCH v6 00/14] crypto: add a new driver for Marvell's CESA

2015-06-17 Thread Boris Brezillon
Hello, This patch series adds a new driver supporting Marvell's CESA IP. This driver addresses some limitations of the existing one. >From a performance and CPU load point of view the most important limitation in the existing driver is the lack of DMA support, thus preventing us from chaining cryp

[PATCH v6 12/14] crypto: marvell/CESA: add support for Orion SoCs

2015-06-17 Thread Boris Brezillon
Add the Orion SoC description, and select this implementation by default to support non-DT probing: Orion is the only platform where non-DT boards are declaring the CESA block. Control the allhwsupport module parameter to avoid probing the CESA IP when the old CESA driver is enabled (unless it is

[PATCH v6 01/14] crypto: mv_cesa: document the clocks property

2015-06-17 Thread Boris Brezillon
On Dove platforms, the crypto engine requires a clock. Document this clocks property in the mv_cesa bindings doc. Signed-off-by: Boris Brezillon --- Documentation/devicetree/bindings/crypto/mv_cesa.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/devicetree/bindings/crypto

[PATCH v6 03/14] crypto: mv_cesa: explicitly define kirkwood and dove compatible strings

2015-06-17 Thread Boris Brezillon
We are about to add a new driver to support new features like using the TDMA engine to offload the CPU. Orion, Dove and Kirkwood platforms are already using the mv_cesa driver, but Orion SoCs do not embed the TDMA engine, which means we will have to differentiate them if we want to get TDMA support

[PATCH v6 05/14] crypto: marvell/CESA: add TDMA support

2015-06-17 Thread Boris Brezillon
The CESA IP supports CPU offload through a dedicated DMA engine (TDMA) which can control the crypto block. When you use this mode, all the required data (operation metadata and payload data) are transferred using DMA, and the results are retrieved through DMA when possible (hash results are not ret

[PATCH v6 11/14] crypto: marvell/CESA: add allhwsupport module parameter

2015-06-17 Thread Boris Brezillon
The old and new marvell CESA drivers both support Orion and Kirkwood SoCs. Add a module parameter to choose whether these SoCs should be attached to the new or the old driver. The default policy is to keep attaching those IPs to the old driver if it is enabled, until we decide the new CESA driver

[PATCH v6 13/14] crypto: marvell/CESA: add support for Kirkwood and Dove SoCs

2015-06-17 Thread Boris Brezillon
From: Arnaud Ebalard Add the Kirkwood and Dove SoC descriptions, and control the allhwsupport module parameter to avoid probing the CESA IP when the old CESA driver is enabled (unless it is explicitly requested to do so). Signed-off-by: Arnaud Ebalard Signed-off-by: Boris Brezillon --- driver

[PATCH v6 14/14] crypto: marvell/CESA: add DT bindings documentation

2015-06-17 Thread Boris Brezillon
Add DT bindings documentation for the new marvell-cesa driver. Signed-off-by: Boris Brezillon --- .../devicetree/bindings/crypto/marvell-cesa.txt| 45 ++ 1 file changed, 45 insertions(+) create mode 100644 Documentation/devicetree/bindings/crypto/marvell-cesa.txt diff -

[PATCH v6 10/14] crypto: marvell/CESA: add support for all armada SoCs

2015-06-17 Thread Boris Brezillon
Add CESA IP description for all the missing armada SoCs (XP, 375 and 38x). Signed-off-by: Boris Brezillon --- drivers/crypto/marvell/cesa.c | 12 1 file changed, 12 insertions(+) diff --git a/drivers/crypto/marvell/cesa.c b/drivers/crypto/marvell/cesa.c index 9c43cd7e..af590bf 1006

[PATCH v6 07/14] crypto: marvell/CESA: add Triple-DES support

2015-06-17 Thread Boris Brezillon
From: Arnaud Ebalard Add support for Triple-DES operations. Signed-off-by: Arnaud Ebalard Signed-off-by: Boris Brezillon --- drivers/crypto/marvell/cesa.c | 2 + drivers/crypto/marvell/cesa.h | 2 + drivers/crypto/marvell/cipher.c | 147 3 file

[PATCH v6 06/14] crypto: marvell/CESA: add DES support

2015-06-17 Thread Boris Brezillon
Add support for DES operations. Signed-off-by: Boris Brezillon Signed-off-by: Arnaud Ebalard --- drivers/crypto/marvell/cesa.c | 2 + drivers/crypto/marvell/cesa.h | 2 + drivers/crypto/marvell/cipher.c | 150 3 files changed, 154 insertions(+)

[PATCH v6 09/14] crypto: marvell/CESA: add SHA256 support

2015-06-17 Thread Boris Brezillon
From: Arnaud Ebalard Add support for SHA256 operations. Signed-off-by: Arnaud Ebalard Signed-off-by: Boris Brezillon --- drivers/crypto/marvell/cesa.c | 2 + drivers/crypto/marvell/cesa.h | 2 + drivers/crypto/marvell/hash.c | 159 ++ 3 files change

[PATCH v6 02/14] crypto: mv_cesa: use gen_pool to reserve the SRAM memory region

2015-06-17 Thread Boris Brezillon
The mv_cesa driver currently expects the SRAM memory region to be passed as a platform device resource. This approach implies two drawbacks: - the DT representation is wrong - the only one that can access the SRAM is the crypto engine The last point is particularly annoying in some cases: for exa

[PATCH v6 08/14] crypto: marvell/CESA: add MD5 support

2015-06-17 Thread Boris Brezillon
From: Arnaud Ebalard Add support for MD5 operations. Signed-off-by: Arnaud Ebalard Signed-off-by: Boris Brezillon --- drivers/crypto/marvell/cesa.c | 2 + drivers/crypto/marvell/cesa.h | 2 + drivers/crypto/marvell/hash.c | 172 +- 3 files changed,

[PATCH v6 04/14] crypto: add a new driver for Marvell's CESA

2015-06-17 Thread Boris Brezillon
The existing mv_cesa driver supports some features of the CESA IP but is quite limited, and reworking it to support new features (like involving the TDMA engine to offload the CPU) is almost impossible. This driver has been rewritten from scratch to take those new features into account. This commi

Re: [PATCH RFC 01/11] crypto: caam - Add cache coherency support

2015-06-17 Thread Steffen Trumtrar
On Mon, Jun 15, 2015 at 04:52:49PM -0700, Victoria Milhoan wrote: > Freescale i.MX6 ARM platforms do not support hardware cache coherency. This > patch adds cache coherency support to the CAAM driver. > > Signed-off-by: Victoria Milhoan > --- > drivers/crypto/caam/caamhash.c | 28

Re: [PATCH 0/3] crypto: picoxcell - Clamp AEAD SG list by input length

2015-06-17 Thread Jamie Iles
On Thu, Jun 11, 2015 at 11:27:03AM +0800, Herbert Xu wrote: > Hi: > > This series of patches adds a couple of minor fixes to picoxcell, > but most importantly allows it to be used with the new AEAD interface > by ensuring that it clamps the AD SG list by the AD length. > > This is compile-tested

Re: [PATCH] crypto: poly1305 - Pass key as first two message blocks to each desc_ctx

2015-06-17 Thread Herbert Xu
On Tue, Jun 16, 2015 at 11:34:16AM +0200, Martin Willi wrote: > The Poly1305 authenticator requires a unique key for each generated tag. This > implies that we can't set the key per tfm, as multiple users set individual > keys. Instead we pass a desc specific key as the first two blocks of the > me

Re: [PATCH RFC v7 0/3] crypto: Introduce Public Key Encryption API

2015-06-17 Thread Herbert Xu
On Tue, Jun 16, 2015 at 10:30:50AM -0700, Tadeusz Struk wrote: > This patch set introduces a Public Key Encryption API. > What is proposed is a new crypto type called crypto_akcipher_type, > plus new struct akcipher_alg and struct crypto_akcipher, together with number > of helper functions to regis

Re: [PATCH v6 05/14] crypto: marvell/CESA: add TDMA support

2015-06-17 Thread Herbert Xu
On Wed, Jun 17, 2015 at 09:45:33AM +0200, Boris Brezillon wrote: > > + ret = dma_map_sg(cesa_dev->dev, req->src, creq->src_nents, > + DMA_TO_DEVICE); > + if (!ret) > + return -ENOMEM; > + > + creq->src_nents = ret; DMA-API-HOWTO says that you must retai

Re: [PATCH v6 05/14] crypto: marvell/CESA: add TDMA support

2015-06-17 Thread Boris Brezillon
On Wed, 17 Jun 2015 17:50:01 +0800 Herbert Xu wrote: > On Wed, Jun 17, 2015 at 09:45:33AM +0200, Boris Brezillon wrote: > > > > + ret = dma_map_sg(cesa_dev->dev, req->src, creq->src_nents, > > +DMA_TO_DEVICE); > > + if (!ret) > > + return -ENOMEM; > > + > > + c

Re: [PATCH v6 05/14] crypto: marvell/CESA: add TDMA support

2015-06-17 Thread Herbert Xu
On Wed, Jun 17, 2015 at 01:33:24PM +0200, Boris Brezillon wrote: > > Actually, I think I don't need to save the dma_map_sg return val, since > I'm using the sg_next function to iterate over the scatterlist. Am I > right ? > IOW, is the ->map_sg() function (in dma_map_ops) supposed to merge the > co

[PATCH v7 05/14] crypto: marvell/CESA: add TDMA support

2015-06-17 Thread Boris Brezillon
The CESA IP supports CPU offload through a dedicated DMA engine (TDMA) which can control the crypto block. When you use this mode, all the required data (operation metadata and payload data) are transferred using DMA, and the results are retrieved through DMA when possible (hash results are not ret

Re: [PATCH] crypto: caam - fix non-64-bit write/read access

2015-06-17 Thread Victoria Milhoan
On Tue, 16 Jun 2015 12:59:07 +0200 Steffen Trumtrar wrote: > The patch > > crypto: caam - Add definition of rd/wr_reg64 for little endian platform > > added support for little endian platforms to the CAAM driver. Namely a > write and read function for 64 bit registers. > The only user of

Re: [PATCH v7 05/14] crypto: marvell/CESA: add TDMA support

2015-06-17 Thread Herbert Xu
On Wed, Jun 17, 2015 at 03:32:02PM +0200, Boris Brezillon wrote: > > Hi Herbert, > > I send you this patch alone so that you can verify I'm now properly > manipulating the SG list. Once I have your confirmation I'll send > the whole series again and annoy all the people in Cc one more time > ;-).

Re: [PATCH v7 05/14] crypto: marvell/CESA: add TDMA support

2015-06-17 Thread Boris Brezillon
On Wed, 17 Jun 2015 23:08:08 +0800 Herbert Xu wrote: > On Wed, Jun 17, 2015 at 03:32:02PM +0200, Boris Brezillon wrote: > > > > Hi Herbert, > > > > I send you this patch alone so that you can verify I'm now properly > > manipulating the SG list. Once I have your confirmation I'll send > > the wh

Re: [PATCH v7 05/14] crypto: marvell/CESA: add TDMA support

2015-06-17 Thread Boris Brezillon
On Wed, 17 Jun 2015 17:34:02 +0200 Boris Brezillon wrote: > On Wed, 17 Jun 2015 23:08:08 +0800 > Herbert Xu wrote: > > > On Wed, Jun 17, 2015 at 03:32:02PM +0200, Boris Brezillon wrote: > > > > > > Hi Herbert, > > > > > > I send you this patch alone so that you can verify I'm now properly > >

Re: [PATCH RFC v7 0/3] crypto: Introduce Public Key Encryption API

2015-06-17 Thread Tadeusz Struk
On 06/17/2015 02:14 AM, Herbert Xu wrote: >> This patch set introduces a Public Key Encryption API. >> > What is proposed is a new crypto type called crypto_akcipher_type, >> > plus new struct akcipher_alg and struct crypto_akcipher, together with >> > number >> > of helper functions to register a

Re: [v2 PATCH 6/8] crypto: caam - Convert GCM to new AEAD interface

2015-06-17 Thread Horia Geantă
On 6/16/2015 8:54 AM, Herbert Xu wrote: > This patch converts the caam GCM implementations to the new AEAD > interface. This is compile-tested only. > > Note that all IV generation for GCM algorithms have been removed. > The reason is that the current generation uses purely random IVs > which is

Re: [PATCH v5 06/14] crypto: marvell/CESA: add DES support

2015-06-17 Thread Sandy Harris
On Tue, Jun 16, 2015 at 5:59 AM, Boris Brezillon wrote: > Add support for DES operations. Why on Earth should we do that? DES is demonstrably insecure. The only possible excuse for allowing it anywhere in a modern code base is that you need it to implement triple DES, and even that should by now

Re: [PATCH v7 05/14] crypto: marvell/CESA: add TDMA support

2015-06-17 Thread Herbert Xu
On Wed, Jun 17, 2015 at 05:34:02PM +0200, Boris Brezillon wrote: > > I can check for that too, but note that it doesn't prevent one from > providing different scatterlist structures pointing to the same memory > region. Pointing to the same memory should be fine, it's the act of passing the same S

Re: [PATCH v7 05/14] crypto: marvell/CESA: add TDMA support

2015-06-17 Thread Herbert Xu
On Wed, Jun 17, 2015 at 05:58:28PM +0200, Boris Brezillon wrote: > > Here is an incremental patch [1], please let me know if something else > is missing. Looks good. Thanks! -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.

Crypto Fixes for 4.1

2015-06-17 Thread Herbert Xu
Hi Linus: This push fixes the following issues: 1) Crash in caam hash due to uninitialised buffer lengths. 2) Alignment issue in caam RNG that may lead to non-random output. Please pull from git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6.git Steve Cornelius (2): crypto

[PATCH 0/2] crypto: aead - Fix aead_instance memory overrun

2015-06-17 Thread Herbert Xu
Hi: I just noticed that the code for struct aead_instance allocation is wrong. The problem is that struct aead_instance doesn't contain the full amount of space required. For ahash/shash this is dealt with by calculating the size by adding head space to the size of struct crypto_instance. Unfor

[PATCH 1/2] crypto: api - Add CRYPTO_MINALIGN_ATTR to struct crypto_alg

2015-06-17 Thread Herbert Xu
The struct crypto_alg is embedded into various type-specific structs such as aead_alg. This is then used as part of instances such as struct aead_instance. It is also embedded into the generic struct crypto_instance. In order to ensure that struct aead_instance can be converted to struct crypto_

[PATCH 2/2] crypto: aead - Fix aead_instance struct size

2015-06-17 Thread Herbert Xu
The struct aead_instance is meant to extend struct crypto_instance by incorporating the extra members of struct aead_alg. However, the current layout which is copied from shash/ahash does not specify the struct fully. In particular only aead_alg is present. For shash/ahash this works because use

Re: [v2 PATCH 6/8] crypto: caam - Convert GCM to new AEAD interface

2015-06-17 Thread Herbert Xu
On Wed, Jun 17, 2015 at 08:02:30PM +0300, Horia Geantă wrote: > > > > -#define DESC_MAX_USED_BYTES(DESC_RFC4543_GIVENC_LEN + \ > > -CAAM_MAX_KEY_SIZE) > > -#define DESC_MAX_USED_LEN (DESC_MAX_USED_BYTES / CAAM_CMD_SZ) > > +#define DESC_

[PATCH 2/2] crypto: caam - Set last bit on src SG list

2015-06-17 Thread Herbert Xu
The new aead_edesc_alloc left out the bit indicating the last entry on the source SG list. This patch fixes it. Signed-off-by: Herbert Xu --- drivers/crypto/caam/caamalg.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/crypto/caam/caamalg.c b/drivers/crypto/caam

[PATCH 1/2] crypto: caam - Reintroduce DESC_MAX_USED_BYTES

2015-06-17 Thread Herbert Xu
I incorrectly removed DESC_MAX_USED_BYTES when enlarging the size of the shared descriptor buffers, thus making it four times larger than what is necessary. This patch restores the division by four calculation. Signed-off-by: Herbert Xu --- drivers/crypto/caam/caamalg.c |3 ++- 1 file chan

Re: [PATCH] crypto: caam - fix non-64-bit write/read access

2015-06-17 Thread Herbert Xu
On Tue, Jun 16, 2015 at 12:59:07PM +0200, Steffen Trumtrar wrote: > The patch > > crypto: caam - Add definition of rd/wr_reg64 for little endian platform > > added support for little endian platforms to the CAAM driver. Namely a > write and read function for 64 bit registers. > The only use

Re: [PATCH v6 06/14] crypto: marvell/CESA: add DES support

2015-06-17 Thread Boris Brezillon
Hi Herbert, On Wed, 17 Jun 2015 09:45:34 +0200 Boris Brezillon wrote: > Add support for DES operations. The addition of DES support seems controversial. At first I thought it would be good to support all the algorithms supported by the CESA engine, but I think I'll drop it in the next iteration