Browse Source

Do not initialize secs.mrenclave and secs.mrsigner prior to ECREATE.

Added comment.
Thomas Knauth 5 years ago
parent
commit
0e320f3fa2
1 changed files with 5 additions and 2 deletions
  1. 5 2
      Pal/src/host/Linux-SGX/sgx_framework.c

+ 5 - 2
Pal/src/host/Linux-SGX/sgx_framework.c

@@ -146,8 +146,11 @@ int create_enclave(sgx_arch_secs_t * secs,
     secs->miscselect = token->miscselect_mask;
     memcpy(&secs->attributes, &token->attributes,
            sizeof(sgx_arch_attributes_t));
-    memcpy(&secs->mrenclave, &token->mrenclave, sizeof(sgx_arch_hash_t));
-    memcpy(&secs->mrsigner,  &token->mrsigner,  sizeof(sgx_arch_hash_t));
+    /* Do not initialize secs->mrsigner and secs->mrenclave here as they are
+     * not used by ECREATE to populate the internal SECS. SECS's mrenclave is
+     * computed dynamically and SECS's mrsigner is populated based on the
+     * SIGSTRUCT during EINIT (see pp21 for ECREATE and pp34 for
+     * EINIT in https://software.intel.com/sites/default/files/managed/48/88/329298-002.pdf). */
 
     if (baseaddr) {
         secs->baseaddr = (uint64_t) baseaddr & ~(secs->size - 1);