public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 0/1] lib/crypto: tests: KUnit test-suite for AES
@ 2026-01-15 18:38 Holger Dengler
  2026-01-15 18:38 ` [PATCH v1 1/1] lib/crypto: tests: Add KUnit tests " Holger Dengler
  0 siblings, 1 reply; 14+ messages in thread
From: Holger Dengler @ 2026-01-15 18:38 UTC (permalink / raw)
  To: Eric Biggers
  Cc: Ard Biesheuvel, Jason A . Donenfeld, Herbert Xu,
	Harald Freudenberger, Holger Dengler, linux-kernel, linux-crypto

The following patch adds a kunit tests for the aes library. It does a very
minimal verification of the aes operation for all key-sizes. The benchmarks,
which are also part of the test-suite, can be used to get some rough
performance measurements of the aes encrypt and decrypt functions. The
aes_prepare*key() APIs are not covered by the benchmarks.

Changes since RFC [1]:
- reorder entries in Kconfig/Makefile alphabetically
- fail (instead of skip) in case of failures in key preparation
- replace local constant definitions
- replace macros with helper functions

[1] https://lore.kernel.org/linux-crypto/20260114153138.4896-1-dengler@linux.ibm.com

Example output of the aes_kunit test-suite:

[  178.640161] KTAP version 1
[  178.640167] 1..1
[  178.642268]     KTAP version 1
[  178.642269]     # Subtest: aes
[  178.642270]     # module: aes_kunit
[  178.642272]     1..9
[  178.642330]     ok 1 test_aes128_encrypt
[  178.642378]     ok 2 test_aes128_decrypt
[  178.642427]     ok 3 test_aes192_encrypt
[  178.642477]     ok 4 test_aes192_decrypt
[  178.642531]     ok 5 test_aes256_encrypt
[  178.642584]     ok 6 test_aes256_decrypt
[  179.345355]     # benchmark_aes128: enc (iter. 10000000, duration 351128093ns)
[  179.345359]     # benchmark_aes128: enc (len=16): 434 MB/s
[  179.345361]     # benchmark_aes128: dec (iter. 10000000, duration 351541596ns)
[  179.345363]     # benchmark_aes128: dec (len=16): 434 MB/s
[  179.345398]     ok 7 benchmark_aes128
[  180.082939]     # benchmark_aes192: enc (iter. 10000000, duration 370559483ns)
[  180.082942]     # benchmark_aes192: enc (len=16): 411 MB/s
[  180.082944]     # benchmark_aes192: dec (iter. 10000000, duration 366888529ns)
[  180.082946]     # benchmark_aes192: dec (len=16): 415 MB/s
[  180.082982]     ok 8 benchmark_aes192
[  180.810447]     # benchmark_aes256: enc (iter. 10000000, duration 363703684ns)
[  180.810450]     # benchmark_aes256: enc (len=16): 419 MB/s
[  180.810452]     # benchmark_aes256: dec (iter. 10000000, duration 363671689ns)
[  180.810454]     # benchmark_aes256: dec (len=16): 419 MB/s
[  180.810490]     ok 9 benchmark_aes256
[  180.810495] # aes: pass:9 fail:0 skip:0 total:9
[  180.810498] # Totals: pass:9 fail:0 skip:0 total:9
[  180.810500] ok 1 aes

Holger Dengler (1):
  lib/crypto: tests: Add KUnit tests for AES

 lib/crypto/tests/Kconfig        |  12 +++
 lib/crypto/tests/Makefile       |   1 +
 lib/crypto/tests/aes-testvecs.h |  78 +++++++++++++++++
 lib/crypto/tests/aes_kunit.c    | 149 ++++++++++++++++++++++++++++++++
 4 files changed, 240 insertions(+)
 create mode 100644 lib/crypto/tests/aes-testvecs.h
 create mode 100644 lib/crypto/tests/aes_kunit.c


base-commit: 47753e09a15d9fd7cdf114550510f4f2af9333ec
-- 
2.51.0


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2026-01-17 23:59 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-15 18:38 [PATCH v1 0/1] lib/crypto: tests: KUnit test-suite for AES Holger Dengler
2026-01-15 18:38 ` [PATCH v1 1/1] lib/crypto: tests: Add KUnit tests " Holger Dengler
2026-01-15 20:43   ` Eric Biggers
2026-01-15 21:51     ` Holger Dengler
2026-01-15 21:58       ` Eric Biggers
2026-01-15 22:05     ` David Laight
2026-01-16 17:31       ` Holger Dengler
2026-01-16 18:37         ` David Laight
2026-01-16 19:20           ` Holger Dengler
2026-01-16 19:44             ` Eric Biggers
2026-01-16 20:55               ` Holger Dengler
2026-01-16 22:30                 ` David Laight
2026-01-17 23:59                   ` Eric Biggers
2026-01-16  0:25   ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox