in src/local_gpu_verifier/src/verifier/attestation/spdm_msrt_resp_msg.py [0:0]
def parse(self, response, settings):
""" Parses the raw SPDM GET_MEASUREMENT response message and sets the various fields of the SpdmMeasurementResponseMessage class object.
Args:
response (bytes): the raw data content of the SPDM GET_MEASUREMENT response message.
settings (config.HopperSettings): object that contains the config info.
"""
assert type(response) is bytes
byte_index = 0
value = response[byte_index: byte_index + self.FieldSize['SPDMVersion']]
self.set_spdm_version(value)
byte_index = byte_index + self.FieldSize['SPDMVersion']
value = response[byte_index: byte_index + self.FieldSize['RequestResponseCode']]
self.set_request_response_code(value)
byte_index = byte_index + self.FieldSize['RequestResponseCode']
value = response[byte_index: byte_index + self.FieldSize['Param1']]
self.set_param1(value)
byte_index = byte_index + self.FieldSize['Param1']
value = response[byte_index: byte_index + self.FieldSize['Param2']]
self.set_param2(value)
byte_index = byte_index + self.FieldSize['Param2']
x = response[byte_index: byte_index + self.FieldSize['NumberOfBlocks']]
value = int(x.hex(), 16)
self.set_number_of_blocks(value)
byte_index = byte_index + self.FieldSize['NumberOfBlocks']
x = response[byte_index: byte_index + self.FieldSize['MeasurementRecordLength']]
value = int(read_field_as_little_endian(x), 16)
self.set_measurement_record_length(value)
byte_index = byte_index + self.FieldSize['MeasurementRecordLength']
measurement_record = response[byte_index: byte_index + self.get_measurement_record_length()]
self.set_measurement_record(MeasurementRecord(measurement_record, self.get_number_of_blocks(), settings))
byte_index = byte_index + self.get_measurement_record_length()
value = response[byte_index: byte_index + self.FieldSize['Nonce']]
self.set_nonce(value)
byte_index = byte_index + self.FieldSize['Nonce']
x = response[byte_index: byte_index + self.FieldSize['OpaqueLength']]
x = read_field_as_little_endian(x)
value = int(x, 16)
self.set_opaque_data_length(value)
byte_index = byte_index + self.FieldSize['OpaqueLength']
opaque_data_content = response[byte_index: byte_index + self.get_opaque_data_length()]
self.OpaqueData = OpaqueData(opaque_data_content)
byte_index = byte_index + self.get_opaque_data_length()
value = response[byte_index: byte_index + self.FieldSize['Signature']]
self.set_signature(value)
byte_index = byte_index + self.FieldSize['Signature']