Re: [PATCH 1/1] lz4: Implement lz4 with dynamic offset length.

2018-04-03 Thread Sergey Senozhatsky
On (04/03/18 19:13), Vaneet Narang wrote: > Hi Sergey, > > >You shrink a 2 bytes offset down to a 1 byte offset, thus you enforce that > 2 Byte offset is not shrinked to 1 byte, Its only 1 bit is reserved out of > 16 bits of offset. So only 15 Bits can be used to store offset value. Yes, you are

[crypto-chtls] Supicious code in chtls_io

2018-04-03 Thread Gustavo A. R. Silva
Hi all, While doing some static analysis I came across the following piece of code at drivers/crypto/chelsio/chtls/chtls_io.c:1203: 1203 if (!size) 1204 break; 1205 1206 if (unlikely(ULP_SKB_CB(skb)->flags & ULPCB_FLAG_NO_APPEND)) 1207

Re: [v3] crypto: ctr - avoid VLA use

2018-04-03 Thread Laura Abbott
On 03/30/2018 01:53 AM, Salvatore Mesoraca wrote: All ciphers implemented in Linux have a block size less than or equal to 16 bytes and the most demanding hw require 16 bytes alignment for the block buffer. We avoid 2 VLAs[1] by always allocating 16 bytes with 16 bytes alignment, unless the

[PATCH] crypto : chtls_cm - Fix potential NULL pointer dereferences

2018-04-03 Thread Gustavo A. R. Silva
Add null checks on lookup_tid() return value in order to prevent null pointer dereferences. Addresses-Coverity-ID: 1467422 ("Dereference null return value") Addresses-Coverity-ID: 1467443 ("Dereference null return value") Addresses-Coverity-ID: 1467445 ("Dereference null return value")

RE: Re: [PATCH 1/1] lz4: Implement lz4 with dynamic offset length.

2018-04-03 Thread Vaneet Narang
Hi Sergey, >You shrink a 2 bytes offset down to a 1 byte offset, thus you enforce that 2 Byte offset is not shrinked to 1 byte, Its only 1 bit is reserved out of 16 bits of offset. So only 15 Bits can be used to store offset value. >'page should be less than 32KB', which I'm sure will be

Re: [PATCH 1/1] lz4: Implement lz4 with dynamic offset length.

2018-04-03 Thread Sergey Senozhatsky
On (04/02/18 11:21), Maninder Singh wrote: [..] > >> static const char * const backends[] = { > >> "lzo", > >> #if IS_ENABLED(CONFIG_CRYPTO_LZ4) > >> "lz4", > >> +#if (PAGE_SIZE < (32 * KB)) > >> +"lz4_dyn", > >> +#endif > > > >This is not the list of supported

Re: [PATCH 2/2] crypto: ccree: enable support for hardware keys

2018-04-03 Thread Milan Broz
On 03/31/2018 07:30 PM, Gilad Ben-Yossef wrote: ... >> Are there other crypto drivers doing this? > > I thought the exact same thing until I ran into a presentation about the s390 > secure keys implementation. I basically imitated their use (or abuse?) > of the Crypto API > assuming it is the way

Re: [PATCH 2/2] crypto: ccree: enable support for hardware keys

2018-04-03 Thread Herbert Xu
On Sat, Mar 31, 2018 at 08:30:46PM +0300, Gilad Ben-Yossef wrote: > > However, as it uses the exact same mechanism of the regular xts-aes-ccree > but takes the key from another source, I've marked it with a test of > alg_test_null() on the premise that if the xts-aes-ccree works, so must this.

Re: [PATCH] crypto: rsa - remove unneeded initializations

2018-04-03 Thread Herbert Xu
On Tue, Apr 03, 2018 at 09:01:02AM +0300, Tudor Ambarus wrote: > > I set the err inside the if branch so that the compiler will > warn me in case of undefined value for err. Like here: > > https://rusty.ozlabs.org/?p=232 Yes but then sometimes the compiler will get it wrong and we will then have

[PATCH v3 2/2] crypto: authencesn - don't leak pointers to authenc keys

2018-04-03 Thread Tudor Ambarus
In crypto_authenc_esn_setkey we save pointers to the authenc keys in a local variable of type struct crypto_authenc_keys and we don't zeroize it after use. Fix this and don't leak pointers to the authenc keys. Signed-off-by: Tudor Ambarus --- crypto/authencesn.c | 1

[PATCH v3 1/2] crypto: authenc - don't leak pointers to authenc keys

2018-04-03 Thread Tudor Ambarus
In crypto_authenc_setkey we save pointers to the authenc keys in a local variable of type struct crypto_authenc_keys and we don't zeroize it after use. Fix this and don't leak pointers to the authenc keys. Signed-off-by: Tudor Ambarus --- crypto/authenc.c | 1 + 1

Re: [PATCH] crypto: rsa - remove unneeded initializations

2018-04-03 Thread Tudor Ambarus
On 03/30/2018 08:27 PM, Herbert Xu wrote: On Mon, Mar 26, 2018 at 02:59:06PM +0300, Tudor Ambarus wrote: Remove useless assignment of ret to -ENOMEM in rsa_verify. Remove useless initialization of ret to zero at declaration in rsa_enc/dec/sign/verify. Benefit of the power of undefined values