[PATCH 3/6] crypto: api - avoid VLA use

2018-04-09 Thread Salvatore Mesoraca
We avoid a VLA[1] by always allocating MAX_BLOCKSIZE + MAX_ALIGNMASK bytes. We also check the selected cipher at initialization time, if it doesn't comply with these limits, the initialization will fail. [1]

Re: [PATCH 3/6] crypto: api - avoid VLA use

2018-04-09 Thread Salvatore Mesoraca
2018-04-08 11:22 GMT+02:00 Herbert Xu : > On Sun, Apr 08, 2018 at 11:07:12AM +0200, Salvatore Mesoraca wrote: >> >> > This check should be done when the algorithm is registered. Perhaps >> > crypto_check_alg. >> >> Please correct me if I'm wrong: >> isn't

Re: [PATCH 3/6] crypto: api - avoid VLA use

2018-04-08 Thread Herbert Xu
On Sun, Apr 08, 2018 at 11:07:12AM +0200, Salvatore Mesoraca wrote: > > > This check should be done when the algorithm is registered. Perhaps > > crypto_check_alg. > > Please correct me if I'm wrong: > isn't crypto_check_alg invoked also during hashing algorithm registration? > In this patch-set

Re: [PATCH 3/6] crypto: api - avoid VLA use

2018-04-08 Thread Salvatore Mesoraca
2018-04-08 5:16 GMT+02:00 Herbert Xu : > On Sat, Apr 07, 2018 at 08:38:20PM +0200, Salvatore Mesoraca wrote: >> >> int crypto_init_cipher_ops(struct crypto_tfm *tfm) >> { >> + const unsigned long alignmask = crypto_tfm_alg_alignmask(tfm); >> + const unsigned

Re: [PATCH 3/6] crypto: api - avoid VLA use

2018-04-07 Thread Herbert Xu
On Sat, Apr 07, 2018 at 08:38:20PM +0200, Salvatore Mesoraca wrote: > > int crypto_init_cipher_ops(struct crypto_tfm *tfm) > { > + const unsigned long alignmask = crypto_tfm_alg_alignmask(tfm); > + const unsigned int size = crypto_tfm_alg_blocksize(tfm); > struct cipher_tfm *ops =

[PATCH 3/6] crypto: api - avoid VLA use

2018-04-07 Thread Salvatore Mesoraca
We avoid a VLA[1] by always allocating MAX_BLOCKSIZE + MAX_ALIGNMASK bytes. We also check the selected cipher at initialization time, if it doesn't comply with these limits, the initialization will fail. [1]