Re: [PATCH 2/2] selftests: tpm: add async space test with noneexisting handle

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2021-12-28 at 21:06 -0800, Tadeusz Struk wrote:
> Add a test for tpm2 spaces in async mode that checks if
                 ~~~~
I would rather speak about adding a test case for /dev/tpmrm0.

> the code handles invalid handles correctly.
> 
> Cc: Jarkko Sakkinen <jarkko@xxxxxxxxxx>
> Cc: Shuah Khan <shuah@xxxxxxxxxx>
> Cc: <linux-integrity@xxxxxxxxxxxxxxx>
> Cc: <linux-kselftest@xxxxxxxxxxxxxxx>
> Cc: <linux-kernel@xxxxxxxxxxxxxxx>
> Signed-off-by: Tadeusz Struk <tstruk@xxxxxxxxx>
> ---
>  tools/testing/selftests/tpm2/tpm2_tests.py | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 
> diff --git a/tools/testing/selftests/tpm2/tpm2_tests.py
> b/tools/testing/selftests/tpm2/tpm2_tests.py
> index 9d764306887b..b373b0936e40 100644
> --- a/tools/testing/selftests/tpm2/tpm2_tests.py
> +++ b/tools/testing/selftests/tpm2/tpm2_tests.py
> @@ -302,3 +302,19 @@ class AsyncTest(unittest.TestCase):
>          log.debug("Calling get_cap in a NON_BLOCKING mode")
>          async_client.get_cap(tpm2.TPM2_CAP_HANDLES,
> tpm2.HR_LOADED_SESSION)
>          async_client.close()
> +
> +    def test_flush_invlid_context(self):
> +        log = logging.getLogger(__name__)
> +        log.debug(sys._getframe().f_code.co_name)
> +
> +        async_client = tpm2.Client(tpm2.Client.FLAG_SPACE |
> tpm2.Client.FLAG_NONBLOCK)
> +        log.debug("Calling flush_context passing in an invalid
> handle ")
> +        handle = 0x80123456
> +        rc = 0
> +        try:
> +            async_client.flush_context(handle)
> +        except OSError as e:
> +            rc = e.errno
> +
> +        self.assertEqual(rc, 22)
> +        async_client.close()

BR,
Jarkko




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux Kernel]     [Linux Kernel Hardening]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux