[RFC PATCH 0/1] lib/crypto: tests: KUnit test-suite for AES

Holger Dengler posted 1 patch 3 weeks, 2 days ago
There is a newer version of this series
lib/crypto/tests/Kconfig        |  12 ++++
lib/crypto/tests/Makefile       |   1 +
lib/crypto/tests/aes-testvecs.h |  78 ++++++++++++++++++++++
lib/crypto/tests/aes_kunit.c    | 115 ++++++++++++++++++++++++++++++++
4 files changed, 206 insertions(+)
create mode 100644 lib/crypto/tests/aes-testvecs.h
create mode 100644 lib/crypto/tests/aes_kunit.c
[RFC PATCH 0/1] lib/crypto: tests: KUnit test-suite for AES
Posted by Holger Dengler 3 weeks, 2 days ago
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.

Example output of the aes_kunit test-suite:

[   44.748194] KTAP version 1
[   44.748199] 1..1
[   44.748240]     KTAP version 1
[   44.748241]     # Subtest: aes
[   44.748242]     # module: aes_kunit
[   44.748244]     1..9
[   44.748304]     ok 1 aes128_kat_encrypt
[   44.748365]     ok 2 aes128_kat_decrypt
[   44.748417]     ok 3 aes192_kat_encrypt
[   44.748482]     ok 4 aes192_kat_decrypt
[   44.748528]     ok 5 aes256_kat_encrypt
[   44.748583]     ok 6 aes256_kat_decrypt
[   45.466878]     # aes128_benchmark: enc (iter. 10000000, duration 359887225ns)
[   45.466881]     # aes128_benchmark: enc (len=16): 423 MB/s
[   45.466883]     # aes128_benchmark: dec (iter. 10000000, duration 358322328ns)
[   45.466885]     # aes128_benchmark: dec (len=16): 425 MB/s
[   45.466921]     ok 7 aes128_benchmark
[   46.205717]     # aes192_benchmark: enc (iter. 10000000, duration 367953960ns)
[   46.205720]     # aes192_benchmark: enc (len=16): 414 MB/s
[   46.205722]     # aes192_benchmark: dec (iter. 10000000, duration 370756491ns)
[   46.205724]     # aes192_benchmark: dec (len=16): 411 MB/s
[   46.205752]     ok 8 aes192_benchmark
[   46.974536]     # aes256_benchmark: enc (iter. 10000000, duration 386414949ns)
[   46.974539]     # aes256_benchmark: enc (len=16): 394 MB/s
[   46.974541]     # aes256_benchmark: dec (iter. 10000000, duration 382280549ns)
[   46.974542]     # aes256_benchmark: dec (len=16): 399 MB/s
[   46.974716]     ok 9 aes256_benchmark
[   46.974719] # aes: pass:9 fail:0 skip:0 total:9
[   46.974721] # Totals: pass:9 fail:0 skip:0 total:9
[   46.974724] 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    | 115 ++++++++++++++++++++++++++++++++
 4 files changed, 206 insertions(+)
 create mode 100644 lib/crypto/tests/aes-testvecs.h
 create mode 100644 lib/crypto/tests/aes_kunit.c

-- 
2.51.0