aboutsummaryrefslogtreecommitdiff
path: root/tools/testing/selftests/tpm2
AgeCommit message (Collapse)AuthorFilesLines
2020-07-06selftests: tpm: upgrade TPM2 tests from Python 2 to Python 3Pengfei Xu4-49/+52
Python 2 is no longer supported by the Python upstream project, so upgrade TPM2 tests to Python 3. Fixed minor merge conflicts Shuah Khan <[email protected]> Signed-off-by: Pengfei Xu <[email protected]> Reviewed-by: Jarkko Sakkinen <[email protected]> Tested-by: Jarkko Sakkinen <[email protected]> Signed-off-by: Shuah Khan <[email protected]>
2020-06-29selftests: tpm: Use /bin/sh instead of /bin/bashJarkko Sakkinen2-2/+2
It's better to use /bin/sh instead of /bin/bash in order to run the tests in the BusyBox shell. Fixes: 6ea3dfe1e073 ("selftests: add TPM 2.0 tests") Cc: [email protected] Cc: [email protected] Cc: [email protected] Signed-off-by: Jarkko Sakkinen <[email protected]> Signed-off-by: Shuah Khan <[email protected]>
2020-06-29selftests: tpm: Use 'test -e' instead of 'test -f'Jarkko Sakkinen2-2/+2
'test -f' is suitable only for *regular* files. Use 'test -e' instead. Cc: Nikita Sobolev <[email protected]> Cc: [email protected] Cc: [email protected] Fixes: 5627f9cffee7 ("Kernel selftests: Add check if TPM devices are supported") Signed-off-by: Jarkko Sakkinen <[email protected]> Signed-off-by: Shuah Khan <[email protected]>
2020-06-29Revert "tpm: selftest: cleanup after unseal with wrong auth/policy test"Jarkko Sakkinen1-5/+0
The reverted commit illegitly uses tpm2-tools. External dependencies are absolutely forbidden from these tests. There is also the problem that clearing is not necessarily wanted behavior if the test/target computer is not used only solely for testing. Fixes: a9920d3bad40 ("tpm: selftest: cleanup after unseal with wrong auth/policy test") Cc: Tadeusz Struk <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Signed-off-by: Jarkko Sakkinen <[email protected]> Signed-off-by: Shuah Khan <[email protected]>
2020-05-22Kernel selftests: Add check if TPM devices are supportedNikita Sobolev2-0/+10
TPM2 tests set uses /dev/tpm0 and /dev/tpmrm0 without check if they are available. In case, when these devices are not available test fails, but expected behaviour is skipped test. Signed-off-by: Nikita Sobolev <[email protected]> Reviewed-by: Jarkko Sakkinen <[email protected]> Reviewed-by: Petr Vorel <[email protected]> Signed-off-by: Shuah Khan <[email protected]>
2020-04-14Revert "Kernel selftests: tpm2: check for tpm support"Jarkko Sakkinen2-19/+3
This reverts commit b32694cd0724d4ceca2c62cc7c3d3a8d1ffa11fc. The original comment was neither reviewed nor tested. Thus, this the *only* possible action to take. Cc: Nikita Sobolev <[email protected]> Signed-off-by: Jarkko Sakkinen <[email protected]> Signed-off-by: Shuah Khan <[email protected]>
2020-02-10Kernel selftests: tpm2: check for tpm supportNikita Sobolev2-3/+19
tpm2 tests set fails if there is no /dev/tpm0 and /dev/tpmrm0 supported. Check if these files exist before run and mark test as skipped in case of absence. Signed-off-by: Nikita Sobolev <[email protected]> Signed-off-by: Shuah Khan <[email protected]>
2019-12-17tpm: selftest: cleanup after unseal with wrong auth/policy testTadeusz Struk1-0/+5
Unseal with wrong auth or wrong policy test affects DA lockout and eventually causes the tests to fail with: "ProtocolError: TPM_RC_LOCKOUT: rc=0x00000921" when the tests run multiple times. Send tpm clear command after the test to reset the DA counters. Signed-off-by: Tadeusz Struk <[email protected]> Reviewed-by: Jarkko Sakkinen <[email protected]> Signed-off-by: Jarkko Sakkinen <[email protected]>
2019-12-17tpm: selftest: add test covering async modeTadeusz Struk3-2/+31
Add a test that sends a tpm cmd in an async mode. Currently there is a gap in test coverage with regards to this functionality. Signed-off-by: Tadeusz Struk <[email protected]> Reviewed-by: Jarkko Sakkinen <[email protected]> Signed-off-by: Jarkko Sakkinen <[email protected]>
2019-09-23selftests: tpm2: install python filesAnders Roxell1-0/+1
Both test_smoke.sh and test_space.sh require tpm2.py and tpm2_test.py. Rework so that tpm2.py and tpm2_test.py gets installed, added them to the variable TEST_PROGS_EXTENDED. Signed-off-by: Anders Roxell <[email protected]> Signed-off-by: Shuah Khan <[email protected]>
2019-04-08selftests/tpm2: Open tpm dev in unbuffered modeTadeusz Struk1-2/+2
In order to have control over how many bytes are read or written the device needs to be opened in unbuffered mode. Signed-off-by: Tadeusz Struk <[email protected]> Reviewed-by: Jarkko Sakkinen <[email protected]> Tested-by: Jarkko Sakkinen <[email protected]> Signed-off-by: Jarkko Sakkinen <[email protected]> Signed-off-by: James Morris <[email protected]>
2019-04-08selftests/tpm2: Extend tests to cover partial readsTadeusz Struk2-0/+64
Three new tests added: 1. Send get random cmd, read header in 1st read, read the rest in second read - expect success 2. Send get random cmd, read only part of the response, send another get random command, read the response - expect success 3. Send get random cmd followed by another get random cmd, without reading the first response - expect the second cmd to fail with -EBUSY Signed-off-by: Tadeusz Struk <[email protected]> Reviewed-by: Jarkko Sakkinen <[email protected]> Tested-by: Jarkko Sakkinen <[email protected]> Signed-off-by: Jarkko Sakkinen <[email protected]> Signed-off-by: James Morris <[email protected]>
2019-02-08selftests: add TPM 2.0 testsJarkko Sakkinen5-0/+935
Added the tests that I've been using for testing TPM 2.0 functionality for a long time but have been out-of-tree so far, residing in https://github.com/jsakkine-intel/tpm2-scripts Cc: Tadeusz Struk <[email protected]> Signed-off-by: Jarkko Sakkinen <[email protected]> Acked-by: Joey Pabalinas <[email protected]> Reviewed-by: Petr Vorel <[email protected]>