tpmstream
tpmstream copied to clipboard
BUG: Wrong values in TPM2_PT enum
I'm not sure whether all the constant were generated manually or with a script, but there's a systematic error due to imporeprly combing Hex and Decimal numbers:
from /usr/include/tss2/tss2_tpm2_types.h:
#define TPM2_PT_VENDOR_STRING_1 ((TPM2_PT) (TPM2_PT_FIXED + 6))
#define TPM2_PT_VENDOR_STRING_2 ((TPM2_PT) (TPM2_PT_FIXED + 7))
#define TPM2_PT_VENDOR_STRING_3 ((TPM2_PT) (TPM2_PT_FIXED + 8))
#define TPM2_PT_VENDOR_STRING_4 ((TPM2_PT) (TPM2_PT_FIXED + 9))
#define TPM2_PT_VENDOR_TPM_TYPE ((TPM2_PT) (TPM2_PT_FIXED + 10)) // <--- in hex this would be 0x10a, not 0x110
#define TPM2_PT_FIRMWARE_VERSION_1 ((TPM2_PT) (TPM2_PT_FIXED + 11)) // 0x10b, not 0x110
#define TPM2_PT_FIRMWARE_VERSION_2 ((TPM2_PT) (TPM2_PT_FIXED + 12)) // etc'
Vs. https://github.com/joholl/tpmstream/blob/f5084ec8803969773d477e0998c85172235427fb/src/tpmstream/spec/structures/constants.py#L344-L350
I discovered this through unexplained decoding errors in example streams. Depending on how this happend, it's possible the same issue also exists in other tpmstream data structures.