Merge pull request #215 from deeglaze/sgx_is_enclave_crashed

Adds an API function to check if the enclave has crashed.

Signed-off-by: Zhang Lili Z <lili.z.zhang@intel.com>
This commit is contained in:
lzha101
2018-03-05 15:52:56 +08:00
committed by GitHub
3 changed files with 13 additions and 2 deletions
+7
View File
@@ -74,6 +74,13 @@ int SGXAPI sgx_is_outside_enclave(const void *addr, size_t size);
*/
sgx_status_t SGXAPI sgx_read_rand(unsigned char *rand, size_t length_in_bytes);
/* sgx_is_enclave_crashed()
* Return Value:
* 1 - The global enclave state is crashed.
* 0 - The global enclave state is not crashed.
*/
int SGXAPI sgx_is_enclave_crashed(void);
#ifdef __cplusplus
}
#endif
+5 -1
View File
@@ -291,6 +291,11 @@ sgx_status_t sgx_read_rand(unsigned char *rand, size_t length_in_bytes)
return SGX_SUCCESS;
}
int sgx_is_enclave_crashed()
{
return get_enclave_state() == ENCLAVE_CRASHED;
}
extern uintptr_t __stack_chk_guard;
int check_static_stack_canary(void *tcs)
{
@@ -301,4 +306,3 @@ int check_static_stack_canary(void *tcs)
}
return 0;
}
+1 -1
View File
@@ -73,7 +73,7 @@ static void init_stack_guard(void *tcs)
extern "C" int enter_enclave(int index, void *ms, void *tcs, int cssa)
{
if(get_enclave_state() == ENCLAVE_CRASHED)
if(sgx_is_enclave_crashed())
{
return SGX_ERROR_ENCLAVE_CRASHED;
}