Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
77423fee
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看板
提交
77423fee
编写于
12月 26, 2022
作者:
伞
伞木希美
1
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
aaa
Signed-off-by:
N
伞木希美
<
zhanghanlin9@huawei.com
>
上级
3de19324
变更
4
展开全部
隐藏空白更改
内联
并排
Showing
4 changed file
with
677 addition
and
17 deletion
+677
-17
security/security_huks_reformed_test/huks_signverify_promise_BasicTest/src/main/js/test/List.test.js
...ignverify_promise_BasicTest/src/main/js/test/List.test.js
+3
-0
security/security_huks_reformed_test/huks_signverify_promise_BasicTest/src/main/js/test/SignVerify/SecurityHuksRSASignExtendJsunit.test.js
...s/test/SignVerify/SecurityHuksRSASignExtendJsunit.test.js
+524
-0
security_lite/huks/liteos_m_adapter/hks_derive_test.c
security_lite/huks/liteos_m_adapter/hks_derive_test.c
+57
-0
security_lite/huks/liteos_m_adapter/hks_hash_test.c
security_lite/huks/liteos_m_adapter/hks_hash_test.c
+93
-17
未找到文件。
security/security_huks_reformed_test/huks_signverify_promise_BasicTest/src/main/js/test/List.test.js
浏览文件 @
77423fee
...
...
@@ -30,6 +30,8 @@ import SecurityHuksSM2BasicAbort63KBPromiseJsunit from './SignVerify/SecurityHuk
import
SecurityHuksSM2BasicAbort65KBPromiseJsunit
from
'
./SignVerify/SecurityHuksSM2BasicAbort65KBPromiseJsunit.test.js
'
import
SecurityHuksSM2BasicFinish63KBPromiseJsunit
from
'
./SignVerify/SecurityHuksSM2BasicFinish63KBPromiseJsunit.test.js
'
import
SecurityHuksSM2BasicFinish65KBPromiseJsunit
from
'
./SignVerify/SecurityHuksSM2BasicFinish65KBPromiseJsunit.test.js
'
import
SecurityHuksRSASignExtendJsunit
from
'
./SignVerify/SecurityHuksRSASignExtendJsunit.test.js
'
export
default
function
testsuite
()
{
SecurityHuksDSABasicAbort63KBPromiseJsunit
()
SecurityHuksDSABasicAbort65KBPromiseJsunit
()
...
...
@@ -48,4 +50,5 @@ SecurityHuksSM2BasicAbort63KBPromiseJsunit()
SecurityHuksSM2BasicAbort65KBPromiseJsunit
()
SecurityHuksSM2BasicFinish63KBPromiseJsunit
()
SecurityHuksSM2BasicFinish65KBPromiseJsunit
()
SecurityHuksRSASignExtendJsunit
()
}
security/security_huks_reformed_test/huks_signverify_promise_BasicTest/src/main/js/test/SignVerify/SecurityHuksRSASignExtendJsunit.test.js
0 → 100644
浏览文件 @
77423fee
此差异已折叠。
点击以展开。
security_lite/huks/liteos_m_adapter/hks_derive_test.c
浏览文件 @
77423fee
...
...
@@ -138,6 +138,32 @@ static const struct HksTestDeriveParams g_testDeriveParams[] = {
{
true
,
DEFAULT_LOCAL_KEY_SIZE
,
true
,
DEFAULT_LOCAL_KEY_SIZE
}
},
/* pbkdf-sha256-salt-info */
{
2
,
HKS_SUCCESS
,
{
true
,
DEFAULT_KEY_ALIAS_SIZE
,
true
,
DEFAULT_KEY_ALIAS_SIZE
},
{
true
,
/* genKey params */
true
,
HKS_ALG_AES
,
true
,
HKS_AES_KEY_SIZE_256
,
true
,
HKS_KEY_PURPOSE_DERIVE
,
true
,
HKS_DIGEST_SHA256
,
false
,
0
,
false
,
0
,
false
,
0
},
{
0
},
{
true
,
/* derive params */
true
,
HKS_ALG_PBKDF2
,
true
,
HKS_KEY_PURPOSE_DERIVE
,
true
,
HKS_DIGEST_SHA256
,
true
,
1000
,
true
,
DEFAULT_SALT_SIZE
,
true
,
DEFAULT_INFO_SIZE
,
false
,
true
},
{
true
,
DEFAULT_DERIVE_SIZE
,
true
,
DEFAULT_DERIVE_SIZE
},
{
false
,
0
,
false
,
0
}
},
};
static
int32_t
DeriveKey
(
const
struct
HksTestDeriveParamSet
*
deriveParamSetParams
,
const
struct
HksBlob
*
masterKey
,
...
...
@@ -242,6 +268,15 @@ static void ExecHksDeriveTest002(void const *argument)
osThreadExit
();
}
static
void
ExecHksDeriveTest003
(
void
const
*
argument
)
{
LiteTestPrint
(
"HksDeriveTest003 Begin!
\n
"
);
int32_t
ret
=
BaseTestDerive
(
2
);
TEST_ASSERT_TRUE
(
ret
==
0
);
LiteTestPrint
(
"HksDeriveTest003 End!
\n
"
);
osThreadExit
();
}
#ifndef _CUT_AUTHENTICATE_
/**
* @tc.name: HksDeriveTest.HksDeriveTest001
...
...
@@ -264,6 +299,27 @@ LITE_TEST_CASE(HksDeriveTest, HksDeriveTest001, Level1)
sleep
(
WAIT_TO_TEST_DONE
);
LiteTestPrint
(
"HksDeriveTest001 End2!
\n
"
);
}
/**
* @tc.name: HksDeriveTest.HksDeriveTest003
* @tc.desc: The static function will return true;
* @tc.type: FUNC
*/
LITE_TEST_CASE
(
HksDeriveTest
,
HksDeriveTest003
,
Level1
)
{
osThreadId_t
id
;
osThreadAttr_t
attr
;
g_setPriority
=
osPriorityAboveNormal6
;
attr
.
name
=
"test"
;
attr
.
attr_bits
=
0U
;
attr
.
cb_mem
=
NULL
;
attr
.
cb_size
=
0U
;
attr
.
stack_mem
=
NULL
;
attr
.
stack_size
=
TEST_TASK_STACK_SIZE
;
attr
.
priority
=
g_setPriority
;
id
=
osThreadNew
((
osThreadFunc_t
)
ExecHksDeriveTest003
,
NULL
,
&
attr
);
sleep
(
WAIT_TO_TEST_DONE
);
LiteTestPrint
(
"HksDeriveTest001 End2!
\n
"
);
}
#endif
/* _CUT_AUTHENTICATE_ */
/**
...
...
@@ -287,4 +343,5 @@ LITE_TEST_CASE(HksDeriveTest, HksDeriveTest002, Level1)
sleep
(
WAIT_TO_TEST_DONE
);
LiteTestPrint
(
"HksDeriveTest002 End2!
\n
"
);
}
RUN_TEST_SUITE
(
HksDeriveTest
);
security_lite/huks/liteos_m_adapter/hks_hash_test.c
浏览文件 @
77423fee
...
...
@@ -30,7 +30,11 @@
#include "ohos_types.h"
#define DEFAULT_SRC_DATA_SIZE 200
#define DIGEST_SHA1_HASH_SIZE 20
#define DIGEST_SHA224_HASH_SIZE 28
#define DIGEST_SHA256_HASH_SIZE 32
#define DIGEST_SHA384_HASH_SIZE 48
#define DIGEST_SHA512_HASH_SIZE 64
#define TEST_TASK_STACK_SIZE 0x2000
#define WAIT_TO_TEST_DONE 4
...
...
@@ -92,50 +96,80 @@ static const struct HksTestHashParams g_testHashParams[] = {
{
true
,
DEFAULT_SRC_DATA_SIZE
,
true
,
DEFAULT_SRC_DATA_SIZE
},
{
true
,
DIGEST_SHA256_HASH_SIZE
,
true
,
DIGEST_SHA256_HASH_SIZE
}
},
{
1
,
HKS_SUCCESS
,
{
true
,
true
,
HKS_DIGEST_SHA384
},
{
true
,
DEFAULT_SRC_DATA_SIZE
,
true
,
DEFAULT_SRC_DATA_SIZE
},
{
true
,
DIGEST_SHA384_HASH_SIZE
,
true
,
DIGEST_SHA384_HASH_SIZE
}
},
{
2
,
HKS_SUCCESS
,
{
true
,
true
,
HKS_DIGEST_SHA512
},
{
true
,
DEFAULT_SRC_DATA_SIZE
,
true
,
DEFAULT_SRC_DATA_SIZE
},
{
true
,
DIGEST_SHA512_HASH_SIZE
,
true
,
DIGEST_SHA512_HASH_SIZE
}
},
};
static
void
ExecHksHashTest
001
(
void
const
*
argument
)
static
void
ExecHksHashTest
Common
(
int
index
)
{
LiteTestPrint
(
"HksMacTest001 Begin!
\n
"
);
struct
HksParamSet
*
paramSet
=
NULL
;
struct
HksBlob
*
srcData
=
NULL
;
struct
HksBlob
*
hash
=
NULL
;
int32_t
ret
=
TestConstructHashParamSet
(
&
paramSet
,
g_testHashParams
[
0
].
paramSetParams
.
paramSetExist
,
g_testHashParams
[
0
].
paramSetParams
.
setDigest
,
g_testHashParams
[
0
].
paramSetParams
.
digest
);
g_testHashParams
[
index
].
paramSetParams
.
paramSetExist
,
g_testHashParams
[
index
].
paramSetParams
.
setDigest
,
g_testHashParams
[
index
].
paramSetParams
.
digest
);
TEST_ASSERT_TRUE
(
ret
==
0
);
ret
=
TestConstuctBlob
(
&
srcData
,
g_testHashParams
[
0
].
srcDataParams
.
blobExist
,
g_testHashParams
[
0
].
srcDataParams
.
blobSize
,
g_testHashParams
[
0
].
srcDataParams
.
blobDataExist
,
g_testHashParams
[
0
].
srcDataParams
.
blobDataSize
);
g_testHashParams
[
index
].
srcDataParams
.
blobExist
,
g_testHashParams
[
index
].
srcDataParams
.
blobSize
,
g_testHashParams
[
index
].
srcDataParams
.
blobDataExist
,
g_testHashParams
[
index
].
srcDataParams
.
blobDataSize
);
TEST_ASSERT_TRUE
(
ret
==
0
);
ret
=
TestConstructBlobOut
(
&
hash
,
g_testHashParams
[
0
].
hashParams
.
blobExist
,
g_testHashParams
[
0
].
hashParams
.
blobSize
,
g_testHashParams
[
0
].
hashParams
.
blobDataExist
,
g_testHashParams
[
0
].
hashParams
.
blobDataSize
);
g_testHashParams
[
index
].
hashParams
.
blobExist
,
g_testHashParams
[
index
].
hashParams
.
blobSize
,
g_testHashParams
[
index
].
hashParams
.
blobDataExist
,
g_testHashParams
[
index
].
hashParams
.
blobDataSize
);
TEST_ASSERT_TRUE
(
ret
==
0
);
ret
=
HksHashRun
(
paramSet
,
srcData
,
hash
,
1
);
if
(
ret
!=
g_testHashParams
[
0
].
expectResult
)
{
HKS_TEST_LOG_I
(
"HksHashRun failed, ret[%u] = %d"
,
g_testHashParams
[
0
].
testId
,
ret
);
if
(
ret
!=
g_testHashParams
[
index
].
expectResult
)
{
HKS_TEST_LOG_I
(
"HksHashRun failed, ret[%u] = %d"
,
g_testHashParams
[
index
].
testId
,
ret
);
}
TEST_ASSERT_TRUE
(
ret
==
g_testHashParams
[
0
].
expectResult
);
TEST_ASSERT_TRUE
(
ret
==
g_testHashParams
[
index
].
expectResult
);
HksFreeParamSet
(
&
paramSet
);
TestFreeBlob
(
&
srcData
);
TestFreeBlob
(
&
hash
);
HKS_TEST_LOG_I
(
"[%u]TestHash, Testcase_Hash_[%03u] pass!"
,
1
,
g_testHashParams
[
0
].
testId
);
HKS_TEST_LOG_I
(
"[%u]TestHash, Testcase_Hash_[%03u] pass!"
,
1
,
g_testHashParams
[
index
].
testId
);
TEST_ASSERT_TRUE
(
ret
==
0
);
}
static
void
ExecHksHashTest001
(
void
const
*
argument
)
{
LiteTestPrint
(
"HksMacTest001 Begin!
\n
"
);
ExecHksHashTestCommon
(
0
);
LiteTestPrint
(
"HksMacTest001 End!
\n
"
);
osThreadExit
();
}
static
void
ExecHksHashTest002
(
void
const
*
argument
)
{
LiteTestPrint
(
"HksMacTest002 Begin!
\n
"
);
ExecHksHashTestCommon
(
1
);
LiteTestPrint
(
"HksMacTest002 End!
\n
"
);
osThreadExit
();
}
static
void
ExecHksHashTest003
(
void
const
*
argument
)
{
LiteTestPrint
(
"HksMacTest003 Begin!
\n
"
);
ExecHksHashTestCommon
(
2
);
LiteTestPrint
(
"HksMacTest003 End!
\n
"
);
osThreadExit
();
}
/**
* @tc.name: HksHashTest.HksHashTest001
* @tc.desc: The static function will return true;
...
...
@@ -157,6 +191,48 @@ LITE_TEST_CASE(HksHashTest, HksHashTest001, Level1)
sleep
(
WAIT_TO_TEST_DONE
);
LiteTestPrint
(
"HksMacTest001 End2!
\n
"
);
}
/**
* @tc.name: HksHashTest.HksHashTest002
* @tc.desc: The static function will return true;
* @tc.type: FUNC
*/
LITE_TEST_CASE
(
HksHashTest
,
HksHashTest002
,
Level1
)
{
osThreadId_t
id
;
osThreadAttr_t
attr
;
g_setPriority
=
osPriorityAboveNormal6
;
attr
.
name
=
"test"
;
attr
.
attr_bits
=
0U
;
attr
.
cb_mem
=
NULL
;
attr
.
cb_size
=
0U
;
attr
.
stack_mem
=
NULL
;
attr
.
stack_size
=
TEST_TASK_STACK_SIZE
;
attr
.
priority
=
g_setPriority
;
id
=
osThreadNew
((
osThreadFunc_t
)
ExecHksHashTest002
,
NULL
,
&
attr
);
sleep
(
WAIT_TO_TEST_DONE
);
LiteTestPrint
(
"HksMacTest001 End2!
\n
"
);
}
/**
* @tc.name: HksHashTest.HksHashTest003
* @tc.desc: The static function will return true;
* @tc.type: FUNC
*/
LITE_TEST_CASE
(
HksHashTest
,
HksHashTest003
,
Level1
)
{
osThreadId_t
id
;
osThreadAttr_t
attr
;
g_setPriority
=
osPriorityAboveNormal6
;
attr
.
name
=
"test"
;
attr
.
attr_bits
=
0U
;
attr
.
cb_mem
=
NULL
;
attr
.
cb_size
=
0U
;
attr
.
stack_mem
=
NULL
;
attr
.
stack_size
=
TEST_TASK_STACK_SIZE
;
attr
.
priority
=
g_setPriority
;
id
=
osThreadNew
((
osThreadFunc_t
)
ExecHksHashTest003
,
NULL
,
&
attr
);
sleep
(
WAIT_TO_TEST_DONE
);
LiteTestPrint
(
"HksMacTest001 End2!
\n
"
);
}
RUN_TEST_SUITE
(
HksHashTest
);
#endif
/* _CUT_AUTHENTICATE_ */
...
...
鸿蒙社区
@harmonycommunity
mentioned in commit
65149788
·
12月 28, 2022
mentioned in commit
65149788
mentioned in commit 65149788927505bcaccca2a1e962d25e5c4251e2
开关提交列表
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录