|
|
@@ -847,6 +847,24 @@ void test_dh (void)
|
|
|
|
|
|
int init_enclave (void)
|
|
|
{
|
|
|
+ // Get report to initialize info (MRENCLAVE, etc.) about this enclave from
|
|
|
+ // a trusted source.
|
|
|
+
|
|
|
+ // Since this report is only read by ourselves we can
|
|
|
+ // leave targetinfo zeroed.
|
|
|
+ sgx_arch_targetinfo_t targetinfo = {0};
|
|
|
+ struct pal_enclave_state reportdata = {0};
|
|
|
+ sgx_arch_report_t report;
|
|
|
+
|
|
|
+ int ret = sgx_report(&targetinfo, &reportdata, &report);
|
|
|
+ if (ret) {
|
|
|
+ SGX_DBG(DBG_E, "failed to get self report: %d\n", ret);
|
|
|
+ return -PAL_ERROR_INVAL;
|
|
|
+ }
|
|
|
+ memcpy(pal_sec.mrenclave, report.mrenclave, sizeof(pal_sec.mrenclave));
|
|
|
+ memcpy(pal_sec.mrsigner, report.mrsigner, sizeof(pal_sec.mrsigner));
|
|
|
+ pal_sec.enclave_attributes = report.attributes;
|
|
|
+
|
|
|
#if 0
|
|
|
/*
|
|
|
* This enclave-specific key is a building block for authenticating
|