• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2021 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("../../dsoftbus.gni")
15
16AUTH_SERVER_DEFINES = []
17if (dsoftbus_feature_auth_account == true) {
18  AUTH_SERVER_DEFINES += [ "AUTH_ACCOUNT" ]
19}
20
21authentication_path = "$dsoftbus_root_path/core/authentication"
22native_source_path = rebase_path("$dsoftbus_root_path")
23auth_dir = "dsoftbus_enhance/core/authentication/"
24enhanced = exec_script("$dsoftbus_root_path/check_sub_module.py",
25                       [
26                         "$native_source_path",
27                         "$auth_dir",
28                       ],
29                       "value")
30
31auth_server_inc = [
32  "$dsoftbus_dfx_path/interface/include",
33  "$dsoftbus_root_path/core/authentication/include",
34  "$dsoftbus_root_path/core/authentication/interface",
35  "$dsoftbus_root_path/core/adapter/authentication/include",
36  "$dsoftbus_root_path/core/bus_center/lnn/lane_hub/heartbeat/include",
37  "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/distributed_ledger/include",
38  "$dsoftbus_root_path/core/adapter/bus_center/include",
39  "$dsoftbus_root_path/core/bus_center/utils/include/",
40  "$dsoftbus_root_path/dsoftbus_enhance/core/authentication/ccmp/include/",
41]
42if (dsoftbus_feature_lnn_frame) {
43  auth_server_src = [
44    "$authentication_path/src/auth_common.c",
45    "$authentication_path/src/auth_connection.c",
46    "$authentication_path/src/auth_device.c",
47    "$authentication_path/src/auth_hichain.c",
48    "$authentication_path/src/auth_hichain_adapter.c",
49    "$authentication_path/src/auth_manager.c",
50    "$authentication_path/src/auth_normalize_request.c",
51    "$authentication_path/src/auth_request.c",
52    "$authentication_path/src/auth_session_fsm.c",
53    "$authentication_path/src/auth_session_key.c",
54    "$authentication_path/src/auth_session_json.c",
55    "$authentication_path/src/auth_session_message.c",
56    "$authentication_path/src/auth_interface.c",
57    "$authentication_path/src/auth_pre_link.c",
58  ]
59  if (enhanced) {
60    auth_server_src += [
61      "$dsoftbus_root_path/dsoftbus_enhance/core/authentication/auth_device_common_key.c",
62      "$dsoftbus_root_path/dsoftbus_enhance/core/authentication/auth_generate_attest.c",
63      "$dsoftbus_root_path/dsoftbus_enhance/core/authentication/auth_validate_attest.c",
64    ]
65    auth_server_inc += [
66      "$dsoftbus_root_path/adapter/common/include/",
67      "$dsoftbus_root_path/core/adapter/huks/include/",
68      "$dsoftbus_root_path/dsoftbus_enhance/core/bus_center/lnn/usb_channel_config/include/",
69    ]
70  } else {
71    auth_server_src += [
72      "$authentication_path/src/virtual/auth_attest_virtual.c",
73      "$authentication_path/src/virtual/auth_device_common_key_virtual.c",
74      "$authentication_path/src/virtual/customized_security_protocol_virtual.c",
75      "$authentication_path/src/virtual/auth_meta_ptk_proc_virtual.c",
76    ]
77  }
78  if (dsoftbus_feature_ip_auth) {
79    auth_server_src +=
80        [ "$dsoftbus_root_path/core/authentication/src/auth_tcp_connection.c" ]
81  } else {
82    auth_server_src += [ "$dsoftbus_root_path/core/authentication/src/virtual/auth_tcp_connection_virtual.c" ]
83  }
84} else {
85  auth_server_src = [
86    "$authentication_path/src/virtual/auth_device_common_key_virtual.c",
87    "$authentication_path/src/virtual/auth_interface_virtual.c",
88    "$authentication_path/src/virtual/auth_tcp_connection_virtual.c",
89    "$authentication_path/src/virtual/auth_meta_manager_virtual.c",
90    "$authentication_path/src/virtual/auth_meta_ptk_proc_virtual.c",
91  ]
92}
93
94if (dsoftbus_feature_lnn_meta_node && enhanced) {
95  auth_server_src += [
96    "$dsoftbus_root_path/dsoftbus_enhance/core/authentication/auth_meta_manager.c",
97    "$dsoftbus_root_path/dsoftbus_enhance/core/authentication/auth_meta_ptk_proc.c",
98  ]
99} else if (dsoftbus_feature_lnn_frame) {
100  auth_server_src +=
101      [ "$authentication_path/src/virtual/auth_meta_manager_virtual.c" ]
102}
103
104if (enhanced) {
105  if (dsoftbus_feature_lnn_ccmp) {
106    auth_server_src += [
107      "$dsoftbus_root_path/dsoftbus_enhance/core/authentication/ccmp/src/auth_account.c",
108      "$dsoftbus_root_path/dsoftbus_enhance/core/authentication/ccmp/src/ccmp_instance.c",
109      "$dsoftbus_root_path/dsoftbus_enhance/core/authentication/ccmp/src/ccmp_key.c",
110      "$dsoftbus_root_path/dsoftbus_enhance/core/authentication/ccmp/src/ccmp_manager.c",
111      "$dsoftbus_root_path/dsoftbus_enhance/core/authentication/ccmp/src/ccmp_message_hml.c",
112      "$dsoftbus_root_path/dsoftbus_enhance/core/authentication/ccmp/src/ccmp_message.c",
113      "$dsoftbus_root_path/dsoftbus_enhance/core/authentication/ccmp/src/ccmp_utils.c",
114    ]
115  } else {
116    auth_server_src += [ "$dsoftbus_root_path/dsoftbus_enhance/core/authentication/ccmp/src/ccmp_virtual.c" ]
117  }
118}
119
120auth_server_deps = [ "$dsoftbus_dfx_path:softbus_dfx" ]
121auth_server_ex_deps = []
122if (defined(ohos_lite)) {
123  if (ohos_kernel_type == "liteos_m") {
124    auth_server_inc += [ "//base/security/device_auth/interfaces/inner_api" ]
125    if (dsoftbus_feature_lnn_frame) {
126      auth_server_deps += [ "//base/security/device_auth/services:deviceauth" ]
127    }
128  } else {
129    auth_server_inc += [ "//third_party/cJSON" ]
130    if (dsoftbus_feature_lnn_frame) {
131      auth_server_deps +=
132          [ "//base/security/device_auth/services:deviceauth_sdk" ]
133    }
134  }
135  auth_server_src += [ "$authentication_path/src/virtual/auth_hichain_system_ability_monitor_virtual.c" ]
136} else {
137  auth_server_ex_deps += [ "device_auth:deviceauth_sdk" ]
138  auth_server_src +=
139      [ "$authentication_path/src/auth_hichain_system_ability_monitor.cpp" ]
140}
141
142if (!defined(global_parts_info) ||
143    defined(global_parts_info.deviceprofile_device_info_manager)) {
144  auth_server_src += [
145    "$authentication_path/bind/auth_device_profile_listener.cpp",
146    "$authentication_path/src/auth_deviceprofile.cpp",
147  ]
148} else {
149  auth_server_src += [
150    "$authentication_path/bind/auth_device_profile_listener_virtual.cpp",
151    "$authentication_path/src/auth_deviceprofile_virtual.cpp",
152  ]
153}
154