Browse Source

[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 years ago
parent
commit
c99497e51b
1 changed files with 6 additions and 3 deletions
  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,