Re: [dm-devel] [PATCH v5 05/11] crypto: ahash: Remove VLA usage

2018-07-18 Thread Kees Cook
On Tue, Jul 17, 2018 at 4:12 PM, Eric Biggers wrote: > I just don't see why ahash algorithms would need such a huge maximum digest > size. Don't the 'ahash' algorithms all have 'shash' equivalents too? Is > there > actually any hash algorithm, either shash or ahash, in the Linux kernel that >

Re: [dm-devel] [PATCH v4 11/14] treewide: Prepare to remove VLA usage for AHASH_REQUEST_ON_STACK

2018-07-18 Thread Ard Biesheuvel
> On 19 Jul 2018, at 12:09, Kees Cook wrote: > > On Wed, Jul 18, 2018 at 7:55 PM, Ard Biesheuvel > wrote: >> I have only build tested it, so if you make sure that it does not break >> anything, please go ahead. > > I can give it a spin; what's the best way? Is CONFIG_CRYPTO_MANAGER=y > suffi

Re: [dm-devel] [PATCH v4 11/14] treewide: Prepare to remove VLA usage for AHASH_REQUEST_ON_STACK

2018-07-18 Thread Kees Cook
On Wed, Jul 18, 2018 at 7:55 PM, Ard Biesheuvel wrote: > I have only build tested it, so if you make sure that it does not break > anything, please go ahead. I can give it a spin; what's the best way? Is CONFIG_CRYPTO_MANAGER=y sufficient? -Kees -- Kees Cook Pixel Security -- dm-devel mailin

Re: [dm-devel] [PATCH v4 11/14] treewide: Prepare to remove VLA usage for AHASH_REQUEST_ON_STACK

2018-07-18 Thread Ard Biesheuvel
> On 19 Jul 2018, at 11:51, Kees Cook wrote: > > On Wed, Jul 18, 2018 at 8:19 AM, Ard Biesheuvel > wrote: >> On 18 July 2018 at 23:50, Ard Biesheuvel wrote: On 18 July 2018 at 05:59, Arnd Bergmann wrote: > On Sun, Jul 15, 2018 at 6:28 AM, Kees Cook wrote: > > After my aha

Re: [dm-devel] [PATCH v4 11/14] treewide: Prepare to remove VLA usage for AHASH_REQUEST_ON_STACK

2018-07-18 Thread Kees Cook
On Wed, Jul 18, 2018 at 8:19 AM, Ard Biesheuvel wrote: > On 18 July 2018 at 23:50, Ard Biesheuvel wrote: >> On 18 July 2018 at 05:59, Arnd Bergmann wrote: >>> On Sun, Jul 15, 2018 at 6:28 AM, Kees Cook wrote: After my ahash to shash conversions, only ccm is left as an ahash user,

Re: [dm-devel] [PATCH 4/5] crypto: Add IV generation templates

2018-07-18 Thread Milan Broz
On 18/07/18 18:46, Mark Brown wrote: > On Wed, Jul 18, 2018 at 10:16:05AM +0200, Milan Broz wrote: > >> So we are here again and moving INTERNAL dm-crypt functionality into >> cryptoapi. > >> The TCW,LMK IVs generator make sense only for dm-crypt >> for compatible old disk encryption mappings.

Re: [dm-devel] [PATCH 0/5] crypto: add IV generation templates

2018-07-18 Thread Ard Biesheuvel
On 18 July 2018 at 19:59, Arnd Bergmann wrote: > On Wed, Jul 18, 2018 at 9:30 AM, Xiongfeng Wang > wrote: >> >> I tested the performance of software implemented ciphers before and after >> applying this patchset. The performance didn't change much except for >> slight regression when writting. Th

Re: [dm-devel] [PATCH v4 11/14] treewide: Prepare to remove VLA usage for AHASH_REQUEST_ON_STACK

2018-07-18 Thread Ard Biesheuvel
On 19 July 2018 at 00:33, Arnd Bergmann wrote: > On Wed, Jul 18, 2018 at 5:19 PM, Ard Biesheuvel > wrote: >> On 18 July 2018 at 23:50, Ard Biesheuvel wrote: >>> On 18 July 2018 at 05:59, Arnd Bergmann wrote: On Sun, Jul 15, 2018 at 6:28 AM, Kees Cook wrote: > > After my ahash to s

Re: [dm-devel] [PATCH v4 11/14] treewide: Prepare to remove VLA usage for AHASH_REQUEST_ON_STACK

2018-07-18 Thread Arnd Bergmann
On Wed, Jul 18, 2018 at 5:19 PM, Ard Biesheuvel wrote: > On 18 July 2018 at 23:50, Ard Biesheuvel wrote: >> On 18 July 2018 at 05:59, Arnd Bergmann wrote: >>> On Sun, Jul 15, 2018 at 6:28 AM, Kees Cook wrote: After my ahash to shash conversions, only ccm is left as an ahash user,

Re: [dm-devel] [PATCH v4 11/14] treewide: Prepare to remove VLA usage for AHASH_REQUEST_ON_STACK

