<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/tools/testing/selftests/tpm2, branch v6.6.131</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v6.6.131</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v6.6.131'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2023-02-13T16:09:46+00:00</updated>
<entry>
<title>selftests: tpm2: remove redundant ord()</title>
<updated>2023-02-13T16:09:46+00:00</updated>
<author>
<name>Tzung-Bi Shih</name>
<email>tzungbi@kernel.org</email>
</author>
<published>2023-02-03T10:14:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=787fccb321dd6c1c464bb11d952074edbde5de36'/>
<id>urn:sha1:787fccb321dd6c1c464bb11d952074edbde5de36</id>
<content type='text'>
When testing with FLAG_DEBUG enabled client, it emits the following
error messages:

File "/root/tpm2/tpm2.py", line 347, in hex_dump
    d = [format(ord(x), '02x') for x in d]
File "/root/tpm2/tpm2.py", line 347, in &lt;listcomp&gt;
    d = [format(ord(x), '02x') for x in d]
TypeError: ord() expected string of length 1, but int found

The input of hex_dump() should be packed binary data.  Remove the
ord().

Signed-off-by: Tzung-Bi Shih &lt;tzungbi@kernel.org&gt;
Signed-off-by: Shuah Khan &lt;skhan@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>selftests/tpm2: Split async tests call to separate shell script runner</title>
<updated>2022-11-30T00:28:31+00:00</updated>
<author>
<name>Nícolas F. R. A. Prado</name>
<email>nfraprado@collabora.com</email>
</author>
<published>2022-11-28T22:03:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=8008d88e6d160c4e73de5be7c3dcc54e3ccccf49'/>
<id>urn:sha1:8008d88e6d160c4e73de5be7c3dcc54e3ccccf49</id>
<content type='text'>
When the async test case was introduced, despite being a completely
independent test case, the command to run it was added to the same shell
script as the smoke test case. Since a shell script implicitly returns
the error code from the last run command, this effectively caused the
script to only return as error code the result from the async test case,
hiding the smoke test result (which could then only be seen from the
python unittest logs).

Move the async test case call to its own shell script runner to avoid
the aforementioned issue. This also makes the output clearer to read,
since each kselftest KTAP result now matches with one python unittest
report.

While at it, also make it so the async test case is skipped if
/dev/tpmrm0 doesn't exist, since commit 8335adb8f9d3 ("selftests: tpm:
add async space test with noneexisting handle") added a test that relies
on it.

Signed-off-by: Nícolas F. R. A. Prado &lt;nfraprado@collabora.com&gt;
Signed-off-by: Shuah Khan &lt;skhan@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>selftest: tpm2: Add Client.__del__() to close /dev/tpm* handle</title>
<updated>2022-10-04T21:25:56+00:00</updated>
<author>
<name>Stefan Berger</name>
<email>stefanb@linux.ibm.com</email>
</author>
<published>2022-09-20T13:15:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=2d869f0b458547386fbcd8cf3004b271b7347b7f'/>
<id>urn:sha1:2d869f0b458547386fbcd8cf3004b271b7347b7f</id>
<content type='text'>
The following output can bee seen when the test is executed:

  test_flush_context (tpm2_tests.SpaceTest) ... \
    /usr/lib64/python3.6/unittest/case.py:605: ResourceWarning: \
    unclosed file &lt;_io.FileIO name='/dev/tpmrm0' mode='rb+' closefd=True&gt;

An instance of Client does not implicitly close /dev/tpm* handle, once it
gets destroyed. Close the file handle in the class destructor
Client.__del__().

