From 3455e7ebc3c366d42cab4c6b5d36f47b0a30e1fe Mon Sep 17 00:00:00 2001 From: Ruoyu Ying Date: Fri, 12 Apr 2024 09:56:26 +0800 Subject: [PATCH] common: expand CcReport definition for configfs-tsm support (#122) --- common/python/cctrusted_base/ccreport.py | 33 ++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/common/python/cctrusted_base/ccreport.py b/common/python/cctrusted_base/ccreport.py index 675cddfd..092c4959 100644 --- a/common/python/cctrusted_base/ccreport.py +++ b/common/python/cctrusted_base/ccreport.py @@ -17,20 +17,49 @@ class CcReportSignature(BinaryBlob): class CcReport(BinaryBlob): """CcReport base class.""" - def __init__(self, data: bytearray, cc_type): + def __init__( + self, + data: bytearray, + cc_type, + aux_blob: bytearray=None, + generation:int=None, + provider:str=None + ): """Initialize instance with raw data. Args: - data: A bytearray storing the raw data. + data: A bytearray storing the raw data(in configfs-tsm, the data contained in outblob). + cc_type: An int specifying the TEE type + aux_blob: A bytearray storing aux data when leveraging configfs-tsm. + generation: An int specifying generation when leveraging configfs-tsm. + provider: A string specifying provider when leveraging configfs-tsm. """ super().__init__(data) self._cc_type = cc_type + self._cc_aux_blob = aux_blob + self._cc_report_generation = generation + self._cc_provider = provider @property def cc_type(self): """Get the CC (Confidential Computing) type.""" return self._cc_type + @property + def cc_aux_blob(self): + """Get the aux blob of CC report.""" + return self._cc_aux_blob + + @property + def cc_report_generation(self): + """Get the report generation.""" + return self._cc_report_generation + + @property + def cc_provider(self): + """Get cc provider.""" + return self._cc_provider + @abstractmethod def get_quoted_data(self) -> CcReportData: """Get quoted data."""