code_signature组件自适应加载

Signed-off-by: limerence <shituanhui@huawei.com>
This commit is contained in:
limerence 2023-11-27 13:02:33 +08:00
parent 8261c550dd
commit f2b356b6b9
2 changed files with 10 additions and 1 deletions

View File

@ -142,7 +142,6 @@ if (!defined(ohos_lite)) {
"access_token:libtoken_setproc",
"access_token:libtokenid_sdk",
"c_utils:utils",
"code_signature:libcode_sign_attr_utils",
"config_policy:configpolicy_util",
"hilog:libhilog",
"init:libbegetutil",
@ -157,6 +156,12 @@ if (!defined(ohos_lite)) {
[ "security_component_manager:libsecurity_component_enhance_sdk" ]
}
if (!defined(global_parts_info) ||
defined(global_parts_info.security_code_signature)) {
defines += [ "CODE_SIGNATURE_ENABLE" ]
external_deps += [ "code_signature:libcode_sign_attr_utils" ]
}
if (build_selinux) {
external_deps += [ "selinux_adapter:libhap_restorecon" ]
}

View File

@ -36,7 +36,9 @@
#include "limits.h"
#include "string.h"
#include "init_param.h"
#ifdef CODE_SIGNATURE_ENABLE
#include "code_sign_attr_utils.h"
#endif
#define DEVICE_NULL_STR "/dev/null"
@ -199,6 +201,7 @@ static void ClearEnvironment(AppSpawnContent *content, AppSpawnClient *client)
int SetXpmConfig(struct AppSpawnContent_ *content, AppSpawnClient *client)
{
#ifdef CODE_SIGNATURE_ENABLE
int ret = InitXpmRegion();
APPSPAWN_CHECK(ret == 0, return ret, "init xpm region failed: %{public}d", ret);
@ -211,6 +214,7 @@ int SetXpmConfig(struct AppSpawnContent_ *content, AppSpawnClient *client)
ret = SetXpmOwnerId(PROCESS_OWNERID_APP, appProperty->property.ownerId);
}
APPSPAWN_CHECK(ret == 0, return ret, "set xpm region failed: %{public}d", ret);
#endif
return 0;
}