* [PATCH] tpm: Add upgrade/reduced mode support for TPM1.2 modules
@ 2022-06-01 8:38 Stefan Mahnke-Hartmann
2022-06-02 11:25 ` Jarkko Sakkinen
0 siblings, 1 reply; 2+ messages in thread
From: Stefan Mahnke-Hartmann @ 2022-06-01 8:38 UTC (permalink / raw)
To: jarkko, linux-integrity, linux-kernel
Cc: peterhuewe, jgg, stefan.mahnke-hartmann
In case a TPM in failure mode is detected, the TPM should be accessible
through a transparent communication channel for analysing purposes (e.g.
TPM_GetTestResult) or a field upgrade. Since a TPM in failure mode has
similar reduced functionality as in field upgrade mode, the flag
TPM_CHIP_FLAG_FIRMWARE_UPGRADE_MODE is also valid.
As described in TCG TPM Main Part1 Design Principles, Revision 116,
chapter 9.2.1. the TPM also allows an update function in case a TPM is
in failure mode.
If the TPM in failure mode is detected, the function tpm1_auto_startup()
sets TPM_CHIP_FLAG_FIRMWARE_UPGRADE_MODE flag. This patch simply follows
the same rationale as TPM2 in field upgrade mode.
Signed-off-by: Stefan Mahnke-Hartmann <stefan.mahnke-hartmann@infineon.com>
---
If you have any better suggestions, please let me know.
drivers/char/tpm/tpm1-cmd.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/char/tpm/tpm1-cmd.c b/drivers/char/tpm/tpm1-cmd.c
index f7dc986fa4a0..7a42d74c450c 100644
--- a/drivers/char/tpm/tpm1-cmd.c
+++ b/drivers/char/tpm/tpm1-cmd.c
@@ -710,8 +710,10 @@ int tpm1_auto_startup(struct tpm_chip *chip)
goto out;
rc = tpm1_do_selftest(chip);
if (rc) {
- dev_err(&chip->dev, "TPM self test failed\n");
- goto out;
+ dev_err(&chip->dev, "TPM self test failed, so the TPM has limited functionality\n");
+ /* A TPM in this state possibly allows or needs a firmware upgrade */
+ chip->flags |= TPM_CHIP_FLAG_FIRMWARE_UPGRADE;
+ rc = 0;
}
return rc;
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] tpm: Add upgrade/reduced mode support for TPM1.2 modules
2022-06-01 8:38 [PATCH] tpm: Add upgrade/reduced mode support for TPM1.2 modules Stefan Mahnke-Hartmann
@ 2022-06-02 11:25 ` Jarkko Sakkinen
0 siblings, 0 replies; 2+ messages in thread
From: Jarkko Sakkinen @ 2022-06-02 11:25 UTC (permalink / raw)
To: Stefan Mahnke-Hartmann; +Cc: linux-integrity, linux-kernel, peterhuewe, jgg
On Wed, Jun 01, 2022 at 10:38:11AM +0200, Stefan Mahnke-Hartmann wrote:
> In case a TPM in failure mode is detected, the TPM should be accessible
> through a transparent communication channel for analysing purposes (e.g.
> TPM_GetTestResult) or a field upgrade. Since a TPM in failure mode has
> similar reduced functionality as in field upgrade mode, the flag
> TPM_CHIP_FLAG_FIRMWARE_UPGRADE_MODE is also valid.
>
> As described in TCG TPM Main Part1 Design Principles, Revision 116,
> chapter 9.2.1. the TPM also allows an update function in case a TPM is
> in failure mode.
>
> If the TPM in failure mode is detected, the function tpm1_auto_startup()
> sets TPM_CHIP_FLAG_FIRMWARE_UPGRADE_MODE flag. This patch simply follows
> the same rationale as TPM2 in field upgrade mode.
"following the rationale" does not give a clue what it does.
Also minor nit: write in imperative from, and please do not say "this
patch". It won't be a patch, once it is in git.
> Signed-off-by: Stefan Mahnke-Hartmann <stefan.mahnke-hartmann@infineon.com>
> ---
> If you have any better suggestions, please let me know.
>
> drivers/char/tpm/tpm1-cmd.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/char/tpm/tpm1-cmd.c b/drivers/char/tpm/tpm1-cmd.c
> index f7dc986fa4a0..7a42d74c450c 100644
> --- a/drivers/char/tpm/tpm1-cmd.c
> +++ b/drivers/char/tpm/tpm1-cmd.c
> @@ -710,8 +710,10 @@ int tpm1_auto_startup(struct tpm_chip *chip)
> goto out;
> rc = tpm1_do_selftest(chip);
> if (rc) {
> - dev_err(&chip->dev, "TPM self test failed\n");
> - goto out;
> + dev_err(&chip->dev, "TPM self test failed, so the TPM has limited functionality\n");
> + /* A TPM in this state possibly allows or needs a firmware upgrade */
> + chip->flags |= TPM_CHIP_FLAG_FIRMWARE_UPGRADE;
> + rc = 0;
> }
>
> return rc;
> --
> 2.25.1
>
Why all error codes trigger this action, e.g. all possible TPM2
errors and -ETIME?
BR, Jarkko
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-06-02 11:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-01 8:38 [PATCH] tpm: Add upgrade/reduced mode support for TPM1.2 modules Stefan Mahnke-Hartmann
2022-06-02 11:25 ` Jarkko Sakkinen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).