• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2023 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("DevAuthFuzzTest") {
25  module_out_path = module_output_path
26  fuzz_config_file = "${deviceauth_path}/test/fuzztest/devauth_fuzzer"
27  include_dirs = inc_path + hals_inc_path
28  include_dirs += [
29    ".",
30    "${frameworks_path}/inc/standard",
31    "${dev_frameworks_path}/inc/hiview_adapter",
32    "${dev_frameworks_path}/inc/permission_adapter",
33    "${frameworks_path}/sdk/sa_load_on_demand/inc",
34  ]
35  if (support_os_account) {
36    include_dirs += [ "${dev_frameworks_path}/inc/account_subscriber" ]
37    include_dirs += [ "${dev_frameworks_path}/inc/sa_subscriber" ]
38    include_dirs += [ "${dev_frameworks_path}/inc/net_observer" ]
39  }
40  include_dirs += identity_manager_inc
41
42  sources = [ "devauth_fuzzer.cpp" ]
43  sources += deviceauth_ipc_files
44  sources += permission_adapter_files
45  sources += sa_load_on_demand_mock_files
46  sources += sdk_load_on_demand_mock_files
47  sources += [ "${frameworks_path}/src/ipc_service_common.c" ]
48  sources += [ "${frameworks_path}/src/ipc_service_lite.c" ]
49  sources += identity_service_mock_files
50  sources += deviceauth_files
51  if (support_os_account) {
52    sources += account_subscriber_files
53    sources += sa_subscriber_files
54    sources += net_observer_files
55  }
56  sources += hiview_adapter_files
57  sources += identity_manager_files
58  defines = [ "HILOG_ENABLE" ]
59  defines += [ "DEV_AUTH_HIVIEW_ENABLE" ]
60  defines += [ "DEV_AUTH_FUZZ_TEST" ]
61  cflags = [
62    "-g",
63    "-O0",
64    "-Wno-unused-variable",
65    "-fno-omit-frame-pointer",
66    "-DHILOG_ENABLE",
67  ]
68  cflags += build_flags
69  cflags += [
70    "-DDEV_AUTH_WORK_THREAD_STACK_SIZE=${device_auth_hichain_thread_stack_size}",
71    "-DMAX_AUTH_SESSION_COUNT=${max_auth_session_count}",
72  ]
73  sanitize = {
74    cfi = true
75    cfi_cross_dso = true
76    integer_overflow = true
77    boundary_sanitize = true
78    ubsan = true
79    debug = true
80  }
81  if (target_cpu == "arm") {
82    cflags += [ "-DBINDER_IPC_32BIT" ]
83  }
84  deps = [ "${deps_adapter_path}:${hal_module_test_name}" ]
85  external_deps = [
86    "access_token:libaccesstoken_sdk",
87    "access_token:libnativetoken",
88    "access_token:libtoken_setproc",
89    "selinux_adapter:librestorecon",
90    "cJSON:cjson",
91    "c_utils:utils",
92    "dsoftbus:softbus_client",
93    "hilog:libhilog",
94    "hisysevent:libhisysevent",
95    "hitrace:hitrace_meter",
96    "init:libbegetutil",
97    "ipc:ipc_core",
98    "samgr:samgr_proxy",
99  ]
100  if (support_os_account) {
101    external_deps += [
102      "ability_base:want",
103      "common_event_service:cesfwk_innerkits",
104      "ipc:ipc_single",
105      "json:nlohmann_json_static",
106      "netmanager_base:net_conn_manager_if",
107      "os_account:os_account_innerkits",
108      "samgr:samgr_proxy",
109    ]
110  }
111}
112
113###############################################################################
114group("fuzztest") {
115  testonly = true
116  deps = []
117  deps += [
118    # deps file
119    ":DevAuthFuzzTest",
120  ]
121}
122###############################################################################
123