1fc0b0055Sopenharmony_ci# Copyright (c) 2024 Huawei Device Co., Ltd.
2fc0b0055Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License");
3fc0b0055Sopenharmony_ci# you may not use this file except in compliance with the License.
4fc0b0055Sopenharmony_ci# You may obtain a copy of the License at
5fc0b0055Sopenharmony_ci#
6fc0b0055Sopenharmony_ci#     http://www.apache.org/licenses/LICENSE-2.0
7fc0b0055Sopenharmony_ci#
8fc0b0055Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software
9fc0b0055Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS,
10fc0b0055Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11fc0b0055Sopenharmony_ci# See the License for the specific language governing permissions and
12fc0b0055Sopenharmony_ci# limitations under the License.
13fc0b0055Sopenharmony_ci
14fc0b0055Sopenharmony_ciimport("//build/ohos.gni")
15fc0b0055Sopenharmony_ciimport("../../access_token.gni")
16fc0b0055Sopenharmony_ci
17fc0b0055Sopenharmony_ciohos_prebuilt_etc("el5_filekey_manager_cfg") {
18fc0b0055Sopenharmony_ci  source = "el5_filekey_manager.cfg"
19fc0b0055Sopenharmony_ci  relative_install_dir = "init"
20fc0b0055Sopenharmony_ci  subsystem_name = "security"
21fc0b0055Sopenharmony_ci  part_name = "access_token"
22fc0b0055Sopenharmony_ci}
23fc0b0055Sopenharmony_ci
24fc0b0055Sopenharmony_cigroup("el5filekeymanager") {
25fc0b0055Sopenharmony_ci  if (is_standard_system && ability_base_enable == true) {
26fc0b0055Sopenharmony_ci    deps = [
27fc0b0055Sopenharmony_ci      "${access_token_path}/services/el5filekeymanager:el5_filekey_manager_service",
28fc0b0055Sopenharmony_ci      "${access_token_path}/services/el5filekeymanager/sa_profile:efm_sa_profile",
29fc0b0055Sopenharmony_ci    ]
30fc0b0055Sopenharmony_ci  }
31fc0b0055Sopenharmony_ci}
32fc0b0055Sopenharmony_ci
33fc0b0055Sopenharmony_ciif (is_standard_system && ability_base_enable == true) {
34fc0b0055Sopenharmony_ci  ohos_shared_library("el5_filekey_manager_service") {
35fc0b0055Sopenharmony_ci    sanitize = {
36fc0b0055Sopenharmony_ci      integer_overflow = true
37fc0b0055Sopenharmony_ci      ubsan = true
38fc0b0055Sopenharmony_ci      boundary_sanitize = true
39fc0b0055Sopenharmony_ci      cfi = true
40fc0b0055Sopenharmony_ci      cfi_cross_dso = true
41fc0b0055Sopenharmony_ci      debug = false
42fc0b0055Sopenharmony_ci    }
43fc0b0055Sopenharmony_ci    branch_protector_ret = "pac_ret"
44fc0b0055Sopenharmony_ci
45fc0b0055Sopenharmony_ci    shlib_type = "sa"
46fc0b0055Sopenharmony_ci    cflags = []
47fc0b0055Sopenharmony_ci    cflags_cc = []
48fc0b0055Sopenharmony_ci    defines = []
49fc0b0055Sopenharmony_ci    sources = [
50fc0b0055Sopenharmony_ci      "src/el5_filekey_callback_proxy.cpp",
51fc0b0055Sopenharmony_ci      "src/el5_filekey_manager_service.cpp",
52fc0b0055Sopenharmony_ci      "src/el5_filekey_manager_service_ability.cpp",
53fc0b0055Sopenharmony_ci      "src/el5_filekey_manager_stub.cpp",
54fc0b0055Sopenharmony_ci    ]
55fc0b0055Sopenharmony_ci
56fc0b0055Sopenharmony_ci    configs = []
57fc0b0055Sopenharmony_ci
58fc0b0055Sopenharmony_ci    if (target_cpu == "arm") {
59fc0b0055Sopenharmony_ci      cflags += [ "-DBINDER_IPC_32BIT" ]
60fc0b0055Sopenharmony_ci    }
61fc0b0055Sopenharmony_ci
62fc0b0055Sopenharmony_ci    include_dirs = [
63fc0b0055Sopenharmony_ci      "${access_token_path}/services/el5filekeymanager/include",
64fc0b0055Sopenharmony_ci      "${access_token_path}/frameworks/el5filekeymanager/include/",
65fc0b0055Sopenharmony_ci    ]
66fc0b0055Sopenharmony_ci
67fc0b0055Sopenharmony_ci    deps = [
68fc0b0055Sopenharmony_ci      "${access_token_path}/interfaces/innerkits/accesstoken:libaccesstoken_sdk",
69fc0b0055Sopenharmony_ci      "${access_token_path}/interfaces/innerkits/accesstoken:libtokenid_sdk",
70fc0b0055Sopenharmony_ci      "${access_token_path}/interfaces/innerkits/el5filekeymanager:el5_filekey_manager_sdk",
71fc0b0055Sopenharmony_ci      "${access_token_path}/services/el5filekeymanager:el5_filekey_manager_cfg",
72fc0b0055Sopenharmony_ci    ]
73fc0b0055Sopenharmony_ci
74fc0b0055Sopenharmony_ci    external_deps = [
75fc0b0055Sopenharmony_ci      "ability_base:want",
76fc0b0055Sopenharmony_ci      "c_utils:utils",
77fc0b0055Sopenharmony_ci      "hilog:libhilog",
78fc0b0055Sopenharmony_ci      "ipc:ipc_single",
79fc0b0055Sopenharmony_ci      "json:nlohmann_json_static",
80fc0b0055Sopenharmony_ci      "safwk:system_ability_fwk",
81fc0b0055Sopenharmony_ci      "samgr:samgr_proxy",
82fc0b0055Sopenharmony_ci    ]
83fc0b0055Sopenharmony_ci
84fc0b0055Sopenharmony_ci    if (common_event_service_enable) {
85fc0b0055Sopenharmony_ci      cflags_cc += [ "-DCOMMON_EVENT_SERVICE_ENABLE" ]
86fc0b0055Sopenharmony_ci      external_deps += [ "common_event_service:cesfwk_innerkits" ]
87fc0b0055Sopenharmony_ci      sources += [ "src/el5_filekey_manager_subscriber.cpp" ]
88fc0b0055Sopenharmony_ci    }
89fc0b0055Sopenharmony_ci
90fc0b0055Sopenharmony_ci    if (eventhandler_enable == true) {
91fc0b0055Sopenharmony_ci      cflags_cc += [ "-DEVENTHANDLER_ENABLE" ]
92fc0b0055Sopenharmony_ci      external_deps += [ "eventhandler:libeventhandler" ]
93fc0b0055Sopenharmony_ci    }
94fc0b0055Sopenharmony_ci
95fc0b0055Sopenharmony_ci    if (theme_screenlock_mgr_enable) {
96fc0b0055Sopenharmony_ci      cflags_cc += [ "-DTHEME_SCREENLOCK_MGR_ENABLE" ]
97fc0b0055Sopenharmony_ci      external_deps += [ "screenlock_mgr:screenlock_client" ]
98fc0b0055Sopenharmony_ci    }
99fc0b0055Sopenharmony_ci
100fc0b0055Sopenharmony_ci    subsystem_name = "security"
101fc0b0055Sopenharmony_ci    part_name = "access_token"
102fc0b0055Sopenharmony_ci  }
103fc0b0055Sopenharmony_ci}
104