[PATCH v3 19/27] staging: ccree: do not map bufs in ahash_init

2018-01-07 Thread Gilad Ben-Yossef
API op. This also properly deals with hash_import() not knowing if hash_init was called or not as it now no longer matters. Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> --- drivers/staging/ccree/ssi_hash.c | 192 +-- 1 file changed, 103 insertions(

[PATCH v3 22/27] staging: ccree: put pointer next to var name

2018-01-07 Thread Gilad Ben-Yossef
Put pointer next to var name as per coding style. Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> --- drivers/staging/ccree/ssi_request_mgr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/ccree/ssi_request_mgr.c b/drivers/staging

[PATCH v3 23/27] stating: ccree: fix allocation of void sized buf

2018-01-07 Thread Gilad Ben-Yossef
We were allocating buffers using sizeof(*struct->field) where field was type void. Fix it by having a local variable with the real type. Cc: sta...@vger.kernel.org Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> --- drivers/staging/ccree/ssi_ivgen.c| 9 - drivers/stag

[PATCH v3 01/27] staging: ccree: SPDXify driver

2018-01-07 Thread Gilad Ben-Yossef
Replace verbatim GPL v2 copy with SPDX tag. Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> --- drivers/staging/ccree/Kconfig| 2 ++ drivers/staging/ccree/Makefile | 2 ++ drivers/staging/ccree/cc_crypto_ctx.h| 17 ++--- drivers/staging

[PATCH v3 14/27] staging: ccree: handle end of sg list gracefully

2018-01-07 Thread Gilad Ben-Yossef
If we are asked for number of entries of an offset bigger than the sg list we should not crash. Cc: sta...@vger.kernel.org Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> --- drivers/staging/ccree/ssi_buffer_mgr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/d

[PATCH v3 18/27] staging: ccree: allocate hash bufs inside req ctx

2018-01-07 Thread Gilad Ben-Yossef
Move to allocating the buffers needed for requests as part of the request structure instead of malloc'ing each one on it's own, making for simpler (and more efficient) code. Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> --- drivers/staging/ccree/ssi_hash.

[PATCH v3 10/27] staging: ccree: add backlog processing

2018-01-07 Thread Gilad Ben-Yossef
Crypto API tfm providers are required to provide a backlog service, if so indicated, that queues up requests in the case of the provider being busy and processing them later. The ccree driver did not provide this facility. Add it now. Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.

[PATCH v3 12/27] staging: ccree: failing the suspend is not an error

2018-01-07 Thread Gilad Ben-Yossef
PM suspend returning a none zero value is not an error. It simply indicates a suspend is not advised right now so don't treat it as an error. Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> --- drivers/staging/ccree/ssi_request_mgr.c | 8 +--- 1 file changed, 1 insertion

[PATCH v3 17/27] staging: ccree: use array for double buffer

2018-01-07 Thread Gilad Ben-Yossef
The ccree hash code is using a double buffer to hold data for processing but manages the buffers and their associated data count in two separate fields and uses a predicate to chose which to use. Move to using a proper 2 members array for a much cleaner code. Signed-off-by: Gilad Ben-Yossef <

[PATCH v3 15/27] staging: ccree: use Makefile to include PM code

2018-01-07 Thread Gilad Ben-Yossef
Replace ugly ifdefs with some inline macros and Makefile magic for optionally including power management related code for better readability. Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> --- drivers/staging/ccree/Makefile | 3 ++- drivers/staging/ccree/ssi_pm.c

[PATCH v3 13/27] staging: ccree: check DMA pool buf !NULL before free

2018-01-07 Thread Gilad Ben-Yossef
If we ran out of DMA pool buffers, we get into the unmap code path with a NULL before. Deal with this by checking the virtual mapping is not NULL. Cc: sta...@vger.kernel.org Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> --- drivers/staging/ccree/ssi_buffer_mgr.c | 3 ++- 1 file c

[PATCH v3 11/27] stating: ccree: revert "staging: ccree: fix leak of import() after init()"

2018-01-07 Thread Gilad Ben-Yossef
me at the time. Cc: sta...@vger.kernel.org Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> --- drivers/staging/ccree/ssi_hash.c | 11 --- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/staging/ccree/ssi_hash.c b/drivers/staging/ccree/ssi_hash.c ind

[PATCH v3 21/27] staging: ccree: fold common code into service func

2018-01-07 Thread Gilad Ben-Yossef
Fold common code in hash call into service functions. Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> --- drivers/staging/ccree/ssi_hash.c | 339 ++- 1 file changed, 116 insertions(+), 223 deletions(-) diff --git a/drivers/staging/ccree/ssi_ha

[PATCH v3 16/27] staging: ccree: remove unused field

2018-01-07 Thread Gilad Ben-Yossef
Remove unused struct field. Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> --- drivers/staging/ccree/ssi_hash.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/ccree/ssi_hash.c b/drivers/staging/ccree/ssi_hash.c index ee7370c..efea792 100644 --- a/drivers/staging

[PATCH v3 07/27] staging: ccree: tag debugfs init/exit func properly

2018-01-07 Thread Gilad Ben-Yossef
The debugfs global init and exit functions were missing __init and __exit tags, potentially wasting memory. Fix it by properly tagging them. Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> --- drivers/staging/ccree/cc_debugfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 del

[PATCH v3 04/27] staging: ccree: remove GFP_DMA flag from mem allocs

2018-01-07 Thread Gilad Ben-Yossef
Remove bogus GFP_DMA flag from memory allocations. ccree driver does not operate over an ISA or similar limited bus. Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> --- drivers/staging/ccree/ssi_cipher.c | 2 +- drivers/staging/ccree/ssi_hash.c | 15 ++- 2 files chan

[PATCH v3 02/27] staging: ccree: fold hash defs into queue defs

2018-01-07 Thread Gilad Ben-Yossef
Fold the two remaining enum in hash defs into the queue defs that are using them and delete the hash defs include file. Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> --- drivers/staging/ccree/cc_hw_queue_defs.h | 13 + drivers/staging/ccree/hash_defs.h

[PATCH v3 08/27] staging: ccree: remove unused leftover field

2018-01-07 Thread Gilad Ben-Yossef
Remove the unused monitor_desc field. Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> --- drivers/staging/ccree/ssi_request_mgr.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/ccree/ssi_request_mgr.c b/drivers/staging/ccree/ssi_request_mgr.c index 7686e14..e

[PATCH v3 06/27] staging: ccree: copy larval digest from RAM

2018-01-07 Thread Gilad Ben-Yossef
The ccree driver was using a DMA operation to copy larval digest from the ccree SRAM to RAM. Replace it with a simple memcpy. Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> --- drivers/staging/ccree/ssi_driver.c | 2 + drivers/staging/ccree/ssi_hash.c

[PATCH v3 09/27] staging: ccree: break send_request and fix ret val

2018-01-07 Thread Gilad Ben-Yossef
a common internal service function and return error instead of sleeping for the asynchronous case. The next patch will complete the fix by implementing proper backlog handling. Fixes: abefd6741d ("staging: ccree: introduce CryptoCell HW driver"). Signed-off-by: Gilad Ben-Yossef <gi...@

[PATCH v3 00/27] staging: ccree: fixes and cleanups

2018-01-07 Thread Gilad Ben-Yossef
about that keeps it from moving out of staging to the best of my understanding and would like to ask for a review before moving out of staging. Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> Changes from v2: - Revert to SPDX-2.0 license tags as the kernel tools are not ready yet f

[PATCH v3 05/27] staging: ccree: pick alloc mem flags based on req flags

2018-01-07 Thread Gilad Ben-Yossef
The ccree driver was allocating memory using GFP_KERNEL flag always, ignoring the flags set in the crypto request. Fix it by choosing gfp flags based on crypto request flags. Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> --- drivers/staging/ccree/ssi_buffer_mgr.

[PATCH v3 03/27] staging: ccree: fold reg common defines into driver

2018-01-07 Thread Gilad Ben-Yossef
Fold the 2 macro defined in dx_reg_common.h into the file they are used in and delete the file. Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> --- drivers/staging/ccree/cc_crypto_ctx.h | 4 ++-- drivers/staging/ccree/dx_reg_common.h | 13 - drivers/staging/ccree/ssi_dr

Re: [PATCH v3 24/27] staging: ccree: use a consistent file naming convention

2018-01-08 Thread Gilad Ben-Yossef
On Mon, Jan 8, 2018 at 5:28 PM, Greg Kroah-Hartman <gre...@linuxfoundation.org> wrote: > On Sun, Jan 07, 2018 at 12:14:35PM +0000, Gilad Ben-Yossef wrote: >> The ccree driver source files were using an inconsistent >> naming convention stemming from what the company was cal

[PATCH v2] checkpatch: add Crypto ON_STACK to declaration_macros

2018-01-08 Thread Gilad Ben-Yossef
lt;gre...@linuxfoundation.org> Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> --- Changes from v1: - Use a better regular expression as suggested by Joe Perches. scripts/checkpatch.pl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.p

[PATCH v3 25/27] staging: ccree: remove unneeded includes

2018-01-07 Thread Gilad Ben-Yossef
Remove include files not needed for compilation. Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> --- drivers/staging/ccree/cc_aead.c| 7 --- drivers/staging/ccree/cc_buffer_mgr.c | 6 -- drivers/staging/ccree/cc_cipher.c | 4 drivers/staging/ccree/cc_dr

[PATCH v3 27/27] staging: ccree: add missing include

2018-01-07 Thread Gilad Ben-Yossef
Add the missing include of include file with function declarations. Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> --- drivers/staging/ccree/cc_debugfs.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/ccree/cc_debugfs.c b/drivers/staging/ccree/cc_debugfs.c

Re: [PATCH] checkpatch: add *_ON_STACK to $declaration_macros

2018-01-08 Thread Gilad Ben-Yossef
On Wed, Dec 20, 2017 at 11:41 AM, Joe Perches <j...@perches.com> wrote: > On Tue, 2017-06-27 at 10:55 +0300, Gilad Ben-Yossef wrote: >> Add the crypto API *_ON_STACK to $declaration_macros. >> >> Resolves the following false warning: >> >> WARNING:

[PATCH 0/7] Introduce Arm TrustZone CryptoCell

2018-01-11 Thread Gilad Ben-Yossef
and secure HW keys). Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> Gilad Ben-Yossef (7): staging: ccree: remove ccree from staging tree crypto: ccree: introduce CryptoCell driver crypto: ccree: add ablkcipher support crypto: ccree: add ahash support crypto: ccree: ad

