BUG: Wrong values in TPM2_PT enum
Closed this issue · 3 comments
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.
tpmstream/src/tpmstream/spec/structures/constants.py
Lines 344 to 350 in f5084ec
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.
Thank you! You are absolutely right, that is a bug. I checked all of constants.py
and could not find another issue like this.
The spec was written mostly manually. Trust me, I tried generating but the pain was even bigger.
Thanks. You might also monitor web tpmstream logs (if it sees meaningful amount of traffic) for suspicious looking decoding errors. It might flush out other bugs.
Thanks a lot for this project. I don't suppose It'll ever reach 10k stars or anything but it's been incredibly useful to me.
@SharkOverBite I'm glad it helps and thanks for the idea!