Remove unnecessary check in SGX wait usercall

This commit is contained in:
Mohsen Zohrevandi 2020-07-01 12:45:11 -07:00
parent 3442d23c1a
commit c457b67af3

View file

@ -161,11 +161,10 @@ pub fn wait(event_mask: u64, mut timeout: u64) -> IoResult<u64> {
// model the enclave runner which is serving the wait usercall is not
// trusted to ensure accurate timeouts.
if let Ok(timeout_signed) = i64::try_from(timeout) {
let tenth = 1 + timeout_signed / 10;
let tenth = timeout_signed / 10;
let deviation = (rdrand64() as i64).checked_rem(tenth).unwrap_or(0);
timeout = timeout_signed.saturating_add(deviation) as _;
}
timeout = cmp::min(u64::MAX - 1, cmp::max(1, timeout));
}
unsafe { raw::wait(event_mask, timeout).from_sgx_result() }
}