[PATCH 3/7] crypto: ccree: add ablkcipher support

2018-01-11 Thread Gilad Ben-Yossef
Add CryptoCell ablkcipher support Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> --- drivers/crypto/ccree/Makefile|2 +- drivers/crypto/ccree/cc_buffer_mgr.c | 125 drivers/crypto/ccree/cc_buffer_mgr.h | 10 + drivers/crypto/ccree/cc_cipher.c

[PATCH 5/7] crypto: ccree: add AEAD support

2018-01-11 Thread Gilad Ben-Yossef
Add CryptoCell AEAD support Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> --- drivers/crypto/ccree/Makefile|2 +- drivers/crypto/ccree/cc_aead.c | 2702 ++ drivers/crypto/ccree/cc_aead.h | 109 ++ drivers/crypto

[PATCH 6/7] crypto: ccree: add FIPS support

2018-01-11 Thread Gilad Ben-Yossef
Add FIPS mode support to CryptoCell driver Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> --- drivers/crypto/ccree/Makefile| 1 + drivers/crypto/ccree/cc_driver.c | 29 +- drivers/crypto/ccree/cc_driver.h | 1 + drivers/crypto/ccree/cc_fips.c

[PATCH 7/7] MAINTAINERS: update ccree entry

2018-01-11 Thread Gilad Ben-Yossef
Update Arm TrustZone CryptoCell driver entry move into drivers/crypto/ Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> --- MAINTAINERS | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index 1082846..560e068 100644 --- a/MAINTAINERS

