Skip to content

Commit

Permalink
Merge #157
Browse files Browse the repository at this point in the history
157: fix for newest nightly r=jethrogb a=Goirad



Co-authored-by: Dario Gonzalez <[email protected]>
  • Loading branch information
bors[bot] and Goirad committed Jul 12, 2019
2 parents cc1822d + 7e63bac commit ff9072e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions enclave-runner/src/tcs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,13 @@ pub(crate) fn coenter<T: Tcs>(
let mut _tmp2: u64;

unsafe {
let mut uninit_debug_buf: DebugBuffer;
let mut uninit_debug_buf: std::mem::MaybeUninit<DebugBuffer>;
let debug_buf = debug_buf.map(|r| r.borrow_mut());
let debug_buf = match debug_buf {
Some(mut buf) => buf.as_mut_ptr(),
None => {
uninit_debug_buf = std::mem::uninitialized();
uninit_debug_buf.as_mut_ptr()
uninit_debug_buf = std::mem::MaybeUninit::uninit();
uninit_debug_buf.as_mut_ptr() as *mut _
}
};
asm!("
Expand Down
18 changes: 9 additions & 9 deletions sgxs-tools/src/sgx_detect/tests/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,26 +49,26 @@ impl DebugSupport for SgxCpuConfiguration {
if !Paint::is_enabled() {
swcontrol_msg = swcontrol_msg.replace('“', r#"""#).replace('”', r#"""#).into();
}
const SGX_DISABLED: Result<EfiSoftwareguardstatus, Rc<Error>> = Ok(EfiSoftwareguardstatus { status: SgxEnableStatus::Disabled });
const SGX_ENABLED: Result<EfiSoftwareguardstatus, Rc<Error>> = Ok(EfiSoftwareguardstatus { status: SgxEnableStatus::Enabled });
const SGX_SWCONTROL: Result<EfiSoftwareguardstatus, Rc<Error>> = Ok(EfiSoftwareguardstatus { status: SgxEnableStatus::SoftwareControlled });
const SGX_UNKNOWN: Result<EfiSoftwareguardstatus, Rc<Error>> = Ok(EfiSoftwareguardstatus { status: SgxEnableStatus::Unknown });
const SGX_DISABLED: EfiSoftwareguardstatus = EfiSoftwareguardstatus { status: SgxEnableStatus::Disabled };
const SGX_ENABLED: EfiSoftwareguardstatus = EfiSoftwareguardstatus { status: SgxEnableStatus::Enabled };
const SGX_SWCONTROL: EfiSoftwareguardstatus = EfiSoftwareguardstatus { status: SgxEnableStatus::SoftwareControlled };
const SGX_UNKNOWN: EfiSoftwareguardstatus = EfiSoftwareguardstatus { status: SgxEnableStatus::Unknown };

writeln!(out, "Your hardware supports SGX, but it's not enabled.\n")?;

match (&inner.efi_status, &inner.efi_epcbios) {
(&SGX_DISABLED, _) => {
(&Ok(SGX_DISABLED), _) => {
writeln!(out, "Your BIOS supports SGX, but it's disabled. Reboot your machine and enable SGX in your BIOS.")?;
debug_msr = false;
},
(&SGX_ENABLED, _) => {
(&Ok(SGX_ENABLED), _) => {
writeln!(out, "Your BIOS says it supports SGX and SGX is enabled, but it's not. Try updating your BIOS to the latest version or contact your BIOS vendor.")?;
},
(&SGX_SWCONTROL, Err(e)) if is_efi_perm_error(&e) => {
(&Ok(SGX_SWCONTROL), Err(e)) if is_efi_perm_error(&e) => {
writeln!(out, "Your BIOS says it supports SGX reconfiguration, but the control mechanism could not be accessed due to a permission issue.")?;
writeln!(out, "\nWould you like to re-run this program with sudo to try again?\n{}", Paint::red("(not supported yet)"))?; //TODO
}
(&SGX_SWCONTROL, Err(_)) => {
(&Ok(SGX_SWCONTROL), Err(_)) => {
write!(out, "Your BIOS says it supports SGX reconfiguration, but there is a problem with the control mechanism.")?;
writeln!(out, "{}", swcontrol_msg)?;
},
Expand All @@ -95,7 +95,7 @@ impl DebugSupport for SgxCpuConfiguration {
writeln!(out, "BIOS support for SGX could not be determined due to a permission issue.")?;
writeln!(out, "\nWould you like to re-run this program with sudo to try again?\n{}", Paint::red("TODO"))?;
}
(&SGX_UNKNOWN, Err(_)) | (Err(_), Err(_)) => {
(&Ok(SGX_UNKNOWN), Err(_)) | (Err(_), Err(_)) => {
writeln!(out, "BIOS support for SGX could not be determined. Reboot your machine and try to enable SGX in your BIOS. Alternatively, try updating your BIOS to the latest version or contact your BIOS vendor.")?;
}
}
Expand Down

0 comments on commit ff9072e

Please sign in to comment.