swtpm/tests
Stefan Berger 27bf9db67e swtpm: Use tag-length-value blocks to store data in v2 format
Prepend tag-length-value (tlv) headers in front of all data being stored in
the byte stream following the header. This lets us uniquely identify plain
data (= TPM state), encrypted data (= encrytped TPM state), migration data
(which is wrapped plain or encrytped TPM state), and an HMAC block to
validate the plain data.

We keep support for version 1 for reading the data but convert them to
version 2 when writing them out. This way we loose backwards compatibility
(downgrading of swtpm is not possible), but it allows us to extend the state
in the future by adding addition blocks with tlv headers.

Version 1 of the encryption was prepending the hash on the plaintext data
then encrypting all of it. This method is not so good. In version 2 we now
use Encrypt-then-MAC (EtM) where we encrypt the data and then calculate an
HMAC on the encrypted data.

Files written by the swtpm didn't have a header before. Now they also get a
header. This means that the state written into files and the state retrieved
using the API (swtpm_ioctl --save) have the same format, but still differ
in so far as the API wraps the data in a tlv header for migration, which the
files written out as state would never get.

Adapt a couple of test cases show file sizes and hashes have changed now.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-06-20 10:05:45 -04:00
..
data tests: Use a root CA for creating the issuercert for test_swtpm_cert 2018-04-17 10:52:35 -04:00
_test_encrypted_state tests: Run tests also on socket interfaces 2017-07-11 14:04:40 -04:00
_test_getcap tests: Run tests also on socket interfaces 2017-07-11 14:04:40 -04:00
_test_hashing tests: Run tests also on socket interfaces 2017-07-11 14:04:40 -04:00
_test_hashing2 tests: Run tests also on socket interfaces 2017-07-11 14:04:40 -04:00
_test_init tests: extend INIT test with case where state file is inaccessible 2017-11-12 17:14:33 -05:00
_test_locality tests: Run tests also on socket interfaces 2017-07-11 14:04:40 -04:00
_test_migration_key swtpm: Use tag-length-value blocks to store data in v2 format 2018-06-20 10:05:45 -04:00
_test_migration_key_2 tests: Run tests also on socket interfaces 2017-07-11 14:04:40 -04:00
_test_resume_volatile tests: Run tests also on socket interfaces 2017-07-11 14:04:40 -04:00
_test_save_load_encrypted_state tests: Extend encrypted state test to check for unmodified state 2017-11-14 07:59:04 -05:00
_test_save_load_state tests: Run tests also on socket interfaces 2017-07-11 14:04:40 -04:00
_test_setbuffersize tests: Also TPM 1.2 a valid buffer size range 2017-12-18 20:45:56 -05:00
_test_swtpm_bios tests: Run tests also on socket interfaces 2017-07-11 14:04:40 -04:00
_test_volatilestate tests: Run tests also on socket interfaces 2017-07-11 14:04:40 -04:00
_test_wrongorder tests: Run tests also on socket interfaces 2017-07-11 14:04:40 -04:00
common tests: Poll for 1 second after PID file was found to be gone 2018-06-04 16:10:27 -04:00
create_certs.sh merging swtpm-tools into this project 2014-12-05 13:43:21 -05:00
load_vtpm_proxy tests: Skip CUSE TPM related tests if cuse module is not available 2017-02-02 09:01:55 -05:00
Makefile.am build: add missing load_vtpm_proxy file for 'make dist' 2018-02-06 10:38:03 -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_GETINFO to retrieve TPM specification info 2018-04-23 10:00:26 -04:00
test_commandline Introduce '--flag not-need-init' for socket and chardev 2017-07-11 14:04:40 -04:00
test_common test: Add --log parameter to test logging 2017-02-03 15:15:31 -05:00
test_config.in build: remove hardcoded tss user and group 2015-11-02 20:47:37 -05:00
test_ctrlchannel swtpm: Use tag-length-value blocks to store data in v2 format 2018-06-20 10:05:45 -04:00
test_ctrlchannel2 tests: Poll for 1 second after PID file was found to be gone 2018-06-04 16:10:27 -04:00
test_ctrlchannel3 tests: Split off CMD_SET_DATAFD test into own file 2017-10-11 18:57:16 -04:00
test_ctrlchannel4 swtpm: Implement CMD_GETINFO to retrieve TPM specification info 2018-04-23 10:00:26 -04:00
test_cuse tests: Skip CUSE tests if not compiled with CUSE interface 2018-06-11 10:35:14 -04:00
test_encrypted_state tests: Run tests also on socket interfaces 2017-07-11 14:04:40 -04:00
test_getcap tests: Run tests also on socket interfaces 2017-07-11 14:04:40 -04:00
test_hashing tests: Run tests also on socket interfaces 2017-07-11 14:04:40 -04:00
test_hashing2 tests: Run tests also on socket interfaces 2017-07-11 14:04:40 -04:00
test_init tests: Run tests also on socket interfaces 2017-07-11 14:04:40 -04:00
test_locality tests: Run tests also on socket interfaces 2017-07-11 14:04:40 -04:00
test_migration_key tests: Run tests also on socket interfaces 2017-07-11 14:04:40 -04:00
test_parameters swtpm: Use tag-length-value blocks to store data in v2 format 2018-06-20 10:05:45 -04:00
test_resume_volatile tests: Run tests also on socket interfaces 2017-07-11 14:04:40 -04:00
test_save_load_encrypted_state tests: Run tests also on socket interfaces 2017-07-11 14:04:40 -04:00
test_save_load_state tests: Run tests also on socket interfaces 2017-07-11 14:04:40 -04:00
test_setbuffersize swtpm: Implemented support for PTM_SET_BUFFERSIZE command 2017-11-05 14:53:00 -05:00
test_setdatafd.py tests: use send1msg() in place of sendmsg() for older twisted versions 2017-09-29 20:03:14 -04:00
test_swtpm_bios tests: Run tests also on socket interfaces 2017-07-11 14:04:40 -04:00
test_swtpm_cert swtpm_cert: Add Subject Directory Attributes to EK cert 2018-04-16 21:22:19 -04:00
test_swtpm_setup_create_cert tests: set PATH so swtpm_cert can be found 2018-04-23 11:58:59 -04:00
test_volatilestate tests: Run tests also on socket interfaces 2017-07-11 14:04:40 -04:00
test_vtpm_proxy tests: replace plain sleep with wait for PID file to be gone 2017-10-16 14:19:48 -04:00
test_wrongorder tests: Run tests also on socket interfaces 2017-07-11 14:04:40 -04:00