tpm: add vendor flag to command code validation
authorJulien Gomes <julien@arista.com>
Wed, 8 Feb 2023 19:58:36 +0000 (11:58 -0800)
committerJarkko Sakkinen <jarkko@kernel.org>
Mon, 13 Feb 2023 08:11:20 +0000 (10:11 +0200)
commit85b93bbd1c9768d09adebbe9f33bab0d4ec94404
treea4d8142eb4a8174162660ee113ab843650356d34
parent1e2714bb83fc783d58701967391bea242c65eaff
tpm: add vendor flag to command code validation

Some TPM 2.0 devices have support for additional commands which are not
part of the TPM 2.0 specifications.
These commands are identified with bit 29 of the 32 bits command codes.
Contrarily to other fields of the TPMA_CC spec structure used to list
available commands, the Vendor flag also has to be present in the
command code itself (TPM_CC) when called.

Add this flag to tpm_find_cc() mask to prevent blocking vendor command
codes that can actually be supported by the underlying TPM device.

Signed-off-by: Julien Gomes <julien@arista.com>
Tested-by: Jarkko Sakkinen <jarkko@kernel.org>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
drivers/char/tpm/tpm2-cmd.c
include/linux/tpm.h