Fixes: 6ea3dfe1e0732 ("selftests: add TPM 2.0 tests")
Cc: Shuah Khan &lt;shuah@kernel.org&gt;
Cc: linux-kselftest@vger.kernel.org
Cc: Jarkko Sakkinen &lt;jarkko@kernel.org&gt;
Signed-off-by: Stefan Berger &lt;stefanb@linux.ibm.com&gt;
Reviewed-by: Jarkko Sakkinen &lt;jarkko@kernel.org&gt;
Signed-off-by: Jarkko Sakkinen &lt;jarkko@kernel.org&gt;
</content>
</entry>
<entry>
<title>selftests/tpm2: increase timeout for kselftests</title>
<updated>2022-06-28T19:31:10+00:00</updated>
<author>
<name>Johannes Holland</name>
<email>johannes.holland@infineon.com</email>
</author>
<published>2022-06-28T14:39:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=6b56f5f1ef93ec1b34dee1ef72da33ec046f82be'/>
<id>urn:sha1:6b56f5f1ef93ec1b34dee1ef72da33ec046f82be</id>
<content type='text'>
Due to CreatePrimary commands which need to create RSA keys of
increasing size, the timeout value need to be raised, as well.
Default is 45s.

Fixed git am white space warns:
Shuah Khan &lt;skhan@linuxfoundation.org&gt;

Signed-off-by: Johannes Holland &lt;johannes.holland@infineon.com&gt;
Signed-off-by: Stefan Mahnke-Hartmann &lt;stefan.mahnke-hartmann@infineon.com&gt;
Signed-off-by: Shuah Khan &lt;skhan@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>selftests: tpm: add async space test with noneexisting handle</title>
<updated>2022-03-08T08:33:17+00:00</updated>
<author>
<name>Tadeusz Struk</name>
<email>tstruk@gmail.com</email>
</author>
<published>2022-01-16T01:26:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=8335adb8f9d3ea783422d22883a327427c1dbee8'/>
<id>urn:sha1:8335adb8f9d3ea783422d22883a327427c1dbee8</id>
<content type='text'>
Add a test for /dev/tpmrm0 in async mode that checks if
the code handles invalid handles correctly.

Cc: Jarkko Sakkinen &lt;jarkko@kernel.org&gt;
Cc: Shuah Khan &lt;shuah@kernel.org&gt;
Cc: &lt;linux-integrity@vger.kernel.org&gt;
Cc: &lt;linux-kselftest@vger.kernel.org&gt;
Cc: &lt;linux-kernel@vger.kernel.org&gt;
Tested-by: Jarkko Sakkinen&lt;jarkko@kernel.org&gt;
Signed-off-by: Tadeusz Struk &lt;tstruk@gmail.com&gt;
Reviewed-by: Jarkko Sakkinen &lt;jarkko@kernel.org&gt;
Signed-off-by: Jarkko Sakkinen &lt;jarkko@kernel.org&gt;
</content>
</entry>
<entry>
<title>selftests: tpm2: Determine available PCR bank</title>
<updated>2022-03-08T08:33:17+00:00</updated>
<author>
<name>Stefan Berger</name>
<email>stefanb@linux.ibm.com</email>
</author>
<published>2021-11-28T04:10:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=0d060f230fa06c32d91e67978a3088be9635848e'/>
<id>urn:sha1:0d060f230fa06c32d91e67978a3088be9635848e</id>
<content type='text'>
Determine an available PCR bank to be used by a test case by querying the
capability TPM2_GET_CAP. The TPM2 returns TPML_PCR_SELECTIONS that
contains an array of TPMS_PCR_SELECTIONs indicating available PCR banks
and the bitmasks that show which PCRs are enabled in each bank. Collect
the data in a dictionary. From the dictionary determine the PCR bank that
has the PCRs enabled that the test needs. This avoids test failures with
TPM2's that either to not have a SHA-1 bank or whose SHA-1 bank is
disabled.

