Skip to content

Commit

Permalink
remove MigTd prefix to avoid confusing
Browse files Browse the repository at this point in the history
Signed-off-by: OuyangHang33 <[email protected]>
  • Loading branch information
OuyangHang33 authored and jyao1 committed Apr 30, 2024
1 parent 4fe9b7e commit 768d3d7
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
4 changes: 2 additions & 2 deletions src/attestation/src/attest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pub fn get_quote(td_report: &[u8]) -> Result<Vec<u8>, Error> {
quote.as_mut_ptr() as *mut c_void,
&mut quote_size as *mut u32,
);
if result != AttestLibError::MigtdAttestSuccess {
if result != AttestLibError::AttestSuccess {
return Err(Error::GetQuote);
}
}
Expand Down Expand Up @@ -68,7 +68,7 @@ pub fn verify_quote(quote: &[u8]) -> Result<Vec<u8>, Error> {
td_report_verify.as_mut_ptr() as *mut c_void,
&mut report_verify_size as *mut u32,
);
if result != AttestLibError::MigtdAttestSuccess {
if result != AttestLibError::AttestSuccess {
return Err(Error::VerifyQuote);
}
}
Expand Down
24 changes: 12 additions & 12 deletions src/attestation/src/binding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,29 @@
#[derive(Debug, PartialEq)]
pub(crate) enum AttestLibError {
/// Success
MigtdAttestSuccess = 0x0000,
AttestSuccess = 0x0000,
/// Unexpected error
MigtdAttestErrorUnexpected = 0x0001,
AttestErrorUnexpected = 0x0001,
/// The parameter is incorrect
MigtdAttestErrorInvalidParameter = 0x0002,
AttestErrorInvalidParameter = 0x0002,
/// Not enough memory is available to complete this operation
MigtdAttestErrorOutOfMemory = 0x0003,
AttestErrorOutOfMemory = 0x0003,
/// vsock related failure
MigtdAttestErrorVsockFailure = 0x0004,
AttestErrorVsockFailure = 0x0004,
/// Failed to get the TD Report
MigtdAttestErrorReportFailure = 0x0005,
AttestErrorReportFailure = 0x0005,
/// Failed to extend rtmr
MigtdAttestErrorExtendFailure = 0x0006,
AttestErrorExtendFailure = 0x0006,
/// Request feature is not supported
MigtdAttestErrorNotSupported = 0x0007,
AttestErrorNotSupported = 0x0007,
/// Failed to get the TD Quote
MigtdAttestErrorQuoteFailure = 0x0008,
AttestErrorQuoteFailure = 0x0008,
/// The device driver return busy
MigtdAttestErrorBusy = 0x0009,
AttestErrorBusy = 0x0009,
/// Failed to acess tdx attest device
MigtdAttestErrorDeviceFailure = 0x000a,
AttestErrorDeviceFailure = 0x000a,
/// Only supported RTMR index is 2 and 3
MigtdAttestErrorInvalidRtmrIndex = 0x000b,
AttestErrorInvalidRtmrIndex = 0x000b,
}

extern "C" {
Expand Down
6 changes: 3 additions & 3 deletions src/attestation/src/ghci.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,22 @@ pub static NOTIFIER: AtomicU8 = AtomicU8::new(0);
#[no_mangle]
pub extern "C" fn migtd_get_quote(tdquote_req_buf: *mut c_void, len: u64) -> i32 {
if tdquote_req_buf == null_mut() || len > GET_QUOTE_MAX_SIZE {
return AttestLibError::MigtdAttestErrorInvalidParameter as i32;
return AttestLibError::AttestErrorInvalidParameter as i32;
}

let input = unsafe { from_raw_parts_mut(tdquote_req_buf as *mut u8, len as usize) };

let mut shared = if let Some(shared) = SharedMemory::new(len as usize / 0x1000) {
shared
} else {
return AttestLibError::MigtdAttestErrorOutOfMemory as i32;
return AttestLibError::AttestErrorOutOfMemory as i32;
};
shared.as_mut_bytes()[..len as usize].copy_from_slice(input);

set_vmm_notification();

if tdvmcall_get_quote(shared.as_mut_bytes()).is_err() {
return AttestLibError::MigtdAttestErrorQuoteFailure as i32;
return AttestLibError::AttestErrorQuoteFailure as i32;
}

wait_for_vmm_notification();
Expand Down

0 comments on commit 768d3d7

Please sign in to comment.