Re: [PATCH 2/2] reset: Add Infineon SLB9670 TPM reset driver

Lukas Wunner
2023-11-23T08:59:45Z

On Wed, Nov 22, 2023 at 04:15:18PM +0100, Francesco Dolcini wrote:
> On Wed, Nov 22, 2023 at 12:29:49PM +0100, Lukas Wunner wrote:
> > On Wed, Nov 22, 2023 at 12:33:58AM +0100, Francesco Dolcini wrote:
> > > Not to mention that I was able to see the driver probe succeed in a
> > > similar setup to the one you are describing in the commit message
> > > (different board, arm64, but nothing done by the platform firmware).
> >
> > Hm, is the RST# pin even connected on that board?
>
> Yes, it's connected and it is asserted/de-asserted (aka toggled) during
> startup from the HW reset circuit. However this is not implementing the
> reset sequence you are implementing here.

Section 4.5 of the datasheet seems to indicate that unless the sequence
in Figure 3 is observed, the TPM may enter a defense mode against
dictionary attacks "from which a recovery is very complex or even not
possible."

Simply toggling the RST# pin might therefore not be sufficient to ensure
the TPM is operable.

Here's the relevant section in the datasheet:

"The OPTIGA TPM SLB 9670 features a sophisticated protection mechanism
against dictionary attacks on TPM-based authorization data. Basically,
the device counts the number of failed authorization attempts in a
counter which is located in the non-volatile memory. An attacker who
has physical access to the device could try to cirumvent that mechanism
by resetting the device after the authorization attempt but before the
updated failure counter has been written into the NVM.

Certain countermeasures have been added to the OPTIGA TPM SLB 9670.
In certain time windows during power-on or warm boot of the device,
such reset events might influence the dictionary attack counters and
trigger other security mechanisms as well. In worst case, this might
trigger special security defense modes from which a recovery is very
complex or even not possible.

To avoid that the OPTIGA TPM SLB 9670 reaches such a security defense
state, the RST# signal must not be asserted in certain time windows.
After the deassertion of the RST# signal, the system should wait for
a minimum time of tRSTIN before asserting RST# again (see Figure 3
and Table 11).

TPM commands should only be started after tRSTIN has expired (see
Figure 3 again). If a TPM command is running, RST# should not be
asserted; otherwise, this might also trigger some security functions.
When the TPM shall be reset, the command TPM2_Shutdown should be
issued before the assertion of the RST# signal.

https://www.infineon.com/dgdl/?fileId=5546d4626fc1ce0b016fc78270350cd6

Thanks,

Lukas