Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
039f0bc3
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看板
未验证
提交
039f0bc3
编写于
10月 22, 2022
作者:
伞
伞木希美
提交者:
Gitee
10月 22, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修改一些步骤
Signed-off-by:
N
伞木希美
<
zhanghanlin9@huawei.com
>
上级
985060db
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
12 addition
and
26 deletion
+12
-26
security_lite/huks/liteos_a_adapter/hks_safe_cipher_key_test.cpp
...y_lite/huks/liteos_a_adapter/hks_safe_cipher_key_test.cpp
+12
-26
未找到文件。
security_lite/huks/liteos_a_adapter/hks_safe_cipher_key_test.cpp
浏览文件 @
039f0bc3
...
...
@@ -56,31 +56,8 @@ void HksSafeCipherKeyTest::TearDown()
{
}
const
char
*
g_storePath
=
"/storage/maindata/hks_client/key"
;
const
char
*
g_testEd25519
=
"test_ed25519"
;
static
int32_t
CompareTwoKey
(
const
struct
HksBlob
*
keyAliasOne
,
const
struct
HksBlob
*
keyAliasTwo
)
{
uint32_t
sizeOne
=
HksTestFileSize
(
g_storePath
,
(
char
*
)
keyAliasOne
->
data
);
uint8_t
*
bufOne
=
(
uint8_t
*
)
HksTestMalloc
(
sizeOne
);
if
(
bufOne
==
NULL
)
{
return
HKS_ERROR_MALLOC_FAIL
;
}
uint32_t
sizeRead
=
HksTestFileRead
(
g_storePath
,
(
char
*
)
keyAliasOne
->
data
,
0
,
bufOne
,
sizeOne
);
uint32_t
sizeTwo
=
HksTestFileSize
(
g_storePath
,
(
char
*
)
keyAliasTwo
->
data
);
uint8_t
*
bufTwo
=
(
uint8_t
*
)
HksTestMalloc
(
sizeTwo
);
if
(
bufTwo
==
NULL
)
{
HksTestFree
(
bufOne
);
return
HKS_ERROR_MALLOC_FAIL
;
}
sizeRead
=
HksTestFileRead
(
g_storePath
,
(
char
*
)
keyAliasTwo
->
data
,
0
,
bufTwo
,
sizeOne
);
int32_t
ret
=
memcmp
(
bufOne
,
bufTwo
,
sizeRead
);
HksTestFree
(
bufOne
);
HksTestFree
(
bufTwo
);
return
ret
;
}
/**
* @tc.name: HksSafeCipherKeyTest.HksSafeCipherKeyTest001
* @tc.desc: The static function will return true;
...
...
@@ -106,7 +83,16 @@ HWTEST_F(HksSafeCipherKeyTest, HksSafeCipherKeyTest001, TestSize.Level1)
ret
=
TestImportEd25519
(
newAliasTwo
,
&
pubKeyInfo
);
EXPECT_EQ
(
ret
,
0
);
ret
=
CompareTwoKey
(
&
newAliasOne
,
&
newAliasTwo
);
struct
HksBlob
X25519PubKey1
=
{
.
size
=
HKS_CURVE25519_KEY_SIZE_256
,
.
data
=
nullptr
};
struct
HksBlob
X25519PubKey2
=
{
.
size
=
HKS_CURVE25519_KEY_SIZE_256
,
.
data
=
nullptr
};
X25519PubKey1
.
data
=
(
uint8_t
*
)
HksMalloc
(
X25519PubKey1
.
size
);
X25519PubKey2
.
data
=
(
uint8_t
*
)
HksMalloc
(
X25519PubKey2
.
size
);
ret
=
HksExportPublicKey
(
&
newAliasOne
,
null
,
&
X25519PubKey1
);
EXPECT_EQ
(
ret
,
0
)
<<
"export alies1 fail"
;
ret
=
HksExportPublicKey
(
&
newAliasTwo
,
null
,
&
X25519PubKey1
);
EXPECT_EQ
(
ret
,
0
)
<<
"export alies2 fail"
;
ret
=
memcmp
(
X25519PubKey1
.
data
,
X25519PubKey2
.
data
,
HKS_CURVE25519_KEY_SIZE_256
);
EXPECT_NE
(
ret
,
0
);
ret
=
HksDeleteKey
(
&
newAliasOne
,
NULL
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录