Solution to “error code is 0x4001” when Intel SGX is running

by qiu pengfei

I was running the Intel SGX application on my computer yesterday, but this morning when I was running some minor modifications to the program based on the example provided by Intel, a 0x4001 error occurred. The prompt is as follows:

Error code is 0x4001. Please refer to the "Intel SGX SDK Developer Reference" for more details.

this affects the mood! Yesterday was also the afternoon to write a half – day program, how can there be a problem?I wonder if there is something wrong with my code, not through printing debugging, just start to delete one function after another, or not. Then, I replaced the example files provided by Intel one by one. If the problem is not my own code, I will directly run the example program provided by Intel, and the error 0x4001 still appears. To query the Intel provide SGX SDK development reference documentation, reference documentation can be downloaded at, query 0 x4001, indeed as expected to, the above is this to say:

AE service did not respond or the requested service is not supported.

means that the architecture service provided by Intel SGX is not responsive or the requested service is not supported, and that Intel SGX itself provides some enclaves, assisting the creation of enclaves, report generation, and so on. In this way, it should be the problem of SGX itself. Some people said that it was ok to compile and run in simulation mode, but not in hardware mode, which further verified the problem of SGX itself. Quickly boot up, enter the BIOS to see whether the SGX service is on, a look is on, this bothers me. The computer supports SGX and the service is on. How can there be a problem?Later think may be the driver problem, quickly reinstall the driver, enter the SGX driver download folder, execute the following command, re-install the SGX driver.

sudo ./sgx_linux_x64_driver_eb61a95.bin

compile and run the SGX application again, and there you go! Although I do not know why the driver will go wrong, do not know where the driver problem, but finally solved, or quite gratified.

Read More: