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