Intel® Software Guard Extensions (Intel® SGX)
Discussion board focused on hardware-based isolation and memory encryption to provide extended code protection in solutions.
1459 Discussions

Intel® Software Guard Extensions (Intel® SGX) Web-Based Training Lab 2 problems

pheles
Beginner
1,203 Views

Hello Im new to intel SGX development and decided to follow the labs provided on Intel® Software Guard Extensions (Intel® SGX) Web-Based Training.

Link is provided:

https://software.intel.com/content/dam/develop/external/us/en/documents/sgx-web-training-lab-manual-v1-0-816585.pdf

While doing the task 2.5: Add a trusted call to an Enclave project (starting from page 26) Everything went smoot untill page 29 in which there is a sample code provided for the main() function which is provided in pic1.

pic1.png

But there seems to be no defined ENCLAVE_FILE so I thought I must have been a typo and put ENCLAVE_FILE_T defined at the top but that seems to be not acceptable as well provided in pic 2.

pic2.png

Also in the files that are quto generated in Enclave_u.h there seems to be "İ" letter included in definitions I think this may cause a problem should I change it? Provided in pic3.

pic3.png

Thanks in advance for any help! 

0 Kudos
1 Solution
JesusG_Intel
Moderator
1,126 Views

Hello pheles,


Your ConsoleApp properties should be:


Debugging | Working Directory: $(OutDir)

C\C++ | General | Additional Include Directories: $(SGXSDKInstallPath)\include;%(AdditionalIncludeDirectories)

Linker |

General | Additional Library Directories: $(SGXSDKInstallPath)\bin\$(Platform)\Debug;%(AdditionalLibraryDirectories)

General | Output File: $(OutDir)$(TargetName)$(TargetExt)

Input | Additional Dependencies: sgx_urts.lib;sgx_uae_service.lib;%(AdditionalDependencies)


Sincerely,

Jesus G.

Intel Customer Support


View solution in original post

0 Kudos
9 Replies
JesusG_Intel
Moderator
1,192 Views

Hello pheles,


Make sure to download the lab manual and open it as a PDF outside of the browser so that the code shows up correctly.


The ENCLAVE_FILE definition looks like this:


#define ENCLAVE_FILE _T("enclave.signed.dll")


There is a space between ENCLAVE_FILE and _T so the subsequent references should be to ENCLAVE_FILE.


The generated "İ" may be due to your language settings in Visual Studio. It should be regular "I." You can try either way and see what works.


Sincerely,

Jesus G.

Intel Customer Support



0 Kudos
pheles
Beginner
1,181 Views

Hello again!

 

Thank you so much for the reply. I did all of the changes however I'm still getting errors which are:

 

1>------ Build started: Project: ConsoleApp, Configuration: Debug Win32 ------
1>ConsoleApp.cpp
1>Enclave_u.c
1>ConsoleApp.obj : error LNK2019: unresolved external symbol _sgx_create_enclavew referenced in function _main
1>ConsoleApp.obj : error LNK2019: unresolved external symbol _sgx_destroy_enclave referenced in function _main
1>Enclave_u.obj : error LNK2019: unresolved external symbol _sgx_ecall referenced in function _foo
1>Enclave_u.obj : error LNK2019: unresolved external symbol _sgx_oc_cpuidex referenced in function _Enclave_sgx_oc_cpuidex
1>Enclave_u.obj : error LNK2019: unresolved external symbol _sgx_thread_wait_untrusted_event_ocall referenced in function _Enclave_sgx_thread_wait_untrusted_event_ocall
1>Enclave_u.obj : error LNK2019: unresolved external symbol _sgx_thread_set_untrusted_event_ocall referenced in function _Enclave_sgx_thread_set_untrusted_event_ocall
1>Enclave_u.obj : error LNK2019: unresolved external symbol _sgx_thread_setwait_untrusted_events_ocall referenced in function _Enclave_sgx_thread_setwait_untrusted_events_ocall
1>Enclave_u.obj : error LNK2019: unresolved external symbol _sgx_thread_set_multiple_untrusted_events_ocall referenced in function _Enclave_sgx_thread_set_multiple_untrusted_events_ocall
1>C:\...\Source\Repos\ConsoleApp\Debug\ConsoleApp.exe : fatal error LNK1120: 8 unresolved externals
1>Done building project "ConsoleApp.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

 

