浏览代码

[Pal/Linux-SGX] Init communication with AESM only when app requests RA

Previously, Graphene-SGX always tried to initialize communication with
AESM enclaves (Launch Enclave, Quoting Enclave, etc.) on startup. This
is only needed for SGX Remote Attestation (RA). This commit disables
AESM init if the manifest doesn't explicitly specify need for SGX RA.
This allows non-provisioned SGX machines to run Graphene locally.
Dmitrii Kuvaiskii 5 年之前
父节点
当前提交
c99497e51b
共有 1 个文件被更改,包括 6 次插入3 次删除
  1. 6 3
      Pal/src/host/Linux-SGX/sgx_main.c

+ 6 - 3
Pal/src/host/Linux-SGX/sgx_main.c

@@ -938,9 +938,12 @@ static int load_enclave (struct pal_enclave * enclave,
     if (ret < 0)
         return ret;
 
-    ret = init_aesm_targetinfo(&pal_sec->aesm_targetinfo);
-    if (ret < 0)
-        return ret;
+    if (get_config(enclave->config, "sgx.ra_client_key", cfgbuf, sizeof(cfgbuf)) > 0) {
+        /* initialize communication with AESM enclave only if app requests remote attestation */
+        ret = init_aesm_targetinfo(&pal_sec->aesm_targetinfo);
+        if (ret < 0)
+            return ret;
+    }
 
     void* alt_stack = (void*)INLINE_SYSCALL(mmap, 6, NULL, ALT_STACK_SIZE,
                                             PROT_READ | PROT_WRITE,