Hi, this repository is very useful to learn about remote attestation and I would like to propose to add the expected MRENCLAVE to the policy file so that it can be part of the verification, but I am not sure how to do so.
Some things to do:
In enclave_verify.c:
int verify_enclave_identity(sgx_measurement_t req_mr_signer,
sgx_measurement_t req_mr_enclave, sgx_prod_id_t req_isv_product_id,
sgx_isv_svn_t min_isvsvn, int allow_debug, sgx_report_body_t *report)
In sp.cpp:
typedef struct config_struct {
// ...
sgx_measurement_t req_mrsigner;
sgx_measurement_t req_mrenclave;
sgx_prod_id_t req_isv_product_id;
// ...
} config_t;
if ( ! verify_enclave_identity(config->req_mrsigner, config->req_mrenclave,
config->req_isv_product_id, config->min_isvsvn,
config->allow_debug_enclave, r) ) {
eprintf("Invalid enclave.\n");
msg4->status= NotTrusted;
}
Others:
Reasoning
My understanding is that in order for a remote verifier to be sure that an enclave is running the expected code, the MRENCLAVE in the attestation report must be checked against an expected "trusted" MRENCLAVE. It's not clear to me how a remote verifier is expected to obtain that "trusted" MRENCLAVE, and this example could also demonstrate this, which would be very useful for learning purposes.
For instance, this repository shows how the expected MRSIGNER is extracted out of the SIGSTRUCT from the Enclave.signed.so, using the sgx sdk sgx_sign tool, (and mrsigner program) but how does one get the MRENCLAVE? Are there recommended protocols for the remote verifier to obtain such information?
https://software.intel.com/content/www/us/en/develop/documentation/sgx-developer-guide/top/attestation/remote-interplatform-attestation.html mentions:
The enclave data contained in the quote (MRENCLAVE, MRSIGNER, ISVPRODID, ISVSVN, ATTRIBUTES, and so on.) is presented to the remote service provider at the end of the attestation process. This is the data the service provider will compare against a trusted configuration to decide whether to render the service to the enclave.
But it does not mention how to get this "trusted configuration". This example gives ideas on how to obtain this trusted configuration but it is missing one crucial piece: the MRENCLAVE.
Related: https://community.intel.com/t5/Intel-Software-Guard-Extensions/Who-has-the-original-hash-of-enclave-in-remote-attestation/m-p/1103756#M1136
Hi, this repository is very useful to learn about remote attestation and I would like to propose to add the expected MRENCLAVE to the
policyfile so that it can be part of the verification, but I am not sure how to do so.Some things to do:
policy.infile. For development purposes it can first be hardcoded, and if there's some kind of automated way to add it to thepolicy.infile like it is done for the MRSIGNER, then sure, otherwise, a hardcoded one may be ok, as it would correspond to the version of the code. If the enclave code changes then the hardcoded MRENCLAVE would have to be updated. That seems reasonable for an example, if the reasoning is not flawed.In
enclave_verify.c:verify_enclave_identityfunction must be modified to take in the mrenclave as a paramater. Something like:In
sp.cpp:config_structconfig->req_mrenclaveas a parameter to the call toverify_enclave_identity():--mrenclaveand its processing, and setting the config accordingly.Others:
run.inReasoning
My understanding is that in order for a remote verifier to be sure that an enclave is running the expected code, the MRENCLAVE in the attestation report must be checked against an expected "trusted" MRENCLAVE. It's not clear to me how a remote verifier is expected to obtain that "trusted" MRENCLAVE, and this example could also demonstrate this, which would be very useful for learning purposes.
For instance, this repository shows how the expected MRSIGNER is extracted out of the SIGSTRUCT from the
Enclave.signed.so, using the sgx sdksgx_signtool, (andmrsignerprogram) but how does one get the MRENCLAVE? Are there recommended protocols for the remote verifier to obtain such information?https://software.intel.com/content/www/us/en/develop/documentation/sgx-developer-guide/top/attestation/remote-interplatform-attestation.html mentions:
But it does not mention how to get this "trusted configuration". This example gives ideas on how to obtain this trusted configuration but it is missing one crucial piece: the MRENCLAVE.
Related: https://community.intel.com/t5/Intel-Software-Guard-Extensions/Who-has-the-original-hash-of-enclave-in-remote-attestation/m-p/1103756#M1136