[PATCH v2 08/12] crypto: sun4i-ss: use GENMASK to generate masks

2017-05-29 Thread Antoine Tenart
Use the GENMASK helper instead of custom calculations to generate masks, It also helps the readability. Signed-off-by: Antoine Tenart --- drivers/crypto/sunxi-ss/sun4i-ss-hash.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git

[PATCH v2 07/12] crypto: sun4i-ss: simplify the appended bit assignment

2017-05-29 Thread Antoine Tenart
A bit is appended at the end of the input buffer for sha1. Simplify the code assigning it. Signed-off-by: Antoine Tenart --- drivers/crypto/sunxi-ss/sun4i-ss-hash.c | 8 ++-- 1 file changed, 2 insertions(+), 6 deletions(-) diff --git

[PATCH v2 12/12] ARM: sun5i: add a cryptographic engine node

2017-05-29 Thread Antoine Tenart
Add a node for the cryptographic engine that can be found on sun5i SoCs. This cryptographic engine is compatible with the Allwinner cryptographic accelerator driver. Signed-off-by: Antoine Tenart --- arch/arm/boot/dts/sun5i.dtsi | 8 1 file changed, 8

[PATCH v2 05/12] crypto: sun4i-ss: do not dynamically set parts of the last buffer to 0

2017-05-29 Thread Antoine Tenart
Parts of the bf buffer were dynamically set to 0. Change this to set the whole buffer to 0 by default to avoid any mistake. Signed-off-by: Antoine Tenart --- drivers/crypto/sunxi-ss/sun4i-ss-hash.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff

[PATCH v2 10/12] crypto: sun4i-ss: add the CRYPTO_ALG_KERN_DRIVER_ONLY flag

2017-05-29 Thread Antoine Tenart
The CRYPTO_ALG_KERN_DRIVER_ONLY flag is set for hardware accelerated ciphers accessible through a kernel driver only. This is the case for ciphers exposed by the sun4i-ss driver. This patch sets this flag. Signed-off-by: Antoine Tenart ---

[PATCH v2 00/12] ARM: sun5i: cryptographic engine support

2017-05-29 Thread Antoine Tenart
Hello, This series adds the cryptographic engine support to sun5i SoCs. This is based on top of v4.12-rc1 and was tested on a CHIP. The series begins with fixes and improvements. The series is available at: https://github.com/atenart/linux v4.12-rc1/sun5i-crypto The 8 first patches are reworks

[PATCH v2 09/12] crypto: sun4i-ss: move from ablkcipher to skcipher API

2017-05-29 Thread Antoine Tenart
Update the sun4i-ss driver to use the skcipher API instead of the old ablkcipher one. It's a bit more tricky than s/ablkcipher/skcipher/, but still nothing special and the driver's logic stays the same. Signed-off-by: Antoine Tenart ---

[PATCH v2 04/12] crypto: sun4i-ss: cannot use DMA is the request is 0 length

2017-05-29 Thread Antoine Tenart
Do not use DMA is the request is 0 length. Signed-off-by: Antoine Tenart --- drivers/crypto/sunxi-ss/sun4i-ss-hash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/crypto/sunxi-ss/sun4i-ss-hash.c

[PATCH v2 11/12] crypto: sun4i-ss: fix large block size support

2017-05-29 Thread Antoine Tenart
The run-time self-tests fail quite early, as soon as the input block size is larger than 64 bytes: alg: hash: Test 4 failed for sha1-sun4i-ss : b9 c9 1e 52 c0 26 d8 39 81 ff f2 3c 99 b1 27 b2 0010: 30 d6 c9 85 One thing to notice is the value of the last word, which is the one

[PATCH v2 02/12] crypto: sun4i-ss: remove conditional checks against 0

2017-05-29 Thread Antoine Tenart
Cosmetic clean up if conditional checks on 0s values. Signed-off-by: Antoine Tenart --- drivers/crypto/sunxi-ss/sun4i-ss-cipher.c | 28 +++--- drivers/crypto/sunxi-ss/sun4i-ss-core.c | 10 drivers/crypto/sunxi-ss/sun4i-ss-hash.c |

[PATCH v2 01/12] crypto: sun4i-ss: group variable definitions in sun4i_hash()