[PATCH 2/7] crypto: ccree: introduce CryptoCell driver

2018-01-11 Thread Gilad Ben-Yossef
Introduce basic low level Arm TrustZone CryptoCell HW support. This first patch doesn't actually register any Crypto API transformations, these will follow up in the next patch. This first revision supports the CC 712 REE component. Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.

[PATCH 4/7] crypto: ccree: add ahash support

2018-01-11 Thread Gilad Ben-Yossef
Add CryptoCell async. hash and HMAC support. Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> --- drivers/crypto/ccree/Makefile|2 +- drivers/crypto/ccree/cc_buffer_mgr.c | 257 drivers/crypto/ccree/cc_driver.c | 13 + drivers/crypto/ccree/cc_driver.h

[PATCH 1/7] staging: ccree: remove ccree from staging tree

2018-01-11 Thread Gilad Ben-Yossef
Remove the ccree driver from the staging tree in preparation to introducing it in the crypto tree. Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> --- drivers/staging/Kconfig|2 - drivers/staging/Makefile |1 - .../devi

[PATCH v2 25/27] staging: ccree: remove unneeded includes

2018-01-03 Thread Gilad Ben-Yossef
Remove include files not needed for compilation. Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> --- drivers/staging/ccree/cc_aead.c| 7 --- drivers/staging/ccree/cc_buffer_mgr.c | 6 -- drivers/staging/ccree/cc_cipher.c | 4 drivers/staging/ccree/cc_dr

[PATCH v2 20/27] staging: ccree: fix indentation of func params

