Intel® Software Guard Extensions (Intel® SGX)
Use hardware-based isolation and memory encryption to provide more code protection in your solutions.

Can't install intel SGX PSW

iii8475
Beginner
1,190 Views

Hello,

I can't install intel SGX PSW and therefore my sample project doesn't work.  My CPU is i5 6200U and it has support for intel sgx, but in BIOS I do not see any option for intel sgx.

I have only installed SDK.

Simulation mode doesn't work as well. Program crashed on the same error and by the way link for download latest intel psw doesn't work.

 

Thanks for help. 

 

0 Kudos
1 Solution
JesusG_Intel
Moderator
1,028 Views

Hello iii8475,

How to Run Intel® Software Guard Extensions' Simulation Mode was written in May 2016 and many things have changed since then. I suspect there are also some typos in there. The settings in SGX SDK/SampleEnclave are the correct settings.

The Intel SGX SDK Developer Reference Guide for Windows that is distributed with each SDK contains the latest guidance in Section Setting up an Intel Software Guard Extensions Project. The guide is in the documents directory where you expanded the SGX SDK installer file. This slightly older Developer Reference Guide has the same guidance, I think.

Refer to Spectre mitigations in msvc to resolve your Spectre-related error. You will need to install the Spectre-mitigated MSVC libraries from the Individual Components in the Visual Studio installer. The page says 2017 but you will find the "libs for Spectre (x86 and x64) for your version of Visual Studio.

 

Sincerely,

Jesus G.

Intel Customer Support

 

View solution in original post

13 Replies
ChrisB_Intel
Moderator
1,152 Views

Can you provide me some additional information about your system, such as motherboard and BIOS information. The CPU should support SGX, however, if the board manufacture does not enable it in the BIOS, then that would be a problem. If you haven't already check for a BIOS update that would also be a good place to start.


iii8475
Beginner
1,149 Views

There is some bios update, but I think simulation mode should work at least.

I took dxdiag screenshot.

JesusG_Intel
Moderator
1,117 Views

Hello iii8475,

 

If there is no SGX option in your BIOS then your PC manufacturer did not expose SGX functionality in the BIOS. In this case, you cannot use the Intel SGX PSW so you cannot install it. The Intel SGX PSW requires SGX to be "Enabled" in BIOS.

You need only the SGX SDK to run in Simulation mode.

The screenshot you sent shows that you ran your program in Debug mode. Change the project configuration to Simulation mode as shown in the attached screenshot.

Also, try running one of the SGX SDK samples, SampleEnclave, in Simulation mode and see if that works for you.

Sincerely,

Jesus G.

Intel Customer Support

 

JesusG_Intel
Moderator
1,102 Views

Hello iii8475,


Do you still need help with this issue?


Sincerely,

Jesus G.

Intel Customer Support


iii8475
Beginner
1,091 Views

Hello,

Sorry for keep you waiting. 

Yes, I still need help.

When I changed from debug to simulation, it  didn't work.  Same" error occurred.  

Then I tried intel sgx master Simulation_Code from github: https://github.com/surentharbe/Intel_SGX

but I got some error message.

Thanks for help.

JesusG_Intel
Moderator
1,085 Views

Hello iii8475,


Start with one of the provided SGX SDK samples, such as SampleEnclave, in Simulation mode. If that works, then copy the app and enclave project C/C++ and Linker settings from the SDK Sample onto your own code. Below are the command lines for my environment for the Simulation Configuration in Visual Studio 2019, 64-bit mode:


App

C/C++:

/JMC /ifcOutput "x64\Simulation\" /GS /W4 /Zc:wchar_t /I"C:\Program Files (x86)\Intel\IntelSGXSDK\\include" /I"C:\git\src\SampleEnclave - Copy\\Include" /I"C:\Program Files (x86)\Intel\IntelSGXSDK\\include\epid" /I"C:\git\src\SampleEnclave - Copy\\App" /guard:cf /Zi /Gm- /Od /Fd"x64\Simulation\vc142.pdb" /Zc:inline /fp:precise /D "_MBCS" /errorReport:prompt /WX /Zc:forScope /RTC1 /Gd /MDd /FC /Fa"x64\Simulation\" /EHsc /nologo /Fo"x64\Simulation\" /Fp"x64\Simulation\App.pch" /diagnostics:column 


Linker:

/OUT:"C:\git\src\SampleEnclave - Copy\x64\Simulation\App.exe" /MANIFEST /NXCOMPAT /PDB:"C:\git\src\SampleEnclave - Copy\x64\Simulation\App.pdb" /DYNAMICBASE "sgx_urts_sim.lib" "kernel32.lib" "user32.lib" "gdi32.lib" "winspool.lib" "comdlg32.lib" "advapi32.lib" "shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib" "odbc32.lib" "odbccp32.lib" /DEBUG /MACHINE:X64 /WX /INCREMENTAL /PGD:"C:\git\src\SampleEnclave - Copy\x64\Simulation\App.pgd" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /ManifestFile:"x64\Simulation\App.exe.intermediate.manifest" /ERRORREPORT:PROMPT /NOLOGO /LIBPATH:"C:\Program Files (x86)\Intel\IntelSGXSDK\\bin\x64\Debug" /TLBID:1 


Enclave

C/C++:

