tpm2-tss icon indicating copy to clipboard operation
tpm2-tss copied to clipboard

SPI-Helper: Checking expect bit requires checking stsValid as well

Open AndreasFuchsTPM opened this issue 1 year ago • 0 comments

The SPI-Helper seems to not check the expect bit nor the stsValid bit during command transmission.

The transfer should go as follows:

  • Write 1 byte
  • Check that expect and stsValid are both set (loop until stsValid)
  • Write the rest of the command except for the last byte (respecting burstcount and expect and stsValid along the way).
  • Check that expect and stsValid are set.
  • Write the last byte
  • Check that except is clear but stsValid is set.

Same applies for dataAvail during reception.

https://github.com/tpm2-software/tpm2-tss/blob/c641c77769a6953fea8ec986d22c754757426f42/src/tss2-tcti/tcti-spi-helper.c#L407

AndreasFuchsTPM avatar Aug 20 '24 12:08 AndreasFuchsTPM