2018-07-18 Thread Ard Biesheuvel
On 18 July 2018 at 23:50, Ard Biesheuvel wrote: > On 18 July 2018 at 05:59, Arnd Bergmann wrote: >> On Sun, Jul 15, 2018 at 6:28 AM, Kees Cook wrote: >>> >>> After my ahash to shash conversions, only ccm is left as an ahash >>> user, since it actually uses sg. But with the hard-coded value reduc

Re: [dm-devel] [PATCH v4 11/14] treewide: Prepare to remove VLA usage for AHASH_REQUEST_ON_STACK

2018-07-18 Thread Ard Biesheuvel
On 18 July 2018 at 05:59, Arnd Bergmann wrote: > On Sun, Jul 15, 2018 at 6:28 AM, Kees Cook wrote: >> >> After my ahash to shash conversions, only ccm is left as an ahash >> user, since it actually uses sg. But with the hard-coded value reduced >> to 376, this doesn't trip the frame warnings any

Re: [dm-devel] [PATCH 4/5] crypto: Add IV generation templates

2018-07-18 Thread Xiongfeng Wang
On 2018/7/18 16:16, Milan Broz wrote: > On 18/07/18 09:30, Xiongfeng Wang wrote: >> Currently, the IV generation algorithms are implemented in dm-crypt.c. >> This patch implement these algorithms as template ciphers, so that >> dm-crypt layer can be simplified, and also these algorithms can be >

Re: [dm-devel] [PATCH 4/5] crypto: Add IV generation templates

2018-07-18 Thread Mike Snitzer
On Wed, Jul 18 2018 at 4:16am -0400, Milan Broz wrote: > On 18/07/18 09:30, Xiongfeng Wang wrote: > > Currently, the IV generation algorithms are implemented in dm-crypt.c. > > This patch implement these algorithms as template ciphers, so that > > dm-crypt layer can be simplified, and also these

Re: [dm-devel] [PATCH 0/5] crypto: add IV generation templates

2018-07-18 Thread Arnd Bergmann
On Wed, Jul 18, 2018 at 9:30 AM, Xiongfeng Wang wrote: > > I tested the performance of software implemented ciphers before and after > applying this patchset. The performance didn't change much except for > slight regression when writting. The detail information is as follows. > > The command I us

Re: [dm-devel] [PATCH 4/5] crypto: Add IV generation templates

2018-07-18 Thread Milan Broz
On 18/07/18 09:30, Xiongfeng Wang wrote: > Currently, the IV generation algorithms are implemented in dm-crypt.c. > This patch implement these algorithms as template ciphers, so that > dm-crypt layer can be simplified, and also these algorithms can be > implemented in hardware for performance. > >

[dm-devel] [PATCH 2/5] crypto: ccm - use template array registering API to simplify the code

2018-07-18 Thread Xiongfeng Wang
Use crypto template array registering API to simplify the code. Signed-off-by: Xiongfeng Wang --- crypto/ccm.c | 82 1 file changed, 27 insertions(+), 55 deletions(-) diff --git a/crypto/ccm.c b/crypto/ccm.c index 0a08334..1742d41 100

[dm-devel] [PATCH 4/5] crypto: Add IV generation templates

2018-07-18 Thread Xiongfeng Wang
Currently, the IV generation algorithms are implemented in dm-crypt.c. This patch implement these algorithms as template ciphers, so that dm-crypt layer can be simplified, and also these algorithms can be implemented in hardware for performance. Synchronous crypto requests to encrypt/decrypt a sec

[dm-devel] [PATCH 0/5] crypto: add IV generation templates

2018-07-18 Thread Xiongfeng Wang
Currently, the iv generation algorithms are implemented in dm-crypt.c. This patchset moves these algorithms from the dm layer to the kernel crypto layer by implementing them as template ciphers so they can be implemented in hardware for performance. We modify the dm layer to send a whole 'bio' rath

[dm-devel] [PATCH 5/5] dm-crypt: modify dm-crypt to rely on IV generation templates

2018-07-18 Thread Xiongfeng Wang
This patch remove the IV generation algorithms from dm-crypt.c and rely on the IV generation templates for generating IV. We modify the dm-layer to send a whole 'bio' (as defined in the block layer) at a time. Each bio contains an in memory representation of physically contiguous disk blocks. The d

[dm-devel] [PATCH 1/5] crypto: api - introduce API to (un)register a array of templates

2018-07-18 Thread Xiongfeng Wang
The following patch introduce several crypto templates. To simplify the code, this patch add two APIs to (un)register a array of templates. Signed-off-by: Xiongfeng Wang --- crypto/algapi.c | 27 +++ include/crypto/algapi.h | 2 ++ 2 files changed, 29 insertions(

[dm-devel] [PATCH 3/5] crypto: gcm - use template array registering API to simplify the code

2018-07-18 Thread Xiongfeng Wang
Use crypto template array registering API to simplify the code. Signed-off-by: Xiongfeng Wang --- crypto/gcm.c | 76 +--- 1 file changed, 26 insertions(+), 50 deletions(-) diff --git a/crypto/gcm.c b/crypto/gcm.c index 0ad879e..b180536 100