소스 검색

[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,