• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2025 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_auth/deps_adapter/deviceauth_hals.gni")
15import("//base/security/device_auth/services/deviceauth.gni")
16
17#####################hydra-fuzz###################
18import("//build/config/features.gni")
19import("//build/ohos.gni")
20import("//build/test.gni")
21module_output_path = "device_auth/device_auth"
22
23##############################fuzztest##########################################
24ohos_fuzztest("DevAuthInterfaceFuzzTest") {
25  module_out_path = module_output_path
26  fuzz_config_file = "${deviceauth_path}/test/fuzztest/devauthinterface_fuzzer"
27  include_dirs = inc_path
28  include_dirs += hals_inc_path
29
30  include_dirs += [
31    ".",
32    "../../unittest/deviceauth/include",
33    "${dev_frameworks_path}/inc/hiview_adapter",
34    "${frameworks_path}/inc/standard",
35    "${dev_frameworks_path}/inc/permission_adapter",
36    "${frameworks_path}/sdk/sa_load_on_demand/inc",
37  ]
38
39  sources = hal_common_files
40  sources -= [ "${common_lib_path}/impl/src/json_utils.c" ]
41  sources += [
42    "${key_management_adapter_path}/impl/src/common/mbedtls_ec_adapter.c",
43    "${key_management_adapter_path}/impl/src/huks_adapter.c",
44    "${key_management_adapter_path}/impl/src/huks_adapter_utils.c",
45    "${key_management_adapter_path}/impl/src/standard/crypto_hash_to_point.c",
46    "${key_management_adapter_path}/impl/src/standard/huks_adapter_diff_impl.c",
47    "${os_adapter_path}/impl/src/hc_log.c",
48    "${os_adapter_path}/impl/src/linux/hc_condition.c",
49    "${os_adapter_path}/impl/src/linux/hc_file.c",
50    "${os_adapter_path}/impl/src/linux/hc_init_protection.c",
51    "${os_adapter_path}/impl/src/linux/hc_thread.c",
52    "${os_adapter_path}/impl/src/linux/hc_types.c",
53    "../../unittest/deviceauth/source/hc_dev_info_mock.c",
54    "../../unittest/deviceauth/source/json_utils_mock.c",
55  ]
56
57  sources += dev_frameworks_files
58  sources += identity_service_mock_files
59  sources += deviceauth_common_files
60  sources += group_database_manager_files
61  sources += ext_plugin_manager_files
62  sources += session_manager_files
63  sources += session_mini_files
64  sources += session_v1_files
65  sources += session_v2_files
66  sources += iso_protocol_files
67  sources += ec_speke_protocol_files
68  sources += auth_code_import_files
69  sources += pub_key_exchange_files
70  sources += save_trusted_info_files
71  sources += creds_manager_files
72  sources += broadcast_manager_files
73  sources += soft_bus_channel_files
74  sources += deviceauth_ipc_files
75  sources += permission_adapter_files
76  sources += sa_load_on_demand_mock_files
77  sources += sdk_load_on_demand_mock_files
78
79  sources += group_auth_files
80  sources += group_auth_account_unrelated_files
81
82  sources += group_manager_files
83  sources += group_manager_peer_to_peer_files
84
85  sources += authenticators_p2p_files
86  sources += authenticators_p2p_iso_files
87  sources += authenticators_p2p_pake_files
88  sources += authenticators_standard_exchange_task_files
89
90  sources += account_related_files
91
92  sources += privacy_enhancement_files
93  sources += mk_agree_files
94
95  sources += security_label_adapter_files
96
97  sources += hiview_adapter_files
98
99  sources += [
100    "${dev_frameworks_path}/src/account_task_manager/account_task_manager.c",
101    "${dev_frameworks_path}/src/plugin_adapter/ext_part/account_auth_plugin/account_auth_plugin_proxy.c",
102    "../../unittest/deviceauth/source/device_auth_ext_mock.c",
103    "../../unittest/deviceauth/source/os_account_adapter_mock.c",
104  ]
105  sources -= [
106    "${authenticators_path}/src/account_unrelated/pake_task/pake_v1_task/pake_v1_protocol_task/pake_v1_protocol_task_common.c",
107    "${deviceauth_account_group_manager_path}/src/group_operation/identical_account_group/identical_account_group.c",
108    "${session_manager_path}/src/session/v2/dev_session_util.c",
109  ]
110  defines = [
111    "P2P_PAKE_DL_PRIME_LEN_384",
112    "P2P_PAKE_EC_TYPE",
113    "ENABLE_EC_SPEKE",
114    "ENABLE_ISO",
115    "ENABLE_AUTH_CODE_IMPORT",
116    "ENABLE_PUB_KEY_EXCHANGE",
117    "ENABLE_SAVE_TRUSTED_INFO",
118    "ENABLE_ACCOUNT_AUTH_ISO",
119    "ENABLE_ACCOUNT_AUTH_EC_SPEKE",
120    "ENABLE_P2P_BIND_ISO",
121    "ENABLE_P2P_BIND_EC_SPEKE",
122    "ENABLE_P2P_AUTH_ISO",
123    "ENABLE_P2P_AUTH_EC_SPEKE",
124    "ENABLE_PSEUDONYM",
125    "DEV_AUTH_HIVIEW_ENABLE",
126  ]
127
128  sources += identity_manager_files
129  include_dirs += identity_manager_inc
130  sources += [ "devauthinterface_fuzzer.cpp" ]
131
132  cflags = [ "-DHILOG_ENABLE" ]
133  cflags += [
134    "-DDEV_AUTH_WORK_THREAD_STACK_SIZE=${device_auth_hichain_thread_stack_size}",
135    "-DMAX_AUTH_SESSION_COUNT=${max_auth_session_count}",
136  ]
137
138  deps = []
139
140  external_deps = [
141    "access_token:libaccesstoken_sdk",
142    "bounds_checking_function:libsec_shared",
143    "cJSON:cjson",
144    "c_utils:utils",
145    "dsoftbus:softbus_client",
146    "hilog:libhilog",
147    "hisysevent:libhisysevent",
148    "hitrace:hitrace_meter",
149    "huks:libhukssdk",
150    "init:libbegetutil",
151    "ipc:ipc_single",
152    "mbedtls:mbedtls_shared",
153    "openssl:libcrypto_static",
154    "samgr:samgr_proxy",
155    "common_event_service:cesfwk_innerkits",
156    "safwk:system_ability_fwk",
157  ]
158}
159
160###############################################################################
161group("fuzztest") {
162  testonly = true
163  deps = []
164  deps += [
165    # deps file
166    ":DevAuthInterfaceFuzzTest",
167  ]
168}
169###############################################################################
170