Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
53961ac1
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看板
未验证
提交
53961ac1
编写于
12月 14, 2022
作者:
O
openharmony_ci
提交者:
Gitee
12月 14, 2022
浏览文件
操作
浏览文件
下载
差异文件
!6904 【OpenHarmony 3.2.9.1】【安全子系统】1018分支huks用例mini问题挑单
Merge pull request !6904 from qiaozzzh/1213_1
上级
26df0247
2b44c8ee
变更
23
隐藏空白更改
内联
并排
Showing
23 changed file
with
66 addition
and
36 deletion
+66
-36
security_lite/huks/common/hks_test_cipher.c
security_lite/huks/common/hks_test_cipher.c
+3
-3
security_lite/huks/common/hks_test_common.c
security_lite/huks/common/hks_test_common.c
+1
-1
security_lite/huks/common/hks_test_file_operator.c
security_lite/huks/common/hks_test_file_operator.c
+3
-3
security_lite/huks/common/include/hks_test_common.h
security_lite/huks/common/include/hks_test_common.h
+1
-1
security_lite/huks/liteos_a_adapter/hks_derive_test.cpp
security_lite/huks/liteos_a_adapter/hks_derive_test.cpp
+1
-1
security_lite/huks/liteos_a_adapter/hks_mac_test.cpp
security_lite/huks/liteos_a_adapter/hks_mac_test.cpp
+1
-1
security_lite/huks/liteos_a_adapter/hks_others_test.cpp
security_lite/huks/liteos_a_adapter/hks_others_test.cpp
+4
-4
security_lite/huks/liteos_a_adapter/hks_safe_cipher_key_test.cpp
...y_lite/huks/liteos_a_adapter/hks_safe_cipher_key_test.cpp
+25
-11
security_lite/huks/liteos_m_adapter/BUILD.gn
security_lite/huks/liteos_m_adapter/BUILD.gn
+1
-0
security_lite/huks/liteos_m_adapter/hks_aes_test.c
security_lite/huks/liteos_m_adapter/hks_aes_test.c
+2
-0
security_lite/huks/liteos_m_adapter/hks_agreement_test.c
security_lite/huks/liteos_m_adapter/hks_agreement_test.c
+1
-0
security_lite/huks/liteos_m_adapter/hks_bn_exp_mod_test.c
security_lite/huks/liteos_m_adapter/hks_bn_exp_mod_test.c
+1
-0
security_lite/huks/liteos_m_adapter/hks_cipher_test.c
security_lite/huks/liteos_m_adapter/hks_cipher_test.c
+1
-0
security_lite/huks/liteos_m_adapter/hks_delete_test.c
security_lite/huks/liteos_m_adapter/hks_delete_test.c
+1
-0
security_lite/huks/liteos_m_adapter/hks_derive_test.c
security_lite/huks/liteos_m_adapter/hks_derive_test.c
+2
-1
security_lite/huks/liteos_m_adapter/hks_exist_test.c
security_lite/huks/liteos_m_adapter/hks_exist_test.c
+1
-0
security_lite/huks/liteos_m_adapter/hks_generate_key_test.c
security_lite/huks/liteos_m_adapter/hks_generate_key_test.c
+1
-0
security_lite/huks/liteos_m_adapter/hks_generate_random_test.c
...ity_lite/huks/liteos_m_adapter/hks_generate_random_test.c
+1
-0
security_lite/huks/liteos_m_adapter/hks_hash_test.c
security_lite/huks/liteos_m_adapter/hks_hash_test.c
+1
-0
security_lite/huks/liteos_m_adapter/hks_mac_test.c
security_lite/huks/liteos_m_adapter/hks_mac_test.c
+1
-0
security_lite/huks/liteos_m_adapter/hks_modify_key_test.c
security_lite/huks/liteos_m_adapter/hks_modify_key_test.c
+3
-1
security_lite/huks/liteos_m_adapter/hks_others_test.c
security_lite/huks/liteos_m_adapter/hks_others_test.c
+5
-4
security_lite/huks/liteos_m_adapter/hks_safe_compare_key_test.c
...ty_lite/huks/liteos_m_adapter/hks_safe_compare_key_test.c
+5
-5
未找到文件。
security_lite/huks/common/hks_test_cipher.c
浏览文件 @
53961ac1
...
...
@@ -593,7 +593,7 @@ int32_t BaseTestCipher(uint32_t times, uint32_t index, uint32_t performTimes)
g_testCipherParams
[
index
].
genKeyParamSetParams
.
keyStorageFlag
==
HKS_STORAGE_TEMP
)
{
ret
=
GenerateLocalRandomKey
(
&
keyAlias
,
&
g_testCipherParams
[
index
].
localKeyParams
);
}
else
{
ret
=
GenerateKey
(
&
keyAlias
,
&
g_testCipherParams
[
index
].
keyAliasParams
,
ret
=
Huks
GenerateKey
(
&
keyAlias
,
&
g_testCipherParams
[
index
].
keyAliasParams
,
&
g_testCipherParams
[
index
].
genKeyParamSetParams
,
&
g_testCipherParams
[
index
].
genKeyParamSetParamsOut
);
}
HKS_TEST_ASSERT
(
ret
==
0
);
...
...
@@ -648,7 +648,7 @@ int32_t BaseTestEncrypt(uint32_t times, uint32_t index, uint32_t performTimes)
ret
=
GenerateLocalRandomKey
(
&
keyAlias
,
&
g_testEncryptParams
[
index
].
localKeyParams
);
}
else
{
if
(
g_testEncryptParams
[
index
].
keyAliasParams
.
blobExist
)
{
ret
=
GenerateKey
(
&
keyAlias
,
&
g_testEncryptParams
[
index
].
keyAliasParams
,
ret
=
Huks
GenerateKey
(
&
keyAlias
,
&
g_testEncryptParams
[
index
].
keyAliasParams
,
&
g_testEncryptParams
[
index
].
genKeyParamSetParams
,
NULL
);
}
else
{
ret
=
TestConstuctBlob
(
&
keyAlias
,
...
...
@@ -700,7 +700,7 @@ int32_t BaseTestDecrypt(uint32_t times, uint32_t index, uint32_t performTimes)
ret
=
GenerateLocalRandomKey
(
&
keyAlias
,
&
g_testDecryptParams
[
index
].
localKeyParams
);
}
else
{
if
(
g_testDecryptParams
[
index
].
keyAliasParams
.
blobExist
)
{
ret
=
GenerateKey
(
&
keyAlias
,
&
g_testDecryptParams
[
index
].
keyAliasParams
,
ret
=
Huks
GenerateKey
(
&
keyAlias
,
&
g_testDecryptParams
[
index
].
keyAliasParams
,
&
g_testDecryptParams
[
index
].
genKeyParamSetParams
,
NULL
);
}
else
{
ret
=
TestConstuctBlob
(
&
keyAlias
,
...
...
security_lite/huks/common/hks_test_common.c
浏览文件 @
53961ac1
...
...
@@ -551,7 +551,7 @@ int32_t TestConstructHashParamSet(
return
ret
;
}
int32_t
GenerateKey
(
struct
HksBlob
**
keyAlias
,
const
struct
HksTestBlobParams
*
keyAliasParams
,
int32_t
Huks
GenerateKey
(
struct
HksBlob
**
keyAlias
,
const
struct
HksTestBlobParams
*
keyAliasParams
,
const
struct
HksTestGenKeyParamsParamSet
*
genKeyParamSetParams
,
const
struct
HksTestGenKeyParamsParamSetOut
*
genKeyParamSetParamsOut
)
{
...
...
security_lite/huks/common/hks_test_file_operator.c
浏览文件 @
53961ac1
...
...
@@ -188,7 +188,7 @@ static uint32_t FileRead(const char *fileName, uint32_t offset, uint8_t *buf, ui
{
/* now offset is 0, but we maybe extend hi1131 file interfaces in the future */
if
(
offset
!=
0
)
{
return
HKS_ERROR_INVALID_ARGUMENT
;
return
(
uint32_t
)
HKS_ERROR_INVALID_ARGUMENT
;
}
unsigned
int
fileSize
;
...
...
@@ -209,7 +209,7 @@ static uint32_t FileRead(const char *fileName, uint32_t offset, uint8_t *buf, ui
return
0
;
}
ret
=
UtilsFileRead
(
fd
,
buf
,
len
);
ret
=
UtilsFileRead
(
fd
,
(
char
*
)
buf
,
len
);
UtilsFileClose
(
fd
);
if
(
ret
<
0
)
{
HKS_TEST_LOG_E
(
"failed to read file, errno = 0x%x"
,
ret
);
...
...
@@ -232,7 +232,7 @@ static int32_t FileWrite(const char *fileName, uint32_t offset, const uint8_t *b
return
HKS_ERROR_OPEN_FILE_FAIL
;
}
int32_t
ret
=
UtilsFileWrite
(
fd
,
buf
,
len
);
int32_t
ret
=
UtilsFileWrite
(
fd
,
(
char
const
*
)
buf
,
len
);
if
(
ret
<
0
)
{
HKS_TEST_LOG_E
(
"failed to write key file, errno = 0x%x
\n
"
,
ret
);
ret
=
HKS_ERROR_WRITE_FILE_FAIL
;
...
...
security_lite/huks/common/include/hks_test_common.h
浏览文件 @
53961ac1
...
...
@@ -412,7 +412,7 @@ int32_t TestConstructHashParamSet(
bool
paramSetExist
,
bool
setDigest
,
uint32_t
digest
);
int32_t
GenerateKey
(
struct
HksBlob
**
keyAlias
,
const
struct
HksTestBlobParams
*
keyAliasParams
,
int32_t
Huks
GenerateKey
(
struct
HksBlob
**
keyAlias
,
const
struct
HksTestBlobParams
*
keyAliasParams
,
const
struct
HksTestGenKeyParamsParamSet
*
genKeyParamSetParams
,
const
struct
HksTestGenKeyParamsParamSetOut
*
genKeyParamSetParamsOut
);
...
...
security_lite/huks/liteos_a_adapter/hks_derive_test.cpp
浏览文件 @
53961ac1
...
...
@@ -154,7 +154,7 @@ static int32_t BaseTestDerive(uint32_t index)
ret
=
GenerateLocalRandomKey
(
&
keyAlias
,
&
g_testDeriveParams
[
index
].
localKeyParams
);
}
else
{
if
(
g_testDeriveParams
[
index
].
keyAliasParams
.
blobExist
)
{
ret
=
GenerateKey
(
&
keyAlias
,
&
g_testDeriveParams
[
index
].
keyAliasParams
,
ret
=
Huks
GenerateKey
(
&
keyAlias
,
&
g_testDeriveParams
[
index
].
keyAliasParams
,
&
g_testDeriveParams
[
index
].
genKeyParamSetParams
,
NULL
);
}
else
{
ret
=
TestConstuctBlob
(
&
keyAlias
,
...
...
security_lite/huks/liteos_a_adapter/hks_mac_test.cpp
浏览文件 @
53961ac1
...
...
@@ -142,7 +142,7 @@ static int32_t BaseTestMac(uint32_t index)
g_testMacParams
[
index
].
keyParams
.
blobDataSize
);
}
else
{
if
(
g_testMacParams
[
index
].
keyAliasParams
.
blobExist
)
{
ret
=
GenerateKey
(
&
key
,
&
(
g_testMacParams
[
index
].
keyAliasParams
),
ret
=
Huks
GenerateKey
(
&
key
,
&
(
g_testMacParams
[
index
].
keyAliasParams
),
&
g_testMacParams
[
index
].
genKeyParamSetParams
,
NULL
);
}
else
{
ret
=
TestConstuctBlob
(
&
key
,
...
...
security_lite/huks/liteos_a_adapter/hks_others_test.cpp
浏览文件 @
53961ac1
...
...
@@ -84,7 +84,7 @@ HWTEST_F(HksOthersTest, HksOthersTest002, TestSize.Level1)
HWTEST_F
(
HksOthersTest
,
HksOthersTest003
,
TestSize
.
Level1
)
{
int32_t
ret
=
HksAttestKey
(
NULL
,
NULL
,
NULL
);
ASSERT_TRUE
(
ret
==
HKS_ERROR_
API_
NOT_SUPPORTED
);
ASSERT_TRUE
(
ret
==
HKS_ERROR_NOT_SUPPORTED
);
}
/**
...
...
@@ -95,7 +95,7 @@ HWTEST_F(HksOthersTest, HksOthersTest003, TestSize.Level1)
HWTEST_F
(
HksOthersTest
,
HksOthersTest004
,
TestSize
.
Level1
)
{
int32_t
ret
=
HksGetCertificateChain
(
NULL
,
NULL
,
NULL
);
ASSERT_TRUE
(
ret
==
HKS_ERROR_
API_
NOT_SUPPORTED
);
ASSERT_TRUE
(
ret
==
HKS_ERROR_NOT_SUPPORTED
);
}
/**
...
...
@@ -106,7 +106,7 @@ HWTEST_F(HksOthersTest, HksOthersTest004, TestSize.Level1)
HWTEST_F
(
HksOthersTest
,
HksOthersTest005
,
TestSize
.
Level1
)
{
int32_t
ret
=
HksWrapKey
(
NULL
,
NULL
,
NULL
,
NULL
);
ASSERT_TRUE
(
ret
==
HKS_ERROR_
API_
NOT_SUPPORTED
);
ASSERT_TRUE
(
ret
==
HKS_ERROR_NOT_SUPPORTED
);
}
/**
...
...
@@ -117,7 +117,7 @@ HWTEST_F(HksOthersTest, HksOthersTest005, TestSize.Level1)
HWTEST_F
(
HksOthersTest
,
HksOthersTest006
,
TestSize
.
Level1
)
{
int32_t
ret
=
HksUnwrapKey
(
NULL
,
NULL
,
NULL
,
NULL
);
ASSERT_TRUE
(
ret
==
HKS_ERROR_
API_
NOT_SUPPORTED
);
ASSERT_TRUE
(
ret
==
HKS_ERROR_NOT_SUPPORTED
);
}
/**
...
...
security_lite/huks/liteos_a_adapter/hks_safe_cipher_key_test.cpp
浏览文件 @
53961ac1
...
...
@@ -56,7 +56,29 @@ 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
...
...
@@ -83,21 +105,13 @@ HWTEST_F(HksSafeCipherKeyTest, HksSafeCipherKeyTest001, TestSize.Level1)
ret
=
TestImportEd25519
(
newAliasTwo
,
&
pubKeyInfo
);
EXPECT_EQ
(
ret
,
0
);
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
*
)
malloc
(
X25519PubKey1
.
size
);
X25519PubKey2
.
data
=
(
uint8_t
*
)
malloc
(
X25519PubKey2
.
size
);
ret
=
CompareTwoKey
(
&
newAliasOne
,
&
newAliasTwo
);
ret
=
HksExportPublicKey
(
&
newAliasOne
,
nullptr
,
&
X25519PubKey1
);
EXPECT_EQ
(
ret
,
0
)
<<
"export alies1 fail"
;
ret
=
HksExportPublicKey
(
&
newAliasTwo
,
nullptr
,
&
X25519PubKey2
);
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
,
nullptr
);
ret
=
HksDeleteKey
(
&
newAliasOne
,
NULL
);
EXPECT_EQ
(
ret
,
0
);
ret
=
HksDeleteKey
(
&
newAliasTwo
,
nullptr
);
ret
=
HksDeleteKey
(
&
newAliasTwo
,
NULL
);
EXPECT_EQ
(
ret
,
0
);
}
#endif
/* _CUT_AUTHENTICATE_ */
...
...
security_lite/huks/liteos_m_adapter/BUILD.gn
浏览文件 @
53961ac1
...
...
@@ -39,6 +39,7 @@ hctest_suite("ActsHuksHalFunctionTest") {
include_dirs = [
"//base/security/huks/interfaces/innerkits/huks_standard/main/include",
"//base/iothardware/peripheral/interfaces/inner_api",
"//base/security/huks/frameworks/huks_standard/main/common/include",
"../common/include",
]
...
...
security_lite/huks/liteos_m_adapter/hks_aes_test.c
浏览文件 @
53961ac1
...
...
@@ -17,9 +17,11 @@
#include "hks_api.h"
#include "hks_param.h"
#include "hks_test_aes.h"
#include "securec.h"
#include "cmsis_os2.h"
#include "ohos_types.h"
#include <unistd.h>
#define TEST_TASK_STACK_SIZE 0x2000
#define WAIT_TO_TEST_DONE 4
...
...
security_lite/huks/liteos_m_adapter/hks_agreement_test.c
浏览文件 @
53961ac1
...
...
@@ -26,6 +26,7 @@
#include "cmsis_os2.h"
#include "ohos_types.h"
#include <unistd.h>
#define TMP_SIZE 512
#define X25519_KEY_SIZE 32
#define TEST_TASK_STACK_SIZE 0x2000
...
...
security_lite/huks/liteos_m_adapter/hks_bn_exp_mod_test.c
浏览文件 @
53961ac1
...
...
@@ -28,6 +28,7 @@
#define TEST_TASK_STACK_SIZE 0x2000
#define WAIT_TO_TEST_DONE 4
#include <unistd.h>
static
osPriority_t
g_setPriority
;
/*
...
...
security_lite/huks/liteos_m_adapter/hks_cipher_test.c
浏览文件 @
53961ac1
...
...
@@ -24,6 +24,7 @@
#include "cmsis_os2.h"
#include "ohos_types.h"
#include <unistd.h>
#define TEST_INDEX_0 0
#define TEST_INDEX_1 1
#define TEST_INDEX_2 2
...
...
security_lite/huks/liteos_m_adapter/hks_delete_test.c
浏览文件 @
53961ac1
...
...
@@ -27,6 +27,7 @@
#include "cmsis_os2.h"
#include "ohos_types.h"
#include <unistd.h>
#define TEST_TASK_STACK_SIZE 0x2000
#define WAIT_TO_TEST_DONE 4
...
...
security_lite/huks/liteos_m_adapter/hks_derive_test.c
浏览文件 @
53961ac1
...
...
@@ -26,6 +26,7 @@
#include "cmsis_os2.h"
#include "ohos_types.h"
#include <unistd.h>
#define DEFAULT_DERIVE_SIZE 32
#define DEFAULT_INFO_SIZE 55
#define DEFAULT_SALT_SIZE 16
...
...
@@ -180,7 +181,7 @@ static int32_t BaseTestDerive(uint32_t index)
ret
=
GenerateLocalRandomKey
(
&
keyAlias
,
&
g_testDeriveParams
[
index
].
localKeyParams
);
}
else
{
if
(
g_testDeriveParams
[
index
].
keyAliasParams
.
blobExist
)
{
ret
=
GenerateKey
(
&
keyAlias
,
&
g_testDeriveParams
[
index
].
keyAliasParams
,
ret
=
Huks
GenerateKey
(
&
keyAlias
,
&
g_testDeriveParams
[
index
].
keyAliasParams
,
&
g_testDeriveParams
[
index
].
genKeyParamSetParams
,
NULL
);
}
else
{
ret
=
TestConstuctBlob
(
&
keyAlias
,
...
...
security_lite/huks/liteos_m_adapter/hks_exist_test.c
浏览文件 @
53961ac1
...
...
@@ -27,6 +27,7 @@
#include "cmsis_os2.h"
#include "ohos_types.h"
#include <unistd.h>
#define TEST_TASK_STACK_SIZE 0x2000
#define WAIT_TO_TEST_DONE 4
...
...
security_lite/huks/liteos_m_adapter/hks_generate_key_test.c
浏览文件 @
53961ac1
...
...
@@ -27,6 +27,7 @@
#include "cmsis_os2.h"
#include "ohos_types.h"
#include <unistd.h>
#define DEFAULT_X25519_PARAM_SET_OUT 104
#define TEST_TASK_STACK_SIZE 0x2000
#define WAIT_TO_TEST_DONE 4
...
...
security_lite/huks/liteos_m_adapter/hks_generate_random_test.c
浏览文件 @
53961ac1
...
...
@@ -26,6 +26,7 @@
#include "cmsis_os2.h"
#include "ohos_types.h"
#include <unistd.h>
#define TEST_TASK_STACK_SIZE 0x2000
#define WAIT_TO_TEST_DONE 4
...
...
security_lite/huks/liteos_m_adapter/hks_hash_test.c
浏览文件 @
53961ac1
...
...
@@ -28,6 +28,7 @@
#include "cmsis_os2.h"
#include "ohos_types.h"
#include <unistd.h>
#define DEFAULT_SRC_DATA_SIZE 200
#define DIGEST_SHA256_HASH_SIZE 32
#define TEST_TASK_STACK_SIZE 0x2000
...
...
security_lite/huks/liteos_m_adapter/hks_mac_test.c
浏览文件 @
53961ac1
...
...
@@ -26,6 +26,7 @@
#include "cmsis_os2.h"
#include "ohos_types.h"
#include <unistd.h>
#define HKS_TEST_MAC_REE_KEY_SIZE_32 32
#define HKS_DEFAULT_MAC_SRCDATA_SIZE 253
#define HKS_DEFAULT_MAC_SHA256_SIZE 32
...
...
security_lite/huks/liteos_m_adapter/hks_modify_key_test.c
浏览文件 @
53961ac1
...
...
@@ -30,6 +30,7 @@
#include "cmsis_os2.h"
#include "ohos_types.h"
#include <unistd.h>
#define DEFAULT_AES_CIPHER_PLAIN_SIZE 1000
#define AES_DEFAULT_GCM_NONCE_LENGTH 12
#define AES_DEFAULT_AAD_LEN 4
...
...
@@ -291,7 +292,7 @@ int32_t BaseTestCipherProcess(const struct HksBlob *keyAlias, uint32_t index)
}
/* 3. decrypt */
struct
CipherDecryptStructure
testDecryptStruct
=
{
keyAlias
,
&
g_testCipherParams
[
index
],
cipherData
,
(
struct
HksBlob
*
)(
keyAlias
)
,
&
g_testCipherParams
[
index
],
cipherData
,
&
decryptedData
,
ivData
,
nonceData
,
aadData
,
1
};
ret
=
DecryptCipher
(
&
testDecryptStruct
);
...
...
@@ -330,6 +331,7 @@ int32_t __attribute__((weak)) HksStoreKeyBlob(const struct HksBlob *processName,
(
void
)
keyAlias
;
(
void
)
storageType
;
(
void
)
keyBlob
;
return
HKS_SUCCESS
;
}
static
void
ExecHksModifyKeyTest001
(
void
const
*
argument
)
...
...
security_lite/huks/liteos_m_adapter/hks_others_test.c
浏览文件 @
53961ac1
...
...
@@ -18,6 +18,7 @@
#include "hks_others_test.h"
#include <hctest.h>
#include <unistd.h>
#include "hks_api.h"
#include "hks_param.h"
...
...
@@ -101,7 +102,7 @@ static void ExcHksOthersTest003(void const *argument)
{
LiteTestPrint
(
"HksOthersTest003 Begin!
\n
"
);
int32_t
ret
=
HksAttestKey
(
NULL
,
NULL
,
NULL
);
TEST_ASSERT_TRUE
(
ret
==
HKS_ERROR_
API_
NOT_SUPPORTED
);
TEST_ASSERT_TRUE
(
ret
==
HKS_ERROR_NOT_SUPPORTED
);
LiteTestPrint
(
"HksOthersTest003 End!
\n
"
);
osThreadExit
();
}
...
...
@@ -110,7 +111,7 @@ static void ExcHksOthersTest004(void const *argument)
{
LiteTestPrint
(
"HksOthersTest004 Begin!
\n
"
);
int32_t
ret
=
HksGetCertificateChain
(
NULL
,
NULL
,
NULL
);
TEST_ASSERT_TRUE
(
ret
==
HKS_ERROR_
API_
NOT_SUPPORTED
);
TEST_ASSERT_TRUE
(
ret
==
HKS_ERROR_NOT_SUPPORTED
);
LiteTestPrint
(
"HksOthersTest004 End!
\n
"
);
osThreadExit
();
}
...
...
@@ -119,7 +120,7 @@ static void ExcHksOthersTest005(void const *argument)
{
LiteTestPrint
(
"HksOthersTest005 Begin!
\n
"
);
int32_t
ret
=
HksGetCertificateChain
(
NULL
,
NULL
,
NULL
);
TEST_ASSERT_TRUE
(
ret
==
HKS_ERROR_
API_
NOT_SUPPORTED
);
TEST_ASSERT_TRUE
(
ret
==
HKS_ERROR_NOT_SUPPORTED
);
LiteTestPrint
(
"HksOthersTest005 End!
\n
"
);
osThreadExit
();
}
...
...
@@ -128,7 +129,7 @@ static void ExcHksOthersTest006(void const *argument)
{
LiteTestPrint
(
"HksOthersTest006 Begin!
\n
"
);
int32_t
ret
=
HksUnwrapKey
(
NULL
,
NULL
,
NULL
,
NULL
);
TEST_ASSERT_TRUE
(
ret
==
HKS_ERROR_
API_
NOT_SUPPORTED
);
TEST_ASSERT_TRUE
(
ret
==
HKS_ERROR_NOT_SUPPORTED
);
LiteTestPrint
(
"HksOthersTest006 End!
\n
"
);
osThreadExit
();
}
...
...
security_lite/huks/liteos_m_adapter/hks_safe_compare_key_test.c
浏览文件 @
53961ac1
...
...
@@ -16,9 +16,9 @@
#ifndef _CUT_AUTHENTICATE_
#include "hks_safe_compare_key_test.h"
#include "hks_mem.h"
#include <hctest.h>
#include <unistd.h>
#include "hks_api.h"
#include "hks_param.h"
#include "hks_test_api_performance.h"
...
...
@@ -61,7 +61,7 @@ static void ExecHksInitialize(void const *argument)
static
BOOL
HksSafeCompareKeyTestSetUp
()
{
LiteTestPrint
(
"setup
\n
"
);
LiteTestPrint
(
"setup
\n
"
);
osThreadId_t
id
;
osThreadAttr_t
attr
;
g_setPriority
=
osPriorityAboveNormal6
;
...
...
@@ -197,13 +197,13 @@ static int32_t CompareKeyData(struct HksBlob *keyAliasOne, struct HksBlob *keyAl
g_storageImageBuffer
.
size
=
sizeOne
;
int32_t
offset1
;
int
ret
=
GetKeyOffsetByKeyAlias
(
keyAliasOne
,
&
offset1
);
int
ret
=
GetKeyOffsetByKeyAlias
(
keyAliasOne
,
(
uint32_t
*
)(
&
offset1
)
);
TEST_ASSERT_TRUE
(
ret
==
0
);
struct
HksStoreKeyInfo
*
keyInfo1
=
(
struct
HksStoreKeyInfo
*
)(
g_storageImageBuffer
.
data
+
offset1
);
int32_t
offset2
;
ret
=
GetKeyOffsetByKeyAlias
(
keyAliasTwo
,
&
offset2
);
ret
=
GetKeyOffsetByKeyAlias
(
keyAliasTwo
,
(
uint32_t
*
)(
&
offset2
)
);
TEST_ASSERT_TRUE
(
ret
==
0
);
struct
HksStoreKeyInfo
*
keyInfo2
=
(
struct
HksStoreKeyInfo
*
)(
g_storageImageBuffer
.
data
+
offset2
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录