in src/local_gpu_verifier/src/verifier/attestation/spdm_msrt_resp_msg.py [0:0]
def parse(self, binary_data):
""" Parses the raw OpaqueData field of the SPDM GET_MEASUREMENT response message.
Args:
binary_data (bytes): the data content of the Opaque Data field.
"""
byte_index = 0
while byte_index < len(binary_data):
x = binary_data[byte_index: byte_index + self.FieldSize['DataType']]
value = int(read_field_as_little_endian(x), 16)
data_type = self.OPAQUE_DATA_TYPES[value]
byte_index = byte_index + self.FieldSize['DataType']
x = binary_data[byte_index: byte_index + self.FieldSize['DataSize']]
data_size = int(read_field_as_little_endian(x), 16)
byte_index = byte_index + self.FieldSize['DataSize']
value = binary_data[byte_index: byte_index + data_size]
if data_type == 'OPAQUE_FIELD_ID_MSRSCNT':
self.parse_measurement_count(value)
elif data_type == 'OPAQUE_FIELD_ID_SWITCH_PDI':
self.parse_switch_pdis(value)
else:
self.OpaqueDataField[data_type] = value
byte_index = byte_index + data_size