in cvm-attestation/snp.py [0:0]
def serialize(self):
"""
Serializes an AttestationReport instance into a binary blob.
"""
print('here', type(self.current_tcb.serialize()))
return struct.pack(
self.FORMAT_STRING,
self.version, # int
self.guest_svn, # int
self.policy, # int or uint64_t
bytes(self.family_id), # bytes
bytes(self.image_id), # bytes
self.vmpl, # int
self.sig_algo, # int
int.from_bytes(self.current_tcb.serialize(), byteorder='little'), # Should return bytes or int (Q)
int.from_bytes(self.plat_info.serialize(), byteorder='little'), # Serialize PlatformInfo to int (Q)
int.from_bytes(self.key_info.serialize(), byteorder='little'), # Serialize KeyInfo to int (I)
self._reserved_0, # int
bytes(self.report_data), # bytes
bytes(self.measurement), # bytes
bytes(self.host_data), # bytes
bytes(self.id_key_digest), # bytes
bytes(self.author_key_digest), # bytes
bytes(self.report_id), # bytes
bytes(self.report_id_ma), # bytes
int.from_bytes(self.reported_tcb.serialize(), byteorder='little'), # Should return bytes or int (Q)
bytes(self._reserved_1), # bytes
bytes(self.chip_id), # bytes
int.from_bytes(self.committed_tcb.serialize(), byteorder='little'), # Should return bytes or int (Q)
self.current_build, # int
self.current_minor, # int
self.current_major, # int
self._reserved_2, # int
self.committed_build, # int
self.committed_minor, # int
self.committed_major, # int
self._reserved_3, # int
int.from_bytes(self.launch_tcb.serialize(), byteorder='little'), # Should return bytes or int (Q)
bytes(self._reserved_4), # bytes
self.signature.serialize() # Should return bytes (512 bytes)
)