Commit Graph

16 Commits

Author SHA1 Message Date
Stefan Berger
f956bce305 tests: Add test case for loading of an NVRAM completely full with keys
Add a test case that fills up the NVRAM area with as many persisted keys
as possible and then fills up the rest with an NVRAM index so that all
space is occupied. We have to be able to load this state again into the
NVRAM once the OBJECT's size increases due to RSA keys size increase,
which must have us increase the total size of NVRAM in libtpm's TPM profile.

The state in tests/data/tpm2state5/tpm2-00.permall was created using
libtpms 0.6.0, where only 2048 bit keys were supported and total NVRAM size
was 128kb. This state file should never be changed and always be loadable
into a current libtpms. In its USER NVRAM it holds 64 persisted 2048 bit
keys and an NVRAM index with 236 bytes. For this to stay the reference
NVRAM, we need to make sure that it fits exactly to the byte.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-04-24 15:03:03 -04:00
Stefan Berger
39b49a4e71 tests: Modify test to create 2 orderly indices
Modify the test_tpm2_save_load_state_3 to create 2 orderly NVRAM indices
in the first two locations. Those indices will be cleared by a reset
of the TPM and therefore cannot be read once the TPM 2 restarts after
the reset. This also provides better test coverage.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-04-09 19:39:38 -04:00
Stefan Berger
b35eb9fcd5 swtpm_cert: Allow passing signing key and parent key via new option
Allow passing signing key and parent key via files and file descriptors
and environment variables. Adapt a test case to exercise this new
functionality.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-01-30 08:52:58 -05:00
Stefan Berger
8e95c996d2 tests: Add test cases for new CrytpAdjustPrimeCandidate algo
Extend the existing key derivation test case for TPM 2 with test cases
that use a newer TPM 2 state where we now exercise the new
CryptAdjustPrimeCandidate algorithm that produces the same results on
big and little enidan 32 bit and 64 bit machines. This newer algorithm
is available in libtpms with revision 155 of the TPM 2 code.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2019-12-23 14:14:25 -05:00
Stefan Berger
71d9581aa4 tests: Extend test cases with aes-256-cbc state file encryption
Extend existing test cases with aes-256-cbc state file encryption.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-09-17 12:23:22 -04:00
Stefan Berger
9e3fab9817 tests: Update test case due to SHA512 support in libtpms
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-08-07 12:19:47 -04:00
Stefan Berger
9a08b03c57 tests: Test key written to and loaded from volatile state
Test that a key written to volatile state is properly loaded again
and produces the same signature as before.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-08-07 12:19:47 -04:00
Stefan Berger
70ed60be38 tests: Add test_tpm2_migration_key test case
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-08-07 12:19:46 -04:00
Stefan Berger
c88b36f0a9 tests: Add TPM 2 test case tpm_tpm2_resume_volatile
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-08-07 12:19:46 -04:00
Stefan Berger
6a110a5a7e tests: Check TPM2 state using TPM2 utilities
Check the TPM2 state using the TPM2 utilities, if available.

Create persistent state and check it, then shut down the TPM 2 and
restart it, and check the persistent state again.

Use previously created state and have the TPM 2 start with it
and check the persistent state. The persistent state must be
readable on little and big endian machines.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-08-07 12:19:46 -04:00
Stefan Berger
276eee02b4 swtpm_cert: Support for Elliptic Curve keys
Provide support for creating certificates for TPM2 ECC type of keys.

Extend the test cases and the man pages.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-08-07 12:19:46 -04:00
Stefan Berger
a8667992e0 tests: Use a root CA for creating the issuercert for test_swtpm_cert
Update the test case test_swtpm_cert to have its issuercert signed
by a created root CA so that we have the Authority Key Id in the cert.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-04-17 10:52:35 -04:00
Stefan Berger
25fee77410 Extend test cases with large permanent state
For being able to test the transfer of larger state blobs, extend the existing
test case with creating a large NVRAM location that becomes part of the permanent
state.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2015-06-04 10:55:32 -04:00
Stefan Berger
1680c41d9e swtpm: Add a command line option for a migration key
The migration key ensures that TPM state blobs, when retrieved using the
ioctl for getting state blobs, are always encrypted with this key.
When the state is later on loaded back into the TPM using the ioctl
to set the state blobs, the migration key is used to decrypt them.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2015-05-25 11:18:44 -04:00
Stefan Berger
b902468900 swtpm: integrity protect the encrypt TPM state
Integrity protect the TPM state when it is written in entrypted form.
libtpms state (for TPM1.2) is also integrity protecting the blobs, but
we better determine the integrity of the decrypted data on the layer
above it.
2015-05-19 16:35:08 -04:00
Stefan Berger
e46a2b6686 merging swtpm-tools into this project 2014-12-05 13:43:21 -05:00