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 += sa_load_on_demand_mock_files 44 sources += hal_common_files 45 sources += hiview_adapter_files 46 if (support_os_account) { 47 sources -= os_account_adapter_files 48 } else { 49 sources -= os_account_adapter_mock_files 50 } 51 if (enable_extend_plugin) { 52 sources -= account_auth_plugin_files 53 sources -= account_task_manager_files 54 sources += account_auth_plugin_mock_files 55 sources += account_task_manager_mock_files 56 } 57 sources -= soft_bus_channel_files 58 sources += soft_bus_channel_mock_files 59 sources += identity_manager_files 60 sources += [ 61 "${key_management_adapter_path}/impl/src/common/mbedtls_ec_adapter.c", 62 "${key_management_adapter_path}/impl/src/huks_adapter.c", 63 "${key_management_adapter_path}/impl/src/huks_adapter_utils.c", 64 "${key_management_adapter_path}/impl/src/standard/crypto_hash_to_point.c", 65 "${key_management_adapter_path}/impl/src/standard/huks_adapter_diff_impl.c", 66 "${os_adapter_path}/impl/src/hc_log.c", 67 "${os_adapter_path}/impl/src/linux/hc_condition.c", 68 "${os_adapter_path}/impl/src/linux/hc_file.c", 69 "${os_adapter_path}/impl/src/linux/hc_init_protection.c", 70 "${os_adapter_path}/impl/src/linux/hc_thread.c", 71 "${os_adapter_path}/impl/src/linux/hc_types.c", 72 ] 73 sources += [ 74 "${tdd_framework_path}/common/src/hc_dev_info_mock.c", 75 "${tdd_framework_path}/common/src/os_account_adapter_mock.c", 76 ] 77 78 defines = [ 79 "DEV_AUTH_FUZZ_TEST", 80 "DEV_AUTH_HIVIEW_ENABLE", 81 ] 82 cflags = [ "-DHILOG_ENABLE" ] 83 cflags += [ 84 "-DDEV_AUTH_WORK_THREAD_STACK_SIZE=${device_auth_hichain_thread_stack_size}", 85 "-DMAX_AUTH_SESSION_COUNT=${max_auth_session_count}", 86 ] 87 88 external_deps = [ 89 "cJSON:cjson", 90 "c_utils:utils", 91 "dsoftbus:softbus_client", 92 "hilog:libhilog", 93 "hisysevent:libhisysevent", 94 "hitrace:hitrace_meter", 95 "huks:libhukssdk", 96 "mbedtls:mbedtls_shared", 97 "openssl:libcrypto_static", 98 ] 99} 100 101############################################################################### 102group("fuzztest") { 103 testonly = true 104 deps = [] 105 deps += [ 106 # deps file 107 ":CredsManagerFuzzTest", 108 ] 109} 110############################################################################### 111