in cvm-attestation/deserialize_tdx_v4.py [0:0]
def deserialize_td_quotev4(tq_quote):
"""
Parses the given TD quote object and returns the structured data.
:param tq_quote: The TD quote binary data.
:return: Parsed TD Quote structure.
"""
QuoteHeaderv4 = Struct(
"version" / Int16ul,
"attestation_key_type" / Int16ul,
"tee_type" / Bytes(4),
"reserved_0" / Int16ul,
"reserved_1" / Int16ul,
"qe_vendor_id" / Bytes(16),
"user_data" / Bytes(20)
)
TDQuoteBodyv4 = Struct(
"tee_tcb_svn" / Bytes(16),
"mrseam" / Bytes(48),
"mrsignerseam" / Bytes(48),
"seam_attributes" / Bytes(8),
"td_attributes" / Bytes(8),
"xfam" / Int64ul,
"mr_td" / Bytes(48),
"mr_config_id" / Bytes(48),
"mr_owner" / Bytes(48),
"mr_owner_config" / Bytes(48),
"rtmr_0" / Bytes(48),
"rtmr_1" / Bytes(48),
"rtmr_2" / Bytes(48),
"rtmr_3" / Bytes(48),
"report_data" / Bytes(64)
)
QuoteSignatureDatav4 = Struct(
"signature" / Bytes(64),
"attestation_key" / Bytes(64),
"qe_certification_data_type" / Bytes(2),
"cert_data_size" / Int32ul,
"cert_data" / Bytes(this.cert_data_size)
)
TDQuote_V4 = Struct(
"header" / QuoteHeaderv4,
"td_quote_body" / TDQuoteBodyv4,
"quote_signature_data_len" / Int32ul,
"quote_signature_data" / QuoteSignatureDatav4,
)
try:
return TDQuote_V4.parse(tq_quote)
except Exception as e:
print(f"Error parsing TD Quote: {e}", file=sys.stderr)
return None