From 0e320f3fa21dd08de1e6aaa8a58207b149db0f59 Mon Sep 17 00:00:00 2001 From: Thomas Knauth Date: Tue, 12 Feb 2019 15:41:26 -0800 Subject: [PATCH] Do not initialize secs.mrenclave and secs.mrsigner prior to ECREATE. Added comment. --- Pal/src/host/Linux-SGX/sgx_framework.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Pal/src/host/Linux-SGX/sgx_framework.c b/Pal/src/host/Linux-SGX/sgx_framework.c index 3949b7aa..7a63a0e9 100644 --- a/Pal/src/host/Linux-SGX/sgx_framework.c +++ b/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);