Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
ce163195
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
1 年多 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
ce163195
编写于
4月 18, 2023
作者:
S
sunmingze
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
modify xts_lite
Signed-off-by:
N
sunmingze
<
sunmingze3@huawei.com
>
上级
105782f5
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
95 addition
and
3 deletion
+95
-3
xts_lite/device_attest_lite/device_attestQuerry_posix/src/device_attest_querry.cpp
...te/device_attestQuerry_posix/src/device_attest_querry.cpp
+18
-1
xts_lite/device_attest_lite/device_attestStart_hal/src/device_attest.c
...ce_attest_lite/device_attestStart_hal/src/device_attest.c
+77
-2
未找到文件。
xts_lite/device_attest_lite/device_attestQuerry_posix/src/device_attest_querry.cpp
浏览文件 @
ce163195
...
...
@@ -72,7 +72,7 @@ public:
result
=
false
;
}
if
(
!
AttestStatusNumberValid
(
attestResultInfo
.
softwareResultDetail
[
SOFTWARE_RESULT_RESERVE
]))
{
failString
+=
string
(
" reserveResult is "
)
+
to_string
(
attestResultInfo
.
softwareResultDetail
[
SOFTWARE_RESULT_
PCID
]);
failString
+=
string
(
" reserveResult is "
)
+
to_string
(
attestResultInfo
.
softwareResultDetail
[
SOFTWARE_RESULT_
RESERVE
]);
result
=
false
;
}
if
(
attestResultInfo
.
authResult
==
DEVATTEST_SUCCESS
)
{
...
...
@@ -119,6 +119,21 @@ HWTEST_F(DeviceAttestQuerryTest, subDeviceAttestTest0200, Function | MediumTest
* @tc.name : HiLog::Warn parameter legal test (Cortex-A, C)
* @tc.desc : [C- SOFTWARE -0200]
*/
#ifdef __LINUX__
HWTEST_F
(
DeviceAttestQuerryTest
,
subDeviceAttestTest0300
,
Function
|
MediumTest
|
Level1
)
{
int32_t
ret
=
DEVATTEST_SUCCESS
;
ret
=
StartDevAttestTask
();
printf
(
"[CLIENT MAIN] StartDevAttestTask ret:%d.
\n
"
,
ret
);
EXPECT_EQ
(
ret
,
DEVATTEST_SUCCESS
);
AttestResultInfo
attestResultInfo
=
{
0
};
attestResultInfo
.
ticket
=
NULL
;
printf
(
"[CLIENT MAIN] query.
\n
"
);
ret
=
GetAttestStatus
(
&
attestResultInfo
);
printf
(
"[CLIENT MAIN] wrong. ret:%d
\n
"
,
ret
);
EXPECT_EQ
(
ret
,
DEVATTEST_SUCCESS
);
}
#else
HWTEST_F
(
DeviceAttestQuerryTest
,
subDeviceAttestTest0300
,
Function
|
MediumTest
|
Level1
)
{
int32_t
ret
=
DEVATTEST_SUCCESS
;
...
...
@@ -132,3 +147,5 @@ HWTEST_F(DeviceAttestQuerryTest, subDeviceAttestTest0300, Function | MediumTest
printf
(
"[CLIENT MAIN] wrong. ret:%d
\n
"
,
ret
);
EXPECT_FALSE
(
ret
==
DEVATTEST_SUCCESS
);
}
#endif
xts_lite/device_attest_lite/device_attestStart_hal/src/device_attest.c
浏览文件 @
ce163195
...
...
@@ -17,6 +17,17 @@
#include "hctest.h"
#include "devattest_interface.h"
#define DEVATTEST_INIT -2
#define DEVATTEST_SUCCESS 0
typedef
enum
{
SOFTWARE_RESULT_VERSIONID
,
SOFTWARE_RESULT_PATCHLEVEL
,
SOFTWARE_RESULT_ROOTHASH
,
SOFTWARE_RESULT_PCID
,
SOFTWARE_RESULT_RESERVE
,
}
SOFTWARE_RESULT_DETAIL_TYPE
;
/**
* @tc.desc : register a test suite, this suite is used to test basic flow and interface dependency
* @param : subsystem name is dfx
...
...
@@ -44,8 +55,55 @@ static BOOL DeviceAttestFuncTestSuiteTearDown(void)
return
TRUE
;
}
bool
AttestStatusNumberValid
(
int32_t
attestStatusNumber
)
{
if
(
attestStatusNumber
<
DEVATTEST_INIT
||
attestStatusNumber
>
DEVATTEST_SUCCESS
)
{
return
false
;
}
return
true
;
}
bool
AttestStatusValid
(
AttestResultInfo
attestResultInfo
)
{
bool
result
=
true
;
if
(
!
AttestStatusNumberValid
(
attestResultInfo
.
authResult
))
{
result
=
false
;
}
if
(
!
AttestStatusNumberValid
(
attestResultInfo
.
softwareResult
))
{
result
=
false
;
}
if
(
!
AttestStatusNumberValid
(
attestResultInfo
.
softwareResultDetail
[
SOFTWARE_RESULT_VERSIONID
]))
{
result
=
false
;
}
if
(
!
AttestStatusNumberValid
(
attestResultInfo
.
softwareResultDetail
[
SOFTWARE_RESULT_PATCHLEVEL
]))
{
result
=
false
;
}
if
(
!
AttestStatusNumberValid
(
attestResultInfo
.
softwareResultDetail
[
SOFTWARE_RESULT_ROOTHASH
]))
{
result
=
false
;
}
if
(
!
AttestStatusNumberValid
(
attestResultInfo
.
softwareResultDetail
[
SOFTWARE_RESULT_PCID
]))
{
result
=
false
;
}
if
(
!
AttestStatusNumberValid
(
attestResultInfo
.
softwareResultDetail
[
SOFTWARE_RESULT_RESERVE
]))
{
result
=
false
;
}
if
(
attestResultInfo
.
authResult
==
DEVATTEST_SUCCESS
)
{
if
(
attestResultInfo
.
ticketLength
<=
0
)
{
result
=
false
;
}
if
(
attestResultInfo
.
ticket
==
""
)
{
result
=
false
;
}
}
if
(
result
)
{
return
true
;
}
else
{
return
false
;
}
}
/**
* @tc.number : SUB_Device_Attest_0
6
00
* @tc.number : SUB_Device_Attest_0
1
00
* @tc.name : StartDevAttestTask test
* @tc.desc : [C- SOFTWARE -0200]
* @tc.size : MEDIUM
...
...
@@ -56,8 +114,25 @@ LITE_TEST_CASE(DeviceAttestFuncTestSuite, subDeviceAttest0100, LEVEL0)
{
int32_t
ret
=
DEVATTEST_SUCCESS
;
ret
=
StartDevAttestTask
();
printf
(
"[CLIENT MAIN] StartDevAttestTask ret:%d.
\n
"
,
ret
);
TEST_ASSERT_EQUAL_INT
(
ret
,
DEVATTEST_SUCCESS
);
};
/**
* @tc.number : SUB_Device_Attest_0200
* @tc.name : GetAttestStatus test
* @tc.desc : [C- SOFTWARE -0200]
* @tc.size : MEDIUM
* @tc.type : RELI
* @tc.level : Level 0
*/
LITE_TEST_CASE
(
DeviceAttestFuncTestSuite
,
subDeviceAttest0200
,
LEVEL0
)
{
int32_t
ret
=
DEVATTEST_SUCCESS
;
AttestResultInfo
attestResultInfo
=
{
0
};
attestResultInfo
.
ticket
=
NULL
;
ret
=
GetAttestStatus
(
&
attestResultInfo
);
TEST_ASSERT_EQUAL_INT
(
ret
,
DEVATTEST_SUCCESS
);
TEST_ASSERT_EQUAL_INT
(
AttestStatusValid
(
attestResultInfo
),
true
);
};
RUN_TEST_SUITE
(
DeviceAttestFuncTestSuite
);
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录