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