Skip to content

KUnit tests for SHA-2 and Poly1305

Eric Biggers linux-crypto lkml 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v5 Latest4 patches 1 replyIn review
  2. v44 patches 0 repliesSuperseded

Changes in v5 from the cover letter

- Moved hash_irq_test2_state from stack to heap
(fixes https://lore.kernel.org/r/[email protected])
- Replaced HRTIMER_MODE_REL with HRTIMER_MODE_REL_HARD to make hardirq context be used on CONFIG_PREEMPT_RT (fixes a WARN_ON_ONCE).
- Removed an unnecessary initialization in hash_irq_test2_func()
- Added comments that explain kconfig option naming
- Added link to Poly1305 paper

Patches in v5 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4lib/crypto: tests: Add hash-test-template.h and gen-hash-testvecs.pylib/crypto/tests/hash-test-template.h scripts/crypto/gen-hash-testvecs.py+785 -00 replies
2/4lib/crypto: tests: Add KUnit tests for SHA-224 and SHA-256lib/crypto/Kconfig lib/crypto/Makefile lib/crypto/tests/Kconfig +5 more+590 -00 replies
3/4lib/crypto: tests: Add KUnit tests for SHA-384 and SHA-512lib/crypto/tests/Kconfig lib/crypto/tests/Makefile lib/crypto/tests/sha384-testvecs.h +3 more+723 -00 replies
4/4lib/crypto: tests: Add KUnit tests for Poly1305lib/crypto/tests/Kconfig lib/crypto/tests/Makefile lib/crypto/tests/poly1305-testvecs.h +2 more+408 -20 replies

Reviews trailers per patch

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

PatchArd Biesheuvel
SeriesA-b
1/4
2/4
3/4
4/4

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

Read the v5 thread

Cover letter [PATCH v5 0/4] KUnit tests for SHA-2 and Poly1305

This series is also available at:

git fetch https://git.kernel.org/pub/scm/linux/kernel/git/ebiggers/linux.git libcrypto-kunit-v5

This series adds the first KUnit tests for lib/crypto/, including tests for SHA-2 and Poly1305.

Changed in v5:
- Moved hash_irq_test2_state from stack to heap
(fixes https://lore.kernel.org/r/[email protected])
- Replaced HRTIMER_MODE_REL with HRTIMER_MODE_REL_HARD to make hardirq context be used on CONFIG_PREEMPT_RT (fixes a WARN_ON_ONCE).
- Removed an unnecessary initialization in hash_irq_test2_func()
- Added comments that explain kconfig option naming
- Added link to Poly1305 paper

Changed in v4:
- Added Poly1305 tests.
- Split the addition of hash-test-template.h and gen-hash-testvecs.py into a separate patch.
- Added two more test cases to hash-test-template.h (test_hash_all_lens_up_to_4096 and test_hash_interrupt_context_2).
- Simplified test_hmac to use a single consolidated test vector.
- Lots of other cleanups.

Changed in v3:
- Split from SHA-512 and SHA-256 series, as per the request from Linus that the tests be kept last on the branch.

Eric Biggers (4):
lib/crypto: tests: Add hash-test-template.h and gen-hash-testvecs.py lib/crypto: tests: Add KUnit tests for SHA-224 and SHA-256 lib/crypto: tests: Add KUnit tests for SHA-384 and SHA-512 lib/crypto: tests: Add KUnit tests for Poly1305

 lib/crypto/Kconfig                    |   2 +
 lib/crypto/Makefile                   |   2 +
 lib/crypto/tests/Kconfig              |  50 ++
 lib/crypto/tests/Makefile             |   5 +
 lib/crypto/tests/hash-test-template.h | 683 ++++++++++++++++++++++++++
 lib/crypto/tests/poly1305-testvecs.h  | 186 +++++++
 lib/crypto/tests/poly1305_kunit.c     | 165 +++++++
 lib/crypto/tests/sha224-testvecs.h    | 238 +++++++++
 lib/crypto/tests/sha224_kunit.c       |  39 ++
 lib/crypto/tests/sha256-testvecs.h    | 238 +++++++++
 lib/crypto/tests/sha256_kunit.c       |  39 ++
 lib/crypto/tests/sha384-testvecs.h    | 290 +++++++++++
 lib/crypto/tests/sha384_kunit.c       |  39 ++
 lib/crypto/tests/sha512-testvecs.h    | 342 +++++++++++++
 lib/crypto/tests/sha512_kunit.c       |  39 ++
 scripts/crypto/gen-hash-testvecs.py   | 147 ++++++
 16 files changed, 2504 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/poly1305-testvecs.h
 create mode 100644 lib/crypto/tests/poly1305_kunit.c
 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.1