2018-01-03 Thread Gilad Ben-Yossef
Fix indentation of some function params in hash code for better readability. Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> --- drivers/staging/ccree/ssi_hash.c | 46 +--- 1 file changed, 20 insertions(+), 26 deletions(-) diff --git a/drivers/s

[PATCH v2 26/27] staging: ccree: update TODO

2018-01-03 Thread Gilad Ben-Yossef
Update TODO to reflect work done Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> --- drivers/staging/ccree/TODO | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/ccree/TODO b/drivers/staging/ccree/TODO index 6d8702b..b8e163d 100644 --- a/drivers/s

[PATCH v2 23/27] stating: ccree: fix allocation of void sized buf

2018-01-03 Thread Gilad Ben-Yossef
We were allocating buffers using sizeof(*struct->field) where field was type void. Fix it by having a local variable with the real type. Cc: sta...@vger.kernel.org Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> --- drivers/staging/ccree/ssi_ivgen.c| 9 - drivers/stag

[PATCH v2 27/27] staging: ccree: add missing include

2018-01-03 Thread Gilad Ben-Yossef
Add the missing include of include file with function declarations. Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> --- drivers/staging/ccree/cc_debugfs.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/ccree/cc_debugfs.c b/drivers/staging/ccree/cc_debugfs.c

[PATCH v2 05/27] staging: ccree: pick alloc mem flags based on req flags

2018-01-03 Thread Gilad Ben-Yossef
The ccree driver was allocating memory using GFP_KERNEL flag always, ignoring the flags set in the crypto request. Fix it by choosing gfp flags based on crypto request flags. Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> --- drivers/staging/ccree/ssi_buffer_mgr.

[PATCH v2 06/27] staging: ccree: copy larval digest from RAM

2018-01-03 Thread Gilad Ben-Yossef
The ccree driver was using a DMA operation to copy larval digest from the ccree SRAM to RAM. Replace it with a simple memcpy. Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> --- drivers/staging/ccree/ssi_driver.c | 2 + drivers/staging/ccree/ssi_hash.c

[PATCH v2 12/27] staging: ccree: failing the suspend is not an error

2018-01-03 Thread Gilad Ben-Yossef
PM suspend returning a none zero value is not an error. It simply indicates a suspend is not advised right now so don't treat it as an error. Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> --- drivers/staging/ccree/ssi_request_mgr.c | 8 +--- 1 file changed, 1 insertion

[PATCH v2 09/27] staging: ccree: break send_request and fix ret val

2018-01-03 Thread Gilad Ben-Yossef
a common internal service function and return error instead of sleeping for the asynchronous case. The next patch will complete the fix by implementing proper backlog handling. Fixes: abefd6741d ("staging: ccree: introduce CryptoCell HW driver"). Signed-off-by: Gilad Ben-Yossef <gi...@

[PATCH v2 08/27] staging: ccree: remove unused leftover field

2018-01-03 Thread Gilad Ben-Yossef
Remove the unused monitor_desc field. Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> --- drivers/staging/ccree/ssi_request_mgr.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/ccree/ssi_request_mgr.c b/drivers/staging/ccree/ssi_request_mgr.c index ac6846f..1

[PATCH v2 04/27] staging: ccree: remove GFP_DMA flag from mem allocs

2018-01-03 Thread Gilad Ben-Yossef
Remove bogus GFP_DMA flag from memory allocations. ccree driver does not operate over an ISA or similar limited bus. Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> --- drivers/staging/ccree/ssi_cipher.c | 2 +- drivers/staging/ccree/ssi_hash.c | 15 ++- 2 files chan

[PATCH v2 07/27] staging: ccree: tag debugfs init/exit func properly

2018-01-03 Thread Gilad Ben-Yossef
The debugfs global init and exit functions were missing __init and __exit tags, potentially wasting memory. Fix it by properly tagging them. Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> --- drivers/staging/ccree/cc_debugfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 del

[PATCH v2 00/27] staging: ccree: fixes and cleanups

2018-01-03 Thread Gilad Ben-Yossef
about that keeps it from moving out of staging to the best of my understanding and would like to ask for a review before moving out of staging. Thanks and happy new year ;-) Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> Changes from v1: - Fixed wrong use of CPP style comments in SPDX i

[PATCH v2 03/27] staging: ccree: fold reg common defines into driver

2018-01-03 Thread Gilad Ben-Yossef
Fold the 2 macro defined in dx_reg_common.h into the file they are used in and delete the file. Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> --- drivers/staging/ccree/cc_crypto_ctx.h | 4 ++-- drivers/staging/ccree/dx_reg_common.h | 13 - drivers/staging/ccree/ssi_dr

[PATCH v2 02/27] staging: ccree: fold hash defs into queue defs

