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
17service_dslm_sources = [
18  "dslm_core_process.c",
19  "dslm_device_list.c",
20  "dslm_dfx_default.c",
21  "dslm_fsm_process.c",
22  "dslm_hievent.c",
23  "dslm_inner_process.c",
24  "dslm_msg_utils.c",
25]
26
27service_dslm_include_dirs = [
28  "../include",
29  "../../common/include",
30  "../../oem_property/common",
31  "../../oem_property/include",
32  "../../interfaces/inner_api/include",
33]
34
35# service_dslm object
36ohos_source_set("service_dslm_obj") {
37  sources = service_dslm_sources
38  include_dirs = service_dslm_include_dirs
39  deps = [ "../../baselib/utils:utils_static" ]
40
41  if (defined(ohos_lite)) {
42    if (ohos_kernel_type == "liteos_m") {
43      deps += [ "$dslm_hilog_path/featured:hilog_static" ]
44    } else {
45      deps += [ "$dslm_hilog_path/featured:hilog_shared" ]
46    }
47  } else {
48    sanitize = {
49      integer_overflow = true
50      ubsan = true
51      boundary_sanitize = true
52      cfi = true
53      cfi_cross_dso = true
54      blocklist = "../../cfi_blocklist.txt"
55    }
56    branch_protector_ret = "pac_ret"
57
58    external_deps = [
59      "c_utils:utils",
60      "hilog:libhilog",
61    ]
62  }
63
64  defines = [
65    "MAX_SEND_TIMES=5",
66    "SEND_MSG_TIMEOUT_LEN=40000",
67  ]
68
69  configs = [
70    "../../common:common_configs",
71    "../../common:common_lite_configs",
72  ]
73
74  part_name = "device_security_level"
75  subsystem_name = "security"
76}
77
78# service_dslm object, only for test
79ohos_source_set("service_dslm_test_obj") {
80  testonly = true
81  sources = service_dslm_sources
82  include_dirs = service_dslm_include_dirs
83  deps = [ "../../baselib/utils:utils_static" ]
84
85  if (defined(ohos_lite)) {
86    if (ohos_kernel_type == "liteos_m") {
87      deps += [ "$dslm_hilog_path/featured:hilog_static" ]
88    } else {
89      deps += [ "$dslm_hilog_path/featured:hilog_shared" ]
90    }
91  } else {
92    sanitize = {
93      integer_overflow = true
94      ubsan = true
95      boundary_sanitize = true
96      cfi = true
97      cfi_cross_dso = true
98      blocklist = "../../cfi_blocklist.txt"
99    }
100    branch_protector_ret = "pac_ret"
101
102    external_deps = [
103      "c_utils:utils",
104      "hilog:libhilog",
105    ]
106  }
107
108  defines = [
109    "MAX_SEND_TIMES=5",
110    "SEND_MSG_TIMEOUT_LEN=500",
111  ]
112
113  configs = [ "../../common:common_configs" ]
114
115  part_name = "device_security_level"
116  subsystem_name = "security"
117}
118