mirror of
https://gitee.com/openharmony/security_huks
synced 2024-11-30 10:21:22 +00:00
修复容灾备份编译问题
Signed-off-by: tangboyi <tangboyi1@huawei.com> Change-Id: I022df2d242af06039a0a164115561516e447636a Signed-off-by: tangboyi <tangboyi1@huawei.com>
This commit is contained in:
parent
bf4fa2cd54
commit
66e90f2e93
@ -279,7 +279,11 @@ int32_t HksManageStoreKeyBlob(const struct HksProcessInfo *processInfo, const st
|
||||
{
|
||||
(void)processInfo;
|
||||
(void)paramSet;
|
||||
struct HksStoreFileInfo fileInfo = { 0 };
|
||||
#ifdef SUPPORT_STORAGE_BACKUP
|
||||
struct HksStoreFileInfo fileInfo = { { 0 }, { 0 } };
|
||||
#else
|
||||
struct HksStoreFileInfo fileInfo = { { 0 } };
|
||||
#endif
|
||||
struct HksStoreMaterial material = { DE_PATH, 0, 0, 0, 0 };
|
||||
int32_t ret;
|
||||
do {
|
||||
@ -307,7 +311,11 @@ int32_t HksManageStoreDeleteKeyBlob(const struct HksProcessInfo *processInfo, co
|
||||
{
|
||||
(void)processInfo;
|
||||
(void)paramSet;
|
||||
struct HksStoreFileInfo fileInfo = { 0 };
|
||||
#ifdef SUPPORT_STORAGE_BACKUP
|
||||
struct HksStoreFileInfo fileInfo = { { 0 }, { 0 } };
|
||||
#else
|
||||
struct HksStoreFileInfo fileInfo = { { 0 } };
|
||||
#endif
|
||||
struct HksStoreMaterial material = { DE_PATH, 0, 0, 0, 0 };
|
||||
int32_t ret;
|
||||
do {
|
||||
@ -335,7 +343,11 @@ int32_t HksManageStoreIsKeyBlobExist(const struct HksProcessInfo *processInfo, c
|
||||
{
|
||||
(void)processInfo;
|
||||
(void)paramSet;
|
||||
struct HksStoreFileInfo fileInfo = { 0 };
|
||||
#ifdef SUPPORT_STORAGE_BACKUP
|
||||
struct HksStoreFileInfo fileInfo = { { 0 }, { 0 } };
|
||||
#else
|
||||
struct HksStoreFileInfo fileInfo = { { 0 } };
|
||||
#endif
|
||||
struct HksStoreMaterial material = { DE_PATH, 0, 0, 0, 0 };
|
||||
int32_t ret;
|
||||
do {
|
||||
@ -363,7 +375,11 @@ int32_t HksManageStoreGetKeyBlob(const struct HksProcessInfo *processInfo, const
|
||||
{
|
||||
(void)processInfo;
|
||||
(void)paramSet;
|
||||
struct HksStoreFileInfo fileInfo = { 0 };
|
||||
#ifdef SUPPORT_STORAGE_BACKUP
|
||||
struct HksStoreFileInfo fileInfo = { { 0 }, { 0 } };
|
||||
#else
|
||||
struct HksStoreFileInfo fileInfo = { { 0 } };
|
||||
#endif
|
||||
struct HksStoreMaterial material = { DE_PATH, 0, 0, 0, 0 };
|
||||
int32_t ret;
|
||||
do {
|
||||
@ -404,7 +420,11 @@ int32_t HksManageStoreGetKeyBlobSize(const struct HksProcessInfo *processInfo, c
|
||||
{
|
||||
(void)processInfo;
|
||||
(void)paramSet;
|
||||
struct HksStoreFileInfo fileInfo = { 0 };
|
||||
#ifdef SUPPORT_STORAGE_BACKUP
|
||||
struct HksStoreFileInfo fileInfo = { { 0 }, { 0 } };
|
||||
#else
|
||||
struct HksStoreFileInfo fileInfo = { { 0 } };
|
||||
#endif
|
||||
struct HksStoreMaterial material = { DE_PATH, 0, 0, 0, 0 };
|
||||
int32_t ret;
|
||||
do {
|
||||
@ -437,7 +457,11 @@ int32_t HksManageStoreGetKeyBlobSize(const struct HksProcessInfo *processInfo, c
|
||||
int32_t HksManageGetKeyAliasByProcessName(const struct HksProcessInfo *processInfo, const struct HksParamSet *paramSet,
|
||||
struct HksKeyInfo *keyInfoList, uint32_t *listCount)
|
||||
{
|
||||
struct HksStoreFileInfo fileInfo = { 0 };
|
||||
#ifdef SUPPORT_STORAGE_BACKUP
|
||||
struct HksStoreFileInfo fileInfo = { { 0 }, { 0 } };
|
||||
#else
|
||||
struct HksStoreFileInfo fileInfo = { { 0 } };
|
||||
#endif
|
||||
struct HksStoreMaterial material = { DE_PATH, 0, 0, 0, 0 };
|
||||
int32_t ret;
|
||||
do {
|
||||
@ -461,7 +485,11 @@ int32_t HksManageGetKeyCountByProcessName(const struct HksProcessInfo *processIn
|
||||
{
|
||||
(void)processInfo;
|
||||
(void)paramSet;
|
||||
struct HksStoreFileInfo fileInfo = { 0 };
|
||||
#ifdef SUPPORT_STORAGE_BACKUP
|
||||
struct HksStoreFileInfo fileInfo = { { 0 }, { 0 } };
|
||||
#else
|
||||
struct HksStoreFileInfo fileInfo = { { 0 } };
|
||||
#endif
|
||||
struct HksStoreMaterial material = { DE_PATH, 0, 0, 0, 0 };
|
||||
int32_t ret;
|
||||
do {
|
||||
@ -488,7 +516,11 @@ int32_t HksManageListAliasesByProcessName(const struct HksProcessInfo *processIn
|
||||
struct HksKeyAliasSet **outData)
|
||||
{
|
||||
#ifdef L2_STANDARD
|
||||
struct HksStoreFileInfo fileInfo = { 0 };
|
||||
#ifdef SUPPORT_STORAGE_BACKUP
|
||||
struct HksStoreFileInfo fileInfo = { { 0 }, { 0 } };
|
||||
#else
|
||||
struct HksStoreFileInfo fileInfo = { { 0 } };
|
||||
#endif
|
||||
struct HksStoreMaterial material = { DE_PATH, 0, 0, 0, 0 };
|
||||
int32_t ret;
|
||||
do {
|
||||
|
@ -495,16 +495,14 @@ static int32_t ConstructPath(const struct HksStoreMaterial *material, const char
|
||||
case CE_PATH:
|
||||
ret = CheckUserPathExist(CE_PATH, material->userIdPath);
|
||||
HKS_IF_NOT_SUCC_LOGE_RETURN(ret, ret, "check user path exist failed.")
|
||||
offset = sprintf_s(fileInfoPath->path, HKS_MAX_DIRENT_FILE_LEN, "%s/%s/%s/%s/%s",
|
||||
HKS_CE_ROOT_PATH, material->userIdPath, ceOrEceDataPath, material->uidPath,
|
||||
material->storageTypePath);
|
||||
offset = sprintf_s(fileInfoPath->path, HKS_MAX_DIRENT_FILE_LEN, "%s/%s/%s/%s/%s", HKS_CE_ROOT_PATH,
|
||||
material->userIdPath, ceOrEceDataPath, material->uidPath, material->storageTypePath);
|
||||
break;
|
||||
case ECE_PATH:
|
||||
ret = CheckUserPathExist(ECE_PATH, material->userIdPath);
|
||||
HKS_IF_NOT_SUCC_LOGE_RETURN(ret, ret, "check user path exist failed.")
|
||||
offset = sprintf_s(fileInfoPath->path, HKS_MAX_DIRENT_FILE_LEN, "%s/%s/%s/%s/%s",
|
||||
HKS_ECE_ROOT_PATH, material->userIdPath, ceOrEceDataPath, material->uidPath,
|
||||
material->storageTypePath);
|
||||
offset = sprintf_s(fileInfoPath->path, HKS_MAX_DIRENT_FILE_LEN, "%s/%s/%s/%s/%s", HKS_ECE_ROOT_PATH,
|
||||
material->userIdPath, ceOrEceDataPath, material->uidPath, material->storageTypePath);
|
||||
break;
|
||||
#ifdef HUKS_ENABLE_SKIP_UPGRADE_KEY_STORAGE_SECURE_LEVEL
|
||||
case TMP_PATH:
|
||||
|
@ -81,7 +81,11 @@ static int32_t ConstructNewFilePath(const char *alias, const struct HksUpgradeFi
|
||||
char **newPath)
|
||||
{
|
||||
int32_t ret;
|
||||
struct HksStoreFileInfo fileInfo = { 0 };
|
||||
#ifdef SUPPORT_STORAGE_BACKUP
|
||||
struct HksStoreFileInfo fileInfo = { { 0 }, { 0 } };
|
||||
#else
|
||||
struct HksStoreFileInfo fileInfo = { { 0 } };
|
||||
#endif
|
||||
struct HksStoreMaterial storeMaterial = { DE_PATH, 0 };
|
||||
struct HksBlob aliasBlob = { .data = (uint8_t *)alias, .size = strlen(alias) };
|
||||
do {
|
||||
|
@ -167,7 +167,8 @@ HWTEST_F(HksModifyKeyTest, HksModifyKeyTest001, TestSize.Level0)
|
||||
};
|
||||
ret = DecryptCipher(&testDecryptStruct);
|
||||
|
||||
EXPECT_TRUE(ret != g_testCipherParams[index].expectResult);
|
||||
//because of storage backup
|
||||
EXPECT_TRUE(ret == g_testCipherParams[index].expectResult);
|
||||
(void)HksDeleteKey(&keyAlias, NULL);
|
||||
TestFreeBlob(&plainData);
|
||||
TestFreeBlob(&cipherData);
|
||||
@ -175,6 +176,6 @@ HWTEST_F(HksModifyKeyTest, HksModifyKeyTest001, TestSize.Level0)
|
||||
TestFreeBlob(&ivData);
|
||||
TestFreeBlob(&nonceData);
|
||||
TestFreeBlob(&aadData);
|
||||
ASSERT_TRUE(ret != 0);
|
||||
ASSERT_TRUE(ret == 0);
|
||||
}
|
||||
}
|
||||
|
@ -82,7 +82,11 @@ HWTEST_F(HksStorageUtilTest, HksStorageUtilTest001, TestSize.Level0)
|
||||
material.storageTypePath = const_cast<char *>("key");
|
||||
material.uidPath = const_cast<char *>("123");
|
||||
material.userIdPath = const_cast<char *>("999");
|
||||
struct HksStoreFileInfo fileInfo = { 0 };
|
||||
#ifdef SUPPORT_STORAGE_BACKUP
|
||||
struct HksStoreFileInfo fileInfo = { { 0 }, { 0 } };
|
||||
#else
|
||||
struct HksStoreFileInfo fileInfo = { { 0 } };
|
||||
#endif
|
||||
int32_t ret = HksGetFileInfo(&material, &fileInfo);
|
||||
ASSERT_EQ(HKS_SUCCESS, ret);
|
||||
ASSERT_EQ(strlen(fileInfo.mainPath.fileName), strlen(material.keyAliasPath));
|
||||
@ -107,7 +111,11 @@ HWTEST_F(HksStorageUtilTest, HksStorageUtilTest002, TestSize.Level0)
|
||||
material.storageTypePath = const_cast<char *>("key");
|
||||
material.uidPath = const_cast<char *>("222");
|
||||
material.userIdPath = const_cast<char *>("");
|
||||
struct HksStoreFileInfo fileInfo = { 0 };
|
||||
#ifdef SUPPORT_STORAGE_BACKUP
|
||||
struct HksStoreFileInfo fileInfo = { { 0 }, { 0 } };
|
||||
#else
|
||||
struct HksStoreFileInfo fileInfo = { { 0 } };
|
||||
#endif
|
||||
int32_t ret = HksGetFileInfo(&material, &fileInfo);
|
||||
ASSERT_EQ(HKS_SUCCESS, ret);
|
||||
ASSERT_EQ(strlen(fileInfo.mainPath.fileName), strlen(material.keyAliasPath));
|
||||
@ -132,7 +140,11 @@ HWTEST_F(HksStorageUtilTest, HksStorageUtilTest003, TestSize.Level0)
|
||||
material.storageTypePath = const_cast<char *>("key");
|
||||
material.uidPath = const_cast<char *>("333");
|
||||
material.userIdPath = const_cast<char *>("100");
|
||||
struct HksStoreFileInfo fileInfo = { 0 };
|
||||
#ifdef SUPPORT_STORAGE_BACKUP
|
||||
struct HksStoreFileInfo fileInfo = { { 0 }, { 0 } };
|
||||
#else
|
||||
struct HksStoreFileInfo fileInfo = { { 0 } };
|
||||
#endif
|
||||
int32_t ret = HksGetFileInfo(&material, &fileInfo);
|
||||
ASSERT_EQ(HKS_SUCCESS, ret);
|
||||
ASSERT_EQ(strlen(fileInfo.mainPath.fileName), strlen(material.keyAliasPath));
|
||||
@ -157,7 +169,11 @@ HWTEST_F(HksStorageUtilTest, HksStorageUtilTest004, TestSize.Level0)
|
||||
material.storageTypePath = const_cast<char *>("key");
|
||||
material.uidPath = const_cast<char *>("444");
|
||||
material.userIdPath = const_cast<char *>("100");
|
||||
struct HksStoreFileInfo fileInfo = { 0 };
|
||||
#ifdef SUPPORT_STORAGE_BACKUP
|
||||
struct HksStoreFileInfo fileInfo = { { 0 }, { 0 } };
|
||||
#else
|
||||
struct HksStoreFileInfo fileInfo = { { 0 } };
|
||||
#endif
|
||||
int32_t ret = HksGetFileInfo(&material, &fileInfo);
|
||||
ASSERT_EQ(HKS_SUCCESS, ret);
|
||||
ASSERT_EQ(strlen(fileInfo.mainPath.fileName), strlen(material.keyAliasPath));
|
||||
@ -183,7 +199,11 @@ HWTEST_F(HksStorageUtilTest, HksStorageUtilTest005, TestSize.Level0)
|
||||
material.storageTypePath = const_cast<char *>("key");
|
||||
material.uidPath = const_cast<char *>("555");
|
||||
material.userIdPath = const_cast<char *>("555");
|
||||
struct HksStoreFileInfo fileInfo = { 0 };
|
||||
#ifdef SUPPORT_STORAGE_BACKUP
|
||||
struct HksStoreFileInfo fileInfo = { { 0 }, { 0 } };
|
||||
#else
|
||||
struct HksStoreFileInfo fileInfo = { { 0 } };
|
||||
#endif
|
||||
int32_t ret = HksGetFileInfo(&material, &fileInfo);
|
||||
ASSERT_EQ(HKS_SUCCESS, ret);
|
||||
ASSERT_EQ(strlen(fileInfo.mainPath.fileName), strlen(material.keyAliasPath));
|
||||
@ -209,7 +229,11 @@ HWTEST_F(HksStorageUtilTest, HksStorageUtilTest006, TestSize.Level0)
|
||||
material.storageTypePath = const_cast<char *>("key");
|
||||
material.uidPath = const_cast<char *>("hks_client");
|
||||
material.userIdPath = const_cast<char *>("");
|
||||
struct HksStoreFileInfo fileInfo = { 0 };
|
||||
#ifdef SUPPORT_STORAGE_BACKUP
|
||||
struct HksStoreFileInfo fileInfo = { { 0 }, { 0 } };
|
||||
#else
|
||||
struct HksStoreFileInfo fileInfo = { { 0 } };
|
||||
#endif
|
||||
int32_t ret = HksGetFileInfo(&material, &fileInfo);
|
||||
ASSERT_EQ(HKS_SUCCESS, ret);
|
||||
ASSERT_EQ(strlen(fileInfo.mainPath.fileName), strlen(material.keyAliasPath));
|
||||
@ -234,7 +258,11 @@ HWTEST_F(HksStorageUtilTest, HksStorageUtilTest007, TestSize.Level0)
|
||||
material.storageTypePath = const_cast<char *>("key");
|
||||
material.uidPath = const_cast<char *>("hks_client");
|
||||
material.userIdPath = const_cast<char *>("0");
|
||||
struct HksStoreFileInfo fileInfo = { 0 };
|
||||
#ifdef SUPPORT_STORAGE_BACKUP
|
||||
struct HksStoreFileInfo fileInfo = { { 0 }, { 0 } };
|
||||
#else
|
||||
struct HksStoreFileInfo fileInfo = { { 0 } };
|
||||
#endif
|
||||
int32_t ret = HksGetFileInfo(&material, &fileInfo);
|
||||
ASSERT_EQ(HKS_SUCCESS, ret);
|
||||
ASSERT_EQ(strlen(fileInfo.mainPath.fileName), strlen(material.keyAliasPath));
|
||||
|
Loading…
Reference in New Issue
Block a user