Re: [PATCH v2 0/2] crypto: removing various VLAs

2018-04-26 Thread Salvatore Mesoraca
2018-04-20 18:51 GMT+02:00 Herbert Xu <herb...@gondor.apana.org.au>: > On Mon, Apr 09, 2018 at 03:54:45PM +0200, Salvatore Mesoraca wrote: >> v2: >> As suggested by Herbert Xu, the blocksize and alignmask checks >> have been moved to crypto_check_alg. >

Re: [PATCH v2 0/2] crypto: removing various VLAs

2018-04-09 Thread Salvatore Mesoraca
2018-04-09 16:35 GMT+02:00 David Laight <david.lai...@aculab.com>: > From: Salvatore Mesoraca >> Sent: 09 April 2018 14:55 >> >> v2: >> As suggested by Herbert Xu, the blocksize and alignmask checks >> have been moved to crypto_check_alg. >>

Re: [PATCH 0/6] Remove several VLAs in the crypto subsystem

2018-04-09 Thread Salvatore Mesoraca
Please ignore this thread, I sent the old patch-set again by mistake :( I'm sorry for the noise. Salvatore

[PATCH 1/6] crypto: api - laying macros for statically allocated buffers

2018-04-09 Thread Salvatore Mesoraca
://lkml.kernel.org/r/CA+55aFzCG-zNmZwX4A2FQpadafLfEzK6CC=qpxydaacu1rq...@mail.gmail.com Signed-off-by: Salvatore Mesoraca <s.mesorac...@gmail.com> --- crypto/internal.h | 8 1 file changed, 8 insertions(+) diff --git a/crypto/internal.h b/crypto/internal.h index 9a3f399..89ae41e 100644 --- a/

[PATCH 6/6] crypto: cfb - avoid VLA use

2018-04-09 Thread Salvatore Mesoraca
-zNmZwX4A2FQpadafLfEzK6CC=qpxydaacu1rq...@mail.gmail.com Signed-off-by: Salvatore Mesoraca <s.mesorac...@gmail.com> --- crypto/cfb.c | 14 ++ 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/crypto/cfb.c b/crypto/cfb.c index 94ee39b..f500816 100644 --- a/crypto/cfb.c

[PATCH 4/6] crypto: pcbc - avoid VLA use

2018-04-09 Thread Salvatore Mesoraca
-by: Salvatore Mesoraca <s.mesorac...@gmail.com> --- crypto/pcbc.c | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/crypto/pcbc.c b/crypto/pcbc.c index d9e45a9..797da2f 100644 --- a/crypto/pcbc.c +++ b/crypto/pcbc.c @@ -21,6 +21,7 @@ #include #include #i

[PATCH 5/6] crypto: cts - avoid VLA use

2018-04-09 Thread Salvatore Mesoraca
-by: Salvatore Mesoraca <s.mesorac...@gmail.com> --- crypto/cts.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/crypto/cts.c b/crypto/cts.c index 4773c18..12e6bd3 100644 --- a/crypto/cts.c +++ b/crypto/cts.c @@ -50,6 +50,7 @@ #include #include #include +#i

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

2018-04-09 Thread Salvatore Mesoraca
...@mail.gmail.com Signed-off-by: Salvatore Mesoraca <s.mesorac...@gmail.com> --- crypto/cipher.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/crypto/cipher.c b/crypto/cipher.c index 94fa355..9cedf23 100644 --- a/crypto/cipher.c +++ b/crypto/cipher.c @@ -67,7 +67,7 @@ stati

[PATCH v2 1/2] crypto: api - laying defines and checks for statically allocated buffers

2018-04-09 Thread Salvatore Mesoraca
in crypto_check_alg when a new cipher is registered. [1] http://lkml.kernel.org/r/CA+55aFzCG-zNmZwX4A2FQpadafLfEzK6CC=qpxydaacu1rq...@mail.gmail.com Signed-off-by: Salvatore Mesoraca <s.mesorac...@gmail.com> --- crypto/algapi.c | 10 ++ include/crypto/algapi.h | 8 2 files c

[PATCH v2 0/2] crypto: removing various VLAs

2018-04-09 Thread Salvatore Mesoraca
-2d4286913...@redhat.com Salvatore Mesoraca (2): crypto: api - laying defines and checks for statically allocated buffers crypto: remove several VLAs crypto/algapi.c | 10 ++ crypto/cfb.c| 7 +++ crypto/cipher.c | 3 ++- crypto/ctr.c| 4

[PATCH v2 2/2] crypto: remove several VLAs

2018-04-09 Thread Salvatore Mesoraca
We avoid various VLAs[1] by using constant expressions for block size and alignment mask. [1] http://lkml.kernel.org/r/CA+55aFzCG-zNmZwX4A2FQpadafLfEzK6CC=qpxydaacu1rq...@mail.gmail.com Signed-off-by: Salvatore Mesoraca <s.mesorac...@gmail.com> --- crypto/cfb.c| 7 +++ crypto/ci

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

2018-04-09 Thread Salvatore Mesoraca
...@mail.gmail.com Signed-off-by: Salvatore Mesoraca <s.mesorac...@gmail.com> --- crypto/ctr.c | 13 +++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/crypto/ctr.c b/crypto/ctr.c index 854d924..ce62552 100644 --- a/crypto/ctr.c +++ b/crypto/ctr.c @@ -20,6 +20,7 @@ #include #i

[PATCH 0/6] Remove several VLAs in the crypto subsystem

2018-04-09 Thread Salvatore Mesoraca
-zNmZwX4A2FQpadafLfEzK6CC=qpxydaacu1rq...@mail.gmail.com [2] http://lkml.kernel.org/r/4e536889-439a-49e6-dd95-2d4286913...@redhat.com Salvatore Mesoraca (6): crypto: api - laying macros for statically allocated buffers crypto: ctr - avoid VLA use crypto: api - avoid VLA use crypto: pcbc - avoid VLA use crypto

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 <herb...@gondor.apana.org.au>: > 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. >> >

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 <herb...@gondor.apana.org.au>: > 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_alignm

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 <herb...@gondor.apana.org.au>: > 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_

Re: [PATCH 1/6] crypto: api - laying macros for statically allocated buffers

2018-04-08 Thread Salvatore Mesoraca
2018-04-08 5:15 GMT+02:00 Herbert Xu <herb...@gondor.apana.org.au>: > On Sat, Apr 07, 2018 at 08:38:18PM +0200, Salvatore Mesoraca wrote: >> Creating 2 new compile-time constants for internal use, >> in preparation for the removal of VLAs[1] from crypto code. >> All c

Re: [PATCH 0/6] Remove several VLAs in the crypto subsystem

2018-04-08 Thread Salvatore Mesoraca
2018-04-07 21:56 GMT+02:00 Kees Cook <keesc...@chromium.org>: > On Sat, Apr 7, 2018 at 11:38 AM, Salvatore Mesoraca > <s.mesorac...@gmail.com> wrote: >> As suggested by Laura Abbott[2], I'm resending my patch with >> MAX_BLOCKSIZE and MAX_ALIGNMASK defined in an

[PATCH 1/6] crypto: api - laying macros for statically allocated buffers

2018-04-07 Thread Salvatore Mesoraca
://lkml.kernel.org/r/CA+55aFzCG-zNmZwX4A2FQpadafLfEzK6CC=qpxydaacu1rq...@mail.gmail.com Signed-off-by: Salvatore Mesoraca <s.mesorac...@gmail.com> --- crypto/internal.h | 8 1 file changed, 8 insertions(+) diff --git a/crypto/internal.h b/crypto/internal.h index 9a3f399..89ae41e 100644 --- a/

[PATCH 4/6] crypto: pcbc - avoid VLA use

2018-04-07 Thread Salvatore Mesoraca
-by: Salvatore Mesoraca <s.mesorac...@gmail.com> --- crypto/pcbc.c | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/crypto/pcbc.c b/crypto/pcbc.c index d9e45a9..797da2f 100644 --- a/crypto/pcbc.c +++ b/crypto/pcbc.c @@ -21,6 +21,7 @@ #include #include #i

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

2018-04-07 Thread Salvatore Mesoraca
...@mail.gmail.com Signed-off-by: Salvatore Mesoraca <s.mesorac...@gmail.com> --- crypto/cipher.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/crypto/cipher.c b/crypto/cipher.c index 94fa355..9cedf23 100644 --- a/crypto/cipher.c +++ b/crypto/cipher.c @@ -67,7 +67,7 @@ stati

[PATCH 5/6] crypto: cts - avoid VLA use

2018-04-07 Thread Salvatore Mesoraca
-by: Salvatore Mesoraca <s.mesorac...@gmail.com> --- crypto/cts.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/crypto/cts.c b/crypto/cts.c index 4773c18..12e6bd3 100644 --- a/crypto/cts.c +++ b/crypto/cts.c @@ -50,6 +50,7 @@ #include #include #include +#i

[PATCH 6/6] crypto: cfb - avoid VLA use

2018-04-07 Thread Salvatore Mesoraca
-zNmZwX4A2FQpadafLfEzK6CC=qpxydaacu1rq...@mail.gmail.com Signed-off-by: Salvatore Mesoraca <s.mesorac...@gmail.com> --- crypto/cfb.c | 14 ++ 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/crypto/cfb.c b/crypto/cfb.c index 94ee39b..f500816 100644 --- a/crypto/cfb.c

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

2018-04-07 Thread Salvatore Mesoraca
...@mail.gmail.com Signed-off-by: Salvatore Mesoraca <s.mesorac...@gmail.com> --- crypto/ctr.c | 13 +++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/crypto/ctr.c b/crypto/ctr.c index 854d924..ce62552 100644 --- a/crypto/ctr.c +++ b/crypto/ctr.c @@ -20,6 +20,7 @@ #include #i

[PATCH 0/6] Remove several VLAs in the crypto subsystem

2018-04-07 Thread Salvatore Mesoraca
-zNmZwX4A2FQpadafLfEzK6CC=qpxydaacu1rq...@mail.gmail.com [2] http://lkml.kernel.org/r/4e536889-439a-49e6-dd95-2d4286913...@redhat.com Salvatore Mesoraca (6): crypto: api - laying macros for statically allocated buffers crypto: ctr - avoid VLA use crypto: api - avoid VLA use crypto: pcbc - avoid VLA use crypto

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

2018-04-04 Thread Salvatore Mesoraca
2018-04-03 23:37 GMT+02:00 Laura Abbott <labb...@redhat.com>: > On 03/30/2018 01:53 AM, Salvatore Mesoraca wrote: >> --- >> crypto/ctr.c | 15 +-- >> 1 file changed, 13 insertions(+), 2 deletions(-) >> >> diff --git a/crypto/ctr.c b/crypto

[v3] crypto: ctr - avoid VLA use

2018-03-30 Thread Salvatore Mesoraca
also check the selected cipher at instance creation time, if it doesn't comply with these limits, we fail the creation. [1] https://lkml.org/lkml/2018/3/7/621 Signed-off-by: Salvatore Mesoraca <s.mesorac...@gmail.com> --- crypto/ctr.c | 15 +-- 1 file changed, 13 insertions

Re: [PATCH v2] crypto: ctr - avoid VLA use

2018-03-24 Thread Salvatore Mesoraca
2018-03-23 16:36 GMT+01:00 Herbert Xu <herb...@gondor.apana.org.au>: > On Thu, Mar 15, 2018 at 12:18:58PM +0100, Salvatore Mesoraca wrote: >> >> +#define MAX_BLOCKSIZE 16 >> + >> +#ifdef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS >> +#define MAX_ALIGNMASK 1

[PATCH v2] crypto: ctr - avoid VLA use

2018-03-15 Thread Salvatore Mesoraca
also check the selected cipher at instance creation time, if it doesn't comply with these limits, we fail the creation. [1] https://lkml.org/lkml/2018/3/7/621 Signed-off-by: Salvatore Mesoraca <s.mesorac...@gmail.com> --- crypto/ctr.c | 20 ++-- 1 file changed, 18 insertions

Re: [PATCH] crypto: ctr: avoid VLA use

2018-03-15 Thread Salvatore Mesoraca
2018-03-15 10:54 GMT+01:00 Herbert Xu <herb...@gondor.apana.org.au>: > On Wed, Mar 14, 2018 at 02:17:30PM +0100, 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 bits >&

Re: [PATCH] crypto: ctr: avoid VLA use

2018-03-14 Thread Salvatore Mesoraca
2018-03-14 19:31 GMT+01:00 Eric Biggers <ebigge...@gmail.com>: > On Wed, Mar 14, 2018 at 02:17:30PM +0100, 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 bits >> ali

Re: [PATCH] crypto: ctr: avoid VLA use

2018-03-14 Thread Salvatore Mesoraca
2018-03-14 14:31 GMT+01:00 Stephan Mueller <smuel...@chronox.de>: > Am Mittwoch, 14. März 2018, 14:17:30 CET schrieb Salvatore Mesoraca: > > Hi Salvatore, > >> if (walk.nbytes) { >> - crypto_ctr_crypt_final(, child); >> -

[PATCH] crypto: ctr: avoid VLA use

2018-03-14 Thread Salvatore Mesoraca
check, at runtime, that our assumptions still stand, possibly dynamically allocating a new buffer, just in case something changes in the future. [1] https://lkml.org/lkml/2018/3/7/621 Signed-off-by: Salvatore Mesoraca <s.mesorac...@gmail.com> --- Notes: Can we maybe skip the runtime