microsoft / ms-tpm-20-ref

Reference implementation of the TCG Trusted Platform Module 2.0 specification.
Other
345 stars 134 forks source link

Use appropriate error for incorrect reserved bits in TPMA structures #39

Closed diabonas closed 5 years ago

diabonas commented 5 years ago

According to the TPM 2.0 Library specification, Part 2 (rev. 1.38), Table 2, a TPM_RC_RESERVED_BITS error shall be used if "a non-zero value was found in a reserved field of an attribute structure (TPMA_)". This is done correctly when compiling with TABLE_DRIVEN_MARSHAL=NO, cf. Marshal.c, but for TABLE_DRIVEN_MARSHAL=YES the incorrect error TPM_RC_ATTRIBUTES is used instead.

This issue came up when experimenting with using the simulator for tpm2-tss (cf. https://github.com/tpm2-software/tpm2-tss/pull/1544) because it caused a test failure in test/tpmclient/tpmclient.int.

amarochk commented 5 years ago

Thank you for reporting the issue! I was able to reproduce it, and we'll look into it.

DavidWooten commented 5 years ago

I found the problem and will post a fix. If you want to get ahead of the update, just go to TableDrivenDMarshal.c and change TPM_RC_ATTRIBUTES to TPM_RC_RESERVED_BITS (it's around line 531).

diabonas commented 5 years ago

That's what this pull request does ;)