Skip to content

crypto: test the !may_use_simd() fallback code

Eric Biggers linux-arm-kernel linux-crypto 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest8 patches 10 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/8crypto: chacha-generic - fix use as arm64 no-NEON fallbackcrypto/chacha_generic.c+1 -11 reply
2/8crypto: arm64/gcm-aes-ce - fix no-NEON fallback codearch/arm64/crypto/ghash-ce-glue.c+6 -41 reply
3/8crypto: simd,testmgr - introduce crypto_simd_usable()crypto/testmgr.c include/crypto/internal/simd.h+49 -11 reply
4/8crypto: x86 - convert to use crypto_simd_usable()arch/x86/crypto/aesni-intel_glue.c arch/x86/crypto/chacha_glue.c arch/x86/crypto/crc32-pclmul_glue.c +9 more+44 -361 reply
5/8crypto: arm - convert to use crypto_simd_usable()arch/arm/crypto/chacha-neon-glue.c arch/arm/crypto/crc32-ce-glue.c arch/arm/crypto/crct10dif-ce-glue.c +7 more+29 -191 reply
6/8crypto: arm64 - convert to use crypto_simd_usable()arch/arm64/crypto/aes-ce-ccm-glue.c arch/arm64/crypto/aes-ce-glue.c arch/arm64/crypto/aes-glue.c +12 more+47 -341 reply
7/8crypto: simd - convert to use crypto_simd_usable()crypto/simd.c+4 -41 reply
8/8crypto: testmgr - test the !may_use_simd() fallback codecrypto/testmgr.c+92 -241 reply

Reviews trailers per patch

All 8 patches have a Reviewed-by or Acked-by.

PatchArd Biesheuvel
1/8R-b
2/8R-b
3/8R-b
4/8R-b
5/8R-b
6/8R-b
7/8R-b
8/8A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/8] crypto: test the !may_use_simd() fallback code

All crypto API algorithms are supposed to support the case where they are called in a context where SIMD instructions are unusable, e.g. IRQ context on some architectures. However, this isn't tested for by the self-tests, causing bugs to go undetected.

This patch series therefore updates the self-tests to test the no-SIMD code. It works by converting all may_use_simd() checks to a new macro crypto_simd_usable(), which also returns false when the self-tests have disabled SIMD in crypto algorithms on the current CPU for test purposes.

For now, all no-SIMD testing is limited to the extra crypto self-tests, because it might be a bit too invasive for the regular self-tests. But this could be changed later.

This already found bugs in the arm64 implementations of AES-GCM and ChaCha. These are fixed by the first two patches. Following this, the tests pass on x86, arm, and arm64.

This patch series is based on top of my other pending patch series "crypto: add SIMD helpers for AEADs". It can also be found in git at:

URL: https://git.kernel.org/pub/scm/linux/kernel/git/ebiggers/linux.git
Branch: crypto-nosimd-tests

Eric Biggers (8):
crypto: chacha-generic - fix use as arm64 no-NEON fallback
crypto: arm64/gcm-aes-ce - fix no-NEON fallback code
crypto: simd,testmgr - introduce crypto_simd_usable()
crypto: x86 - convert to use crypto_simd_usable()
crypto: arm - convert to use crypto_simd_usable()
crypto: arm64 - convert to use crypto_simd_usable()
crypto: simd - convert to use crypto_simd_usable()
crypto: testmgr - test the !may_use_simd() fallback code

 arch/arm/crypto/chacha-neon-glue.c         |   5 +-
 arch/arm/crypto/crc32-ce-glue.c            |   5 +-
 arch/arm/crypto/crct10dif-ce-glue.c        |   3 +-
 arch/arm/crypto/ghash-ce-glue.c            |   7 +-
 arch/arm/crypto/nhpoly1305-neon-glue.c     |   3 +-
 arch/arm/crypto/sha1-ce-glue.c             |   5 +-
 arch/arm/crypto/sha1_neon_glue.c           |   5 +-
 arch/arm/crypto/sha2-ce-glue.c             |   5 +-
 arch/arm/crypto/sha256_neon_glue.c         |   5 +-
 arch/arm/crypto/sha512-neon-glue.c         |   5 +-
 arch/arm64/crypto/aes-ce-ccm-glue.c        |   7 +-
 arch/arm64/crypto/aes-ce-glue.c            |   5 +-
 arch/arm64/crypto/aes-glue.c               |   4 +-
 arch/arm64/crypto/aes-neonbs-glue.c        |   2 +-
 arch/arm64/crypto/chacha-neon-glue.c       |   5 +-
 arch/arm64/crypto/crct10dif-ce-glue.c      |   5 +-
 arch/arm64/crypto/ghash-ce-glue.c          |  17 ++-
 arch/arm64/crypto/nhpoly1305-neon-glue.c   |   3 +-
 arch/arm64/crypto/sha1-ce-glue.c           |   7 +-
 arch/arm64/crypto/sha2-ce-glue.c           |   7 +-
 arch/arm64/crypto/sha256-glue.c            |   5 +-
 arch/arm64/crypto/sha3-ce-glue.c           |   5 +-
 arch/arm64/crypto/sha512-ce-glue.c         |   7 +-
 arch/arm64/crypto/sm3-ce-glue.c            |   7 +-
 arch/arm64/crypto/sm4-ce-glue.c            |   5 +-
 arch/x86/crypto/aesni-intel_glue.c         |   8 +-
 arch/x86/crypto/chacha_glue.c              |   6 +-
 arch/x86/crypto/crc32-pclmul_glue.c        |   5 +-
 arch/x86/crypto/crc32c-intel_glue.c        |   7 +-
 arch/x86/crypto/crct10dif-pclmul_glue.c    |   7 +-
 arch/x86/crypto/ghash-clmulni-intel_glue.c |   9 +-
 arch/x86/crypto/nhpoly1305-avx2-glue.c     |   5 +-
 arch/x86/crypto/nhpoly1305-sse2-glue.c     |   5 +-
 arch/x86/crypto/poly1305_glue.c            |   4 +-
 arch/x86/crypto/sha1_ssse3_glue.c          |   7 +-
 arch/x86/crypto/sha256_ssse3_glue.c        |   7 +-
 arch/x86/crypto/sha512_ssse3_glue.c        |  10 +-
 crypto/chacha_generic.c                    |   2 +-
 crypto/simd.c                              |   8 +-
 crypto/testmgr.c                           | 142 +++++++++++++++++----
 include/crypto/internal/simd.h             |  24 ++++
 41 files changed, 272 insertions(+), 123 deletions(-)
Signature · 1 line
2.21.0