From: Holger Dengler <dengler@linux.ibm.com>
To: Eric Biggers <ebiggers@kernel.org>
Cc: Ard Biesheuvel <ardb@kernel.org>,
"Jason A . Donenfeld" <Jason@zx2c4.com>,
Herbert Xu <herbert@gondor.apana.org.au>,
Harald Freudenberger <freude@linux.ibm.com>,
Holger Dengler <dengler@linux.ibm.com>,
linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org
Subject: [PATCH v1 0/1] lib/crypto: tests: KUnit test-suite for AES
Date: Thu, 15 Jan 2026 19:38:30 +0100 [thread overview]
Message-ID: <20260115183831.72010-1-dengler@linux.ibm.com> (raw)
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
next reply other threads:[~2026-01-15 18:38 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-15 18:38 Holger Dengler [this message]
2026-01-15 18:38 ` [PATCH v1 1/1] lib/crypto: tests: Add KUnit tests for AES 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260115183831.72010-1-dengler@linux.ibm.com \
--to=dengler@linux.ibm.com \
--cc=Jason@zx2c4.com \
--cc=ardb@kernel.org \
--cc=ebiggers@kernel.org \
--cc=freude@linux.ibm.com \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox