Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
inclavare-containers
提交
2c5620e8
I
inclavare-containers
项目概览
openanolis
/
inclavare-containers
通知
4
Star
7
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
5
列表
看板
标记
里程碑
合并请求
0
分析
仓库
DevOps
项目成员
Pages
I
inclavare-containers
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
5
Issue
5
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
2c5620e8
编写于
7月 28, 2020
作者:
Y
YiLin.Li
提交者:
jia zhang
7月 28, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
rune/libenclave: Support to IAS remote attestation when Enclave Runtime started.
Signed-off-by:
N
Yilin Li
<
YiLin.Li@linux.alibaba.com
>
上级
28f51f18
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
94 addition
and
10 deletion
+94
-10
rune/libenclave/internal/runtime/core/core.go
rune/libenclave/internal/runtime/core/core.go
+1
-1
rune/libenclave/internal/runtime/enclave_runtime.go
rune/libenclave/internal/runtime/enclave_runtime.go
+3
-3
rune/libenclave/internal/runtime/pal/pal_linux.go
rune/libenclave/internal/runtime/pal/pal_linux.go
+85
-4
rune/libenclave/runelet.go
rune/libenclave/runelet.go
+5
-2
未找到文件。
rune/libenclave/internal/runtime/core/core.go
浏览文件 @
2c5620e8
...
...
@@ -25,7 +25,7 @@ func (pal *enclaveRuntimeCore) Init(args string, logLevel string) (err error) {
return
fmt
.
Errorf
(
"enclave runtime core Init() unimplemented"
)
}
func
(
pal
*
enclaveRuntimeCore
)
Attest
()
(
err
error
)
{
func
(
pal
*
enclaveRuntimeCore
)
Attest
(
string
,
string
,
uint32
,
uint32
)
(
err
error
)
{
return
fmt
.
Errorf
(
"enclave runtime core Attest() unimplemented"
)
}
...
...
rune/libenclave/internal/runtime/enclave_runtime.go
浏览文件 @
2c5620e8
...
...
@@ -13,7 +13,7 @@ import (
type
EnclaveRuntime
interface
{
Load
(
path
string
)
error
Init
(
args
string
,
logLevel
string
)
error
Attest
()
error
Attest
(
string
,
string
,
uint32
,
uint32
)
error
Exec
(
cmd
[]
string
,
envp
[]
string
,
stdio
[
3
]
*
os
.
File
)
(
int32
,
error
)
Kill
(
sig
int
,
pid
int
)
error
Destroy
()
error
...
...
@@ -56,10 +56,10 @@ func StartInitialization(config *configs.InitEnclaveConfig, logLevel string) (*E
return
rt
,
nil
}
func
(
rt
*
EnclaveRuntimeWrapper
)
LaunchAttestation
()
error
{
func
(
rt
*
EnclaveRuntimeWrapper
)
LaunchAttestation
(
spid
string
,
subscriptionKey
string
,
product
uint32
,
quoteType
uint32
)
error
{
logrus
.
Debugf
(
"attesting enclave runtime"
)
return
rt
.
runtime
.
Attest
()
return
rt
.
runtime
.
Attest
(
spid
,
subscriptionKey
,
product
,
quoteType
)
}
func
(
rt
*
EnclaveRuntimeWrapper
)
ExecutePayload
(
cmd
[]
string
,
envp
[]
string
,
stdio
[
3
]
*
os
.
File
)
(
int32
,
error
)
{
...
...
rune/libenclave/internal/runtime/pal/pal_linux.go
浏览文件 @
2c5620e8
package
enclave_runtime_pal
// import "github.com/opencontainers/runc/libenclave/internal/runtime/pal"
import
"C"
import
(
"encoding/binary"
"fmt"
"github.com/go-restruct/restruct"
"github.com/opencontainers/runc/libenclave/attestation"
"github.com/opencontainers/runc/libenclave/attestation/sgx"
_
"github.com/opencontainers/runc/libenclave/attestation/sgx/ias"
"github.com/opencontainers/runc/libenclave/intelsgx"
"log"
"os"
)
...
...
@@ -31,10 +40,6 @@ func (pal *enclaveRuntimePal) Init(args string, logLevel string) error {
return
api
.
init
(
args
,
logLevel
)
}
func
(
pal
*
enclaveRuntimePal
)
Attest
()
(
err
error
)
{
return
nil
}
func
(
pal
*
enclaveRuntimePal
)
Exec
(
cmd
[]
string
,
envp
[]
string
,
stdio
[
3
]
*
os
.
File
)
(
int32
,
error
)
{
if
pal
.
version
==
1
{
api
:=
&
enclaveRuntimePalApiV1
{}
...
...
@@ -67,3 +72,79 @@ func (pal *enclaveRuntimePal) GetLocalReport(targetInfo []byte) ([]byte, error)
return
nil
,
fmt
.
Errorf
(
"unsupported pal api version %d"
,
pal
.
version
)
}
func
parseAttestParameters
(
spid
string
,
subscriptionKey
string
,
product
uint32
)
map
[
string
]
string
{
p
:=
make
(
map
[
string
]
string
)
p
[
"spid"
]
=
spid
p
[
"subscription-key"
]
=
subscriptionKey
if
product
==
sgx
.
ProductEnclave
{
p
[
"service-class"
]
=
"product"
}
else
if
product
==
sgx
.
DebugEnclave
{
p
[
"service-class"
]
=
"dev"
}
return
p
}
func
(
pal
*
enclaveRuntimePal
)
Attest
(
spid
string
,
subscriptionKey
string
,
product
uint32
,
quoteType
uint32
)
(
err
error
)
{
if
pal
.
GetLocalReport
==
nil
{
return
nil
}
targetInfo
,
err
:=
intelsgx
.
GetQeTargetInfo
()
if
err
!=
nil
{
return
err
}
if
len
(
targetInfo
)
!=
intelsgx
.
TargetinfoLength
{
return
fmt
.
Errorf
(
"len(targetInfo) is not %d, but %d"
,
intelsgx
.
TargetinfoLength
,
len
(
targetInfo
))
}
// get local report of SGX
report
,
err
:=
pal
.
GetLocalReport
(
targetInfo
)
if
err
!=
nil
{
return
err
}
if
len
(
report
)
!=
intelsgx
.
ReportLength
{
return
fmt
.
Errorf
(
"len(report) is not %d, but %d"
,
intelsgx
.
ReportLength
,
len
(
report
))
}
// get quote from QE(aesmd)
linkable
:=
false
if
quoteType
==
intelsgx
.
QuoteSignatureTypeLinkable
{
linkable
=
true
}
quote
,
err
:=
intelsgx
.
GetQuote
(
report
,
spid
,
linkable
)
if
err
!=
nil
{
return
err
}
q
:=
&
intelsgx
.
Quote
{}
if
err
:=
restruct
.
Unpack
(
quote
,
binary
.
LittleEndian
,
&
q
);
err
!=
nil
{
return
err
}
// get IAS remote attestation report
var
verbose
bool
=
true
p
:=
parseAttestParameters
(
spid
,
subscriptionKey
,
product
)
svc
,
err
:=
attestation
.
NewService
(
p
,
verbose
)
if
err
!=
nil
{
log
.
Fatal
(
err
)
return
err
}
if
err
=
svc
.
Check
(
quote
);
err
!=
nil
{
log
.
Fatal
(
err
)
return
err
}
status
:=
svc
.
Verify
(
quote
)
if
status
.
ErrorMessage
!=
""
{
return
fmt
.
Errorf
(
"%s"
,
status
.
ErrorMessage
)
}
svc
.
ShowStatus
(
status
)
return
nil
}
rune/libenclave/runelet.go
浏览文件 @
2c5620e8
...
...
@@ -4,6 +4,7 @@ import (
"encoding/json"
"fmt"
"github.com/opencontainers/runc/libcontainer/utils"
"github.com/opencontainers/runc/libenclave/attestation/sgx"
"github.com/opencontainers/runc/libenclave/configs"
"github.com/opencontainers/runc/libenclave/internal/runtime"
pb
"github.com/opencontainers/runc/libenclave/proto"
...
...
@@ -68,9 +69,11 @@ func StartInitialization(cmd []string, cfg *RuneletConfig) (exitCode int32, err
}
// Launch a remote attestation to the enclave runtime.
if
err
=
rt
.
LaunchAttestation
();
err
!=
nil
{
if
config
.
RaType
==
sgx
.
EPID
{
if
err
=
rt
.
LaunchAttestation
(
config
.
RaEpidSpid
,
config
.
RaEpidSubscriptionKey
,
config
.
IsProductEnclave
,
config
.
RaEpidIsLinkable
);
err
!=
nil
{
return
1
,
err
}
}
if
err
=
readSync
(
initPipe
,
procEnclaveReady
);
err
!=
nil
{
return
1
,
err
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录