Re: [PATCH 00/30] crypto: x86 glue code cleanup/conversion

2018-03-02 Thread Herbert Xu
On Mon, Feb 19, 2018 at 11:47:58PM -0800, Eric Biggers wrote:
> Hi,
> 
> I got tired of seeing some block cipher implementations using the old
> API (blkcipher or ablkcipher) and some using the new API (skcipher)...
> so this series makes a dent in the problem by converting all the
> remaining x86 glue code over to the skcipher API.
> 
> Besides the conversion to use 'skcipher_alg', 'skcipher_request', and
> 'skcipher_walk' this includes replacing all remaining users of
> ablk_helper with crypto_simd, then removing ablk_helper.
> 
> It also includes removing all users of lrw_crypt() and xts_crypt() in
> favor of the lrw and xts templates wrapping an ECB-mode algorithm.  So,
> lrw_crypt() and xts_crypt() are removed too.
> 
> Note that AES was already converted a while ago, so this series mostly
> just deals with the other ciphers (Serpent, Twofish, Camellia, etc.).
> 
> I tested all the affected algorithms with the self-tests.  I also did
> some testing with random sglist divisions, during which I found a bug in
> ecb-cast5-avx which this series fixes as well.
> 
> The overall diff is about 3100 lines of code removed, mainly due to the
> ablk_helper => crypto_simd conversions and removing the unnecessary LRW
> and XTS implementations.
> 
> Eric Biggers (30):
>   crypto: simd - allow registering multiple algorithms at once
>   crypto: x86/glue_helper - add skcipher_walk functions
>   crypto: x86/serpent-sse2 - remove LRW algorithm
>   crypto: x86/serpent-sse2 - remove XTS algorithm
>   crypto: x86/serpent-sse2 - convert to skcipher interface
>   crypto: x86/serpent-avx2 - remove LRW algorithm
>   crypto: x86/serpent-avx - remove LRW algorithm
>   crypto: x86/serpent-avx,avx2 - convert to skcipher interface
>   crypto: x86/twofish-3way - remove LRW algorithm
>   crypto: x86/twofish-3way - remove XTS algorithm
>   crypto: x86/twofish-3way - convert to skcipher interface
>   crypto: x86/twofish-avx - remove LRW algorithm
>   crypto: x86/twofish-avx - convert to skcipher interface
>   crypto: x86/cast5-avx - fix ECB encryption when long sg follows short
> one
>   crypto: x86/cast5-avx - convert to skcipher interface
>   crypto: x86/cast6-avx - remove LRW algorithm
>   crypto: x86/cast6-avx - convert to skcipher interface
>   crypto: x86/blowfish: convert to skcipher interface
>   crypto: x86/des3_ede - convert to skcipher interface
>   crypto: x86/camellia-aesni-avx - remove LRW algorithm
>   crypto: x86/camellia-aesni-avx2 - remove LRW algorithm
>   crypto: x86/camellia - remove LRW algorithm
>   crypto: x86/camellia - remove XTS algorithm
>   crypto: x86/camellia - convert to skcipher interface
>   crypto: x86/camellia-aesni-avx,avx2 - convert to skcipher interface
>   crypto: xts - remove xts_crypt()
>   crypto: lrw - remove lrw_crypt()
>   crypto: x86/glue_helper - remove blkcipher_walk functions
>   crypto: x86/glue_helper - rename glue_skwalk_fpu_begin()
>   crypto: ablk_helper - remove ablk_helper
> 
>  arch/x86/crypto/blowfish_glue.c| 230 +++--
>  arch/x86/crypto/camellia_aesni_avx2_glue.c | 491 ++-
>  arch/x86/crypto/camellia_aesni_avx_glue.c  | 495 +++
>  arch/x86/crypto/camellia_glue.c| 356 +---
>  arch/x86/crypto/cast5_avx_glue.c   | 352 +++
>  arch/x86/crypto/cast6_avx_glue.c   | 489 ++-
>  arch/x86/crypto/des3_ede_glue.c| 238 ++---
>  arch/x86/crypto/glue_helper.c  | 391 +++---
>  arch/x86/crypto/serpent_avx2_glue.c| 478 ++
>  arch/x86/crypto/serpent_avx_glue.c | 518 +++-
>  arch/x86/crypto/serpent_sse2_glue.c| 519 
> -
>  arch/x86/crypto/twofish_avx_glue.c | 493 +++
>  arch/x86/crypto/twofish_glue_3way.c| 339 ---
>  arch/x86/include/asm/crypto/camellia.h |  16 +-
>  arch/x86/include/asm/crypto/glue_helper.h  |  75 +
>  arch/x86/include/asm/crypto/serpent-avx.h  |  17 +-
>  arch/x86/include/asm/crypto/twofish.h  |  19 --
>  crypto/Kconfig |  82 ++---
>  crypto/Makefile|   1 -
>  crypto/ablk_helper.c   | 150 -
>  crypto/lrw.c   | 152 +++--
>  crypto/simd.c  |  50 +++
>  crypto/xts.c   |  72 
>  include/crypto/ablk_helper.h   |  32 --
>  include/crypto/internal/simd.h |   7 +
>  include/crypto/lrw.h   |  44 ---
>  include/crypto/xts.h   |  17 -
>  27 files changed, 1489 insertions(+), 4634 deletions(-)
>  delete mode 100644 crypto/ablk_helper.c
>  delete mode 100644 include/crypto/ablk_helper.h
>  delete mode 100644 include/crypto/lrw.h

All applied.  Thanks.
-- 
Email: Herbert Xu 
Home Page: http:/

[PATCH 00/30] crypto: x86 glue code cleanup/conversion

2018-02-19 Thread Eric Biggers
Hi,

I got tired of seeing some block cipher implementations using the old
API (blkcipher or ablkcipher) and some using the new API (skcipher)...
so this series makes a dent in the problem by converting all the
remaining x86 glue code over to the skcipher API.

Besides the conversion to use 'skcipher_alg', 'skcipher_request', and
'skcipher_walk' this includes replacing all remaining users of
ablk_helper with crypto_simd, then removing ablk_helper.

It also includes removing all users of lrw_crypt() and xts_crypt() in
favor of the lrw and xts templates wrapping an ECB-mode algorithm.  So,
lrw_crypt() and xts_crypt() are removed too.

Note that AES was already converted a while ago, so this series mostly
just deals with the other ciphers (Serpent, Twofish, Camellia, etc.).

I tested all the affected algorithms with the self-tests.  I also did
some testing with random sglist divisions, during which I found a bug in
ecb-cast5-avx which this series fixes as well.

The overall diff is about 3100 lines of code removed, mainly due to the
ablk_helper => crypto_simd conversions and removing the unnecessary LRW
and XTS implementations.

Eric Biggers (30):
  crypto: simd - allow registering multiple algorithms at once
  crypto: x86/glue_helper - add skcipher_walk functions
  crypto: x86/serpent-sse2 - remove LRW algorithm
  crypto: x86/serpent-sse2 - remove XTS algorithm
  crypto: x86/serpent-sse2 - convert to skcipher interface
  crypto: x86/serpent-avx2 - remove LRW algorithm
  crypto: x86/serpent-avx - remove LRW algorithm
  crypto: x86/serpent-avx,avx2 - convert to skcipher interface
  crypto: x86/twofish-3way - remove LRW algorithm
  crypto: x86/twofish-3way - remove XTS algorithm
  crypto: x86/twofish-3way - convert to skcipher interface
  crypto: x86/twofish-avx - remove LRW algorithm
  crypto: x86/twofish-avx - convert to skcipher interface
  crypto: x86/cast5-avx - fix ECB encryption when long sg follows short
one
  crypto: x86/cast5-avx - convert to skcipher interface
  crypto: x86/cast6-avx - remove LRW algorithm
  crypto: x86/cast6-avx - convert to skcipher interface
  crypto: x86/blowfish: convert to skcipher interface
  crypto: x86/des3_ede - convert to skcipher interface
  crypto: x86/camellia-aesni-avx - remove LRW algorithm
  crypto: x86/camellia-aesni-avx2 - remove LRW algorithm
  crypto: x86/camellia - remove LRW algorithm
  crypto: x86/camellia - remove XTS algorithm
  crypto: x86/camellia - convert to skcipher interface
  crypto: x86/camellia-aesni-avx,avx2 - convert to skcipher interface
  crypto: xts - remove xts_crypt()
  crypto: lrw - remove lrw_crypt()
  crypto: x86/glue_helper - remove blkcipher_walk functions
  crypto: x86/glue_helper - rename glue_skwalk_fpu_begin()
  crypto: ablk_helper - remove ablk_helper

 arch/x86/crypto/blowfish_glue.c| 230 +++--
 arch/x86/crypto/camellia_aesni_avx2_glue.c | 491 ++-
 arch/x86/crypto/camellia_aesni_avx_glue.c  | 495 +++
 arch/x86/crypto/camellia_glue.c| 356 +---
 arch/x86/crypto/cast5_avx_glue.c   | 352 +++
 arch/x86/crypto/cast6_avx_glue.c   | 489 ++-
 arch/x86/crypto/des3_ede_glue.c| 238 ++---
 arch/x86/crypto/glue_helper.c  | 391 +++---
 arch/x86/crypto/serpent_avx2_glue.c| 478 ++
 arch/x86/crypto/serpent_avx_glue.c | 518 +++-
 arch/x86/crypto/serpent_sse2_glue.c| 519 -
 arch/x86/crypto/twofish_avx_glue.c | 493 +++
 arch/x86/crypto/twofish_glue_3way.c| 339 ---
 arch/x86/include/asm/crypto/camellia.h |  16 +-
 arch/x86/include/asm/crypto/glue_helper.h  |  75 +
 arch/x86/include/asm/crypto/serpent-avx.h  |  17 +-
 arch/x86/include/asm/crypto/twofish.h  |  19 --
 crypto/Kconfig |  82 ++---
 crypto/Makefile|   1 -
 crypto/ablk_helper.c   | 150 -
 crypto/lrw.c   | 152 +++--
 crypto/simd.c  |  50 +++
 crypto/xts.c   |  72 
 include/crypto/ablk_helper.h   |  32 --
 include/crypto/internal/simd.h |   7 +
 include/crypto/lrw.h   |  44 ---
 include/crypto/xts.h   |  17 -
 27 files changed, 1489 insertions(+), 4634 deletions(-)
 delete mode 100644 crypto/ablk_helper.c
 delete mode 100644 include/crypto/ablk_helper.h
 delete mode 100644 include/crypto/lrw.h

-- 
2.16.2