2018-01-03 Thread Gilad Ben-Yossef
Fold the two remaining enum in hash defs into the queue defs that are using them and delete the hash defs include file. Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> --- drivers/staging/ccree/cc_hw_queue_defs.h | 13 + drivers/staging/ccree/hash_defs.h

[PATCH v2 01/27] staging: ccree: SPDXify driver

2018-01-03 Thread Gilad Ben-Yossef
Replace verbatim GPL v2 copy with SPDX tag. Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> --- drivers/staging/ccree/Kconfig| 2 ++ drivers/staging/ccree/Makefile | 2 ++ drivers/staging/ccree/cc_crypto_ctx.h| 17 ++--- drivers/staging

[PATCH v2 15/27] staging: ccree: use Makefile to include PM code

2018-01-03 Thread Gilad Ben-Yossef
Replace ugly ifdefs with some inline macros and Makefile magic for optionally including power management related code for better readability. Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> --- drivers/staging/ccree/Makefile | 3 ++- drivers/staging/ccree/ssi_pm.c

[PATCH v2 10/27] staging: ccree: add backlog processing

2018-01-03 Thread Gilad Ben-Yossef
Crypto API tfm providers are required to provide a backlog service, if so indicated, that queues up requests in the case of the provider being busy and processing them later. The ccree driver did not provide this facility. Add it now. Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.

[PATCH v2 11/27] stating: ccree: revert "staging: ccree: fix leak of import() after init()"

2018-01-03 Thread Gilad Ben-Yossef
me at the time. Cc: sta...@vger.kernel.org Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> --- drivers/staging/ccree/ssi_hash.c | 11 --- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/staging/ccree/ssi_hash.c b/drivers/staging/ccree/ssi_hash.c ind

[PATCH v2 13/27] staging: ccree: check DMA pool buf !NULL before free

2018-01-03 Thread Gilad Ben-Yossef
If we ran out of DMA pool buffers, we get into the unmap code path with a NULL before. Deal with this by checking the virtual mapping is not NULL. Cc: sta...@vger.kernel.org Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> --- drivers/staging/ccree/ssi_buffer_mgr.c | 3 ++- 1 file c

[PATCH v2 14/27] staging: ccree: handle end of sg list gracefully

2018-01-03 Thread Gilad Ben-Yossef
If we are asked for number of entries of an offset bigger than the sg list we should not crash. Cc: sta...@vger.kernel.org Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> --- drivers/staging/ccree/ssi_buffer_mgr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/d

[PATCH v2 19/27] staging: ccree: do not map bufs in ahash_init

