swtpm/tests
Stefan Berger 8356e28a4e tests: Sign different TPM 2 certificate types with an Ed448 key
Use swtpm_cert to sign the different types of TPM certificates with an
Ed448 key.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2026-06-03 16:30:44 -04:00
..
data tests: Refactor certificate creation tests 2026-06-03 14:20:15 -04:00
patches tests: Make the TPM 1.2 tools compilable in more recent build environments 2026-02-11 18:07:15 -05:00
_test_encrypted_state tests: Derive support for CUSE from SWTPM_EXE help screen 2024-08-26 20:00:14 -04:00
_test_getcap tests: Derive support for CUSE from SWTPM_EXE help screen 2024-08-26 20:00:14 -04:00
_test_hashing tests: Derive support for CUSE from SWTPM_EXE help screen 2024-08-26 20:00:14 -04:00
_test_hashing2 tests: Derive support for CUSE from SWTPM_EXE help screen 2024-08-26 20:00:14 -04:00
_test_init tests: Derive support for CUSE from SWTPM_EXE help screen 2024-08-26 20:00:14 -04:00
_test_locality tests: Derive support for CUSE from SWTPM_EXE help screen 2024-08-26 20:00:14 -04:00
_test_migration_key tests: Derive support for CUSE from SWTPM_EXE help screen 2024-08-26 20:00:14 -04:00
_test_migration_key_2 tests: Fix issues related to SC2164 2023-01-13 21:02:51 -05:00
_test_print_capabilities swtpm_cert: Enable certificate creation for ML-KEM keys 2026-06-03 16:30:44 -04:00
_test_print_states tests: Derive support for CUSE from SWTPM_EXE help screen 2024-08-26 20:00:14 -04:00
_test_resume_volatile tests: Derive support for CUSE from SWTPM_EXE help screen 2024-08-26 20:00:14 -04:00
_test_save_load_encrypted_state tests: Derive support for CUSE from SWTPM_EXE help screen 2024-08-26 20:00:14 -04:00
_test_save_load_state tests: Derive support for CUSE from SWTPM_EXE help screen 2024-08-26 20:00:14 -04:00
_test_setbuffersize tests: Derive support for CUSE from SWTPM_EXE help screen 2024-08-26 20:00:14 -04:00
_test_swtpm_bios tests: Derive support for CUSE from SWTPM_EXE help screen 2024-08-26 20:00:14 -04:00
_test_swtpm_cert tests: Refactor certificate creation tests 2026-06-03 14:20:15 -04:00
_test_tpm2_avoid_da_lockout tests: Retry NVWrite command after 0x922 return code and inc lockout counter 2025-05-12 18:46:28 -04:00
_test_tpm2_derived_keys tests: Derive support for CUSE from SWTPM_EXE help screen 2024-08-26 20:00:14 -04:00
_test_tpm2_encrypted_state tests: Extend existing test case to use the new fsync option 2025-05-27 16:28:39 -04:00
_test_tpm2_file_permissions tests: Derive support for CUSE from SWTPM_EXE help screen 2024-08-26 20:00:14 -04:00
_test_tpm2_getcap tests: Derive support for CUSE from SWTPM_EXE help screen 2024-08-26 20:00:14 -04:00
_test_tpm2_hashing tests: Derive support for CUSE from SWTPM_EXE help screen 2024-08-26 20:00:14 -04:00
_test_tpm2_hashing2 tests: Derive support for CUSE from SWTPM_EXE help screen 2024-08-26 20:00:14 -04:00
_test_tpm2_hashing3 tests: Derive support for CUSE from SWTPM_EXE help screen 2024-08-26 20:00:14 -04:00
_test_tpm2_init tests: Test for expected message receive on NOTIFY_SOCKET 2026-03-12 21:27:43 -04:00
_test_tpm2_locality tests: Derive support for CUSE from SWTPM_EXE help screen 2024-08-26 20:00:14 -04:00
_test_tpm2_migration_key tests: Derive support for CUSE from SWTPM_EXE help screen 2024-08-26 20:00:14 -04:00
_test_tpm2_pcap tests: Fix name of CUSE TPM device in pcap test case 2026-02-27 15:35:15 -05:00
_test_tpm2_print_capabilities swtpm_cert: Enable certificate creation for ML-KEM keys 2026-06-03 16:30:44 -04:00
_test_tpm2_print_states tests: Derive support for CUSE from SWTPM_EXE help screen 2024-08-26 20:00:14 -04:00
_test_tpm2_probe tests: Derive support for CUSE from SWTPM_EXE help screen 2024-08-26 20:00:14 -04:00
_test_tpm2_resume_volatile tests: Derive support for CUSE from SWTPM_EXE help screen 2024-08-26 20:00:14 -04:00
_test_tpm2_save_load_encrypted_state tests: Derive support for CUSE from SWTPM_EXE help screen 2024-08-26 20:00:14 -04:00
_test_tpm2_save_load_state tests: Derive support for CUSE from SWTPM_EXE help screen 2024-08-26 20:00:14 -04:00
_test_tpm2_save_load_state_da_timeout tests: Derive support for CUSE from SWTPM_EXE help screen 2024-08-26 20:00:14 -04:00
_test_tpm2_save_load_state_locking tests: Fix a spelling error in a variable 2025-10-01 11:47:22 -04:00
_test_tpm2_savestate tests: Derive support for CUSE from SWTPM_EXE help screen 2024-08-26 20:00:14 -04:00
_test_tpm2_setbuffersize tests: Derive support for CUSE from SWTPM_EXE help screen 2024-08-26 20:00:14 -04:00
_test_tpm2_swtpm_bios tests: Derive support for CUSE from SWTPM_EXE help screen 2024-08-26 20:00:14 -04:00
_test_tpm2_swtpm_cert tests: Create certificates for ML-DSA and ML-KEM keys 2026-06-03 16:30:44 -04:00
_test_tpm2_volatilestate tests: Derive support for CUSE from SWTPM_EXE help screen 2024-08-26 20:00:14 -04:00
_test_tpm2_wrongorder tests: Derive support for CUSE from SWTPM_EXE help screen 2024-08-26 20:00:14 -04:00
_test_tpm_probe tests: Derive support for CUSE from SWTPM_EXE help screen 2024-08-26 20:00:14 -04:00
_test_volatilestate tests: Derive support for CUSE from SWTPM_EXE help screen 2024-08-26 20:00:14 -04:00
_test_wrongorder tests: Derive support for CUSE from SWTPM_EXE help screen 2024-08-26 20:00:14 -04:00
common tests: Make some tests work in ubuntu:26.04 containers 2026-06-03 12:40:15 -04:00
create_certs.sh swtpm_setup: Create IAK hwSerialNum from data extracted from EK certificate 2026-04-23 15:43:40 -04:00
fileinstall tests+samples: Check for --help support to determine stat/sed tools flavor 2026-05-19 19:14:37 -04:00
installed-runner.sh tests: drop the need to set INSTALLED=1 when running tests 2024-07-15 10:38:38 -04:00
load_vtpm_proxy tests: Fix shellcheck issue SC2148 by adding a shell directive 2023-01-30 18:25:45 -05:00
Makefile.am tests: Refactor certificate creation tests 2026-06-03 14:20:15 -04:00
Readme.md tests: Enable SWTPM_TEST_PROFILE for running test_tpm2_ibmtss2 with profile 2024-10-02 18:20:18 -04:00
sed-inplace tests+samples: Check for --help support to determine stat/sed tools flavor 2026-05-19 19:14:37 -04:00
softhsm_setup tests: Add softhsm_setup to shellcheck'ed files and fix issues 2023-11-22 07:16:44 -05:00
swtpm_setup.conf treewide: remove executable bit from config files and c-code 2018-01-17 10:45:25 -05:00
test_clientfds.py swtpm: Implement CMD_LOCK_STORAGE to lock storage 2022-09-06 14:08:45 -04:00
test_commandline tests: Remove SWTPM variable and usage 2024-08-26 20:00:14 -04:00
test_common tests: Fix shellcheck issue SC2148 by adding a shell directive 2023-01-30 18:25:45 -05:00
test_config.in build: remove hardcoded tss user and group 2015-11-02 20:47:37 -05:00
test_ctrlchannel tests: Fix 2 cases of shellcheck SC2001 using bash search-replace 2023-01-30 18:25:45 -05:00
test_ctrlchannel2 tests: Convert more test cases to rely on variables from common 2024-08-26 20:00:14 -04:00
test_ctrlchannel3 tests: Fix code to pass shellcheck with some errors disabled 2023-01-13 13:59:02 -05:00
test_ctrlchannel4 tests: Fix code to pass shellcheck with some errors disabled 2023-01-13 13:59:02 -05:00
test_cuse tests: Derive support for CUSE from SWTPM_EXE help screen 2024-08-26 20:00:14 -04:00
test_encrypted_state tests: Fix issues related to SC2164 2023-01-13 21:02:51 -05:00
test_getcap tests: Fix issues related to SC2164 2023-01-13 21:02:51 -05:00
test_hashing tests: Fix issues related to SC2164 2023-01-13 21:02:51 -05:00
test_hashing2 tests: Fix issues related to SC2164 2023-01-13 21:02:51 -05:00
test_init tests: Fix issues related to SC2164 2023-01-13 21:02:51 -05:00
test_locality tests: Fix issues related to SC2164 2023-01-13 21:02:51 -05:00
test_migration_key tests: Fix issues related to SC2164 2023-01-13 21:02:51 -05:00
test_parameters tests: teach them to run installed 2024-07-15 10:38:38 -04:00
test_print_capabilities tests: Fix issues related to SC2164 2023-01-13 21:02:51 -05:00
test_print_states tests: Add test cases for using swtpm --print-states while swtpm is running 2024-06-11 08:43:01 -04:00
test_resume_volatile tests: Fix issues related to SC2164 2023-01-13 21:02:51 -05:00
test_save_load_encrypted_state tests: Fix issues related to SC2164 2023-01-13 21:02:51 -05:00
test_save_load_state tests: Fix issues related to SC2164 2023-01-13 21:02:51 -05:00
test_setbuffersize tests: Fix issues related to SC2164 2023-01-13 21:02:51 -05:00
test_setdatafd.py tests: Replicate test_ctrlchannel3 for TPM 2 to test_tpm2_ctrlchannel3 2022-09-22 13:27:38 -04:00
test_swtpm_bios tests: Fix issues related to SC2164 2023-01-13 21:02:51 -05:00
test_swtpm_cert tests: Refactor certificate creation tests 2026-06-03 14:20:15 -04:00
test_swtpm_setup_create_cert tests: Convert test cases to use openssl tool 2026-04-22 11:19:28 -04:00
test_swtpm_setup_file_backend tests: use swtpm_setup.conf from tests 2024-07-15 10:38:38 -04:00
test_swtpm_setup_misc tests: Rearrange order of test cases to run some also as 'root' 2024-03-19 14:28:01 -04:00
test_swtpm_setup_overwrite tests: use swtpm_setup.conf from tests 2024-07-15 10:38:38 -04:00
test_tpm2_avoid_da_lockout tests: Fix issues related to SC2164 2023-01-13 21:02:51 -05:00
test_tpm2_chroot_chardev tests: Convert more test cases to rely on variables from common 2024-08-26 20:00:14 -04:00
test_tpm2_chroot_cuse tests: cuse: Create /dev/null in chroot environment 2025-08-28 10:47:04 -04:00
test_tpm2_chroot_socket swtpm: Check for good entropy source in chroot environment 2024-09-19 16:54:28 -04:00
test_tpm2_ctrlchannel2 tests: Convert more test cases to rely on variables from common 2024-08-26 20:00:14 -04:00
test_tpm2_ctrlchannel3 tests: Fix code to pass shellcheck with some errors disabled 2023-01-13 13:59:02 -05:00
test_tpm2_derived_keys tests: Fix issues related to SC2164 2023-01-13 21:02:51 -05:00
test_tpm2_encrypted_state tests: Fix issues related to SC2164 2023-01-13 21:02:51 -05:00
test_tpm2_file_permissions tests: Fix issues related to SC2164 2023-01-13 21:02:51 -05:00
test_tpm2_getcap tests: Fix issues related to SC2164 2023-01-13 21:02:51 -05:00
test_tpm2_hashing tests: Fix issues related to SC2164 2023-01-13 21:02:51 -05:00
test_tpm2_hashing2 tests: Fix issues related to SC2164 2023-01-13 21:02:51 -05:00
test_tpm2_hashing3 tests: Fix issues related to SC2164 2023-01-13 21:02:51 -05:00
test_tpm2_ibmtss2 tests: Use IBMTSS2 test v2.5.0 2026-05-21 10:46:34 -04:00
test_tpm2_init tests: Fix issues related to SC2164 2023-01-13 21:02:51 -05:00
test_tpm2_libtpms_versions_profiles tests: Pass --disable-tests when building swtpm across versions 2026-05-05 17:19:48 -04:00
test_tpm2_locality tests: Fix issues related to SC2164 2023-01-13 21:02:51 -05:00
test_tpm2_migration_key tests: Fix issues related to SC2164 2023-01-13 21:02:51 -05:00
test_tpm2_parameters swtpm_setup: Create IAK hwSerialNum from data extracted from EK certificate 2026-04-23 15:43:40 -04:00
test_tpm2_partial_reads tests: source common under ${TESTDIR} 2024-08-27 07:49:10 -04:00
test_tpm2_pcap tests: Add a test for the --pcap command line option 2026-02-27 14:56:36 -05:00
test_tpm2_print_capabilities tests: Fix issues related to SC2164 2023-01-13 21:02:51 -05:00
test_tpm2_print_states tests: Add test cases for using swtpm --print-states while swtpm is running 2024-06-11 08:43:01 -04:00
test_tpm2_probe tests: Fix issues related to SC2164 2023-01-13 21:02:51 -05:00
test_tpm2_profile_disabled_features tests: Test that disabled commands and algorithms are actually disabled 2026-03-19 20:11:10 -04:00
test_tpm2_resume_volatile tests: Fix issues related to SC2164 2023-01-13 21:02:51 -05:00
test_tpm2_samples_create_tpmca.test tests: Skip tests if p11tool is not found in PATH 2026-05-06 08:09:04 -04:00
test_tpm2_save_load_encrypted_state tests: Fix issues related to SC2164 2023-01-13 21:02:51 -05:00
test_tpm2_save_load_state tests: Fix issues related to SC2164 2023-01-13 21:02:51 -05:00
test_tpm2_save_load_state_2 tests: Test verification and encryption with state from libtpms v0.9 and v0.10 2026-04-28 20:40:58 -04:00
test_tpm2_save_load_state_2_block tests: Fix 3 occurrences of stray '\' before '-' 2024-06-10 19:40:31 -04:00
test_tpm2_save_load_state_2_linear tests: Fix code to pass shellcheck with some errors disabled 2023-01-13 13:59:02 -05:00
test_tpm2_save_load_state_3 tests: Convert test cases to use openssl tool 2026-04-22 11:19:28 -04:00
test_tpm2_save_load_state_da_timeout tests: Fix issues related to SC2164 2023-01-13 21:02:51 -05:00
test_tpm2_save_load_state_locking tests: Fix issues related to SC2164 2023-01-13 21:02:51 -05:00
test_tpm2_savestate tests: Fix issues related to SC2164 2023-01-13 21:02:51 -05:00
test_tpm2_setbuffersize tests: Fix issues related to SC2164 2023-01-13 21:02:51 -05:00
test_tpm2_swtpm_bios tests: Fix issues related to SC2164 2023-01-13 21:02:51 -05:00
test_tpm2_swtpm_cert tests: Sign different TPM 2 certificate types with an Ed448 key 2026-06-03 16:30:44 -04:00
test_tpm2_swtpm_localca swtpm_localca: Replace certtool with openssl for creating CAs 2026-05-05 13:41:20 -04:00
test_tpm2_swtpm_localca_pkcs11.test tests: Make some tests work in ubuntu:26.04 containers 2026-06-03 12:40:15 -04:00
test_tpm2_swtpm_setup_check_certs tests: Fall back to using default-v1 profile while libtpms v0.11 is not required 2026-04-22 14:38:43 -04:00
test_tpm2_swtpm_setup_create_cert swtpm_setup: Create IAK hwSerialNum from data extracted from EK certificate 2026-04-23 15:43:40 -04:00
test_tpm2_swtpm_setup_overwrite tests: use swtpm_setup.conf from tests 2024-07-15 10:38:38 -04:00
test_tpm2_swtpm_setup_profile tests: Extend test cases with RSA-4096 and default-v2 testing 2025-08-05 18:05:08 -04:00
test_tpm2_swtpm_setup_profile_name tests: Extend test cases with RSA-4096 and default-v2 testing 2025-08-05 18:05:08 -04:00
test_tpm2_volatilestate tests: Fix issues related to SC2164 2023-01-13 21:02:51 -05:00
test_tpm2_vtpm_proxy tests: Convert more test cases to rely on variables from common 2024-08-26 20:00:14 -04:00
test_tpm2_wrongorder tests: Fix issues related to SC2164 2023-01-13 21:02:51 -05:00
test_tpm12 tests: Make the TPM 1.2 tools compilable in more recent build environments 2026-02-11 18:07:15 -05:00
test_tpm_probe tests: Fix issues related to SC2164 2023-01-13 21:02:51 -05:00
test_volatilestate tests: Fix issues related to SC2164 2023-01-13 21:02:51 -05:00
test_vtpm_proxy tests: Convert more test cases to rely on variables from common 2024-08-26 20:00:14 -04:00
test_wrongorder tests: Fix issues related to SC2164 2023-01-13 21:02:51 -05:00