2017-05-29 Thread Antoine Tenart
Cosmetic change to avoid having a full screen a variable definitions. It also helps to see which variables share the same type. Signed-off-by: Antoine Tenart --- drivers/crypto/sunxi-ss/sun4i-ss-hash.c | 31 +++ 1 file changed, 11

Re: [PATCH 01/12] staging: ccree: correct coding style violations

2017-05-29 Thread Gilad Ben-Yossef
On Mon, May 29, 2017 at 8:36 PM, Joe Perches wrote: > On Mon, 2017-05-29 at 20:11 +0300, Gilad Ben-Yossef wrote: >> On Mon, May 29, 2017 at 7:57 PM, Joe Perches wrote: >> > On Mon, 2017-05-29 at 16:37 +0200, Greg Kroah-Hartman wrote: >> > > On Sun, May 28,

Re: [PATCH 01/12] staging: ccree: correct coding style violations

2017-05-29 Thread Joe Perches
On Mon, 2017-05-29 at 20:11 +0300, Gilad Ben-Yossef wrote: > On Mon, May 29, 2017 at 7:57 PM, Joe Perches wrote: > > On Mon, 2017-05-29 at 16:37 +0200, Greg Kroah-Hartman wrote: > > > On Sun, May 28, 2017 at 05:40:26PM +0300, Gilad Ben-Yossef wrote: > > > > cc_crypto_ctx.h had

Re: [PATCH 04/12] staging: ccree: cleanup lli access macro

2017-05-29 Thread Gilad Ben-Yossef
On Mon, May 29, 2017 at 5:41 PM, Greg Kroah-Hartman wrote: > On Sun, May 28, 2017 at 05:40:29PM +0300, Gilad Ben-Yossef wrote: >> The Linked List Item descriptors were being accessed via >> a baroque set of defines and macro. Re-factor for structs >> and inline

Re: [PATCH 02/12] staging: ccree: move to kernel bitfields/bitops

2017-05-29 Thread Gilad Ben-Yossef
On Mon, May 29, 2017 at 5:38 PM, Greg Kroah-Hartman wrote: > On Sun, May 28, 2017 at 05:40:27PM +0300, Gilad Ben-Yossef wrote: >> ccree had a lot of boilerplate code for dealing with bitops >> and bitfield register access. Move it over to the generic kernel >>

Re: [PATCH 01/12] staging: ccree: correct coding style violations

2017-05-29 Thread Gilad Ben-Yossef
On Mon, May 29, 2017 at 7:57 PM, Joe Perches wrote: > On Mon, 2017-05-29 at 16:37 +0200, Greg Kroah-Hartman wrote: >> On Sun, May 28, 2017 at 05:40:26PM +0300, Gilad Ben-Yossef wrote: >> > cc_crypto_ctx.h had multiple coding style violations reported by >> > checkpatch. Fix them

Re: [PATCH 01/12] staging: ccree: correct coding style violations

2017-05-29 Thread Joe Perches
On Mon, 2017-05-29 at 16:37 +0200, Greg Kroah-Hartman wrote: > On Sun, May 28, 2017 at 05:40:26PM +0300, Gilad Ben-Yossef wrote: > > cc_crypto_ctx.h had multiple coding style violations reported by > > checkpatch. Fix them all. > > Sorry, no. You need to do only one-thing-per-patch, and "fix all

Re: [PATCH 12/27] Drivers: ccree: ssi_fips_ll.c - align block comments

2017-05-29 Thread Greg KH
On Wed, May 24, 2017 at 04:43:52PM +1200, Derek Robson wrote: > Fixed block comment alignment, Style fix only > Found using checkpatch > > Signed-off-by: Derek Robson > --- > drivers/staging/ccree/ssi_fips_ll.c | 21 - > 1 file changed, 12 insertions(+),

Re: [PATCH 09/11] crypto: sun4i-ss: move from ablkcipher to skcipher API

2017-05-29 Thread Antoine Tenart
Hi Corentin, On Mon, May 29, 2017 at 04:47:57PM +0200, Corentin Labbe wrote: > On Wed, May 24, 2017 at 09:06:50PM +0200, Antoine Tenart wrote: > > + .cra_flags = CRYPTO_ALG_TYPE_SKCIPHER | > > +CRYPTO_ALG_KERN_DRIVER_ONLY, > > You add

