@@ -70,6 +70,9 @@ pub const TDX_REPORT_MAC_STRUCT_SIZE: usize = 256;
7070pub const TDX_REPORT_MAC_STRUCT_RESERVED1_BYTES : usize = 12 ;
7171pub const TDX_REPORT_MAC_STRUCT_RESERVED2_BYTES : usize = 32 ;
7272
73+ // Ensure new type name is backward compatibe
74+ pub type TdxReportMac = ReportMac ;
75+
7376struct_def ! {
7477 /// Rust definition of `REPORTMACSTRUCT` from `TDREPORT_STRUCT`.
7578 ///
@@ -81,7 +84,7 @@ struct_def! {
8184 feature = "large_array_derive" ,
8285 derive( Clone , Debug , Eq , PartialEq )
8386 ) ]
84- pub struct TdxReportMac {
87+ pub struct ReportMac {
8588 /// ( 0) TEE Report type
8689 pub report_type: TeeReportType ,
8790 /// ( 4) Reserved, must be zero
@@ -101,12 +104,12 @@ struct_def! {
101104 }
102105}
103106
104- impl TdxReportMac {
107+ impl ReportMac {
105108 pub const UNPADDED_SIZE : usize = 256 ;
106109}
107110
108111#[ cfg( target_env = "sgx" ) ]
109- impl AsRef < tdx_arch:: Align256 < [ u8 ; TdxReportMac :: UNPADDED_SIZE ] > > for TdxReportMac {
112+ impl AsRef < tdx_arch:: Align256 < [ u8 ; ReportMac :: UNPADDED_SIZE ] > > for ReportMac {
110113 fn as_ref ( & self ) -> & tdx_arch:: Align256 < [ u8 ; Self :: UNPADDED_SIZE ] > {
111114 unsafe { & * ( self as * const _ as * const _ ) }
112115 }
@@ -253,7 +256,7 @@ struct_def! {
253256 ) ]
254257 pub struct TdxReportV1 {
255258 /// ( 0) Report mac struct for SGX report type 2
256- pub report_mac: TdxReportMac ,
259+ pub report_mac: ReportMac ,
257260 /// (256) Struct contains details about extra TCB elements not found in CPUSVN
258261 pub tee_tcb_info: TeeTcbInfo ,
259262 /// (495) Reserved, must be zero
@@ -324,7 +327,7 @@ impl Display for TdxError {
324327 TdxError :: Interrupted => f. write_str ( "Usercall is interrupted" ) ,
325328 TdxError :: InvalidCpuSvn => f. write_str ( "Failed to verify TD report: invalid Cpu Svn" ) ,
326329 TdxError :: InvalidParameter => f. write_str ( "The parameter is incorrect" ) ,
327- TdxError :: InvalidReportMacStruct => f. write_str ( "Failed to verify TD report: invalid TdxReportMac " ) ,
330+ TdxError :: InvalidReportMacStruct => f. write_str ( "Failed to verify TD report: invalid ReportMac " ) ,
328331 TdxError :: InvalidRtmrIndex => f. write_str ( "Only supported RTMR index is 2 and 3" ) ,
329332 TdxError :: NotSupported => f. write_str ( "Request feature is not supported" ) ,
330333 TdxError :: OutOfMemory => f. write_str ( "Not enough memory is available to complete this operation" ) ,
@@ -344,9 +347,9 @@ mod debug_impl {
344347 use super :: * ;
345348 use core:: fmt:: { Debug , Formatter , Result } ;
346349
347- impl Debug for TdxReportMac {
350+ impl Debug for ReportMac {
348351 fn fmt ( & self , f : & mut Formatter < ' _ > ) -> Result {
349- f. debug_struct ( "TdxReportMac " )
352+ f. debug_struct ( "ReportMac " )
350353 . field ( "report_type" , & self . report_type )
351354 . field ( "reserved1" , & self . reserved1 )
352355 . field ( "cpu_svn" , & self . cpu_svn )
@@ -419,7 +422,7 @@ mod tdx_arch {
419422 pub struct Align256 < T > ( pub T ) ;
420423
421424 /// Call the `EVERIFYREPORT2` instruction to verify a 256-bit TDX REPORT MAC struct.
422- /// The concrete type is [`crate::tdx::TdxReportMac `].
425+ /// The concrete type is [`crate::tdx::ReportMac `].
423426 pub fn everifyreport2 ( tdx_report_mac : & Align256 < [ u8 ; 256 ] > ) -> Result < ( ) , u32 > {
424427 unsafe {
425428 let error: u32 ;
0 commit comments