2018-01-03 Thread Gilad Ben-Yossef
API op. This also properly deals with hash_import() not knowing if hash_init was called or not as it now no longer matters. Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> --- drivers/staging/ccree/ssi_hash.c | 192 +-- 1 file changed, 103 insertions(

[PATCH v2 18/27] staging: ccree: allocate hash bufs inside req ctx

2018-01-03 Thread Gilad Ben-Yossef
Move to allocating the buffers needed for requests as part of the request structure instead of malloc'ing each one on it's own, making for simpler (and more efficient) code. Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> --- drivers/staging/ccree/ssi_hash.

[PATCH v2 17/27] staging: ccree: use array for double buffer

2018-01-03 Thread Gilad Ben-Yossef
The ccree hash code is using a double buffer to hold data for processing but manages the buffers and their associated data count in two separate fields and uses a predicate to chose which to use. Move to using a proper 2 members array for a much cleaner code. Signed-off-by: Gilad Ben-Yossef <

[PATCH v2 21/27] staging: ccree: fold common code into service func

2018-01-03 Thread Gilad Ben-Yossef
Fold common code in hash call into service functions. Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> --- drivers/staging/ccree/ssi_hash.c | 339 ++- 1 file changed, 116 insertions(+), 223 deletions(-) diff --git a/drivers/staging/ccree/ssi_ha

[PATCH v2 16/27] staging: ccree: remove unused field

2018-01-03 Thread Gilad Ben-Yossef
Remove unused struct field. Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> --- drivers/staging/ccree/ssi_hash.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/ccree/ssi_hash.c b/drivers/staging/ccree/ssi_hash.c index e05c87d..4e11b5d 100644 --- a/drivers/staging

[PATCH 2/5] staging: ccree: remove unneeded includes

2018-01-09 Thread Gilad Ben-Yossef
Remove include files not needed for compilation. Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> --- drivers/staging/ccree/cc_aead.c| 7 --- drivers/staging/ccree/cc_buffer_mgr.c | 6 -- drivers/staging/ccree/cc_cipher.c | 4 drivers/staging/ccree/cc_dr

[PATCH 1/5] staging: ccree: use a consistent file naming convention

2018-01-09 Thread Gilad Ben-Yossef
The ccree driver source files were using an inconsistent naming convention stemming from what the company was called when they were added. Move to a single consistent naming convention for better code readability. Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> --- drivers/staging

[PATCH 0/5] more cleanups

2018-01-09 Thread Gilad Ben-Yossef
File name consistency renames, include files diet and address some sparse warnings. Gilad Ben-Yossef (5): staging: ccree: use a consistent file naming convention staging: ccree: remove unneeded includes staging: ccree: add missing include staging: ccree: make stub function static inline

[PATCH 4/5] staging: ccree: make stub function static inline

2018-01-09 Thread Gilad Ben-Yossef
The debugfs interface defines stub function if debugfs is not enabled, which were missing the 'static inline' qualifiers causing sparse warnings. Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> --- drivers/staging/ccree/cc_debugfs.h | 8 1 file changed, 4 insertions

[PATCH 3/5] staging: ccree: add missing include

2018-01-09 Thread Gilad Ben-Yossef
Add the missing include of include file with function declarations. Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> --- drivers/staging/ccree/cc_debugfs.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/ccree/cc_debugfs.c b/drivers/staging/ccree/cc_debugfs.c

[PATCH 5/5] staging: ccree: dma mask is type u64

2018-01-09 Thread Gilad Ben-Yossef
The dma mask var was defined as dma_addr_t but should be u64. This showed as a sparse warning when building for 32 bit. Fix it by changing type to u64 and drop the cast. Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> --- drivers/staging/ccree/cc_driver.c | 4 ++-- 1 file chan

[PATCH v2 2/7] crypto: ccree: introduce CryptoCell driver

2018-01-22 Thread Gilad Ben-Yossef
Introduce basic low level Arm TrustZone CryptoCell HW support. This first patch doesn't actually register any Crypto API transformations, these will follow up in the next patch. This first revision supports the CC 712 REE component. Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.

[PATCH v2 1/7] staging: ccree: rename staging ver and mark as broken

2018-01-22 Thread Gilad Ben-Yossef
Rename the Kconfig var of the staging tree version of the driver in preparation of introducing the final version of the driver into the cryptodev tree to avoid link time symbol collisions. Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> --- drivers/staging/ccree/Kconfig | 4 ++-- d

[PATCH v2 7/7] MAINTAINERS: update ccree entry

2018-01-22 Thread Gilad Ben-Yossef
Update Arm TrustZone CryptoCell driver entry move into drivers/crypto/ Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> --- MAINTAINERS | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index 1082846..560e068 100644 --- a/MAINTAINERS

[PATCH v2 4/7] crypto: ccree: add ahash support

2018-01-22 Thread Gilad Ben-Yossef
Add CryptoCell async. hash and HMAC support. Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> --- drivers/crypto/ccree/Makefile|2 +- drivers/crypto/ccree/cc_buffer_mgr.c | 261 +++- drivers/crypto/ccree/cc_driver.c | 13 + drivers/crypto/ccree/cc_driver.h

[PATCH v2 0/7] crypto: ccree: Introduce Arm TrustZone CryptoCell

2018-01-22 Thread Gilad Ben-Yossef
functionality (ivgen and secure HW keys), which will be added later. Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> Changes from v1: - Use KConfig directive to stop staging tree version to not collide during link time as opposed to deleting it as indicated by Greg KH. - Switche

Re: [PATCH 3/7] crypto: ccree: add ablkcipher support

2018-01-21 Thread Gilad Ben-Yossef
Hi Corentin, On Thu, Jan 11, 2018 at 12:01 PM, Corentin Labbe <clabbe.montj...@gmail.com> wrote: > On Thu, Jan 11, 2018 at 09:17:10AM +0000, Gilad Ben-Yossef wrote: >> Add CryptoCell ablkcipher support >> > > Hello > > I have some minor comments: > > ablkc

Re: [PATCH 3/7] crypto: ccree: add ablkcipher support

2018-01-21 Thread Gilad Ben-Yossef
On Thu, Jan 11, 2018 at 12:03 PM, Stephan Mueller <smuel...@chronox.de> wrote: > Am Donnerstag, 11. Januar 2018, 10:17:10 CET schrieb Gilad Ben-Yossef: > > Hi Gilad, > >> + // verify weak keys >> + if (ctx_p->flow_mode == S_DIN_to_DES) { >&g

Re: [PATCH 1/7] staging: ccree: remove ccree from staging tree

2018-01-18 Thread Gilad Ben-Yossef
On Sat, Jan 13, 2018 at 3:21 PM, Greg Kroah-Hartman <gre...@linuxfoundation.org> wrote: > On Thu, Jan 11, 2018 at 09:17:08AM +0000, Gilad Ben-Yossef wrote: >> Remove the ccree driver from the staging tree in preparation to >> introducing it in the crypto tree. >> >>

[RESEND PATCH v2] checkpatch: add Crypto ON_STACK to declaration_macros

2018-02-18 Thread Gilad Ben-Yossef
lt;gre...@linuxfoundation.org> Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> --- scripts/checkpatch.pl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 3d40403..7d632645 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpat

[PATCH 2/4] dt-bindings: Add DT bindings for ccree 710 and 630p

2018-02-19 Thread Gilad Ben-Yossef
Add device tree bindings for Arm CryptoCell 710 and 630p hardware revisions. Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> --- Documentation/devicetree/bindings/crypto/arm-cryptocell.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Documentation/devi

[PATCH 1/4] crypto: ccree: remove unused definitions

2018-02-19 Thread Gilad Ben-Yossef
Remove enum definition which are not used by the REE interface driver. Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> --- drivers/crypto/ccree/cc_crypto_ctx.h | 20 1 file changed, 20 deletions(-) diff --git a/drivers/crypto/ccree/cc_crypto_ctx.h b/drivers/

[PATCH 0/4] cleanups and new HW rev support

2018-02-19 Thread Gilad Ben-Yossef
This patch set introduces backward compatible support for the older CryptoCell hardware revision 710 and 630 along some minor code cleanups. Gilad Ben-Yossef (4): crypto: ccree: remove unused definitions dt-bindings: Add DT bindings for ccree 710 and 630p crypto: ccree: add support

[PATCH 3/4] crypto: ccree: add support for older HW revs

2018-02-19 Thread Gilad Ben-Yossef
Add support for the legacy CryptoCell 630 and 710 revs. Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> --- drivers/crypto/Kconfig | 6 +- drivers/crypto/ccree/cc_aead.c | 34 ++-- drivers/crypto/ccree/cc_cipher.c| 25 +- drivers/crypto

[PATCH 4/4] crypto: ccree: replace memset+kfree with kzfree

2018-02-19 Thread Gilad Ben-Yossef
Replace memset to 0 followed by kfree with kzfree for simplicity. Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> --- drivers/crypto/ccree/cc_request_mgr.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/crypto/ccree/cc_request_mgr.c b/drivers/crypto

Re: [PATCH] staging: ccree: mark debug_regs[] as static

2018-01-03 Thread Gilad Ben-Yossef
debugfs_reg32 debug_regs[] = { > +static struct debugfs_reg32 debug_regs[] = { > CC_DEBUG_REG(HOST_SIGNATURE), > CC_DEBUG_REG(HOST_IRR), > CC_DEBUG_REG(HOST_POWER_DOWN_EN), > -- > 2.9.0 > Thank you Arnd. I ran into this issue myself via a sparse check (I di

[PATCH 02/26] staging: ccree: fold hash defs into queue defs

2018-01-01 Thread Gilad Ben-Yossef
Fold the two remaining enum in hash defs into the queue defs that are using them and delete the hash defs include file. Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> --- drivers/staging/ccree/cc_hw_queue_defs.h | 13 + drivers/staging/ccree/hash_defs.h

[PATCH 05/26] staging: ccree: pick alloc mem flags based on req flags

2018-01-01 Thread Gilad Ben-Yossef
The ccree driver was allocating memory using GFP_KERNEL flag always, ignoring the flags set in the crypto request. Fix it by choosing gfp flags based on crypto request flags. Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> --- drivers/staging/ccree/ssi_buffer_mgr.

[PATCH 04/26] staging: ccree: remove GFP_DMA flag from mem allocs

2018-01-01 Thread Gilad Ben-Yossef
Remove bogus GFP_DMA flag from memory allocations. ccree driver does not operate over an ISA or similar limited bus. Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> --- drivers/staging/ccree/ssi_cipher.c | 2 +- drivers/staging/ccree/ssi_hash.c | 15 ++- 2 files chan

[PATCH 00/26] staging: ccree: fixes and cleanups

2018-01-01 Thread Gilad Ben-Yossef
of changes, I've handled anything that I know about that keeps it from moving out of staging to the best of my understanding and would like to ask for a review before moving out of staging. Thanks and happy new year ;-) Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> Gilad Ben-Yoss

[PATCH 07/26] staging: ccree: tag debugfs init/exit func properly

2018-01-01 Thread Gilad Ben-Yossef
The debugfs global init and exit functions were missing __init and __exit tags, potentially wasting memory. Fix it by properly tagging them. Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> --- drivers/staging/ccree/cc_debugfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 del

[PATCH 01/26] staging: ccree: SPDXify driver

2018-01-01 Thread Gilad Ben-Yossef
Replace verbatim GPL v2 copy with SPDX tag. Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> --- drivers/staging/ccree/cc_crypto_ctx.h| 17 ++--- drivers/staging/ccree/cc_debugfs.c | 17 ++--- drivers/staging/ccree/cc_debugfs.h

[PATCH 10/26] staging: ccree: add backlog processing

2018-01-01 Thread Gilad Ben-Yossef
Crypto API tfm providers are required to provide a backlog service, if so indicated, that queues up requests in the case of the provider being busy and processing them later. The ccree driver did not provide this facility. Add it now. Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.

[PATCH 08/26] staging: ccree: remove unused leftover field

2018-01-01 Thread Gilad Ben-Yossef
Remove the unused monitor_desc field. Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> --- drivers/staging/ccree/ssi_request_mgr.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/ccree/ssi_request_mgr.c b/drivers/staging/ccree/ssi_request_mgr.c index bf66286..5

[PATCH 09/26] staging: ccree: breakup send_request

2018-01-01 Thread Gilad Ben-Yossef
The send_request() function was doing too much. Break it up for better readability and as basis for next patch in series Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> --- drivers/staging/ccree/ssi_aead.c| 6 +- drivers/staging/ccree/ssi_cipher.c | 3 +- drivers/s

[PATCH 03/26] staging: ccree: fold reg common defines into driver

2018-01-01 Thread Gilad Ben-Yossef
Fold the 2 macro defined in dx_reg_common.h into the file they are used in and delete the file. Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> --- drivers/staging/ccree/cc_crypto_ctx.h | 4 ++-- drivers/staging/ccree/dx_reg_common.h | 13 - drivers/staging/ccree/ssi_dr

[PATCH 06/26] staging: ccree: copy larval digest from RAM

2018-01-01 Thread Gilad Ben-Yossef
The ccree driver was using a DMA operation to copy larval digest from the ccree SRAM to RAM. Replace it with a simple memcpy. Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> --- drivers/staging/ccree/ssi_driver.c | 2 + drivers/staging/ccree/ssi_hash.c

[PATCH 15/26] staging: ccree: use Makefile to include PM code

2018-01-01 Thread Gilad Ben-Yossef
Replace ugly ifdefs with some inline macros and Makefile magic for optionally including power management related code for better readability. Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> --- drivers/staging/ccree/Makefile | 3 ++- drivers/staging/ccree/ssi_pm.c

[PATCH 12/26] staging: ccree: failing the suspend is not an error

2018-01-01 Thread Gilad Ben-Yossef
PM suspend returning a none zero value is not an error. It simply indicates a suspend is not advised right now so don't treat it as an error. Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> --- drivers/staging/ccree/ssi_request_mgr.c | 8 +--- 1 file changed, 1 insertion

[PATCH 17/26] staging: ccree: use array for double buffer

2018-01-01 Thread Gilad Ben-Yossef
The ccree hash code is using a double buffer to hold data for processing but manages the buffers and their associated data count in two separate fields and uses a predicate to chose which to use. Move to using a proper 2 members array for a much cleaner code. Signed-off-by: Gilad Ben-Yossef <

[PATCH 20/26] staging: ccree: fix indentation of func params

2018-01-01 Thread Gilad Ben-Yossef
Fix indentation of some function params in hash code for better readability. Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> --- drivers/staging/ccree/ssi_hash.c | 46 +--- 1 file changed, 20 insertions(+), 26 deletions(-) diff --git a/drivers/s

[PATCH 11/26] stating: ccree: revert "staging: ccree: fix leak of import() after init()"

2018-01-01 Thread Gilad Ben-Yossef
me at the time. Cc: sta...@vger.kernel.org Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> --- drivers/staging/ccree/ssi_hash.c | 11 --- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/staging/ccree/ssi_hash.c b/drivers/staging/ccree/ssi_hash.c ind

[PATCH 13/26] staging: ccree: check DMA pool buf !NULL before free

2018-01-01 Thread Gilad Ben-Yossef
If we ran out of DMA pool buffers, we get into the unmap code path with a NULL before. Deal with this by checking the virtual mapping is not NULL. Cc: sta...@vger.kernel.org Signed-off-by: Gilad Ben-Yossef <gi...@benyossef.com> --- drivers/staging/ccree/ssi_buffer_mgr.c | 3 ++- 1 file c

<    3   4   5   6   7   8   9   10   11   12   >