Re: [PATCH 09/11] crypto: sun4i-ss: move from ablkcipher to skcipher API

2017-05-29 Thread Corentin Labbe
On Wed, May 24, 2017 at 09:06:50PM +0200, Antoine Tenart wrote: > Update the sun4i-ss driver to use the skcipher API instead of the old > ablkcipher one. It's a bit more tricky than s/ablkcipher/skcipher/, but > still nothing special and the driver's logic stays the same. > > Signed-off-by:

Re: [PATCH 01/12] staging: ccree: correct coding style violations

2017-05-29 Thread Greg Kroah-Hartman
On Sun, May 28, 2017 at 05:40:26PM +0300, Gilad Ben-Yossef wrote: > cc_crypto_ctx.h had multiple coding style violations reported by > checkpatch. Fix them all. Sorry, no. You need to do only one-thing-per-patch, and "fix all coding style issues is not "one thing". I wouldn't take this kind of

Re: [PATCH 04/12] staging: ccree: cleanup lli access macro

2017-05-29 Thread Greg Kroah-Hartman
On Sun, May 28, 2017 at 05:40:29PM +0300, Gilad Ben-Yossef wrote: > The Linked List Item descriptors were being accessed via > a baroque set of defines and macro. Re-factor for structs > and inline function for readability and sanity. > > Signed-off-by: Gilad Ben-Yossef >

Re: [PATCH 02/12] staging: ccree: move to kernel bitfields/bitops

2017-05-29 Thread Greg Kroah-Hartman
On Sun, May 28, 2017 at 05:40:27PM +0300, Gilad Ben-Yossef wrote: > ccree had a lot of boilerplate code for dealing with bitops > and bitfield register access. Move it over to the generic kernel > infrastructure used for doing the same. > > Signed-off-by: Gilad Ben-Yossef >

Re: [PATCH v4 04/14] crypto: ecc - don't be selfish on pubkeys

2017-05-29 Thread Tudor Ambarus
Hi, Horia, On 28.05.2017 20:22, Horia Geantă wrote: On 5/25/2017 10:18 AM, Tudor Ambarus wrote: Rename ecdh_make_pub_key() to ecc_make_pub_key(). This function might as well be used by ecdsa. Where exactly is ecdsa used in the kernel?

Re: [RFC PATCH v2 1/4] crypto: ecc - add privkey generation support

2017-05-29 Thread Tudor Ambarus
Hi, Stephan, On 29.05.2017 12:56, Stephan Müller wrote: Am Montag, 29. Mai 2017, 11:47:48 CEST schrieb Tudor Ambarus: Hi Tudor, Hm, there should be no blocking for the DRBG to initialize. What happens if you compile that as a module and insmod it at runtime? We will have a nop: #ifdef

[PATCH v2] X.509: Fix error code in x509_cert_parse()

2017-05-29 Thread Dan Carpenter
We forgot to set the error code on this path so it could result in returning NULL which leads to a NULL dereference. Fixes: db6c43bd2132 ("crypto: KEYS: convert public key and digsig asym to the akcipher api") Signed-off-by: Dan Carpenter --- v2: Style change Sorry

Re: [RFC PATCH v2 1/4] crypto: ecc - add privkey generation support

2017-05-29 Thread Stephan Müller
Am Montag, 29. Mai 2017, 11:47:48 CEST schrieb Tudor Ambarus: Hi Tudor, > > Hm, there should be no blocking for the DRBG to initialize. > > > > What happens if you compile that as a module and insmod it at runtime? > > We will have a nop: > > #ifdef CONFIG_CRYPTO_MANAGER_DISABLE_TESTS > > /*

Re: [RFC PATCH v2 1/4] crypto: ecc - add privkey generation support

2017-05-29 Thread Tudor Ambarus
Hi, Stephan, On 29.05.2017 12:23, Stephan Müller wrote: Am Montag, 29. Mai 2017, 11:08:38 CEST schrieb Tudor Ambarus: Hi Tudor, + unsigned int nbytes = ndigits << ECC_DIGITS_TO_BYTES_SHIFT; + + get_random_bytes(priv, nbytes); Can you please use crypto_get_default_rng /

