diff options
| author | Eric Biggers <ebiggers@kernel.org> | 2025-10-14 14:16:55 -0700 |
|---|---|---|
| committer | Mikulas Patocka <mpatocka@redhat.com> | 2025-10-20 15:47:27 +0200 |
| commit | ba0f428c9b40364f1af92523860c787068987b8c (patch) | |
| tree | bccffbcfd67b96d321b0d5c487b2b5f95935cd58 /scripts/gdb/linux/bpf.py | |
| parent | 3ee6c4bc5307d9fcc681dc7ee15822a54b94b39c (diff) | |
dm-verity: use SHA-256 library for SHA-256
When the hash algorithm is SHA-256 and the verity version is not 0, use
the SHA-256 library instead of crypto_shash.
This is a prerequisite for making dm-verity interleave the computation
of SHA-256 hashes for increased performance. That optimization is
available in the SHA-256 library but not in crypto_shash.
Even without interleaved hashing, switching to the library also slightly
improves performance by itself because it avoids the overhead of
crypto_shash, including indirect calls and other API overhead.
(Benchmark on x86_64, AMD Zen 5: hashing 4K blocks gets 2.1% faster.)
SHA-256 is by far the most common hash algorithm used with dm-verity.
It makes sense to optimize for the common case and fall back to the
generic crypto layer for uncommon cases, as suggested by Linus:
https://lore.kernel.org/r/CAHk-=wgp-fOSsZsYrbyzqCAfEvrt5jQs1jL-97Wc4seMNTUyng@mail.gmail.com
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Diffstat (limited to 'scripts/gdb/linux/bpf.py')
0 files changed, 0 insertions, 0 deletions