Signed-off-by: Stefan Berger &lt;stefanb@linux.ibm.com&gt;
Tested-by: Jarkko Sakkinen &lt;jarkko@kernel.org&gt;
Reviewed-by: Jarkko Sakkinen &lt;jarkko@kernel.org&gt;
Signed-off-by: Jarkko Sakkinen &lt;jarkko@kernel.org&gt;
</content>
</entry>
<entry>
<title>selftests: tpm: upgrade TPM2 tests from Python 2 to Python 3</title>
<updated>2020-07-06T20:20:35+00:00</updated>
<author>
<name>Pengfei Xu</name>
<email>pengfei.xu@intel.com</email>
</author>
<published>2020-06-26T03:40:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=0b78c9e8c19b57bf2081cd432841c7fe3f800633'/>
<id>urn:sha1:0b78c9e8c19b57bf2081cd432841c7fe3f800633</id>
<content type='text'>
Python 2 is no longer supported by the Python upstream project, so
upgrade TPM2 tests to Python 3.

Fixed minor merge conflicts
Shuah Khan &lt;skhan@linuxfoundation.org&gt;

Signed-off-by: Pengfei Xu &lt;pengfei.xu@intel.com&gt;
Reviewed-by: Jarkko Sakkinen &lt;jarkko.sakkinen@linux.intel.com&gt;
Tested-by: Jarkko Sakkinen &lt;jarkko.sakkinen@linux.intel.com&gt;
Signed-off-by: Shuah Khan &lt;skhan@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>selftests: tpm: Use /bin/sh instead of /bin/bash</title>
<updated>2020-06-29T20:19:38+00:00</updated>
<author>
<name>Jarkko Sakkinen</name>
<email>jarkko.sakkinen@linux.intel.com</email>
</author>
<published>2020-06-22T21:20:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=377ff83083c953dd58c5a030b3c9b5b85d8cc727'/>
<id>urn:sha1:377ff83083c953dd58c5a030b3c9b5b85d8cc727</id>
<content type='text'>
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: stable@vger.kernel.org
Cc: linux-integrity@vger.kernel.org
Cc: linux-kselftest@vger.kernel.org
Signed-off-by: Jarkko Sakkinen &lt;jarkko.sakkinen@linux.intel.com&gt;
Signed-off-by: Shuah Khan &lt;skhan@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>selftests: tpm: Use 'test -e' instead of 'test -f'</title>
<updated>2020-06-29T20:19:23+00:00</updated>
<author>
<name>Jarkko Sakkinen</name>
<email>jarkko.sakkinen@linux.intel.com</email>
</author>
<published>2020-06-22T21:20:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=88a16840f462f96d3a1808aff1d6479f87a02147'/>
<id>urn:sha1:88a16840f462f96d3a1808aff1d6479f87a02147</id>
<content type='text'>
'test -f' is suitable only for *regular* files. Use 'test -e' instead.

Cc: Nikita Sobolev &lt;Nikita.Sobolev@synopsys.com&gt;
Cc: linux-integrity@vger.kernel.org
Cc: linux-kselftest@vger.kernel.org
Fixes: 5627f9cffee7 ("Kernel selftests: Add check if TPM devices are supported")
Signed-off-by: Jarkko Sakkinen &lt;jarkko.sakkinen@linux.intel.com&gt;
Signed-off-by: Shuah Khan &lt;skhan@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>Revert "tpm: selftest: cleanup after unseal with wrong auth/policy test"</title>
<updated>2020-06-29T20:18:15+00:00</updated>
<author>
<name>Jarkko Sakkinen</name>
<email>jarkko.sakkinen@linux.intel.com</email>
</author>
<published>2020-06-22T21:20:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=5be206eaac9a68992fc3b06fb5dd5634e323de86'/>
<id>urn:sha1:5be206eaac9a68992fc3b06fb5dd5634e323de86</id>
<content type='text'>
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 &lt;tadeusz.struk@intel.com&gt;
Cc: stable@vger.kernel.org
Cc: linux-integrity@vger.kernel.org
Cc: linux-kselftest@vger.kernel.org
Signed-off-by: Jarkko Sakkinen &lt;jarkko.sakkinen@linux.intel.com&gt;
Signed-off-by: Shuah Khan &lt;skhan@linuxfoundation.org&gt;
</content>
</entry>
</feed>