Re: [PATCH v6 4/5] crypto: inside-secure: add SafeXcel EIP197 crypto engine driver

2017-05-29 Thread PrasannaKumar Muralidharan
On 29 May 2017 at 14:51, Antoine Tenart wrote: >> As you have got help from other people for testing, wouldn't it be >> nice to add tested-by tag? > > Well, they're listed as authors of the driver: not only they helped to > test it but they developed parts of

Re: [RFC PATCH v2 1/4] crypto: ecc - add privkey generation support

2017-05-29 Thread Stephan Müller
Am Montag, 29. Mai 2017, 11:08:38 CEST schrieb Tudor Ambarus: Hi Tudor, > > >> + unsigned int nbytes = ndigits << ECC_DIGITS_TO_BYTES_SHIFT; > >> + > >> + get_random_bytes(priv, nbytes); > > > > Can you please use crypto_get_default_rng / crypto_rng_get_bytes / > > crypto_put_default_rng? >

Re: [PATCH v6 4/5] crypto: inside-secure: add SafeXcel EIP197 crypto engine driver

2017-05-29 Thread Antoine Tenart
Hello, On Sun, May 28, 2017 at 11:09:43AM +0530, PrasannaKumar Muralidharan wrote: > On 24 May 2017 at 19:40, Antoine Tenart > wrote: > > Add support for Inside Secure SafeXcel EIP197 cryptographic engine, > > which can be found on Marvell Armada 7k and 8k

Re: [PATCH 10/11] crypto: sun4i-ss: fix large block size support

2017-05-29 Thread Antoine Tenart
Hi Maxime, On Mon, May 29, 2017 at 10:29:31AM +0200, Maxime Ripard wrote: > On Mon, May 29, 2017 at 10:09:44AM +0200, Antoine Tenart wrote: > > > Which speed are the SS clocks ? > > > > The AHB SS clk is running at 300 MHz and the SS clk at 150 MHz. SS clk > > is at the expected rate but the AHB

Re: [RFC PATCH v2 1/4] crypto: ecc - add privkey generation support

2017-05-29 Thread Tudor Ambarus
Hi, Stephan, Thank you for the review. Please see inline. On 28.05.2017 21:44, Stephan Müller wrote: Am Mittwoch, 17. Mai 2017, 17:26:50 CEST schrieb Tudor Ambarus: Hi Tudor, Add support for generating ecc private keys. Generation of ecc private keys is helpful in a user-space to kernel

Re: [PATCH 10/11] crypto: sun4i-ss: fix large block size support

2017-05-29 Thread Maxime Ripard
On Mon, May 29, 2017 at 10:09:44AM +0200, Antoine Tenart wrote: > > Which speed are the SS clocks ? > > The AHB SS clk is running at 300 MHz and the SS clk at 150 MHz. SS clk > is at the expected rate but the AHB SS clk has a higher rate that what's > expected. > > In the probing function only

[PATCH v2 05/11] crypto: move gcm to generic async completion

2017-05-29 Thread Gilad Ben-Yossef
gcm is starting an async. crypto op and waiting for it complete. Move it over to generic code doing the same. Signed-off-by: Gilad Ben-Yossef --- crypto/gcm.c | 32 ++-- 1 file changed, 6 insertions(+), 26 deletions(-) diff --git a/crypto/gcm.c

[PATCH v2 02/11] crypto: move algif to generic async completion

2017-05-29 Thread Gilad Ben-Yossef
algif starts several async crypto ops and waits for their completion. Move it over to generic code doing the same. Signed-off-by: Gilad Ben-Yossef --- crypto/af_alg.c | 27 --- crypto/algif_aead.c | 14 +++--- crypto/algif_hash.c

[PATCH v2 04/11] crypto: move drbg to generic async completion

2017-05-29 Thread Gilad Ben-Yossef
DRBG is starting an async. crypto op and waiting for it complete. Move it over to generic code doing the same. The code now also passes CRYPTO_TFM_REQ_MAY_SLEEP flag indicating crypto request memory allocation may use GFP_KERNEL which should be perfectly fine as the code is obviously sleeping for

