Skip to content

Optimize fsverity using 2-way interleaved SHA-256 hashing

Eric Biggers fsverity linux-arm-kernel linux-crypto lkml 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest6 patches 2 repliesIn review
  2. v16 patches 0 repliesSuperseded

Changes in v2 from the cover letter

- Made the new arm64 assembly compatible with CONFIG_CPU_BIG_ENDIAN=y.
- Omitted sha256_finup_2x() from pre-boot environments.
- Made alloc_guarded_buf() assert that the allocation succeeded.
- Minor tweaks to comments and whitespace.

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6lib/crypto: sha256: Add support for 2-way interleaved hashinginclude/crypto/sha2.h lib/crypto/sha256.c+94 -50 replies
2/6lib/crypto: arm64/sha256: Add support for 2-way interleaved hashinglib/crypto/arm64/sha256-ce.S lib/crypto/arm64/sha256.h+315 -60 replies
3/6lib/crypto: x86/sha256: Add support for 2-way interleaved hashinglib/crypto/x86/sha256-ni-asm.S lib/crypto/x86/sha256.h+407 -00 replies
4/6lib/crypto: tests: Add tests and benchmark for sha256_finup_2x()lib/crypto/tests/sha256_kunit.c+184 -00 replies
5/6fsverity: Remove inode parameter from fsverity_hash_block()fs/verity/enable.c fs/verity/fsverity_private.h fs/verity/hash_algs.c +1 more+9 -120 replies
6/6fsverity: Use 2-way interleaved SHA-256 hashing when supportedfs/verity/verify.c+139 -340 replies

Reviews trailers per patch

None of the 6 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchArd Biesheuvel
SeriesR-b
1/6
2/6
3/6
4/6
5/6
6/6

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

Read the v2 thread

Cover letter [PATCH v2 0/6] Optimize fsverity using 2-way interleaved SHA-256 hashing

This series is targeting libcrypto-next. It can also be retrieved from:

git fetch https://git.kernel.org/pub/scm/linux/kernel/git/ebiggers/linux.git sha256_finup_2x-v2

This series adds support for 2-way interleaved SHA-256 hashing to lib/crypto/, implements it for arm64 and x86_64, and makes fsverity use it. This significantly improves fsverity performance on many CPUs.

Later patches will make dm-verity use this optimization as well.

Changed in v2:
- Made the new arm64 assembly compatible with CONFIG_CPU_BIG_ENDIAN=y.
- Omitted sha256_finup_2x() from pre-boot environments.
- Made alloc_guarded_buf() assert that the allocation succeeded.
- Minor tweaks to comments and whitespace.

Eric Biggers (6):
lib/crypto: sha256: Add support for 2-way interleaved hashing lib/crypto: arm64/sha256: Add support for 2-way interleaved hashing lib/crypto: x86/sha256: Add support for 2-way interleaved hashing lib/crypto: tests: Add tests and benchmark for sha256_finup_2x()
fsverity: Remove inode parameter from fsverity_hash_block()
fsverity: Use 2-way interleaved SHA-256 hashing when supported

 fs/verity/enable.c              |  12 +-
 fs/verity/fsverity_private.h    |   2 +-
 fs/verity/hash_algs.c           |   3 +-
 fs/verity/verify.c              | 175 ++++++++++++---
 include/crypto/sha2.h           |  28 +++
 lib/crypto/arm64/sha256-ce.S    | 284 +++++++++++++++++++++++-
 lib/crypto/arm64/sha256.h       |  37 ++++
 lib/crypto/sha256.c             |  71 +++++-
 lib/crypto/tests/sha256_kunit.c | 184 ++++++++++++++++
 lib/crypto/x86/sha256-ni-asm.S  | 368 ++++++++++++++++++++++++++++++++
 lib/crypto/x86/sha256.h         |  39 ++++
 11 files changed, 1147 insertions(+), 56 deletions(-)

base-commit: 54e7bb6ade8acd3fb1c486c9f3e2c0dfdc18f84e

Signature · 1 line
2.51.0