Browse Source

[SGX PAL] Change check_wrfsbase_support() to is_wrfsbase_supported().

Signed-off-by: Chia-Che Tsai <chiache@tamu.edu>
Chia-Che Tsai 5 years ago
parent
commit
f3f05adc2d

+ 3 - 3
Pal/src/host/Linux-SGX/sgx_framework.c

@@ -107,7 +107,7 @@ static size_t get_ssaframesize (uint64_t xfrm)
     return ALLOC_ALIGNUP(xsave_size + sizeof(sgx_arch_gpr_t) + 1);
 }
 
-int check_wrfsbase_support (void)
+bool is_wrfsbase_supported (void)
 {
     uint32_t cpuinfo[4];
     cpuid(7, 0, cpuinfo);
@@ -116,10 +116,10 @@ int check_wrfsbase_support (void)
         SGX_DBG(DBG_E, "The WRFSBASE instruction is not permitted on this"
                 " platform. Please make sure the \'graphene_sgx\' kernel module"
                 " is loaded properly.\n");
-        return 0;
+        return false;
     }
 
-    return 1;
+    return true;
 }
 
 int create_enclave(sgx_arch_secs_t * secs,

+ 1 - 1
Pal/src/host/Linux-SGX/sgx_internal.h

@@ -83,7 +83,7 @@ struct pal_enclave {
 };
 
 int open_gsgx (void);
-int check_wrfsbase_support (void);
+bool is_wrfsbase_supported (void);
 
 int read_enclave_token (int token_file, sgx_arch_token_t * token);
 int read_enclave_sigstruct (int sigfile, sgx_arch_sigstruct_t * sig);

+ 1 - 4
Pal/src/host/Linux-SGX/sgx_main.c

@@ -684,10 +684,7 @@ static int load_enclave (struct pal_enclave * enclave,
     if (ret < 0)
         return ret;
 
-    ret = check_wrfsbase_support();
-    if (ret < 0)
-        return ret;
-    if (!ret)
+    if (!is_wrfsbase_supported())
         return -EPERM;
 
     INLINE_SYSCALL(gettimeofday, 2, &tv, NULL);