Re: [PATCH RESEND] crypto: CTR DRBG - prevent invalid SG mappings

2016-11-29 Thread Herbert Xu
On Mon, Nov 28, 2016 at 02:39:09PM +0100, Stephan Mueller wrote: > > @@ -1737,15 +1750,22 @@ static int drbg_kcapi_sym_ctr(struct drbg_state *drbg, > u8 *outbuf, u32 outlen) > { > struct scatterlist sg_in; > + bool virt_addr_valid = virt_addr_valid(outbuf); >

Re: linux-next: build failure after merge of the crypto tree

2016-11-29 Thread Herbert Xu
On Tue, Nov 29, 2016 at 11:55:29AM +1100, Stephen Rothwell wrote: > Hi Herbert, > > After merging the crypto tree, today's linux-next build (arm > multi_v7_defconfig) failed like this: > > ERROR: "simd_skcipher_free" [arch/arm/crypto/aes-arm-ce.ko] undefined! > ERROR:

Re: [PATCH] crypto: arm64/sha2: add generated .S files to .gitignore

2016-11-29 Thread Herbert Xu
On Mon, Nov 28, 2016 at 02:37:49PM +0100, Ard Biesheuvel wrote: > Add the files that are generated by the recently merged OpenSSL > SHA-256/512 implementation to .gitignore so Git disregards them > when showing untracked files. > > Signed-off-by: Ard Biesheuvel Patch

[PATCH] crypto: caam - fix key pointer size warning

2016-11-29 Thread Horia Geantă
When building on 32-bit, compiler issues [-Wint-to-pointer-cast] warnings: drivers/crypto/caam/caamalg_desc.c: In function 'cnstr_shdsc_aead_null_encap': drivers/crypto/caam/caamalg_desc.c:67:27: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]

RE: [PATCH v3] crypto: add virtio-crypto driver

2016-11-29 Thread Gonglei (Arei)
Hi, > > > > +source "drivers/crypto/virtio/Kconfig" > > > > + > > > > endif # CRYPTO_HW > > > > diff --git a/drivers/crypto/Makefile b/drivers/crypto/Makefile > > > > index ad7250f..bc53cb8 100644 > > > > --- a/drivers/crypto/Makefile > > > > +++ b/drivers/crypto/Makefile > > > > @@ -32,3 +32,4

[PATCH] crypto: rsa - Add Makefile dependencies to fix parallel builds

2016-11-29 Thread David Michael
Both asn1 headers are included by rsa_helper.c, so rsa_helper.o should explicitly depend on them. Signed-off-by: David Michael --- Hi, Our automated CI builds randomly fail with the following: ../source/crypto/rsa_helper.c:19:29: fatal error: rsaprivkey-asn1.h: No

Re: [PATCH v3] crypto: add virtio-crypto driver

2016-11-29 Thread Stefan Hajnoczi
On Tue, Nov 29, 2016 at 08:22:58AM +, Gonglei (Arei) wrote: > Hi, > > > > > > +source "drivers/crypto/virtio/Kconfig" > > > > > + > > > > > endif # CRYPTO_HW > > > > > diff --git a/drivers/crypto/Makefile b/drivers/crypto/Makefile > > > > > index ad7250f..bc53cb8 100644 > > > > > ---

[PATCH v2] crypto: CTR DRBG - prevent invalid SG mappings

2016-11-29 Thread Stephan Mueller
When using SGs, only heap memory (memory that is valid as per virt_addr_valid) is allowed to be referenced. The CTR DRBG used to reference the caller-provided memory directly in an SG. In case the caller provided stack memory pointers, the SG mapping is not considered to be valid. In some cases,

RE: [PATCH v3] crypto: add virtio-crypto driver

2016-11-29 Thread Gonglei (Arei)
> > On Tue, Nov 29, 2016 at 08:22:58AM +, Gonglei (Arei) wrote: > > Hi, > > > > > > > > +source "drivers/crypto/virtio/Kconfig" > > > > > > + > > > > > > endif # CRYPTO_HW > > > > > > diff --git a/drivers/crypto/Makefile b/drivers/crypto/Makefile > > > > > > index ad7250f..bc53cb8 100644 > >

Re: linux-next: build failure after merge of the crypto tree

2016-11-29 Thread Herbert Xu
On Tue, Nov 29, 2016 at 08:34:08AM +, Horia Geantă wrote: > > > Fixes: da40e7a4ba4d ("crypto: aes-ce - Convert to skcipher") > > Fixes: 211f41af534a ("crypto: aesbs - Convert to skcipher") > The fix for this commit is missing. > CRYPTO_AES_ARM_BS also needs to select CRYPTO_SIMD. Thanks.

