Documentation: libcrypto: Add additional testing information
Subsystems (3)
Eric Biggers
maintainerPATCH 1/1 Documentation: libcrypto: Add additional testing information
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.
---
This patch is intended to be taken through libcrypto-next
Documentation/crypto/libcrypto.rst | 13 +++++++++++++ 1 file changed, 13 insertions(+)
Documentation/crypto/libcrypto.rst +13 -0
@@ -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
Signature · 1 line
2.55.0
Quoted 5 lines · Eric Biggers
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.
Quoted 8 lines
Signed-off-by Eric Biggers <[email protected]>---
This patch is intended to be taken through libcrypto-next
Documentation/crypto/libcrypto.rst | 13 +++++++++++++ 1 file changed, 13 insertions(+)
Quoted 49 lines
Documentation/crypto/libcrypto.rst +0
-0@@ -127,6 +127,8 @@ The crypto library uses standard KUnit tests. Likemany 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``.Documentation/crypto/libcrypto.rst +2
-0+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 codeto 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). TheDocumentation/crypto/libcrypto.rst +3
-0+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 andbase-commit:
165768bb70265b5c38cf0b73fafd75be235f8b14Signature · 1 line
2.55.0
Quoted 10 lines · Eric Biggers
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 <[email protected]>---
This patch is intended to be taken through libcrypto-next
Applied to https://git.kernel.org/pub/scm/linux/kernel/git/ebiggers/linux.git/log/?h=libcrypto-next
- Eric