[PATCH v2 1/2] crypto: dh - fix calculating encoded key size

2018-07-27 Thread Eric Biggers
From: Eric Biggers It was forgotten to increase DH_KPP_SECRET_MIN_SIZE to include 'q_size', causing an out-of-bounds write of 4 bytes in crypto_dh_encode_key(), and an out-of-bounds read of 4 bytes in crypto_dh_decode_key(). Fix it, and fix the lengths of the test vectors to match this. Reporte

[PATCH v2 2/2] crypto: dh - make crypto_dh_encode_key() make robust

2018-07-27 Thread Eric Biggers
From: Eric Biggers Make it return -EINVAL if crypto_dh_key_len() is incorrect rather than overflowing the buffer. Signed-off-by: Eric Biggers --- crypto/dh_helper.c | 30 -- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/crypto/dh_helper.c b/crypto/

Re: [PATCH 0/6] lib/crc32: treewide: Use existing define with polynomial

2018-07-27 Thread Herbert Xu
On Tue, Jul 17, 2018 at 06:05:35PM +0200, Krzysztof Kozlowski wrote: > Hi, > > Kernel defines same polynomial for CRC-32 in few places. > This is unnecessary duplication of the same value. Also this might > be error-prone for future code - every driver will define the > polynomial again. > > This

Re: [PATCH] crypto: rmd320 - use swap macro in rmd320_transform

2018-07-27 Thread Herbert Xu
On Wed, Jul 18, 2018 at 12:19:08PM -0500, Gustavo A. R. Silva wrote: > Make use of the swap macro and remove unnecessary variable *tmp*. > This makes the code easier to read and maintain. > > This code was detected with the help of Coccinelle. > > Signed-off-by: Gustavo A. R. Silva Patch applie

Re: [PATCH] crypto: rmd256 - use swap macro in rmd256_transform

2018-07-27 Thread Herbert Xu
On Wed, Jul 18, 2018 at 12:12:00PM -0500, Gustavo A. R. Silva wrote: > Make use of the swap macro and remove unnecessary variable *tmp*. > This makes the code easier to read and maintain. > > This code was detected with the help of Coccinelle. > > Signed-off-by: Gustavo A. R. Silva Patch applie

Re: [PATCH] crypto: arm64/sha256 - increase cra_priority of scalar implementations

2018-07-27 Thread Herbert Xu
On Tue, Jul 17, 2018 at 10:09:26AM -0700, Eric Biggers wrote: > From: Eric Biggers > > Commit b73b7ac0a774 ("crypto: sha256_generic - add cra_priority") gave > sha256-generic and sha224-generic a cra_priority of 100, to match the > convention for generic implementations. But sha256-arm64 and > s

Re: [PATCH v6 0/6] crypto: Add Qcom PRNG support

2018-07-27 Thread Herbert Xu
On Mon, Jul 16, 2018 at 11:20:21AM +0530, Vinod Koul wrote: > This series removes the hwrng qcom driver and replaces it with crypto qcom > driver and then adds support for Execution Environment (EE) found in v2 > version of the hardware and ACPI support for these > > Changes in v6: > - Fix a typo

Re: [PATCH] crypto: CTR DRBG - in-place cipher operation

2018-07-27 Thread Herbert Xu
On Fri, Jul 27, 2018 at 01:49:08PM +0200, Stephan Mueller wrote: > > This is guaranteed by the invokers of drbg_kcapi_sym_ctr as there are two > only: > > - the one in drbg_ctr_update uses the scratchpad for inbuf > > - the one in drbg_ctr_generate uses NULL which implies that the outscratchpad

[PATCH] crypto/arm64: aes-ce-gcm - add missing kernel_neon_begin/end pair

2018-07-27 Thread Ard Biesheuvel
Calling pmull_gcm_encrypt_block() requires kernel_neon_begin() and kernel_neon_end() to be used since the routine touches the NEON register file. Add the missing calls. Also, since NEON register contents are not preserved outside of a kernel mode NEON region, pass the key schedule array again. Fi

Re: [PATCH] crypto: CTR DRBG - in-place cipher operation

2018-07-27 Thread Stephan Mueller
Am Freitag, 27. Juli 2018, 12:53:35 CEST schrieb Herbert Xu: Hi Herbert, > On Fri, Jul 20, 2018 at 07:42:01PM +0200, Stephan Müller wrote: > > @@ -1747,10 +1733,18 @@ static int drbg_kcapi_sym_ctr(struct drbg_state > > *drbg,> > > u8 *outbuf, u32 outlen) > > > > { >

Re: [PATCH] crypto: CTR DRBG - in-place cipher operation

2018-07-27 Thread Herbert Xu
On Fri, Jul 20, 2018 at 07:42:01PM +0200, Stephan Müller wrote: > > @@ -1747,10 +1733,18 @@ static int drbg_kcapi_sym_ctr(struct drbg_state *drbg, > u8 *outbuf, u32 outlen) > { > struct scatterlist *sg_in = &drbg->sg_in, *sg_out = &drbg->sg_out; > + u32 scratc