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# service_common object
18ohos_source_set("service_common_obj") {
19  sources = [
20    "dslm_crypto.c",
21    "dslm_msg_serialize.c",
22  ]
23
24  include_dirs = [
25    "../include",
26    "../../interfaces/inner_api/include",
27  ]
28
29  deps = [ "../..//baselib/utils:utils_static" ]
30
31  if (defined(ohos_lite)) {
32    if (ohos_kernel_type == "linux" || ohos_kernel_type == "liteos_a") {
33      deps += [
34        "$dslm_ipc_path/interfaces/innerkits/c/ipc:ipc_single",
35        "//third_party/openssl/ohos_lite:openssl_shared",
36      ]
37      external_deps = [ "hilog_lite:hilog_shared" ]
38    } else if (ohos_kernel_type == "liteos_m") {
39      deps += [
40        "$dslm_hilog_path/featured:hilog_static",
41        "//third_party/openssl/ohos_lite:openssl_static",
42      ]
43    }
44  } else {
45    sanitize = {
46      integer_overflow = true
47      ubsan = true
48      boundary_sanitize = true
49      cfi = true
50      cfi_cross_dso = true
51      blocklist = "../../cfi_blocklist.txt"
52    }
53    branch_protector_ret = "pac_ret"
54
55    external_deps = [
56      "c_utils:utils",
57      "hilog:libhilog",
58      "ipc:ipc_core",
59      "openssl:libcrypto_shared",
60    ]
61  }
62
63  configs = [
64    "../../common:common_configs",
65    "../../common:common_lite_configs",
66  ]
67
68  part_name = "device_security_level"
69  subsystem_name = "security"
70}
71