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")
16import("../../../unittest/tdd_framework/tdd_framework.gni")
17
18#####################hydra-fuzz###################
19import("//build/config/features.gni")
20import("//build/ohos.gni")
21import("//build/test.gni")
22module_output_path = "device_auth/device_auth"
23
24##############################fuzztest##########################################
25ohos_fuzztest("GroupOperationCommonFuzzTest") {
26  module_out_path = module_output_path
27  fuzz_config_file = "${deviceauth_path}/test/fuzztest/group_manage/groupoperationcommon_fuzzer"
28  include_dirs = inc_path + hals_inc_path
29  include_dirs += [
30    ".",
31    "${inner_api_path}",
32    "${frameworks_path}/inc/standard",
33    "${tdd_framework_path}/common/inc",
34    "${dev_frameworks_path}/inc/hiview_adapter",
35  ]
36  include_dirs += identity_manager_inc
37  if (support_os_account) {
38    include_dirs += [ "${dev_frameworks_path}/inc/account_subscriber" ]
39    include_dirs += [ "${dev_frameworks_path}/inc/sa_subscriber" ]
40  }
41  sources = [ "groupoperationcommon_fuzzer.cpp" ]
42  sources += deviceauth_files
43  sources += hal_common_files
44  sources += hiview_adapter_files
45  sources += identity_manager_files
46  sources -= soft_bus_channel_files
47  sources += soft_bus_channel_mock_files
48  if (support_os_account) {
49    sources += account_subscriber_files
50    sources += sa_subscriber_files
51  }
52  sources += [
53    "${key_management_adapter_path}/impl/src/common/mbedtls_ec_adapter.c",
54    "${key_management_adapter_path}/impl/src/huks_adapter.c",
55    "${key_management_adapter_path}/impl/src/standard/crypto_hash_to_point.c",
56    "${key_management_adapter_path}/impl/src/standard/huks_adapter_diff_impl.c",
57    "${os_adapter_path}/impl/src/hc_log.c",
58    "${os_adapter_path}/impl/src/linux/hc_condition.c",
59    "${os_adapter_path}/impl/src/linux/hc_file.c",
60    "${os_adapter_path}/impl/src/linux/hc_init_protection.c",
61    "${os_adapter_path}/impl/src/linux/hc_thread.c",
62    "${os_adapter_path}/impl/src/linux/hc_types.c",
63    "${tdd_framework_path}/common/src/hc_dev_info_mock.c",
64  ]
65  defines = [
66    "DEV_AUTH_FUZZ_TEST",
67    "DEV_AUTH_HIVIEW_ENABLE",
68  ]
69  cflags = [ "-DHILOG_ENABLE" ]
70  cflags += [
71    "-DDEV_AUTH_WORK_THREAD_STACK_SIZE=${device_auth_hichain_thread_stack_size}",
72    "-DMAX_AUTH_SESSION_COUNT=${max_auth_session_count}",
73  ]
74
75  deps = []
76
77  external_deps = [
78    "cJSON:cjson",
79    "c_utils:utils",
80    "dsoftbus:softbus_client",
81    "hilog:libhilog",
82    "hisysevent:libhisysevent",
83    "hitrace:hitrace_meter",
84    "huks:libhukssdk",
85    "mbedtls:mbedtls_shared",
86    "openssl:libcrypto_static",
87  ]
88  if (support_os_account) {
89    external_deps += [
90      "ability_base:want",
91      "common_event_service:cesfwk_innerkits",
92      "ipc:ipc_single",
93      "json:nlohmann_json_static",
94      "os_account:os_account_innerkits",
95      "samgr:samgr_proxy",
96    ]
97  }
98}
99
100###############################################################################
101group("fuzztest") {
102  testonly = true
103  deps = []
104  deps += [
105    # deps file
106    ":GroupOperationCommonFuzzTest",
107  ]
108}
109###############################################################################
110