SGX Local Attestation sample returning 0x3002 in simulator

162 Views Asked by At

I cannot for the life of me get the LocalAttestation sample to run correctly on a fresh Linux install, following the instructions successfully. Given this is being built in simulation mode, I would have thought there were no additional dependencies?

I modified the demo to provide extra output, and this line returns 3002 SGX_ERROR_INVALID_ATTRIBUTE:

printf("creating enclave 1\n");
    ret = sgx_create_enclave(ENCLAVE1_PATH, SGX_DEBUG_FLAG, &launch_token, &launch_token_updated, &e1_enclave_id, NULL);
    if (ret != SGX_SUCCESS) {
        printf("Failed. Return value is: %X\n", ret);
                return ret;
    }

This is the sample, right out of the linux SDK: https://github.com/intel/linux-sgx and this error isn't even mentioned as a possibility in Intel's documentation on the function: https://software.intel.com/en-us/sgx-sdk-dev-reference-sgx-create-enclave

Any help would be greatly appreciated!

-- Henry

2

There are 2 best solutions below

0
On BEST ANSWER

Turns out this was an issue with the sample code. By initializing the launch_token zeroed out, everything works as expected:

sgx_launch_token_t launch_token = {0};
0
On
ret =sgx_create_enclave(_T(ENCLAVE_PATH),1,&launch_token,&launch_token_update,&enclave_id, NULL);
            if(ret !=SGX_SUCCESS)
            {
                printf("Failed to create enclave");
            }
            printf("Successfully create enclave.");
            printf("\nEnclaveID %llx", enclave_id);