mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: linux-crypto@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Ard Biesheuvel <ardb@kernel.org>,
	"Jason A . Donenfeld" <Jason@zx2c4.com>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	linux-doc@vger.kernel.org, Eric Biggers <ebiggers@kernel.org>
Subject: [PATCH] Documentation: libcrypto: Add additional testing information
Date: Thu, 24 Sep 2026 22:25:02 -0700	[thread overview]
Message-ID: <20260925052502.188024-1-ebiggers@kernel.org> (raw)

Link to the KUnit documentation, mention the existence of the benchmarks
and how to enable them, explicitly mention that the tests can be run on
real hardware, and mention that it's often possible to clear CPU
features via the kernel command line.

Signed-off-by: Eric Biggers <ebiggers@kernel.org>
---

This patch is intended to be taken through libcrypto-next

 Documentation/crypto/libcrypto.rst | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/Documentation/crypto/libcrypto.rst b/Documentation/crypto/libcrypto.rst
index e911e0521597..53037e62728e 100644
--- a/Documentation/crypto/libcrypto.rst
+++ b/Documentation/crypto/libcrypto.rst
@@ -127,6 +127,8 @@ The crypto library uses standard KUnit tests.  Like many of the kernel's other
 KUnit tests, they are included in the set of tests that is run by
 ``tools/testing/kunit/kunit.py run --alltests``.
 
+For more information about KUnit, see Documentation/dev-tools/kunit/start.rst.
+
 A ``.kunitconfig`` file is also provided to run just the crypto library tests.
 For example, here's how to run them in user-mode Linux:
 
@@ -148,6 +150,17 @@ emulate the correct type of hardware for the code to be reached.
 Since correctness is essential in cryptographic code, new architecture-optimized
 code is accepted only if it can be tested in QEMU.
 
+Most of the crypto KUnit tests also include benchmarks.  To enable these, enable
+``CONFIG_CRYPTO_LIB_BENCHMARK=y`` (in addition to the tests themselves).  The
+benchmark results are printed to the kernel log when the test runs.
+
+Of course, the crypto KUnit tests can also be run on real hardware.  Note that
+it is generally still possible to test and benchmark non-default code paths in
+this case (for example, the software implementation of AES when the CPU has
+hardware-accelerated AES), since on many architectures the kernel supports
+disabling CPU features via the kernel command line.  For example, on x86,
+the ``clearcpuid=aes`` kernel command line option disables AES acceleration.
+
 Note: the crypto library also includes FIPS 140 self-tests.  These are
 lightweight, are designed specifically to meet FIPS 140 requirements, and exist
 *only* to meet those requirements.  Normal testing done by kernel developers and

base-commit: 165768bb70265b5c38cf0b73fafd75be235f8b14
-- 
2.55.0


             reply	other threads:[~2026-09-25  5:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-25  5:25 Eric Biggers [this message]
2026-09-25  8:36 ` Ard Biesheuvel
2026-09-25 20:10 ` Eric Biggers

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=20260925052502.188024-1-ebiggers@kernel.org \
    --to=ebiggers@kernel.org \
    --cc=Jason@zx2c4.com \
    --cc=ardb@kernel.org \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-doc@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

all inboxes | Powered by JetHome®