1060ff233Sopenharmony_ci# Copyright (c) 2021 Huawei Device Co., Ltd.
2060ff233Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License");
3060ff233Sopenharmony_ci# you may not use this file except in compliance with the License.
4060ff233Sopenharmony_ci# You may obtain a copy of the License at
5060ff233Sopenharmony_ci#
6060ff233Sopenharmony_ci#     http://www.apache.org/licenses/LICENSE-2.0
7060ff233Sopenharmony_ci#
8060ff233Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software
9060ff233Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS,
10060ff233Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11060ff233Sopenharmony_ci# See the License for the specific language governing permissions and
12060ff233Sopenharmony_ci# limitations under the License.
13060ff233Sopenharmony_ci
14060ff233Sopenharmony_ciimport("../../dsoftbus.gni")
15060ff233Sopenharmony_ciimport("../common/dfx/dsoftbus_dfx.gni")
16060ff233Sopenharmony_ciAUTH_SERVER_DEFINES = []
17060ff233Sopenharmony_ciif (dsoftbus_feature_auth_account == true) {
18060ff233Sopenharmony_ci  AUTH_SERVER_DEFINES += [ "AUTH_ACCOUNT" ]
19060ff233Sopenharmony_ci}
20060ff233Sopenharmony_ci
21060ff233Sopenharmony_ciauthentication_path = "$dsoftbus_root_path/core/authentication"
22060ff233Sopenharmony_cinative_source_path = rebase_path("$dsoftbus_root_path")
23060ff233Sopenharmony_ciauth_dir = "dsoftbus_enhance/core/authentication/"
24060ff233Sopenharmony_cienhanced = exec_script("$dsoftbus_root_path/check_sub_module.py",
25060ff233Sopenharmony_ci                       [
26060ff233Sopenharmony_ci                         "$native_source_path",
27060ff233Sopenharmony_ci                         "$auth_dir",
28060ff233Sopenharmony_ci                       ],
29060ff233Sopenharmony_ci                       "value")
30060ff233Sopenharmony_ci
31060ff233Sopenharmony_ciauth_server_inc = [
32060ff233Sopenharmony_ci  "$dsoftbus_root_path/core/authentication/include",
33060ff233Sopenharmony_ci  "$dsoftbus_root_path/core/authentication/interface",
34060ff233Sopenharmony_ci  "$dsoftbus_root_path/core/common/dfx/hisysevent_adapter/include",
35060ff233Sopenharmony_ci  "$dsoftbus_root_path/core/common/dfx/interface/include",
36060ff233Sopenharmony_ci  "$dsoftbus_root_path/core/adapter/authentication/include",
37060ff233Sopenharmony_ci  "$dsoftbus_root_path/core/bus_center/lnn/lane_hub/heartbeat/include",
38060ff233Sopenharmony_ci  "$dsoftbus_root_path/core/bus_center/lnn/net_ledger/distributed_ledger/include",
39060ff233Sopenharmony_ci  "$dsoftbus_root_path/core/adapter/bus_center/include",
40060ff233Sopenharmony_ci  "$dsoftbus_root_path/core/bus_center/utils/include/",
41060ff233Sopenharmony_ci]
42060ff233Sopenharmony_ciif (dsoftbus_feature_lnn_net) {
43060ff233Sopenharmony_ci  auth_server_src = [
44060ff233Sopenharmony_ci    "$authentication_path/src/auth_common.c",
45060ff233Sopenharmony_ci    "$authentication_path/src/auth_connection.c",
46060ff233Sopenharmony_ci    "$authentication_path/src/auth_device.c",
47060ff233Sopenharmony_ci    "$authentication_path/src/auth_hichain.c",
48060ff233Sopenharmony_ci    "$authentication_path/src/auth_hichain_adapter.c",
49060ff233Sopenharmony_ci    "$authentication_path/src/auth_lane.c",
50060ff233Sopenharmony_ci    "$authentication_path/src/auth_manager.c",
51060ff233Sopenharmony_ci    "$authentication_path/src/auth_normalize_request.c",
52060ff233Sopenharmony_ci    "$authentication_path/src/auth_request.c",
53060ff233Sopenharmony_ci    "$authentication_path/src/auth_session_fsm.c",
54060ff233Sopenharmony_ci    "$authentication_path/src/auth_session_key.c",
55060ff233Sopenharmony_ci    "$authentication_path/src/auth_session_json.c",
56060ff233Sopenharmony_ci    "$authentication_path/src/auth_session_message.c",
57060ff233Sopenharmony_ci    "$authentication_path/src/auth_interface.c",
58060ff233Sopenharmony_ci  ]
59060ff233Sopenharmony_ci  if (enhanced) {
60060ff233Sopenharmony_ci    auth_server_src += [
61060ff233Sopenharmony_ci      "$dsoftbus_root_path/dsoftbus_enhance/core/authentication/auth_device_common_key.c",
62060ff233Sopenharmony_ci      "$dsoftbus_root_path/dsoftbus_enhance/core/authentication/auth_meta_manager.c",
63060ff233Sopenharmony_ci      "$dsoftbus_root_path/dsoftbus_enhance/core/authentication/auth_meta_ptk_proc.c",
64060ff233Sopenharmony_ci      "$dsoftbus_root_path/dsoftbus_enhance/core/authentication/ccmp/src/auth_account.c",
65060ff233Sopenharmony_ci      "$dsoftbus_root_path/dsoftbus_enhance/core/authentication/ccmp/src/ccmp_instance.c",
66060ff233Sopenharmony_ci      "$dsoftbus_root_path/dsoftbus_enhance/core/authentication/ccmp/src/ccmp_key.c",
67060ff233Sopenharmony_ci      "$dsoftbus_root_path/dsoftbus_enhance/core/authentication/ccmp/src/ccmp_manager.c",
68060ff233Sopenharmony_ci      "$dsoftbus_root_path/dsoftbus_enhance/core/authentication/ccmp/src/ccmp_message_hml.c",
69060ff233Sopenharmony_ci      "$dsoftbus_root_path/dsoftbus_enhance/core/authentication/ccmp/src/ccmp_message.c",
70060ff233Sopenharmony_ci      "$dsoftbus_root_path/dsoftbus_enhance/core/authentication/ccmp/src/ccmp_utils.c",
71060ff233Sopenharmony_ci      "$dsoftbus_root_path/dsoftbus_enhance/core/authentication/auth_generate_attest.c",
72060ff233Sopenharmony_ci      "$dsoftbus_root_path/dsoftbus_enhance/core/authentication/auth_validate_attest.c",
73060ff233Sopenharmony_ci    ]
74060ff233Sopenharmony_ci    auth_server_inc += [
75060ff233Sopenharmony_ci      "$dsoftbus_root_path/adapter/common/include/",
76060ff233Sopenharmony_ci      "$dsoftbus_root_path/dsoftbus_enhance/core/authentication/ccmp/include/",
77060ff233Sopenharmony_ci    ]
78060ff233Sopenharmony_ci  } else {
79060ff233Sopenharmony_ci    auth_server_src += [
80060ff233Sopenharmony_ci      "$authentication_path/src/virtual/auth_attest_virtual.c",
81060ff233Sopenharmony_ci      "$authentication_path/src/virtual/auth_device_common_key_virtual.c",
82060ff233Sopenharmony_ci      "$authentication_path/src/virtual/auth_meta_manager_virtual.c",
83060ff233Sopenharmony_ci      "$authentication_path/src/virtual/customized_security_protocol_virtual.c",
84060ff233Sopenharmony_ci      "$authentication_path/src/virtual/auth_meta_ptk_proc_virtual.c",
85060ff233Sopenharmony_ci    ]
86060ff233Sopenharmony_ci  }
87060ff233Sopenharmony_ci  if (dsoftbus_feature_ip_auth) {
88060ff233Sopenharmony_ci    auth_server_src +=
89060ff233Sopenharmony_ci        [ "$dsoftbus_root_path/core/authentication/src/auth_tcp_connection.c" ]
90060ff233Sopenharmony_ci  } else {
91060ff233Sopenharmony_ci    auth_server_src += [ "$dsoftbus_root_path/core/authentication/src/virtual/auth_tcp_connection_virtual.c" ]
92060ff233Sopenharmony_ci  }
93060ff233Sopenharmony_ci} else {
94060ff233Sopenharmony_ci  auth_server_src = [
95060ff233Sopenharmony_ci    "$authentication_path/src/virtual/auth_interface_virtual.c",
96060ff233Sopenharmony_ci    "$authentication_path/src/virtual/auth_tcp_connection_virtual.c",
97060ff233Sopenharmony_ci    "$authentication_path/src/virtual/auth_meta_manager_virtual.c",
98060ff233Sopenharmony_ci    "$authentication_path/src/virtual/auth_meta_ptk_proc_virtual.c",
99060ff233Sopenharmony_ci  ]
100060ff233Sopenharmony_ci}
101060ff233Sopenharmony_ciauth_server_deps = [
102060ff233Sopenharmony_ci  "$dsoftbus_dfx_path/anonymize:softbus_dfx_anonymizer",
103060ff233Sopenharmony_ci  "$dsoftbus_dfx_path/log:softbus_dfx_log",
104060ff233Sopenharmony_ci]
105060ff233Sopenharmony_ciauth_server_ex_deps = []
106060ff233Sopenharmony_ciif (defined(ohos_lite)) {
107060ff233Sopenharmony_ci  if (ohos_kernel_type == "liteos_m") {
108060ff233Sopenharmony_ci    auth_server_inc += [ "//base/security/device_auth/interfaces/inner_api" ]
109060ff233Sopenharmony_ci    if (dsoftbus_feature_lnn_net) {
110060ff233Sopenharmony_ci      auth_server_deps += [ "//base/security/device_auth/services:deviceauth" ]
111060ff233Sopenharmony_ci    }
112060ff233Sopenharmony_ci  } else {
113060ff233Sopenharmony_ci    auth_server_inc += [ "//third_party/cJSON" ]
114060ff233Sopenharmony_ci    if (dsoftbus_feature_lnn_net) {
115060ff233Sopenharmony_ci      auth_server_deps +=
116060ff233Sopenharmony_ci          [ "//base/security/device_auth/services:deviceauth_sdk" ]
117060ff233Sopenharmony_ci    }
118060ff233Sopenharmony_ci  }
119060ff233Sopenharmony_ci  auth_server_src += [ "$authentication_path/src/virtual/auth_hichain_system_ability_monitor_virtual.c" ]
120060ff233Sopenharmony_ci} else {
121060ff233Sopenharmony_ci  auth_server_ex_deps += [ "device_auth:deviceauth_sdk" ]
122060ff233Sopenharmony_ci  auth_server_src +=
123060ff233Sopenharmony_ci      [ "$authentication_path/src/auth_hichain_system_ability_monitor.cpp" ]
124060ff233Sopenharmony_ci}
125060ff233Sopenharmony_ci
126060ff233Sopenharmony_ciif (!defined(global_parts_info) ||
127060ff233Sopenharmony_ci    defined(global_parts_info.deviceprofile_device_info_manager)) {
128060ff233Sopenharmony_ci  auth_server_src += [
129060ff233Sopenharmony_ci    "$authentication_path/bind/auth_device_profile_listener.cpp",
130060ff233Sopenharmony_ci    "$authentication_path/src/auth_deviceprofile.cpp",
131060ff233Sopenharmony_ci  ]
132060ff233Sopenharmony_ci} else {
133060ff233Sopenharmony_ci  auth_server_src += [
134060ff233Sopenharmony_ci    "$authentication_path/bind/auth_device_profile_listener_virtual.cpp",
135060ff233Sopenharmony_ci    "$authentication_path/src/auth_deviceprofile_virtual.cpp",
136060ff233Sopenharmony_ci  ]
137060ff233Sopenharmony_ci}
138