/ifcOutput "x64\Simulation\" /GS /W4 /Zc:wchar_t /I"C:\git\src\SampleEnclave - Copy\\Include" /I"C:\Program Files (x86)\Intel\IntelSGXSDK\include" /I"C:\Program Files (x86)\Intel\IntelSGXSDK\include\tlibc" /I"C:\Program Files (x86)\Intel\IntelSGXSDK\include\libc++" /I"C:\Program Files (x86)\Intel\IntelSGXSDK\include\epid" /I"C:\git\src\SampleEnclave - Copy\\Enclave" /Qspectre /guard:cf /Zi /Gm- /Od /Fd"x64\Simulation\vc142.pdb" /Zc:inline /fp:precise /D "_WINDLL" /errorReport:prompt /WX /Zc:forScope /Gd /MTd /FC /Fa"x64\Simulation\" /EHsc /nologo /Fo"x64\Simulation\" /Fp"x64\Simulation\Enclave.pch" /diagnostics:column 

Additional Options: /d2FH4- 


Linker:

/OUT:"C:\git\src\SampleEnclave - Copy\x64\Simulation\Enclave.dll" /MANIFEST:NO /NOENTRY /NXCOMPAT /PDB:"C:\git\src\SampleEnclave - Copy\x64\Simulation\Enclave.pdb" /DYNAMICBASE "sgx_trts_sim.lib" "sgx_tstdc.lib" "sgx_tservice_sim.lib" "sgx_tcxx.lib" "sgx_tcrypto.lib" /IMPLIB:"C:\git\src\SampleEnclave - Copy\x64\Simulation\Enclave.lib" /DEBUG /DLL /MACHINE:X64 /WX /PGD:"C:\git\src\SampleEnclave - Copy\x64\Simulation\Enclave.pgd" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /ManifestFile:"x64\Simulation\Enclave.dll.intermediate.manifest" /ERRORREPORT:PROMPT /NOLOGO /LIBPATH:"C:\Program Files (x86)\Intel\IntelSGXSDK\bin\x64\debug" /NODEFAULTLIB /TLBID:1 


Sincerely,

Jesus G.

Intel Customer Support


iii8475
Beginner
1,079 Views

I tried to apply this  simulation   settings: https://software.intel.com/content/www/us/en/develop/blogs/usage-of-simulation-mode-in-sgx-enhanced-...  to IntelSgxSdk SamplEnclave project but it ended with error "Unable to create simulation directory".

I do not know how to copy or export settings from one project to another.

Could you describe steps how to do it ? 

Maybe I could try your settings but I have no idea where to copy commands lines from you environment to my environment. 

 

Thanks for help. 

iii8475
Beginner
1,073 Views

One remark.

I have got another one project and in this project should run in simulation mode (simulation setting) but only Debug works. When I switched to Simulation it doesn't work. 

Error message: Couldn't open file with CreateFile() 

 

 

JesusG_Intel
Moderator
1,060 Views

Hello iii8475,

First, make sure you have permissions, such as Admin, to create folders in your project directories. I saw in one of your screenshots that the linker could not find a library, sgx_tstdcxx.lib. This is incorrect. Your linker inputs should be: sgx_trts_sim.lib;sgx_tstdc.lib;sgx_tservice_sim.lib;sgx_tcrypto.lib;sgx_tcxx.lib

You have three options for ensuring you have the correct settings.

 

Option 1:

Create an enclave project using the SGX Enclave Project template.

  1. Install the SGX Wizard in Visual Studio 2019 using these instructions
  2. Open Visual Studio 2019 and create a new Project
  3. In the Search for templates box search for SGX and select the Intel® SGX Enclave Project template.
  4. This will add an Enclave project with all of the correct settings that you can use to create your solution.

 

Option 2:

Make a copy of the SGX SDK/SampleEnclave directory and use that as the base for your new project.

 

Option 3:

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

  1. Open two instances of Visual Studio 2019
  • 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. You will copy all of the properties from the Source to the Target.
  3. At the top of the Property Pages window, select Configuration: Simulation, Platform: x64
  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
  • Quickly glance all other fields to ensure they are the same

 

 

iii8475
Beginner
1,039 Views

Hello,

Why are settings in  my Sdk/SampleEnclave (Simulation, x64 )project different to  this settings:

https://software.intel.com/content/www/us/en/develop/blogs/usage-of-simulation-mode-in-sgx-enhanced-...

Should I applied settings described in this link to my Sdk/SampleEnclave (Simulation, x64 )? You have not described If I should set simulation settings

I tried option 2. I switched to simulation, x64 but some error occurred.

JesusG_Intel
Moderator
1,029 Views

Hello iii8475,

How to Run Intel® Software Guard Extensions' Simulation Mode was written in May 2016 and many things have changed since then. I suspect there are also some typos in there. The settings in SGX SDK/SampleEnclave are the correct settings.

The Intel SGX SDK Developer Reference Guide for Windows that is distributed with each SDK contains the latest guidance in Section Setting up an Intel Software Guard Extensions Project. The guide is in the documents directory where you expanded the SGX SDK installer file. This slightly older Developer Reference Guide has the same guidance, I think.

Refer to Spectre mitigations in msvc to resolve your Spectre-related error. You will need to install the Spectre-mitigated MSVC libraries from the Individual Components in the Visual Studio installer. The page says 2017 but you will find the "libs for Spectre (x86 and x64) for your version of Visual Studio.

 

Sincerely,

Jesus G.

Intel Customer Support

 

iii8475
Beginner
1,011 Views

Problem is solved. I have installed Spectre libs and SampleEnclave project works very well.

Maybe you should update this article https://software.intel.com/content/www/us/en/develop/blogs/usage-of-simulation-mode-in-sgx-enhanced-... and emphasize that it is not actual what is written there.

Thanks for help.

JesusG_Intel
Moderator
995 Views

Hello iii8475,


I am glad you are up and running now. The appropriate team has been notified about that article. Thank you for bringing it to our attention.


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.


Sincerely,

Jesus G.

Intel Customer Support


Reply