On 10/6/2020 11:55 AM, Jarkko Sakkinen wrote:
On Tue, Oct 06, 2020 at 12:01:30PM +0200, Petr Vorel wrote:
If I understand James's commit fdc915f7f719 ("tpm: expose spaces via a device link /dev/tpmrm<n>")
from v4.12-rc1 correctly /dev/tpmrm0 is really for TPM 2.0. But how to detect it
for v4.0 - v4.11 when /sys/class/tpm detection fails?
I'd send an idempotent TPM2 command to /dev/tpm0. I.e. if it works,
it does not change the state. If it doesn't, you know that it is
not TPM2 device.
See the kernel function tpm2_probe() as an example of this approach.
As good candidate is getcapability, because it is guaranteed never to
require authorization.