mbox series

[0/9] crypto: add SIMD helpers for AEADs

Message ID 20190310190058.4912-1-ebiggers@kernel.org (mailing list archive)
Headers show
Series crypto: add SIMD helpers for AEADs | expand

Message

Eric Biggers March 10, 2019, 7 p.m. UTC
This series updates crypto_simd to support wrapping AEADs, then makes
all AEADs that implement the same functionality use crypto_simd instead.

This simplifies the code, and it also fixes the bug where these
algorithms modify the user-provided aead_request.  This was a problem
because users may expect to be able to use the same aead_request for
another encryption/decryption without reinitializing everything.  The
last patch removes the test workaround now that this bug is fixed.

Eric Biggers (9):
  crypto: simd - support wrapping AEAD algorithms
  crypto: x86/aesni - convert to use skcipher SIMD bulk registration
  crypto: x86/aesni - convert to use AEAD SIMD helpers
  crypto: x86/aegis128 - convert to use AEAD SIMD helpers
  crypto: x86/aegis128l - convert to use AEAD SIMD helpers
  crypto: x86/aegis256 - convert to use AEAD SIMD helpers
  crypto: x86/morus640 - convert to use AEAD SIMD helpers
  crypto: x86/morus1280 - convert to use AEAD SIMD helpers
  crypto: testmgr - remove workaround for AEADs that modify aead_request

 arch/x86/crypto/aegis128-aesni-glue.c  | 157 +++------------
 arch/x86/crypto/aegis128l-aesni-glue.c | 157 +++------------
 arch/x86/crypto/aegis256-aesni-glue.c  | 157 +++------------
 arch/x86/crypto/aesni-intel_glue.c     | 204 ++-----------------
 arch/x86/crypto/morus1280-avx2-glue.c  |  12 +-
 arch/x86/crypto/morus1280-sse2-glue.c  |  12 +-
 arch/x86/crypto/morus1280_glue.c       |  85 --------
 arch/x86/crypto/morus640-sse2-glue.c   |  12 +-
 arch/x86/crypto/morus640_glue.c        |  85 --------
 crypto/Kconfig                         |  10 +-
 crypto/simd.c                          | 269 +++++++++++++++++++++++++
 crypto/testmgr.c                       |   3 -
 include/crypto/internal/simd.h         |  20 ++
 include/crypto/morus1280_glue.h        |  79 ++------
 include/crypto/morus640_glue.h         |  79 ++------
 15 files changed, 471 insertions(+), 870 deletions(-)

Comments

Ondrej Mosnacek March 15, 2019, 7:45 a.m. UTC | #1
Hi Eric,

On Sun, Mar 10, 2019 at 8:02 PM Eric Biggers <ebiggers@kernel.org> wrote:
> This series updates crypto_simd to support wrapping AEADs, then makes
> all AEADs that implement the same functionality use crypto_simd instead.
>
> This simplifies the code, and it also fixes the bug where these
> algorithms modify the user-provided aead_request.  This was a problem
> because users may expect to be able to use the same aead_request for
> another encryption/decryption without reinitializing everything.  The
> last patch removes the test workaround now that this bug is fixed.
>
> Eric Biggers (9):
>   crypto: simd - support wrapping AEAD algorithms
>   crypto: x86/aesni - convert to use skcipher SIMD bulk registration
>   crypto: x86/aesni - convert to use AEAD SIMD helpers
>   crypto: x86/aegis128 - convert to use AEAD SIMD helpers
>   crypto: x86/aegis128l - convert to use AEAD SIMD helpers
>   crypto: x86/aegis256 - convert to use AEAD SIMD helpers
>   crypto: x86/morus640 - convert to use AEAD SIMD helpers
>   crypto: x86/morus1280 - convert to use AEAD SIMD helpers
>   crypto: testmgr - remove workaround for AEADs that modify aead_request
>
>  arch/x86/crypto/aegis128-aesni-glue.c  | 157 +++------------
>  arch/x86/crypto/aegis128l-aesni-glue.c | 157 +++------------
>  arch/x86/crypto/aegis256-aesni-glue.c  | 157 +++------------
>  arch/x86/crypto/aesni-intel_glue.c     | 204 ++-----------------
>  arch/x86/crypto/morus1280-avx2-glue.c  |  12 +-
>  arch/x86/crypto/morus1280-sse2-glue.c  |  12 +-
>  arch/x86/crypto/morus1280_glue.c       |  85 --------
>  arch/x86/crypto/morus640-sse2-glue.c   |  12 +-
>  arch/x86/crypto/morus640_glue.c        |  85 --------
>  crypto/Kconfig                         |  10 +-
>  crypto/simd.c                          | 269 +++++++++++++++++++++++++
>  crypto/testmgr.c                       |   3 -
>  include/crypto/internal/simd.h         |  20 ++
>  include/crypto/morus1280_glue.h        |  79 ++------
>  include/crypto/morus640_glue.h         |  79 ++------
>  15 files changed, 471 insertions(+), 870 deletions(-)
>
> --
> 2.21.0

