@Intel SGX 读书笔记…
VS项目设置
本部分介绍以下两个项目设置:
- Enclave项目的推荐项目设置
- 不可信应用程序的推荐项目设置
要在Microsoft Visual Studio中设置项目设置,请右键单击Solution Explorer中的项目名称,并从菜单中选择Properties。
Enclave项目推荐的项目设置。
对于Enclave,建议使用默认的项目设置,但有以下例外:
C/C++ -> 常规 -> 附加包含目录:
参考书中写的是:
[Intel SGX SDK Install Path]include;[Intel SGX SDK Install Path]include\tlibc;
[Intel SGX SDK Install Path]include\stlport;
但是我没有发现stlport这个文件夹,所以以下是我的版本:
(
S
G
X
S
D
K
I
n
s
t
a
l
l
P
a
t
h
)
i
n
c
l
u
d
e
;
(SGXSDKInstallPath)include;
(SGXSDKInstallPath)include;(SGXSDKInstallPath)include\tlibc;KaTeX parse error: Undefined control sequence: \libc at position 27: …allPath)include\̲l̲i̲b̲c̲++;(SGXSDKInstallPath)include\epid;
链接器 -> 常规 -> 附加库目录:
$(SGXSDKInstallPath)bin$(Platform)$(Configuration)
链接器->输入->附加依赖项:
HW Configuration:sgx_trts.lib;sgx_tservice.lib;sgx_tstdc.lib;sgx_tcxx.lib;sgx_tcrypto.lib
Simulation Configuration:sgx_trts_sim.lib;sgx_tservice_sim.lib;sgx_tstdc.lib;sgx_tlibcxx;sgx_tcrypto.lib
链接器->输入->忽略所有默认库:是(/NODEFAULTLIB)
链接器->高级->无入口点:是(/NOENTRY)
要在构建过程中对Enclave进行签名,请在项目设置中设置自定义构建步骤:
生成事件->生成后事件->命令行(Win32):
“[Intel SGX SDK InstallPath]bin\win32\release\sgx_sign.exe” sign -key"
(
P
r
o
j
e
c
t
D
i
r
)
s
a
m
p
l
e
e
n
c
l
a
v
e
p
r
i
v
a
t
e
.
p
e
m
"
−
e
n
c
l
a
v
e
"
(ProjectDir)sample_enclave_private.pem" -enclave "
(ProjectDir)sampleenclaveprivate.pem"−enclave"(OutDir)sample_enclave.dll" -out"
(
O
u
t
D
i
r
)
s
a
m
p
l
e
e
n
c
l
a
v
e
.
s
i
g
n
e
d
.
d
l
l
"
−
c
o
n
f
i
g
"
(OutDir)sample_enclave.signed.dll" -config"
(OutDir)sampleenclave.signed.dll"−config"(ProjectDir)sample_enclave.config.xml"
生成事件->生成后事件->命令行(x64):
“[Intel SGX SDK InstallPath]bin\x64\release\sgx_sign.exe” sign -key “
(
P
r
o
j
e
c
t
D
i
r
)
s
a
m
p
l
e
e
n
c
l
a
v
e
p
r
i
v
a
t
e
.
p
e
m
"
−
e
n
c
l
a
v
e
"
(ProjectDir)sample_enclave_private.pem" -enclave "
(ProjectDir)sampleenclaveprivate.pem"−enclave"(OutDir)sample_enclave.dll” -out"
(
O
u
t
D
i
r
)
s
a
m
p
l
e
e
n
c
l
a
v
e
.
s
i
g
n
e
d
.
d
l
l
"
−
c
o
n
f
i
g
"
(OutDir)sample_enclave.signed.dll" -config "
(OutDir)sampleenclave.signed.dll"−config"(ProjectDir)sample_enclave.config.xml"
生成事件 -> 生成后事件 -> 在生成中使用:是
(签名命令行只是一个例子,要根据你自己的Enclave项目改变命令行哦)
不可信应用程序的推荐项目设置:
为不可信的应用程序使用默认的项目设置,并使用以下附加设置:
C/C++ -> 常规 -> 附加包含目录:$(SGXSDKInstallPath)\include
链接器 -> 常规 -> 附加库目录: $(SGXSDKInstallPath)\bin$(Platform)$(Configuration)
链接器 -> 输入 -> 附加依赖项:
HW Configuration:sgx_uae_service.lib;sgx_urts.lib
Simulation Configuration:sgx_uae_service_sim.lib;sgx_urts_sim.lib
支持的应用程序类型
普通用户、访客和管理员可以以DLL的形式运行Enclave应用程序,以加载Intel SGX Enclave并与之交互。在用户账户的安全上下文中执行的用户级驱动程序和系统服务也可以访问Intel SGX软件栈提供功能。