rust_utee/api/
tee_api_cancel.rs1use crate::{
2 api::tee_api_panic::TEE_Panic,
3 syscalls::syscall_table::{
4 _utee_get_cancellation_flag, _utee_mask_cancellation, _utee_unmask_cancellation,
5 },
6 tee_api_defines::TEE_SUCCESS,
7};
8
9#[unsafe(no_mangle)]
10pub extern "C" fn TEE_GetCancellationFlag() -> bool {
11 let mut flag = 0;
12 let res = unsafe { _utee_get_cancellation_flag(&mut flag) };
13 if res as u32 != TEE_SUCCESS {
14 flag = 0;
15 }
16 flag != 0
17}
18
19#[unsafe(no_mangle)]
20pub extern "C" fn TEE_MaskCancellation() -> bool {
21 let mut old_mask = 0;
22 let res = unsafe { _utee_mask_cancellation(&mut old_mask) } as u32;
23 if res != TEE_SUCCESS {
24 TEE_Panic(res);
25 }
26 old_mask != 0
27}
28
29#[unsafe(no_mangle)]
30pub extern "C" fn TEE_UnmaskCancellation() -> bool {
31 let mut old_mask = 0;
32 let res = unsafe { _utee_unmask_cancellation(&mut old_mask) } as u32;
33 if res != TEE_SUCCESS {
34 TEE_Panic(res);
35 }
36 old_mask != 0
37}