tpm-emulator icon indicating copy to clipboard operation
tpm-emulator copied to clipboard

tpm_setup_rsp_auth needs fall-thru not break

Open jandryuk opened this issue 4 years ago • 1 comments

I wrote this as a comment here https://github.com/PeterHuewe/tpm-emulator/commit/88393faba7276df7df77a85f12d8908c33158aa4#r40001028, but figured I should open an actual issue.

https://github.com/PeterHuewe/tpm-emulator/commit/88393faba7276df7df77a85f12d8908c33158aa4 added a break to quiet an implicit-fallthrough warning. I think this is actually a desired fall though since auth1 is expected to be set when auth2 is set.

Xen changed to to mark the fall-thru, but I'm not sure if it has been tested: https://xenbits.xen.org/gitweb/?p=xen.git;a=blob;f=stubdom/vtpm-implicit-fallthrough.patch;h=db97be552f035871381d2b97b4101a946c8915d0;hb=HEAD ?

https://trustedcomputinggroup.org/wp-content/uploads/TPM-Main-Part-2-TPM-Structures_v1.2_rev116_01032011.pdf shows that auth2 is always set when auth1 is set, except for TPM_Ord_ChangeAuth.

jandryuk avatar Jun 18 '20 15:06 jandryuk

Just following up on an old issue.

I have been struggeling with getting Tspi_Data_Unseal to work against the TPM emulator today, and this was exactly my problem.

The method authsess_xsap_verify called by Tspi_Data_Unseal (tspi_seal.c:188) would fail and cause a return code 0x1.

Commenting out the "break;" introduced in tpm_marshalling.c:588 solves the problem for me.

lbakman avatar May 31 '23 13:05 lbakman