Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
inclavare-containers
提交
28f51f18
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
28f51f18
编写于
7月 28, 2020
作者:
Y
YiLin.Li
提交者:
jia zhang
7月 28, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
rune: Add GetSgxReport PAL API v3
Signed-off-by:
N
Yilin Li
<
YiLin.Li@linux.alibaba.com
>
上级
7b403451
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
63 addition
and
2 deletion
+63
-2
rune/libcontainer/nsenter/enclave.c
rune/libcontainer/nsenter/enclave.c
+2
-0
rune/libcontainer/nsenter/loader.go
rune/libcontainer/nsenter/loader.go
+5
-0
rune/libenclave/internal/runtime/pal/api_linux_v1.go
rune/libenclave/internal/runtime/pal/api_linux_v1.go
+1
-2
rune/libenclave/internal/runtime/pal/api_linux_v3.go
rune/libenclave/internal/runtime/pal/api_linux_v3.go
+46
-0
rune/libenclave/internal/runtime/pal/pal_linux.go
rune/libenclave/internal/runtime/pal/pal_linux.go
+9
-0
未找到文件。
rune/libcontainer/nsenter/enclave.c
浏览文件 @
28f51f18
...
...
@@ -28,6 +28,7 @@ void *fptr_pal_exec;
void
*
fptr_pal_kill
;
void
*
fptr_pal_destroy
;
void
*
fptr_pal_create_process
;
void
*
fptr_pal_get_local_report
;
bool
enclave_configured
(
void
)
{
...
...
@@ -78,6 +79,7 @@ int load_enclave_runtime(void)
DLSYM
(
exec
);
DLSYM
(
kill
);
DLSYM
(
destroy
);
DLSYM
(
get_local_report
);
#undef DLSYM
return
0
;
...
...
rune/libcontainer/nsenter/loader.go
浏览文件 @
28f51f18
...
...
@@ -14,6 +14,7 @@ extern void *fptr_pal_exec;
extern void *fptr_pal_kill;
extern void *fptr_pal_destroy;
extern void *fptr_pal_create_process;
extern void *fptr_pal_get_local_report;
*/
import
"C"
...
...
@@ -41,6 +42,10 @@ func SymAddrPalDestroy() unsafe.Pointer {
return
unsafe
.
Pointer
(
C
.
fptr_pal_destroy
)
}
func
SymAddrPalGetLocalReport
()
unsafe
.
Pointer
{
return
unsafe
.
Pointer
(
C
.
fptr_pal_get_local_report
)
}
func
SymAddrPalCreateProcess
()
unsafe
.
Pointer
{
return
unsafe
.
Pointer
(
C
.
fptr_pal_create_process
)
}
rune/libenclave/internal/runtime/pal/api_linux_v1.go
浏览文件 @
28f51f18
...
...
@@ -46,12 +46,11 @@ import "C"
import
(
"fmt"
"github.com/opencontainers/runc/libcontainer/nsenter"
"github.com/sirupsen/logrus"
"os"
"strings"
"unsafe"
"github.com/opencontainers/runc/libcontainer/nsenter"
)
type
enclaveRuntimePalApiV1
struct
{
...
...
rune/libenclave/internal/runtime/pal/api_linux_v3.go
0 → 100644
浏览文件 @
28f51f18
package
enclave_runtime_pal
// import "github.com/opencontainers/runc/libenclave/internal/runtime/pal"
/*
#include <stdlib.h>
#include <errno.h>
static int palGetLocalReport(void *sym, void *target_info, int target_info_len,
void *report, int* report_len)
{
return ((int (*)(void *, int, void*, int*))sym)(target_info, target_info_len,
report, report_len);
}
*/
import
"C"
import
(
"fmt"
"github.com/opencontainers/runc/libcontainer/nsenter"
"github.com/opencontainers/runc/libenclave/intelsgx"
"unsafe"
)
type
enclaveRuntimePalApiV3
struct
{
}
func
(
pal
*
enclaveRuntimePalApiV3
)
getLocalReport
(
targetInfo
[]
byte
)
([]
byte
,
error
)
{
var
ret
C
.
int
reportBufSize
:=
int32
(
intelsgx
.
ReportLength
)
sym
:=
nsenter
.
SymAddrPalGetLocalReport
()
report
:=
make
([]
byte
,
reportBufSize
)
var
pTargetInfo
unsafe
.
Pointer
=
nil
if
len
(
targetInfo
)
>
0
{
pTargetInfo
=
unsafe
.
Pointer
(
&
targetInfo
[
0
])
}
ret
=
C
.
palGetLocalReport
(
sym
,
pTargetInfo
,
C
.
int
(
len
(
targetInfo
)),
unsafe
.
Pointer
(
&
report
[
0
]),
(
*
C
.
int
)(
unsafe
.
Pointer
(
&
reportBufSize
)))
if
ret
==
0
{
return
report
,
nil
}
return
nil
,
fmt
.
Errorf
(
"C.palGetLocalReport() failed, return %d.
\n
"
,
ret
)
}
rune/libenclave/internal/runtime/pal/pal_linux.go
浏览文件 @
28f51f18
...
...
@@ -58,3 +58,12 @@ func (pal *enclaveRuntimePal) Destroy() error {
api
:=
&
enclaveRuntimePalApiV1
{}
return
api
.
destroy
()
}
func
(
pal
*
enclaveRuntimePal
)
GetLocalReport
(
targetInfo
[]
byte
)
([]
byte
,
error
)
{
if
pal
.
version
>=
3
{
api
:=
&
enclaveRuntimePalApiV3
{}
return
api
.
getLocalReport
(
targetInfo
)
}
return
nil
,
fmt
.
Errorf
(
"unsupported pal api version %d"
,
pal
.
version
)
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录