Skip to content

psw: prefer /dev/sgx_provision & /dev/sgx_enclave #1064

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions psw/enclave_common/sgx_enclave_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -480,11 +480,11 @@ static void enclave_set_provision_access(int hdevice, void* enclave_base)

if (s_driver_type == SGX_DRIVER_IN_KERNEL)
{
hdev_prov = open("/dev/sgx/provision", O_RDWR);
hdev_prov = open("/dev/sgx_provision", O_RDWR);
if (-1 == hdev_prov)
{
//if /dev/sgx/provision is not present, try to open /dev/sgx_provision
hdev_prov = open("/dev/sgx_provision", O_RDWR);
//if /dev/sgx_provision is not present, try to open /dev/sgx/provision
hdev_prov = open("/dev/sgx/provision", O_RDWR);
}
if (-1 == hdev_prov)
{
Expand Down
12 changes: 6 additions & 6 deletions psw/urts/linux/edmm_utility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,11 @@ bool get_driver_type(int *driver_type)
*driver_type = sgx_driver_type;
}

int hdev = open("/dev/sgx/enclave", O_RDWR); //attempt to open the in-kernel driver
int hdev = open("/dev/sgx_enclave", O_RDWR); //attempt to open the in-kernel driver
if (-1 == hdev)
{
//if /dev/sgx/enclave is not present, try to open /dev/sgx_enclave
hdev = open("/dev/sgx_enclave", O_RDWR);
//if /dev/sgx_enclave is not present, try to open /dev/sgx/enclave
hdev = open("/dev/sgx/enclave", O_RDWR);
}
if (-1 == hdev)
{
Expand Down Expand Up @@ -154,11 +154,11 @@ extern "C" bool open_se_device(int driver_type, int *hdevice)
*hdevice = -1;
if (driver_type == SGX_DRIVER_IN_KERNEL)
{
*hdevice = open("/dev/sgx/enclave", O_RDWR); //attempt to open the in-kernel driver
//if /dev/sgx/enclave is not present, try to open /dev/sgx_enclave
*hdevice = open("/dev/sgx_enclave", O_RDWR); //attempt to open the in-kernel driver
//if /dev/sgx_enclave is not present, try to open /dev/sgx/enclave
if(-1 == *hdevice)
{
*hdevice = open("/dev/sgx_enclave", O_RDWR);
*hdevice = open("/dev/sgx/enclave", O_RDWR);
}
}
else if (driver_type == SGX_DRIVER_DCAP)
Expand Down