[PATCH 2/6] crypto: ctr - avoid VLA use

2018-04-09 Thread Salvatore Mesoraca
We avoid 2 VLAs[1] by always allocating MAX_BLOCKSIZE + MAX_ALIGNMASK bytes. We also check the selected cipher at instance creation time, if it doesn't comply with these limits, the creation will fail. [1] http://lkml.kernel.org/r/CA+55aFzCG-zNmZwX4A2FQpadafLfEzK6CC=qpxydaacu1rq...@mail.gmail.com

Re: [PATCH 2/6] crypto: ctr - avoid VLA use

2018-04-08 Thread Herbert Xu
On Sun, Apr 08, 2018 at 10:58:48AM +0200, Salvatore Mesoraca wrote: > > Fair enough. > After removing the individual checks the modification to the single files > will be just a couple of lines, is it OK for you if I collapse all of them in > just a single commit? Sure. -- Email: Herbert Xu Home

Re: [PATCH 2/6] crypto: ctr - avoid VLA use

2018-04-08 Thread Salvatore Mesoraca
018-04-08 5:19 GMT+02:00 Herbert Xu : > On Sat, Apr 07, 2018 at 08:38:19PM +0200, Salvatore Mesoraca wrote: >> >> @@ -206,6 +207,14 @@ static struct crypto_instance *crypto_ctr_alloc(struct >> rtattr **tb) >> if (alg->cra_blocksize < 4) >> goto out_put_alg; >> >> + /* Block

Re: [PATCH 2/6] crypto: ctr - avoid VLA use

2018-04-07 Thread Herbert Xu
On Sat, Apr 07, 2018 at 08:38:19PM +0200, Salvatore Mesoraca wrote: > > @@ -206,6 +207,14 @@ static struct crypto_instance *crypto_ctr_alloc(struct > rtattr **tb) > if (alg->cra_blocksize < 4) > goto out_put_alg; > > + /* Block size must be <= MAX_BLOCKSIZE. */ > + if

[PATCH 2/6] crypto: ctr - avoid VLA use

2018-04-07 Thread Salvatore Mesoraca
We avoid 2 VLAs[1] by always allocating MAX_BLOCKSIZE + MAX_ALIGNMASK bytes. We also check the selected cipher at instance creation time, if it doesn't comply with these limits, the creation will fail. [1] http://lkml.kernel.org/r/CA+55aFzCG-zNmZwX4A2FQpadafLfEzK6CC=qpxydaacu1rq...@mail.gmail.com