[PATCH v2 01/11] crypto: introduce crypto wait for async op

2017-05-29 Thread Gilad Ben-Yossef
Invoking a possibly async. crypto op and waiting for completion while correctly handling backlog processing is a common task in the crypto API implementation and outside users of it. This patch adds a generic implementation for doing so in preparation for using it across the board instead of hand

[PATCH v2 03/11] crypto: move pub key to generic async completion

2017-05-29 Thread Gilad Ben-Yossef
public_key_verify_signature() is starting an async crypto op and waiting for it to complete. Move it over to generic code doing the same. Signed-off-by: Gilad Ben-Yossef --- crypto/asymmetric_keys/public_key.c | 28 1 file changed, 4

[PATCH v2 06/11] crypto: move testmgr to generic async completion

2017-05-29 Thread Gilad Ben-Yossef
testmgr is starting async. crypto ops and waiting for them to complete. Move it over to generic code doing the same. This also provides a test of the generic crypto async. wait code. Signed-off-by: Gilad Ben-Yossef --- crypto/testmgr.c | 184

[PATCH v2 08/11] fscrypt: move to generic async completion

2017-05-29 Thread Gilad Ben-Yossef
fscrypt starts several async. crypto ops and waiting for them to complete. Move it over to generic code doing the same. Signed-off-by: Gilad Ben-Yossef --- fs/crypto/crypto.c | 28 fs/crypto/fname.c | 36

[PATCH v2 07/11] dm: move dm-verity to generic async completion

2017-05-29 Thread Gilad Ben-Yossef
dm-verity is starting async. crypto ops and waiting for them to complete. Move it over to generic code doing the same. This also fixes a possible data coruption bug created by the use of wait_for_completion_interruptible() without dealing correctly with an interrupt aborting the wait prior to the

[PATCH v2 11/11] crypto: adapt api sample to use async. op wait

2017-05-29 Thread Gilad Ben-Yossef
The code sample is waiting for an async. crypto op completion. Adapt sample to use the new generic infrastructure to do the same. This also fixes a possible data coruption bug created by the use of wait_for_completion_interruptible() without dealing correctly with an interrupt aborting the wait

[PATCH v2 09/11] cifs: move to generic async completion

2017-05-29 Thread Gilad Ben-Yossef
cifs starts an async. crypto op and waits for their completion. Move it over to generic code doing the same. Signed-off-by: Gilad Ben-Yossef Acked-by: Pavel Shilovsky --- fs/cifs/smb2ops.c | 30 -- 1 file changed, 4

[PATCH v2 10/11] ima: move to generic async completion

2017-05-29 Thread Gilad Ben-Yossef
ima starts several async crypto ops and waits for their completions. Move it over to generic code doing the same. Signed-off-by: Gilad Ben-Yossef Acked-by: Mimi Zohar --- security/integrity/ima/ima_crypto.c | 56

[PATCH v2 00/11] introduce crypto wait for async op

2017-05-29 Thread Gilad Ben-Yossef
Many users of kernel async. crypto services have a pattern of starting an async. crypto op and than using a completion to wait for it to end, resulting of the same code repeating itself in multiple places, sometime with coding errors. This patch aims to introduce a generic "wait for async. crypto

Re: [PATCH 10/11] crypto: sun4i-ss: fix large block size support

2017-05-29 Thread Antoine Tenart
Hi Corentin, On Fri, May 26, 2017 at 04:55:01PM +0200, Corentin Labbe wrote: > On Wed, May 24, 2017 at 09:06:51PM +0200, Antoine Tenart wrote: > > > > + /* > > +* The datasheet isn't very clear about when to retrieve the digest. The > > +* bit SS_DATA_END is cleared when the engine

Re: [PATCH v3 2/5] crypto : stm32 - Add STM32F4 CRC32 support

2017-05-29 Thread Fabien DESSENNE
Hi Cosar, Thank you for the patch On 22/05/17 16:34, Cosar Dindar wrote: > This patch adds CRC (CRC32 Crypto) support for STM32F4 series. > > As an hardware limitation polynomial and key setting are not supported. > They are fixed as 0x4C11DB7 (poly) and 0x (key). > CRC32C Castagnoli