删除无用依赖

Signed-off-by: cc_ggboy <chenweimin8@huawei.com>
This commit is contained in:
cc_ggboy 2024-07-24 11:34:56 +00:00
parent a4b7a958e2
commit 969a8eba81
15 changed files with 90 additions and 36 deletions

View File

@ -38,12 +38,10 @@
"ability_base",
"ability_runtime",
"access_token",
"ace_engine",
"asset",
"bundle_framework",
"common_event_service",
"c_utils",
"eventhandler",
"kv_store",
"hicollie",
"hilog",
@ -51,7 +49,6 @@
"hitrace",
"huks",
"init",
"i18n",
"ipc",
"napi",
"pin_auth",

View File

@ -159,7 +159,6 @@ ohos_moduletest("domain_account_frameworks_module_mock_test") {
"c_utils:utils",
"config_policy:configpolicy_util",
"hilog:libhilog",
"huks:libhukssdk",
"init:libbegetutil",
"ipc:ipc_single",
"mbedtls:mbedtls_shared",
@ -168,6 +167,10 @@ ohos_moduletest("domain_account_frameworks_module_mock_test") {
"samgr:samgr_proxy",
]
if (has_huks_part) {
external_deps += [ "huks:libhukssdk" ]
}
cflags_cc = []
if (has_user_auth_part) {
@ -243,7 +246,6 @@ ohos_moduletest("domain_account_client_mock_plugin_so_module_test") {
"c_utils:utils",
"config_policy:configpolicy_util",
"hilog:libhilog",
"huks:libhukssdk",
"init:libbegetutil",
"ipc:ipc_single",
"mbedtls:mbedtls_shared",
@ -252,6 +254,10 @@ ohos_moduletest("domain_account_client_mock_plugin_so_module_test") {
"samgr:samgr_proxy",
]
if (has_huks_part) {
external_deps += [ "huks:libhukssdk" ]
}
cflags_cc = []
if (has_user_auth_part) {

View File

@ -146,7 +146,6 @@ ohos_moduletest("AccountInnerSdkModuleMockTest") {
"c_utils:utils",
"config_policy:configpolicy_util",
"hilog:libhilog",
"huks:libhukssdk",
"init:libbegetutil",
"ipc:ipc_single",
"json:nlohmann_json_static",
@ -154,6 +153,9 @@ ohos_moduletest("AccountInnerSdkModuleMockTest") {
"safwk:system_ability_fwk",
"samgr:samgr_proxy",
]
if (has_huks_part) {
external_deps += [ "huks:libhukssdk" ]
}
cflags_cc = []
if (has_user_auth_part) {
cflags_cc += [ "-DHAS_USER_AUTH_PART" ]

View File

@ -161,13 +161,15 @@ ohos_moduletest("os_account_frameworks_module_mock_test") {
"c_utils:utils",
"config_policy:configpolicy_util",
"hilog:libhilog",
"huks:libhukssdk",
"init:libbegetutil",
"ipc:ipc_single",
"mbedtls:mbedtls_shared",
"safwk:system_ability_fwk",
"samgr:samgr_proxy",
]
if (has_huks_part) {
external_deps += [ "huks:libhukssdk" ]
}
cflags_cc = []
if (os_account_multiple_active_accounts) {
cflags_cc += [ "-DENABLE_MULTIPLE_ACTIVE_ACCOUNTS" ]
@ -255,13 +257,15 @@ ohos_moduletest("os_account_manager_no_bms_mock_test") {
"c_utils:utils",
"config_policy:configpolicy_util",
"hilog:libhilog",
"huks:libhukssdk",
"init:libbegetutil",
"ipc:ipc_single",
"mbedtls:mbedtls_shared",
"safwk:system_ability_fwk",
"samgr:samgr_proxy",
]
if (has_huks_part) {
external_deps += [ "huks:libhukssdk" ]
}
cflags_cc = []
if (has_user_auth_part) {
cflags_cc += [ "-DHAS_USER_AUTH_PART" ]

View File

@ -103,13 +103,6 @@ if (!defined(global_parts_info) ||
has_storage_service_part = false
}
if (!defined(global_parts_info) ||
defined(global_parts_info.arkui_ace_engine)) {
has_ace_engine_part = true
} else {
has_ace_engine_part = false
}
declare_args() {
os_account_multiple_active_accounts = false
}
@ -167,6 +160,12 @@ if (!defined(global_parts_info) || defined(global_parts_info.security_asset)) {
has_asset_part = false
}
if (!defined(global_parts_info) || defined(global_parts_info.security_huks)) {
has_huks_part = true
} else {
has_huks_part = false
}
if (!defined(global_parts_info) || defined(global_parts_info.theme_theme_mgr)) {
has_theme_mar_part = true
} else {

View File

@ -258,7 +258,6 @@ ohos_shared_library("accountmgr") {
"bundle_framework:appexecfwk_core",
"c_utils:utils",
"hilog:libhilog",
"huks:libhukssdk",
"init:libbegetutil",
"ipc:ipc_single",
"json:nlohmann_json_static",
@ -266,6 +265,10 @@ ohos_shared_library("accountmgr") {
"safwk:system_ability_fwk",
"samgr:samgr_proxy",
]
if (has_huks_part) {
external_deps += [ "huks:libhukssdk" ]
cflags_cc += [ "-DHAS_HUKS_PART" ]
}
if (ohos_indep_compiler_enable) {
external_deps += [

View File

@ -25,7 +25,9 @@
namespace OHOS {
namespace AccountSA {
#ifdef HAS_HUKS_PART
int32_t GenerateAccountInfoDigest(const std::string &inData, uint8_t* outData, uint32_t size);
#endif // HAS_HUKS_PART
using CheckNotifyEventCallbackFunc = std::function<bool(const std::string&, int32_t, uint32_t)>;
class FileWatcher {

View File

@ -20,9 +20,11 @@
#include <securec.h>
#include <thread>
#include "account_log_wrapper.h"
#ifdef HAS_HUKS_PART
#include "hks_api.h"
#include "hks_param.h"
#include "hks_type.h"
#endif // HAS_HUKS_PART
#include "os_account_constants.h"
#include "hitrace_adapter.h"
@ -31,6 +33,8 @@ namespace AccountSA {
namespace {
constexpr uint32_t FILE_WATCHER_LIMIT = 1024 * 100;
constexpr uint32_t BUF_COMMON_SIZE = 1024 * 100;
constexpr uint32_t ALG_COMMON_SIZE = 32;
#ifdef HAS_HUKS_PART
const struct HksParam g_genSignVerifyParams[] = {
{
.tag = HKS_TAG_ALGORITHM,
@ -49,14 +53,15 @@ const struct HksParam g_genSignVerifyParams[] = {
.uint32Param = HKS_AUTH_STORAGE_LEVEL_DE
}
};
constexpr uint32_t ALG_COMMON_SIZE = 32;
constexpr int32_t TIMES = 4;
constexpr int32_t MAX_UPDATE_SIZE = 256 * 100;
constexpr int32_t MAX_OUTDATA_SIZE = MAX_UPDATE_SIZE * TIMES;
constexpr char ACCOUNT_KEY_ALIAS[] = "os_account_info_encryption_key";
const HksBlob g_keyAlias = { (uint32_t)strlen(ACCOUNT_KEY_ALIAS), (uint8_t *)ACCOUNT_KEY_ALIAS };
#endif // HAS_HUKS_PART
}
#ifdef HAS_HUKS_PART
static int32_t InitParamSet(struct HksParamSet **paramSet, const struct HksParam *params, uint32_t paramCount)
{
int32_t ret = HksInitParamSet(paramSet);
@ -215,10 +220,13 @@ int32_t GenerateAccountInfoDigest(const std::string &inData, uint8_t* outData, u
free(buffer);
return ret;
}
#endif // HAS_HUKS_PART
AccountFileWatcherMgr::AccountFileWatcherMgr()
{
#ifdef HAS_HUKS_PART
InitEncryptionKey();
#endif // HAS_HUKS_PART
inotifyFd_ = inotify_init();
if (inotifyFd_ < 0) {
ACCOUNT_LOGE("failed to init notify, errCode:%{public}d", errno);
@ -369,9 +377,11 @@ ErrCode AccountFileWatcherMgr::GenerateAccountInfoDigestStr(
const std::string &userInfoPath, const std::string &accountInfoStr, std::string &digestStr)
{
uint8_t digestOutData[ALG_COMMON_SIZE];
#ifdef HAS_HUKS_PART
StartTraceAdapter("GenerateAccountInfoDigest Using Huks");
GenerateAccountInfoDigest(accountInfoStr, digestOutData, ALG_COMMON_SIZE);
FinishTraceAdapter();
#endif // HAS_HUKS_PART
std::string accountInfoDigest;
std::lock_guard<std::mutex> lock(accountInfoDigestFileLock_);

View File

@ -94,12 +94,14 @@ bool OhosAccountDataDeal::DealWithFileModifyEvent(const std::string &fileName, c
}
uint8_t localDigestData[ALG_COMMON_SIZE] = {0};
accountFileWatcherMgr_.GetAccountInfoDigestFromFile(fileName, localDigestData, ALG_COMMON_SIZE);
#ifdef HAS_HUKS_PART
uint8_t newDigestData[ALG_COMMON_SIZE] = {0};
GenerateAccountInfoDigest(fileInfoStr, newDigestData, ALG_COMMON_SIZE);
if (memcmp(localDigestData, newDigestData, ALG_COMMON_SIZE) == 0) {
ACCOUNT_LOGD("No need to recover local file data.");
return true;
}
#endif // HAS_HUKS_PART
ReportOsAccountDataTampered(id, fileName, "DISTRIBUTED_ACCOUT_INFO");
return true;
}

View File

@ -169,6 +169,7 @@ bool OsAccountControlFileManager::DealWithFileModifyEvent(const std::string &fil
}
uint8_t localDigestData[ALG_COMMON_SIZE] = {0};
accountFileWatcherMgr_.GetAccountInfoDigestFromFile(fileName, localDigestData, ALG_COMMON_SIZE);
#ifdef HAS_HUKS_PART
uint8_t newDigestData[ALG_COMMON_SIZE] = {0};
GenerateAccountInfoDigest(fileInfoStr, newDigestData, ALG_COMMON_SIZE);
@ -176,6 +177,7 @@ bool OsAccountControlFileManager::DealWithFileModifyEvent(const std::string &fil
ACCOUNT_LOGD("No need to recover local file data.");
return true;
}
#endif // HAS_HUKS_PART
ReportOsAccountDataTampered(id, fileName, "OS_ACCOUNT_INFO");
ACCOUNT_LOGW("local file data has been changed");
return RecoverAccountData(fileName, id);
@ -382,12 +384,14 @@ void OsAccountControlFileManager::RecoverAccountInfoDigestJsonFile()
{
std::string listInfoStr;
accountFileOperator_->GetFileContentByPath(Constants::ACCOUNT_LIST_FILE_JSON_PATH, listInfoStr);
#ifdef HAS_HUKS_PART
uint8_t digestOutData[ALG_COMMON_SIZE] = {0};
GenerateAccountInfoDigest(listInfoStr, digestOutData, ALG_COMMON_SIZE);
Json digestJsonData = Json {
{Constants::ACCOUNT_LIST_FILE_JSON_PATH, digestOutData},
};
accountFileOperator_->InputFileByPathAndContent(Constants::ACCOUNT_INFO_DIGEST_FILE_PATH, digestJsonData.dump());
#endif // HAS_HUKS_PART
return;
}

View File

@ -118,7 +118,6 @@ ohos_moduletest("app_account_authorization_extension_ability_test") {
"ability_runtime:abilitykit_native",
"ability_runtime:app_context",
"ability_runtime:runtime",
"ace_engine:ace_uicontent",
"c_utils:utils",
"hilog:libhilog",
"ipc:ipc_single",
@ -229,8 +228,10 @@ ohos_moduletest("app_account_manager_service_associated_data_test") {
external_deps += [
"ability_runtime:wantagent_innerkits",
"access_token:libtokenid_sdk",
"huks:libhukssdk",
]
if (has_huks_part) {
external_deps += [ "huks:libhukssdk" ]
}
if (has_storage_service_part) {
external_deps += [ "storage_service:storage_manager_sa_proxy" ]
@ -480,8 +481,10 @@ ohos_moduletest("app_account_control_manager_module_test") {
external_deps += [
"ability_runtime:wantagent_innerkits",
"access_token:libtokenid_sdk",
"huks:libhukssdk",
]
if (has_huks_part) {
external_deps += [ "huks:libhukssdk" ]
}
if (has_storage_service_part) {
external_deps += [ "storage_service:storage_manager_sa_proxy" ]
@ -642,11 +645,13 @@ ohos_moduletest("app_account_authenticator_session_module_test") {
"hicollie:libhicollie",
"hisysevent:libhisysevent",
"hitrace:hitrace_meter",
"huks:libhukssdk",
"selinux_adapter:librestorecon",
"storage_service:storage_manager_sa_proxy",
"user_auth_framework:userauth_client",
]
if (has_huks_part) {
external_deps += [ "huks:libhukssdk" ]
}
if (security_guard_enabled) {
external_deps += [
@ -844,8 +849,10 @@ ohos_moduletest("at_not_mock_app_account_manager_service_module_test") {
external_deps += [
"ability_runtime:wantagent_innerkits",
"access_token:libtokenid_sdk",
"huks:libhukssdk",
]
if (has_huks_part) {
external_deps += [ "huks:libhukssdk" ]
}
if (has_storage_service_part) {
external_deps += [ "storage_service:storage_manager_sa_proxy" ]
@ -1147,11 +1154,13 @@ ohos_moduletest("app_account_authenticator_session_manager_module_test") {
"hicollie:libhicollie",
"hisysevent:libhisysevent",
"hitrace:hitrace_meter",
"huks:libhukssdk",
"selinux_adapter:librestorecon",
"storage_service:storage_manager_sa_proxy",
"user_auth_framework:userauth_client",
]
if (has_huks_part) {
external_deps += [ "huks:libhukssdk" ]
}
if (security_guard_enabled) {
external_deps += [

View File

@ -159,13 +159,16 @@ ohos_moduletest("os_account_manager_service_module_test") {
"hicollie:libhicollie",
"hisysevent:libhisysevent",
"hitrace:hitrace_meter",
"huks:libhukssdk",
"init:libbegetutil",
"selinux_adapter:librestorecon",
"storage_service:storage_manager_sa_proxy",
"user_auth_framework:userauth_client",
]
if (has_huks_part) {
external_deps += [ "huks:libhukssdk" ]
}
use_exceptions = true
part_name = "os_account"
@ -341,13 +344,16 @@ ohos_moduletest("os_account_manager_service_subscribe_module_test") {
"hicollie:libhicollie",
"hisysevent:libhisysevent",
"hitrace:hitrace_meter",
"huks:libhukssdk",
"init:libbegetutil",
"selinux_adapter:librestorecon",
"storage_service:storage_manager_sa_proxy",
"user_auth_framework:userauth_client",
]
if (has_huks_part) {
external_deps += [ "huks:libhukssdk" ]
}
use_exceptions = true
cflags_cc = []

View File

@ -236,11 +236,13 @@ ohos_unittest("account_iam_manager_test") {
group("unittest") {
testonly = true
deps = [
":account_iam_callback_test",
":account_iam_manager_test",
":account_iam_service_test",
":account_iam_stub_test",
]
deps = []
if (!use_libfuzzer) {
deps += [
":account_iam_callback_test",
":account_iam_manager_test",
":account_iam_service_test",
":account_iam_stub_test",
]
}
}

View File

@ -444,7 +444,6 @@ ohos_unittest("OsAccountInnerAccmgrBundleAdapterMockTest") {
"c_utils:utils",
"config_policy:configpolicy_util",
"hilog:libhilog",
"huks:libhukssdk",
"init:libbegetutil",
"ipc:ipc_single",
"kv_store:distributeddata_inner",
@ -452,6 +451,9 @@ ohos_unittest("OsAccountInnerAccmgrBundleAdapterMockTest") {
"safwk:system_ability_fwk",
"samgr:samgr_proxy",
]
if (has_huks_part) {
external_deps += [ "huks:libhukssdk" ]
}
cflags_cc = []
if (has_user_auth_part) {
cflags_cc += [ "-DHAS_USER_AUTH_PART" ]
@ -543,13 +545,15 @@ ohos_unittest("OsAccountEventManagerMultipleThreadTest") {
"c_utils:utils",
"config_policy:configpolicy_util",
"hilog:libhilog",
"huks:libhukssdk",
"init:libbegetutil",
"ipc:ipc_single",
"mbedtls:mbedtls_shared",
"safwk:system_ability_fwk",
"samgr:samgr_proxy",
]
if (has_huks_part) {
external_deps += [ "huks:libhukssdk" ]
}
cflags_cc = []
if (has_user_auth_part) {
cflags_cc += [ "-DHAS_USER_AUTH_PART" ]

View File

@ -144,12 +144,14 @@ ohos_moduletest("account_command_create_module_mock_test") {
"c_utils:utils",
"config_policy:configpolicy_util",
"hilog:libhilog",
"huks:libhukssdk",
"ipc:ipc_single",
"mbedtls:mbedtls_shared",
"safwk:system_ability_fwk",
"samgr:samgr_proxy",
]
if (has_huks_part) {
external_deps += [ "huks:libhukssdk" ]
}
cflags_cc = []
if (has_user_auth_part) {
cflags_cc += [ "-DHAS_USER_AUTH_PART" ]
@ -244,12 +246,14 @@ ohos_moduletest("account_command_delete_module_mock_test") {
"c_utils:utils",
"config_policy:configpolicy_util",
"hilog:libhilog",
"huks:libhukssdk",
"ipc:ipc_single",
"mbedtls:mbedtls_shared",
"safwk:system_ability_fwk",
"samgr:samgr_proxy",
]
if (has_huks_part) {
external_deps += [ "huks:libhukssdk" ]
}
cflags_cc = []
if (has_user_auth_part) {
cflags_cc += [ "-DHAS_USER_AUTH_PART" ]