This directory contains the swtpm tests.

To run the tests you need to build swtpm first and then you can run the tests using the following command line:

SWTPM_TEST_PROFILE='{"Name":"default-v1"}' \
SWTPM_TEST_EXPENSIVE=1 SWTPM_TEST_STORE_VOLATILE=1 SWTPM_TEST_IBMTSS2=1 make check

You may omit the environment variables if you don't want to run the more time-consuming tests.

SWTPM_TEST_EXPENSIVE=1 enables the following tests:

  • test_tpm12
  • test_tpm2_ibmtss2
  • test_tpm2_libtpms_versions_profiles

SWTPM_TEST_STORE_VOLATILE=1 enables storing and restoring of the volatile state at every step of the test_tpm2_ibmtss2 test. This environment variable only has an effect if SWTPM_TEST_EXPENSIVE=1 is set.

SWTPM_TEST_IBMTSS2=1 enables the following tests

  • test_tpm2_save_load_state_2
  • test_tpm2_save_load_state_3
  • test_tpm2_libtpms_versions_profiles

SWTPM_TEST_PROFILE allows to set a profile for the following tests:

  • test_tpm2_ibmtss2

Note: The test suite will terminate with an error if the profile disables an algorithm that it requires.

To run against an installed IBM TSS test suite, you may set the SWTPM_TEST_IBMTSS to the location of the test suite, such as /usr/libexec/installed-tests/ibmtss.

Some tests require root rights, especially those involving the CUSE TPM and the vTPM proxy device. To run these and all the other ones you can use the following command line:

sudo bash -c "SWTPM_TEST_EXPENSIVE=1 SWTPM_TEST_STORE_VOLATILE=1 SWTPM_TEST_IBMTSS2=1 make check"