1# Copyright (c) 2022 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("//base/security/device_security_level/common/dslm.gni") 15import("//build/ohos.gni") 16 17# sa lib 18if (defined(ohos_lite)) { 19 group("dslm_service") { 20 } 21 if (ohos_kernel_type == "liteos_a" || ohos_kernel_type == "linux") { 22 ohos_static_library("service_sa_static") { 23 sources = [ "common/dslm_rpc_process.c" ] 24 25 include_dirs = [ 26 "common", 27 "../dslm", 28 "../include", 29 "../../common/include", 30 "../../interfaces/inner_api/include", 31 "../../oem_property/include", 32 ] 33 34 deps = [ 35 "$dslm_hilog_path/featured:hilog_shared", 36 "$dslm_lite_component_path/cJSON:cjson_static", 37 "$dslm_samgr_path/samgr_lite/samgr:samgr", 38 "../../baselib/utils:utils_static", 39 "../common:service_common_obj", 40 "../dslm:service_dslm_obj", 41 "../msg:service_msg_obj", 42 ] 43 44 configs = [ 45 "../../common:common_configs", 46 "../../common:common_lite_configs", 47 ] 48 49 part_name = "device_security_level" 50 subsystem_name = "security" 51 } 52 53 ohos_executable("dslm_server") { 54 sources = [ 55 "lite/dslm_service.c", 56 "lite/small/dslm_ipc_process.c", 57 "lite/small/dslm_service_feature.c", 58 "lite/small/dslm_service_main.c", 59 ] 60 61 include_dirs = [ 62 "common", 63 "lite/small", 64 "../include", 65 "../../baselib/utils/include", 66 "../../interfaces/inner_api/include", 67 ] 68 69 deps = [ 70 ":service_sa_static", 71 "$dslm_hilog_path/featured:hilog_shared", 72 "$dslm_ipc_path/interfaces/innerkits/c/ipc:ipc_single", 73 "$dslm_lite_component_path/cJSON:cjson_shared", 74 "$dslm_samgr_path/samgr_lite/samgr:samgr", 75 "../../oem_property/ohos/lite:dslm_ohos_cred_obj", 76 ] 77 } 78 } else if (ohos_kernel_type == "liteos_m") { 79 ohos_source_set("service_sa_obj") { 80 sources = [ "common/dslm_rpc_process.c" ] 81 82 include_dirs = [ 83 "common", 84 "../dslm", 85 "../include", 86 "../../common/include", 87 "../../interfaces/inner_api/include", 88 "../../oem_property/include", 89 "../../oem_property/ohos/lite", 90 ] 91 92 deps = [ 93 "$dslm_hilog_path/featured:hilog_static", 94 "$dslm_lite_component_path/cJSON:cjson_shared", 95 "$dslm_samgr_path/samgr_lite/samgr:samgr", 96 "../../baselib/utils:utils_static", 97 "../common:service_common_obj", 98 "../dslm:service_dslm_obj", 99 "../msg:service_msg_obj", 100 ] 101 102 configs = [ 103 "../../common:common_configs", 104 "../../common:common_lite_configs", 105 ] 106 107 part_name = "device_security_level" 108 subsystem_name = "security" 109 } 110 111 ohos_static_library("dslm_server") { 112 sources = [ 113 "lite/dslm_service.c", 114 "lite/mini/dslm_inner_process.c", 115 "lite/mini/dslm_service_feature.c", 116 ] 117 118 include_dirs = [ 119 "common", 120 "lite/mini", 121 "../include", 122 "../../baselib/utils/include", 123 "../../interfaces/inner_api/include", 124 "../../interfaces/inner_api/src/lite/include", 125 ] 126 127 configs = [ 128 "../../common:common_configs", 129 "../../common:common_lite_configs", 130 ] 131 132 deps = [ 133 ":service_sa_obj", 134 "$dslm_hilog_path/featured:hilog_static", 135 "$dslm_lite_component_path/cJSON:cjson_static", 136 "$dslm_samgr_path/samgr_lite/samgr:samgr", 137 "../../oem_property/ohos/lite:dslm_ohos_cred_obj", 138 ] 139 } 140 } 141} else { 142 config("dslm_service_config") { 143 include_dirs = [ "../../oem_property/include" ] 144 } 145 declare_args() { 146 device_security_level_feature_plugin_path = "" 147 } 148 ohos_shared_library("dslm_service") { 149 shlib_type = "sa" 150 version_script = "dslm.versionscript" 151 152 sanitize = { 153 integer_overflow = true 154 ubsan = true 155 boundary_sanitize = true 156 cfi = true 157 cfi_cross_dso = true 158 blocklist = "../../cfi_blocklist.txt" 159 } 160 branch_protector_ret = "pac_ret" 161 162 sources = [ 163 "common/dslm_rpc_process.c", 164 "standard/dslm_callback_proxy.cpp", 165 "standard/dslm_ipc_process.cpp", 166 "standard/dslm_service.cpp", 167 ] 168 169 include_dirs = [ 170 "common", 171 "../dslm", 172 "../include", 173 "../../common/include", 174 "../../interfaces/inner_api/include", 175 ] 176 177 deps = [ 178 "../../baselib/utils:utils_static", 179 "../../oem_property:dslm_oem_ext", 180 "../common:service_common_obj", 181 "../dfx:dslm_extension_dfx", 182 "../dslm:service_dslm_obj", 183 "../msg:service_msg_obj", 184 ] 185 186 if (device_security_level_feature_plugin_path != "") { 187 defines = 188 [ "PLUGIN_SO_PATH=\"${device_security_level_feature_plugin_path}\"" ] 189 190 deps -= [ "../../oem_property:dslm_oem_ext" ] 191 192 sources += [ "../../oem_property/common/dslm_credential.c" ] 193 194 include_dirs += [ "../../oem_property/include" ] 195 } 196 197 external_deps = [ 198 "c_utils:utils", 199 "hilog:libhilog", 200 "ipc:ipc_core", 201 "safwk:system_ability_fwk", 202 "samgr:samgr_proxy", 203 ] 204 205 configs = [ "../../common:common_configs" ] 206 public_configs = [ ":dslm_service_config" ] 207 part_name = "device_security_level" 208 subsystem_name = "security" 209 } 210} 211