And here is the pic provided:

Ekran Görüntüsü (28).png

I don't understand what I did wrong?

 

 

0 Kudos
JesusG_Intel
Moderator
1,162 Views

Hello pheles,

Ensure you have set the correct project properties by comparing your console app with a known good app, such as from SampleEnclave from the SGX SDK.


Copy the properties from the SGX SDK/SampleEnclave to your existing project.

  1. Open two instances of Visual Studio.
  • SGX SDK/SampleEnclave - the Source, the known good configuration. Do not change these properties.
    • YourProject - the Target, the project you want to change.
  1. Open the Project Properties for the Source and for the Target so that you can see them side-by-side.
  2. Copy all of the properties from the Source to the Target.
  3. At the top of the Property Pages window, select Configuration: Debug, Platform: x86 (or other desired configuration).
  4. Ensure all settings are the same in all fields:

Configuration Properties |

  • General
  • Advanced
  • Debugging
  • VC++ Directories
  • C/C++ | All Options
  • Linker | All Options
  • Build Events | Post-Build Event
  • Check all other fields to ensure that they are the same.



0 Kudos
pheles
Beginner
1,145 Views

Hello again!

 

I couldnt find the SGX SDK/SampleEnclave. I would really appreciate If you could inform me on this. Thanks in advance!

0 Kudos
JesusG_Intel
Moderator
1,139 Views

Hello pheles,


If you installed the Intel SGX SDK for Windows then you will find it at C:\Program Files (x86)\Intel\IntelSGXSDK\src\SampleEnclave.


Sincerely,

Jesus G.

Intel Customer Support


0 Kudos
pheles
Beginner
1,137 Views

Hello,

 

I do have Intel SGX SDK and found it at C:\Program Files (x86)\Intel\IntelSGXSDK\src\SampleEnclave. But when I try to run it this is the outcome:

First I get this popup:

Ekran Görüntüsü (29).png

Then these errors:

Ekran Görüntüsü (30).png

And when I checked on Enclave_t.h this is the outcome:

Ekran Görüntüsü (31).png

At the end the build fails. I did not changed anything in sample application so I dont understand what I did wrong? Thanks in advance

0 Kudos
pheles
Beginner
1,131 Views

Hello again,

 

Also after changing some of the options this is the pop up I get:

Ekran Görüntüsü (32).png

Which is the path of the .exe and "system cannot find the file specified" error.

 

Here are the error list:

 

Ekran Görüntüsü (34).png

The enclave part works without any errors but consoleApp does not for some reason.

0 Kudos
JesusG_Intel
Moderator
1,127 Views

Hello pheles,


Your ConsoleApp properties should be:


Debugging | Working Directory: $(OutDir)

C\C++ | General | Additional Include Directories: $(SGXSDKInstallPath)\include;%(AdditionalIncludeDirectories)

Linker |

General | Additional Library Directories: $(SGXSDKInstallPath)\bin\$(Platform)\Debug;%(AdditionalLibraryDirectories)

General | Output File: $(OutDir)$(TargetName)$(TargetExt)

Input | Additional Dependencies: sgx_urts.lib;sgx_uae_service.lib;%(AdditionalDependencies)


Sincerely,

Jesus G.

Intel Customer Support


0 Kudos
JesusG_Intel
Moderator
1,086 Views

This thread has been marked as answered and Intel will no longer monitor this thread. If you want a response from Intel in a follow-up question, please open a new thread.


0 Kudos
Reply