KUnit tests for SHA-2 library functions
Get series with b4
b4 am [email protected]Versions newest first
- v3 Latest2 patches 0 repliesNew
Patches in v3 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | lib/crypto: sha512: Add KUnit tests for SHA-384 and SHA-512lib/ lib/ lib/ +7 more | +1943 | 0 replies | |
| 2/2 | lib/crypto: sha256: Add KUnit tests for SHA-224 and SHA-256lib/ lib/ lib/ +3 more | +1048 | 0 replies |
Reviews trailers per patch
All 2 patches have a Reviewed-by or Acked-by.
| Patch | Ard Biesheuvel |
|---|---|
| 1/2 | A-b |
| 2/2 | A-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH v3 0/2] KUnit tests for SHA-2 library functions
This series is also available at:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/ebiggers/linux.git sha2-kunit-v3
This series adds KUnit tests for the SHA-2 library functions.
Most of this code was originally part of my series
"SHA-512 library functions". I made a few updates in "SHA-256 library improvements". As per the request from Linus that the tests be kept last on the branch for a separate pull request, I've reordered the history to add the tests last. Thus this patch series.
Testing strategy:
- Each SHA variant gets its own KUnit test suite, but a header is used to share most of the test code among the SHA variants.
- Test against vectors generated by the Python hashlib and hmac modules.
- Test incremental computation.
- Test with a guard page to catch buffer overruns even in assembly code.
- Test various overlap and alignment cases.
- Compute hashes in task, softirq, and hardirq context in parallel, to verify that the functions work as expected in all contexts and that fallback code paths are exercised.
- Test that the finalization functions zeroize their context.
- Include benchmarks, guarded by a separate Kconfig option.
Eric Biggers (2):
lib/crypto: sha512: Add KUnit tests for SHA-384 and SHA-512 lib/crypto: sha256: Add KUnit tests for SHA-224 and SHA-256
lib/crypto/Kconfig | 2 + lib/crypto/Makefile | 2 + lib/crypto/tests/Kconfig | 25 + lib/crypto/tests/Makefile | 6 + lib/crypto/tests/hash-test-template.h | 512 ++++++++++++++++++++ lib/crypto/tests/sha224-testvecs.h | 470 ++++++++++++++++++ lib/crypto/tests/sha224_kunit.c | 48 ++ lib/crypto/tests/sha256-testvecs.h | 470 ++++++++++++++++++ lib/crypto/tests/sha256_kunit.c | 48 ++ lib/crypto/tests/sha384-testvecs.h | 566 ++++++++++++++++++++++ lib/crypto/tests/sha384_kunit.c | 48 ++ lib/crypto/tests/sha512-testvecs.h | 662 ++++++++++++++++++++++++++ lib/crypto/tests/sha512_kunit.c | 48 ++ scripts/crypto/gen-hash-testvecs.py | 83 ++++ 14 files changed, 2990 insertions(+) create mode 100644 lib/crypto/tests/Kconfig create mode 100644 lib/crypto/tests/Makefile create mode 100644 lib/crypto/tests/hash-test-template.h create mode 100644 lib/crypto/tests/sha224-testvecs.h create mode 100644 lib/crypto/tests/sha224_kunit.c create mode 100644 lib/crypto/tests/sha256-testvecs.h create mode 100644 lib/crypto/tests/sha256_kunit.c create mode 100644 lib/crypto/tests/sha384-testvecs.h create mode 100644 lib/crypto/tests/sha384_kunit.c create mode 100644 lib/crypto/tests/sha512-testvecs.h create mode 100644 lib/crypto/tests/sha512_kunit.c create mode 100755 scripts/crypto/gen-hash-testvecs.py
Signature · 1 line
2.50.0