Nice refactoring, thanks!

I only went quickly through the patches, but I'd say the automated
tests have got us covered quite well here :)

Reviewed-by: Ondrej Mosnacek <omosnace@redhat.com>
Herbert Xu March 22, 2019, 1:03 p.m. UTC | #2
On Sun, Mar 10, 2019 at 12:00:49PM -0700, Eric Biggers wrote:
> This series updates crypto_simd to support wrapping AEADs, then makes
> all AEADs that implement the same functionality use crypto_simd instead.
> 
> This simplifies the code, and it also fixes the bug where these
> algorithms modify the user-provided aead_request.  This was a problem
> because users may expect to be able to use the same aead_request for
> another encryption/decryption without reinitializing everything.  The
> last patch removes the test workaround now that this bug is fixed.
> 
> Eric Biggers (9):
>   crypto: simd - support wrapping AEAD algorithms
>   crypto: x86/aesni - convert to use skcipher SIMD bulk registration
>   crypto: x86/aesni - convert to use AEAD SIMD helpers
>   crypto: x86/aegis128 - convert to use AEAD SIMD helpers
>   crypto: x86/aegis128l - convert to use AEAD SIMD helpers
>   crypto: x86/aegis256 - convert to use AEAD SIMD helpers
>   crypto: x86/morus640 - convert to use AEAD SIMD helpers
>   crypto: x86/morus1280 - convert to use AEAD SIMD helpers
>   crypto: testmgr - remove workaround for AEADs that modify aead_request
> 
>  arch/x86/crypto/aegis128-aesni-glue.c  | 157 +++------------
>  arch/x86/crypto/aegis128l-aesni-glue.c | 157 +++------------
>  arch/x86/crypto/aegis256-aesni-glue.c  | 157 +++------------
>  arch/x86/crypto/aesni-intel_glue.c     | 204 ++-----------------
>  arch/x86/crypto/morus1280-avx2-glue.c  |  12 +-
>  arch/x86/crypto/morus1280-sse2-glue.c  |  12 +-
>  arch/x86/crypto/morus1280_glue.c       |  85 --------
>  arch/x86/crypto/morus640-sse2-glue.c   |  12 +-
>  arch/x86/crypto/morus640_glue.c        |  85 --------
>  crypto/Kconfig                         |  10 +-
>  crypto/simd.c                          | 269 +++++++++++++++++++++++++
>  crypto/testmgr.c                       |   3 -
>  include/crypto/internal/simd.h         |  20 ++
>  include/crypto/morus1280_glue.h        |  79 ++------
>  include/crypto/morus640_glue.h         |  79 ++------
>  15 files changed, 471 insertions(+), 870 deletions(-)

All applied.  Thanks.