Re: [virtio-dev] Re: [PATCH v3] crypto: add virtio-crypto driver

2016-11-29 Thread Cornelia Huck
On Tue, 29 Nov 2016 01:37:44 + "Gonglei (Arei)" wrote: > > On Mon, 28 Nov 2016 20:08:23 +0800 > > Gonglei wrote: > > > > > +static int virtcrypto_update_status(struct virtio_crypto *vcrypto) > > > +{ > > > + u32 status; > > > + int err; > >

Re: [PATCH v3] crypto: add virtio-crypto driver

2016-11-29 Thread Cornelia Huck
On Tue, 29 Nov 2016 09:25:49 + Stefan Hajnoczi wrote: > On Tue, Nov 29, 2016 at 08:22:58AM +, Gonglei (Arei) wrote: > > Hi, > > > > > > > > +source "drivers/crypto/virtio/Kconfig" > > > > > > + > > > > > > endif # CRYPTO_HW > > > > > > diff --git

RE: [PATCH v3] crypto: add virtio-crypto driver

2016-11-29 Thread Gonglei (Arei)
> > > On Tue, Nov 29, 2016 at 08:22:58AM +, Gonglei (Arei) wrote: > > > Hi, > > > > > > > > > > +source "drivers/crypto/virtio/Kconfig" > > > > > > > + > > > > > > > endif # CRYPTO_HW > > > > > > > diff --git a/drivers/crypto/Makefile b/drivers/crypto/Makefile > > > > > > > index

[PATCH v4 1/1] crypto: add virtio-crypto driver

2016-11-29 Thread Gonglei
This patch introduces virtio-crypto driver for Linux Kernel. The virtio crypto device is a virtual cryptography device as well as a kind of virtual hardware accelerator for virtual machines. The encryption anddecryption requests are placed in the data queue and are ultimately handled by

[PATCH v3 05/10] crypto/chcr: Remove dynamic allocation

2016-11-29 Thread Harsh Jain
Remove malloc/free in hash operation and allocate memory in chcr_ahash_req_ctx structure. Signed-off-by: Jitendra Lulla --- drivers/crypto/chelsio/chcr_algo.c | 69 +--- drivers/crypto/chelsio/chcr_crypto.h | 8 +++-- 2 files changed, 45

[PATCH v3 04/10] crypto/chcr: Fixes Unchecked dereference inside function

2016-11-29 Thread Harsh Jain
Fixes 324429d74127, Unchecked dereference inside function. Reported-by: Dan Carpenter Signed-off-by: Jitendra Lulla --- drivers/crypto/chelsio/chcr_algo.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git

[PATCH v3 10/10] Add AEAD algos.

2016-11-29 Thread Harsh Jain
Add support for following AEAD algos. GCM,CCM,RFC4106,RFC4309,authenc(hmac(shaXXX),cbc(aes)). Reviewed-by: Stephan Mueller Signed-off-by: Harsh Jain --- drivers/crypto/chelsio/Kconfig |1 + drivers/crypto/chelsio/chcr_algo.c | 1482

[PATCH v3 03/10] crypto/chcr: Added new structure chcr_wr

2016-11-29 Thread Harsh Jain
Added new structure chcr_wr to populate Work Request Header. Signed-off-by: Jitendra Lulla --- drivers/crypto/chelsio/chcr_algo.c | 239 +-- drivers/crypto/chelsio/chcr_algo.h | 28 ++-- drivers/crypto/chelsio/chcr_core.h | 16 +++

[PATCH v3 02/10] crypto/chcr:Cosmetic change

2016-11-29 Thread Harsh Jain
Moves get_aes_decrypt_key function to .c file and declare inline for "aes_ks_subword" Signed-off-by: Jitendra Lulla --- drivers/crypto/chelsio/chcr_algo.c | 52 + drivers/crypto/chelsio/chcr_algo.h | 59 +-

[PATCH v3 00/10] crypto/chcr: AEAD support and bug fixes

2016-11-29 Thread Harsh Jain
This patch series includes Bug Fixes, performance improvement and support for following AEAD algos. GCM,CCM,RFC4106,RFC4303,authenc(hmac(shaXXX),cbc(aes)) v3: -Break patch 01 into 2. v2: -Replace memcmp to crypto_memneq. -Handle cryptlen less than authsize. -Check assoclen and cryptlen passed

[PATCH v3 07/10] crypto/chcr: Adjust Dest. buffer size

2016-11-29 Thread Harsh Jain
Destination buffer size passed to hardware should not be greater than crypto operation output. Signed-off-by: Harsh Jain --- drivers/crypto/chelsio/chcr_algo.c | 50 +++--- 1 file changed, 20 insertions(+), 30 deletions(-) diff --git

[PATCH v3 09/10] crypto/chcr: Move tfm ctx variable to request context

2016-11-29 Thread Harsh Jain
Move request specific data in request context. Signed-off-by: Harsh Jain --- drivers/crypto/chelsio/chcr_algo.c | 26 +- drivers/crypto/chelsio/chcr_crypto.h | 9 - 2 files changed, 17 insertions(+), 18 deletions(-) diff --git

[PATCH v3 06/10] crypto/chcr: Calculate Reverse round key in setkey callback.

2016-11-29 Thread Harsh Jain
Move reverse round key calculation logic in setkey operation. Signed-off-by: Harsh Jain --- drivers/crypto/chelsio/chcr_algo.c | 52 drivers/crypto/chelsio/chcr_crypto.h | 2 +- 2 files changed, 24 insertions(+), 30 deletions(-) diff

[PATCH v3 01/10] crypto/chcr:Fix memory corruption

2016-11-29 Thread Harsh Jain
Fix memory corruption done by *((u32 *)dec_key + k) operation. Signed-off-by: Jitendra Lulla --- drivers/crypto/chelsio/chcr_algo.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/chelsio/chcr_algo.h

[PATCH v3 08/10] crypto/chcr: Use SHASH_DESC_ON_STACK

2016-11-29 Thread Harsh Jain
Use SHASH_DESC_ON_STACK macro to allocate memory for ipad/opad calculation. Signed-off-by: Harsh Jain --- drivers/crypto/chelsio/chcr_algo.c | 63 +++- drivers/crypto/chelsio/chcr_crypto.h | 2 +- 2 files changed, 27 insertions(+), 38

RE: [virtio-dev] Re: [PATCH v3] crypto: add virtio-crypto driver

2016-11-29 Thread Gonglei (Arei)
> > Subject: Re: [virtio-dev] Re: [PATCH v3] crypto: add virtio-crypto driver > > On Tue, 29 Nov 2016 01:37:44 + > "Gonglei (Arei)" wrote: > > > > On Mon, 28 Nov 2016 20:08:23 +0800 > > > Gonglei wrote: > > > > > > > +static int

[PATCH 3/4] crypto: arm64/aes-ce-ccm - fix decrypt path with new skcipher interface

2016-11-29 Thread Ard Biesheuvel
The new skcipher walk interface does not take into account whether we are encrypting or decrypting. In the latter case, the walk should disregard the MAC. Fix this in the arm64 CE driver. Signed-off-by: Ard Biesheuvel --- arch/arm64/crypto/aes-ce-ccm-glue.c | 7

[PATCH 2/4] crypto: skcipher - fix crash in skcipher_walk_aead()

2016-11-29 Thread Ard Biesheuvel
The new skcipher_walk_aead() may crash in the following way due to the walk flag SKCIPHER_WALK_PHYS not being cleared at the start of the walk: Unable to handle kernel NULL pointer dereference at virtual address 0001 [..] Internal error: Oops: 9644 [#1] PREEMPT SMP [..] PC is at

[PATCH 4/4] crypto: arm64/aes-ce-ctr: fix skcipher conversion

2016-11-29 Thread Ard Biesheuvel
Fix a missing statement that got lost in the skcipher conversion of the CTR transform. Signed-off-by: Ard Biesheuvel --- arch/arm64/crypto/aes-glue.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/crypto/aes-glue.c b/arch/arm64/crypto/aes-glue.c index

[PATCH 1/4] crypto: arm/aes-ce: fix broken monolithic build

2016-11-29 Thread Ard Biesheuvel
When building the arm64 kernel with both CONFIG_CRYPTO_AES_ARM64_CE_BLK=y and CONFIG_CRYPTO_AES_ARM64_NEON_BLK=y configured, the build breaks with the following error: arch/arm64/crypto/aes-neon-blk.o:(.bss+0x0): multiple definition of `aes_simd_algs' arch/arm64/crypto/aes-ce-blk.o:(.bss+0x0):

[PATCH v4 0/1] virtio-crypto: add Linux driver

2016-11-29 Thread Gonglei
v4: - rework unknow status bit handler by calling virtio_break_device(). [Cornelia] - convert space to tab in Kconfig. [Stefan] - rename virtio_crypto.c to virtio_crypto_core.c and then make the moudle named virtio_crypto.ko for consistency. [Stefan] - don't call virtcrypto_dev_stop() on

[PATCH] crypto: arm/aesbs - fix brokenness after skcipher conversion

2016-11-29 Thread Ard Biesheuvel
The CBC encryption routine should use the encryption round keys, not the decryption round keys. Signed-off-by: Ard Biesheuvel --- Another fix for the queued changes, this time for 32-bit ARM. I must say, I'm not impressed with the level of testing that has been