• 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")
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("CredsManagerFuzzTest") {
26  module_out_path = module_output_path
27  fuzz_config_file =
28      "${deviceauth_path}/test/fuzztest/creds_manager/credsmanager_fuzzer"
29  include_dirs = inc_path + hals_inc_path
30  include_dirs += [
31    ".",
32    "${inner_api_path}",
33    "${frameworks_path}/inc/standard",
34    "${tdd_framework_path}/common/inc",
35    "${dev_frameworks_path}/inc/permission_adapter",
36    "${dev_frameworks_path}/inc/hiview_adapter",
37  ]
38  include_dirs += identity_manager_inc
39
40  sources = [ "credsmanager_fuzzer.cpp" ]
41  sources += identity_service_mock_files
42  sources += deviceauth_files
43  sources += hal_common_files
44  sources += hiview_adapter_files
45  if (support_os_account) {
46    sources -= os_account_adapter_files
47  } else {
48    sources -= os_account_adapter_mock_files
49  }
50  if (enable_extend_plugin) {
51    sources -= account_auth_plugin_files
52    sources -= account_task_manager_files
53    sources += account_auth_plugin_mock_files
54    sources += account_task_manager_mock_files
55  }
56  sources -= soft_bus_channel_files
57  sources += soft_bus_channel_mock_files
58  sources += identity_manager_files
59  sources += [
60    "${key_management_adapter_path}/impl/src/common/mbedtls_ec_adapter.c",
61    "${key_management_adapter_path}/impl/src/huks_adapter.c",
62    "${key_management_adapter_path}/impl/src/huks_adapter_utils.c",
63    "${key_management_adapter_path}/impl/src/standard/crypto_hash_to_point.c",
64    "${key_management_adapter_path}/impl/src/standard/huks_adapter_diff_impl.c",
65    "${os_adapter_path}/impl/src/hc_log.c",
66    "${os_adapter_path}/impl/src/linux/hc_condition.c",
67    "${os_adapter_path}/impl/src/linux/hc_file.c",
68    "${os_adapter_path}/impl/src/linux/hc_init_protection.c",
69    "${os_adapter_path}/impl/src/linux/hc_thread.c",
70    "${os_adapter_path}/impl/src/linux/hc_types.c",
71  ]
72  sources += [
73    "${tdd_framework_path}/common/src/hc_dev_info_mock.c",
74    "${tdd_framework_path}/common/src/os_account_adapter_mock.c",
75  ]
76
77  defines = [
78    "DEV_AUTH_FUZZ_TEST",
79    "DEV_AUTH_HIVIEW_ENABLE",
80  ]
81  cflags = [ "-DHILOG_ENABLE" ]
82  cflags += [
83    "-DDEV_AUTH_WORK_THREAD_STACK_SIZE=${device_auth_hichain_thread_stack_size}",
84    "-DMAX_AUTH_SESSION_COUNT=${max_auth_session_count}",
85  ]
86
87  external_deps = [
88    "cJSON:cjson",
89    "c_utils:utils",
90    "dsoftbus:softbus_client",
91    "hilog:libhilog",
92    "hisysevent:libhisysevent",
93    "hitrace:hitrace_meter",
94    "huks:libhukssdk",
95    "mbedtls:mbedtls_shared",
96    "openssl:libcrypto_static",
97  ]
98}
99
100###############################################################################
101group("fuzztest") {
102  testonly = true
103  deps = []
104  deps += [
105    # deps file
106    ":CredsManagerFuzzTest",
107  ]
108}
109###############################################################################
110