[PATCH v3] crypto: omap-aes: Add support for GCM mode

2015-09-15 Thread Lokesh Vutla
OMAP AES hw supports AES-GCM mode. Adding support for GCM and RFC4106 GCM mode in omap-aes driver. Signed-off-by: Lokesh Vutla <lokeshvu...@ti.com> --- Tested on BeagleBone-Black: http://pastebin.ubuntu.com/12417512/ Changes since v1: - Addressed comments by Herbert. Previously poste

Re: [PATCH v2 6/7] crypto: omap-aes: Add support for GCM mode

2015-07-10 Thread Lokesh Vutla
Hi Herbert, On Wednesday 08 July 2015 09:48 AM, Herbert Xu wrote: On Tue, Jul 07, 2015 at 09:01:48PM +0530, Lokesh Vutla wrote: +static int omap_aes_gcm_copy_buffers(struct omap_aes_dev *dd, + struct aead_request *req) [..snip..] +static int do_encrypt_iv

Re: [PATCH v2 6/7] crypto: omap-aes: Add support for GCM mode

2015-07-08 Thread Lokesh Vutla
On Wednesday 08 July 2015 01:23 PM, Herbert Xu wrote: On Wed, Jul 08, 2015 at 03:48:05PM +0800, Herbert Xu wrote: On Wed, Jul 08, 2015 at 12:29:47PM +0530, Lokesh Vutla wrote: + if (req-assoclen + req-cryptlen == 0) { + scatterwalk_map_and_copy(ctx-auth_tag, req-dst, 0, authlen

Re: [PATCH v2 6/7] crypto: omap-aes: Add support for GCM mode

2015-07-08 Thread Lokesh Vutla
On Wednesday 08 July 2015 01:18 PM, Herbert Xu wrote: On Wed, Jul 08, 2015 at 12:29:47PM +0530, Lokesh Vutla wrote: + if (req-assoclen + req-cryptlen == 0) { + scatterwalk_map_and_copy(ctx-auth_tag, req-dst, 0, authlen, + 1); + return 0

Re: [PATCH v2 6/7] crypto: omap-aes: Add support for GCM mode

2015-07-08 Thread Lokesh Vutla
On Wednesday 08 July 2015 09:48 AM, Herbert Xu wrote: On Tue, Jul 07, 2015 at 09:01:48PM +0530, Lokesh Vutla wrote: +static int omap_aes_gcm_copy_buffers(struct omap_aes_dev *dd, + struct aead_request *req) +{ +void *buf_in; +int pages, alen, clen

Re: [PATCH v2 5/7] crypto: aead: Add aead_request_cast() api

2015-07-08 Thread Lokesh Vutla
On Wednesday 08 July 2015 09:26 AM, Herbert Xu wrote: On Tue, Jul 07, 2015 at 09:01:47PM +0530, Lokesh Vutla wrote: Add aead_request_cast() api to get pointer to aead_request from cryto_async_request. Signed-off-by: Lokesh Vutla lokeshvu...@ti.com --- include/crypto/internal/aead.h | 6

[PATCH v2 0/7] crypto: omap-aes: Add support for GCM mode

2015-07-07 Thread Lokesh Vutla
This series does some basic cleanup and adds support for AES GCM mode for omap aes driver. Changes since v1: - Switched GCM to new AEAD interface Lokesh Vutla (7): crypto: omap-aes: Fix CTR mode crypto: omap-aes: Increase priority of hw accelerator crypto: omap-aes: Fix configuring of AES

[PATCH v2 3/7] crypto: omap-aes: Fix configuring of AES mode

2015-07-07 Thread Lokesh Vutla
AES_CTRL_REG is used to configure AES mode. Before configuring any mode we need to make sure all other modes are reset or else driver will misbehave. So mask all modes before configuring any AES mode. Signed-off-by: Lokesh Vutla lokeshvu...@ti.com --- drivers/crypto/omap-aes.c | 13

[PATCH v2 7/7] crypto: tcrypt: Fix AEAD speed tests

2015-07-07 Thread Lokesh Vutla
The AEAD speed tests doesn't do a wait_for_completition, if the return value is EINPROGRESS or EBUSY. Fixing it here. Also add a test case for gcm(aes). Signed-off-by: Lokesh Vutla lokeshvu...@ti.com --- crypto/tcrypt.c | 65 ++--- 1 file

[PATCH v2 1/7] crypto: omap-aes: Fix CTR mode

2015-07-07 Thread Lokesh Vutla
is not aligned with AES_BLOCK_SIZE. Adding support for omap-aes driver for inputs with length not aligned with AES_BLOCK_SIZE. Signed-off-by: Lokesh Vutla lokeshvu...@ti.com --- drivers/crypto/omap-aes.c | 33 - 1 file changed, 16 insertions(+), 17 deletions(-) diff

[PATCH v2 2/7] crypto: omap-aes: Increase priority of hw accelerator

2015-07-07 Thread Lokesh Vutla
Increasing the priority of omap-aes hw algos, in order to take precedence over sw algos. Signed-off-by: Lokesh Vutla lokeshvu...@ti.com --- drivers/crypto/omap-aes.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/crypto/omap-aes.c b/drivers/crypto/omap-aes.c

[PATCH v2 5/7] crypto: aead: Add aead_request_cast() api

2015-07-07 Thread Lokesh Vutla
Add aead_request_cast() api to get pointer to aead_request from cryto_async_request. Signed-off-by: Lokesh Vutla lokeshvu...@ti.com --- include/crypto/internal/aead.h | 6 ++ 1 file changed, 6 insertions(+) diff --git a/include/crypto/internal/aead.h b/include/crypto/internal/aead.h index

[PATCH v2 4/7] crypto: omap-aes: Use BIT() macro

2015-07-07 Thread Lokesh Vutla
Use BIT()/GENMASK() macros for all register definitions instead of hand-writing bit masks. Signed-off-by: Lokesh Vutla lokeshvu...@ti.com --- drivers/crypto/omap-aes.c | 34 +- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/drivers/crypto/omap

[PATCH v2 6/7] crypto: omap-aes: Add support for GCM mode

2015-07-07 Thread Lokesh Vutla
OMAP AES hw supports AES-GCM mode. Adding support for GCM mode in omap-aes driver. Signed-off-by: Lokesh Vutla lokeshvu...@ti.com --- drivers/crypto/Kconfig| 1 + drivers/crypto/Makefile | 3 +- drivers/crypto/omap-aes-gcm.c | 376

Re: [PATCH 08/10] crypto: omap-aes: gmc: Add algo info

2015-07-06 Thread Lokesh Vutla
Hi, On Monday 06 July 2015 01:05 PM, Herbert Xu wrote: On Thu, Jul 02, 2015 at 10:48:38AM +0530, Lokesh Vutla wrote: Now the driver supports gcm mode, add omap-aes-gcm algo info to omap-aes driver. Signed-off-by: Lokesh Vutla lokeshvu...@ti.com You're using the old AEAD interface. We

Re: [PATCH 05/10] crypto: omap-aes: Add support for GCM mode

2015-07-02 Thread Lokesh Vutla
On Thursday 02 July 2015 01:34 PM, Felipe Balbi wrote: On Thu, Jul 02, 2015 at 10:48:35AM +0530, Lokesh Vutla wrote: OMAP AES hw supports aes gcm mode. here you refer to it as 'gcm' Will update it in next revision. Adding support for GCM mode in omap-aes driver. while here

Re: [PATCH 06/10] crypto: omap-aes: gcm: Handle inputs properly

2015-07-02 Thread Lokesh Vutla
On Thursday 02 July 2015 01:34 PM, Felipe Balbi wrote: On Thu, Jul 02, 2015 at 10:48:36AM +0530, Lokesh Vutla wrote: Its not necessary that assoc data and plain text is passed always. Add these checks before processing the input. Signed-off-by: Lokesh Vutla lokeshvu...@ti.com why can't

Re: [PATCH 02/10] crypto: omap-aes: Fix configuring of AES mode

2015-07-02 Thread Lokesh Vutla
On Thursday 02 July 2015 01:27 PM, Felipe Balbi wrote: On Thu, Jul 02, 2015 at 10:48:32AM +0530, Lokesh Vutla wrote: AES_CTRL_REG is used to configure AES mode. Before configuring any mode we need to make sure all other modes are reset or else driver will misbehave. So mask all modes before

Re: [PATCH 03/10] crypto: aead: Add aead_request_cast() api

2015-07-02 Thread Lokesh Vutla
On Thursday 02 July 2015 01:28 PM, Felipe Balbi wrote: On Thu, Jul 02, 2015 at 10:48:33AM +0530, Lokesh Vutla wrote: Add aead_request_cast() api to get pointer to aead_request from cryto_async_request. Signed-off-by: Lokesh Vutla lokeshvu...@ti.com --- include/linux/crypto.h |6

Re: [PATCH 08/10] crypto: omap-aes: gmc: Add algo info

2015-07-02 Thread Lokesh Vutla
On Thursday 02 July 2015 01:30 PM, Stephan Mueller wrote: Am Donnerstag, 2. Juli 2015, 10:48:38 schrieb Lokesh Vutla: Hi Lokesh, Now the driver supports gcm mode, add omap-aes-gcm algo info to omap-aes driver. Signed-off-by: Lokesh Vutla lokeshvu...@ti.com --- drivers/crypto/omap-aes.c

Re: [PATCH 09/10] crypto: omap-aes: gcm: Add support for PIO mode

2015-07-02 Thread Lokesh Vutla
On Thursday 02 July 2015 01:36 PM, Felipe Balbi wrote: On Thu, Jul 02, 2015 at 10:48:39AM +0530, Lokesh Vutla wrote: Add support for PIO mode for GCM mode. Signed-off-by: Lokesh Vutla lokeshvu...@ti.com why do you require PIO ? Is there any situation where DMA can't be used? What would

Re: [PATCH 01/10] crypto: omap-aes: Add support for lengths not aligned with AES_BLOCK_SIZE

2015-07-02 Thread Lokesh Vutla
On Thursday 02 July 2015 01:23 PM, Felipe Balbi wrote: On Thu, Jul 02, 2015 at 10:48:31AM +0530, Lokesh Vutla wrote: OMAP AES driver returns an error if the data is not aligned with AES_BLOCK_SIZE bytes. But OMAP AES hw allows data input upto 1 byte aligned, but still zeros are to be appended

[PATCH] crypto: omap-des: Fix unmapping of dma channels

2015-07-02 Thread Lokesh Vutla
) [4.328500] [c004a840] (irq_exit) from [c000f9ac] (handle_IRQ+0x50/0xb0) [4.335589] [c000f9ac] (handle_IRQ) from [c0008688] (gic_handle_irq+0x28/0x5c) Removing the duplicate call to dma_unmap_sg(). Reported-by: Tomi Valkeinen tomi.valkei...@ti.com Signed-off-by: Lokesh Vutla lokeshvu...@ti.com

[PATCH 05/10] crypto: omap-aes: Add support for GCM mode

2015-07-01 Thread Lokesh Vutla
OMAP AES hw supports aes gcm mode. Adding support for GCM mode in omap-aes driver. Signed-off-by: Lokesh Vutla lokeshvu...@ti.com --- drivers/crypto/Makefile |3 +- drivers/crypto/omap-aes-gcm.c | 304 + drivers/crypto/omap-aes.c | 238

[PATCH 10/10] crypto: tcrypt: Added speed tests for Async AEAD crypto alogrithms

2015-07-01 Thread Lokesh Vutla
Adding simple speed tests for a range of block sizes for Async AEAD crypto algorithms. Signed-off-by: Lokesh Vutla lokeshvu...@ti.com --- crypto/tcrypt.c | 233 +++ crypto/tcrypt.h |1 + 2 files changed, 234 insertions(+) diff --git

[PATCH 03/10] crypto: aead: Add aead_request_cast() api

2015-07-01 Thread Lokesh Vutla
Add aead_request_cast() api to get pointer to aead_request from cryto_async_request. Signed-off-by: Lokesh Vutla lokeshvu...@ti.com --- include/linux/crypto.h |6 ++ 1 file changed, 6 insertions(+) diff --git a/include/linux/crypto.h b/include/linux/crypto.h index 10df5d2..20fac3d

[PATCH 08/10] crypto: omap-aes: gmc: Add algo info

2015-07-01 Thread Lokesh Vutla
Now the driver supports gcm mode, add omap-aes-gcm algo info to omap-aes driver. Signed-off-by: Lokesh Vutla lokeshvu...@ti.com --- drivers/crypto/omap-aes.c | 22 ++ 1 file changed, 22 insertions(+) diff --git a/drivers/crypto/omap-aes.c b/drivers/crypto/omap-aes.c index

[PATCH 01/10] crypto: omap-aes: Add support for lengths not aligned with AES_BLOCK_SIZE

2015-07-01 Thread Lokesh Vutla
for inputs not aligned with AES_BLOCK_SIZE. Signed-off-by: Lokesh Vutla lokeshvu...@ti.com --- drivers/crypto/omap-aes.c | 33 - 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/drivers/crypto/omap-aes.c b/drivers/crypto/omap-aes.c index 9a28b7e..a923101

[PATCH 04/10] crypto: omap-aes: Use BIT() macro

2015-07-01 Thread Lokesh Vutla
Use BIT()/GENMASK() macros for all register definitions instead of hand-writing bit masks. Signed-off-by: Lokesh Vutla lokeshvu...@ti.com --- drivers/crypto/omap-aes.c | 36 ++-- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/drivers/crypto/omap

[PATCH 07/10] crypto: omap-aes: gcm: Add support for unaligned lengths

2015-07-01 Thread Lokesh Vutla
Check if the inputs are not aligned, if not process the input before starting the hw acceleration. Similarly after completition of hw acceleration. Signed-off-by: Lokesh Vutla lokeshvu...@ti.com --- drivers/crypto/omap-aes-gcm.c | 82 + 1 file changed

[PATCH 06/10] crypto: omap-aes: gcm: Handle inputs properly

2015-07-01 Thread Lokesh Vutla
Its not necessary that assoc data and plain text is passed always. Add these checks before processing the input. Signed-off-by: Lokesh Vutla lokeshvu...@ti.com --- drivers/crypto/omap-aes-gcm.c | 26 -- 1 file changed, 20 insertions(+), 6 deletions(-) diff --git

[PATCH 09/10] crypto: omap-aes: gcm: Add support for PIO mode

2015-07-01 Thread Lokesh Vutla
Add support for PIO mode for GCM mode. Signed-off-by: Lokesh Vutla lokeshvu...@ti.com --- drivers/crypto/omap-aes-gcm.c | 10 ++ drivers/crypto/omap-aes.c | 24 ++-- drivers/crypto/omap-aes.h |3 ++- 3 files changed, 26 insertions(+), 11 deletions

[PATCH 02/10] crypto: omap-aes: Fix configuring of AES mode

2015-07-01 Thread Lokesh Vutla
AES_CTRL_REG is used to configure AES mode. Before configuring any mode we need to make sure all other modes are reset or else driver will misbehave. So mask all modes before configuring any AES mode. Signed-off-by: Lokesh Vutla lokeshvu...@ti.com --- drivers/crypto/omap-aes.c | 13

[PATCH 00/10] crypto: omap-aes: Add support for GCM mode

2015-07-01 Thread Lokesh Vutla
This series does some basic cleanup and adds support for AES GCM mode for omap aes driver. Also adds a test case for async aead algos. Tested on BeagelBoneBlack: http://pastebin.ubuntu.com/11808341/ Lokesh Vutla (10): crypto: omap-aes: Add support for lengths not aligned

[PATCH v2] crypto: omap-sham: Add the offset of sg page to vaddr

2015-04-02 Thread Lokesh Vutla
-by: Lokesh Vutla lokeshvu...@ti.com --- - Tested on BBB. Logs below. Without this patch: http://pastebin.ubuntu.com/10722994/ With this patch: http://pastebin.ubuntu.com/10722992/ drivers/crypto/omap-sham.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/crypto/omap-sham.c b

Re: [PATCH] crypto: omap-sham: Check for HIGHMEM before mapping SG pages

2015-04-02 Thread Lokesh Vutla
Hi Herbert, On Wednesday 01 April 2015 07:48 PM, Herbert Xu wrote: On Tue, Mar 31, 2015 at 09:52:23AM +0530, Lokesh Vutla wrote: Commit 26a05489ee0e (crypto: omap-sham - Map SG pages if they are HIGHMEM before accessing) says that HIGHMEM pages may not be mapped so we must kmap them before

[PATCH] crypto: omap-sham: Check for HIGHMEM before mapping SG pages

2015-03-30 Thread Lokesh Vutla
if they are HIGHMEM before accessing) Signed-off-by: Lokesh Vutla lokeshvu...@ti.com --- drivers/crypto/omap-sham.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/omap-sham.c b/drivers/crypto/omap-sham.c index 3c76696..ace5852 100644 --- a/drivers/crypto/omap

[PATCH] crypto: omap-aes: Fix support for unequal lengths

2015-03-30 Thread Lokesh Vutla
a single element SG list for this buffer with length as the total bytes to crypt, which is similar thing that is done in case of unaligned lengths. Fixes: 6242332ff2f3 (crypto: omap-aes - Add support for cases of unaligned lengths) Signed-off-by: Lokesh Vutla lokeshvu...@ti.com --- drivers/crypto

[PATCH] crypto: omap-sham: Use pm_runtime_irq_safe()

2015-03-30 Thread Lokesh Vutla
: scheduling while atomic: kworker/0:2/2676/0x0100 Add pm_runtime_irq_safe() to avoid this. Signed-off-by: Lokesh Vutla lokeshvu...@ti.com --- drivers/crypto/omap-sham.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/crypto/omap-sham.c b/drivers/crypto/omap-sham.c index ace5852..81ed511

Re: [PATCH v3] omap-rng: Change RNG_CONFIG_REG to RNG_CONTROL_REG when, checking and disabling TRNG

2015-03-22 Thread Lokesh Vutla
of entropy generated. Yes you are correct. Patch looks good to me. It should be RNG_CONTROL_REG Acked-by: Lokesh Vutla lokeshvu...@ti.com Thanks and regards, Lokesh Apart from the strange logic, I have reason to suspect that the OMAP4 related code in this driver is driving an Inside Secure IP

Re: [PATCH v2 04/14] crypto: omap-aes: Simplify DMA usage by using direct SGs

2013-08-20 Thread Lokesh Vutla
Hi Joel, On Sunday 18 August 2013 08:12 AM, Joel Fernandes wrote: In early version of this driver, assumptions were made such as DMA layer requires contiguous buffers etc. Due to this, new buffers were allocated, mapped and used for DMA. These assumptions are no longer true and DMAEngine

[PATCH 1/2] crypto: omap-sham: Enable Polling mode if DMA fails

2013-08-20 Thread Lokesh Vutla
the state machine looks like: - if input buffer 9 : use fallback driver - else if input buffer block size : Copy input buffer into data_in regs - else if dma enabled: use dma transfer else use cpu polling mode. Signed-off-by: Lokesh Vutla lokeshvu...@ti.com --- drivers/crypto/omap

[PATCH 0/2] crypto: omap-sham: Misc updates for driver

2013-08-20 Thread Lokesh Vutla
This patch series updates the following for the driver: - Enable polling mode if DMA fails. - Correct the DMA burst size. Lokesh Vutla (2): crypto: omap-sham: Enable Polling mode if DMA fails crypto: omap-sham: correct dma burst size drivers/crypto/omap-sham.c | 72

[PATCH 2/2] crypto: omap-sham: correct dma burst size

2013-08-20 Thread Lokesh Vutla
Each cycle of SHA512 operates on 32 data words where as SHA256 operates on 16 data words. This needs to be updated while configuring DMA channels. Doing the same. Signed-off-by: Lokesh Vutla lokeshvu...@ti.com --- drivers/crypto/omap-sham.c | 11 --- 1 file changed, 4 insertions(+), 7

Re: [PATCH] hwrng: reorder OMAP TRNG driver code

2013-08-20 Thread Lokesh Vutla
it is grouped with its operations struct, which for the omap4 case means also under the #ifdef CONFIG_OF, where it needs to be. Missed testing this. Thanks for the patch. Reviewed-by: Lokesh Vutla lokeshvu...@ti.com Regards, Lokesh Signed-off-by: Olof Johansson o...@lixom.net Cc: Lokesh Vutla lokeshvu

[PATCH 5/6] ARM: OMAP2+: Only manually add hwmod data when DT not used.

2013-08-05 Thread Lokesh Vutla
The omap_init_rng() routine in devices.c only needs to be called when there is no device tree present. Cc: Tony Lindgren t...@atomide.com Signed-off-by: Lokesh Vutla lokeshvu...@ti.com --- arch/arm/mach-omap2/devices.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch

[PATCH 4/6] hwrng: OMAP: Add device tree support

2013-08-05 Thread Lokesh Vutla
Add Device Tree suport to the omap-rng driver. Currently, only support for OMAP2 and OMAP3 is being added but support for OMAP4 and OMAP5 will be added in a subsequent patch. Signed-off-by: Lokesh Vutla lokeshvu...@ti.com --- drivers/char/hw_random/omap-rng.c | 12 1 file changed

[PATCH 1/6] hwrng: OMAP: Use module_platform_driver macro

2013-08-05 Thread Lokesh Vutla
module_platform_driver() makes the code simpler. Using the macro in the driver. Signed-off-by: Lokesh Vutla lokeshvu...@ti.com --- drivers/char/hw_random/omap-rng.c | 18 ++ 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/drivers/char/hw_random/omap-rng.c b

[PATCH 6/6] hwrng: OMAP: Add OMAP4 TRNG support

2013-08-05 Thread Lokesh Vutla
routine pointers, register offsets. OMAP2 specific routines are prefixed with 'omap2_' and OMAP4 specific routines are prefixed with 'omap4_'. Note: Few Hard coded values are from the TI AM33xx SDK. Signed-off-by: Lokesh Vutla lokeshvu...@ti.com --- drivers/char/hw_random/Kconfig|6 +- drivers

[PATCH 0/4] crypto: omap-sham: Add support for SHA384/SHA512 for OMAP5/AM43xx Soc's

2013-07-26 Thread Lokesh Vutla
This patch series adds support for SHA348 and SHA512 in addition to MD5, SHA1, SHA224 SHA256 that the omap sha module supports. Also adding the pdata for OMAP5 and AM43xx Soc's. And using devm_* calls to make cleanup paths simpler. Lokesh Vutla (4): crypto: omap-sham: Add SHA384 and SHA512

[PATCH 1/4] crypto: omap-sham: Add SHA384 and SHA512 Support

2013-07-26 Thread Lokesh Vutla
info. Signed-off-by: Lokesh Vutla lokeshvu...@ti.com --- drivers/crypto/Kconfig | 11 +- drivers/crypto/omap-sham.c | 245 2 files changed, 209 insertions(+), 47 deletions(-) diff --git a/drivers/crypto/Kconfig b/drivers/crypto/Kconfig index

[PATCH 3/4] crypto: omap-sham: Convert to devm_request_irq()

2013-07-26 Thread Lokesh Vutla
Using devm_request_irq() rather than request_irq(). So removing free_irq() calls from the probe error path and the remove handler. Signed-off-by: Lokesh Vutla lokeshvu...@ti.com --- drivers/crypto/omap-sham.c | 12 +--- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git

[PATCH 4/4] crypto: omap-sham: Convert to devm_kzalloc()

2013-07-26 Thread Lokesh Vutla
Use devm_kzalloc() to make cleanup paths simpler. Signed-off-by: Lokesh Vutla lokeshvu...@ti.com --- drivers/crypto/omap-sham.c | 15 +-- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/crypto/omap-sham.c b/drivers/crypto/omap-sham.c index b82b140..ae1ca8b2