1# Copyright (c) 2024 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("DevAuthFuncFuzzTest") { 25 module_out_path = module_output_path 26 fuzz_config_file = "${deviceauth_path}/test/fuzztest/devauthfunc_fuzzer" 27 include_dirs = inc_path 28 include_dirs += hals_inc_path 29 30 include_dirs += [ 31 ".", 32 "../../unittest/deviceauth/include", 33 "../../unittest/deviceauth/unit_test/include", 34 "${dev_frameworks_path}/inc/permission_adapter", 35 "${dev_frameworks_path}/inc/hiview_adapter", 36 ] 37 38 sources = hal_common_files 39 sources -= [ "${common_lib_path}/impl/src/json_utils.c" ] 40 sources += [ 41 "${key_management_adapter_path}/impl/src/common/mbedtls_ec_adapter.c", 42 "${key_management_adapter_path}/impl/src/huks_adapter.c", 43 "${key_management_adapter_path}/impl/src/huks_adapter_utils.c", 44 "${key_management_adapter_path}/impl/src/standard/crypto_hash_to_point.c", 45 "${key_management_adapter_path}/impl/src/standard/huks_adapter_diff_impl.c", 46 "${os_adapter_path}/impl/src/hc_log.c", 47 "${os_adapter_path}/impl/src/linux/hc_condition.c", 48 "${os_adapter_path}/impl/src/linux/hc_file.c", 49 "${os_adapter_path}/impl/src/linux/hc_init_protection.c", 50 "${os_adapter_path}/impl/src/linux/hc_thread.c", 51 "${os_adapter_path}/impl/src/linux/hc_types.c", 52 "../../unittest/deviceauth/source/hc_dev_info_mock.c", 53 "../../unittest/deviceauth/source/json_utils_mock.c", 54 ] 55 56 sources += dev_frameworks_files 57 sources += deviceauth_common_files 58 sources += identity_service_mock_files 59 sources += group_database_manager_files 60 sources += ext_plugin_manager_files 61 sources += session_manager_files 62 sources += session_v1_files 63 sources += session_v2_files 64 sources += iso_protocol_files 65 sources += ec_speke_protocol_files 66 sources += auth_code_import_files 67 sources += pub_key_exchange_files 68 sources += save_trusted_info_files 69 sources += creds_manager_files 70 sources += broadcast_manager_files 71 sources += soft_bus_channel_mock_files 72 73 sources += group_auth_files 74 sources += group_auth_account_unrelated_files 75 76 sources += group_manager_files 77 sources += group_manager_peer_to_peer_files 78 79 sources += authenticators_p2p_files 80 sources += authenticators_p2p_iso_files 81 sources += authenticators_p2p_pake_files 82 sources += authenticators_standard_exchange_task_files 83 84 sources += account_related_files 85 86 sources += privacy_enhancement_files 87 sources += mk_agree_files 88 89 sources += security_label_adapter_files 90 91 sources -= [ 92 "${authenticators_path}/src/account_unrelated/iso_task/iso_task_main.c", 93 "${authenticators_path}/src/account_unrelated/pake_task/pake_v1_task/pake_v1_task_main.c", 94 ] 95 96 sources += [ 97 "${dev_frameworks_path}/src/account_task_manager_mock/account_task_manager_mock.c", 98 "${dev_frameworks_path}/src/plugin_adapter_mock/account_auth_plugin_proxy_mock.c", 99 "../../unittest/deviceauth/source/device_auth_ext_mock.c", 100 "../../unittest/deviceauth/source/os_account_adapter_mock.c", 101 "../../unittest/deviceauth/source/protocol_task_main_mock.c", 102 ] 103 defines = [ 104 "P2P_PAKE_DL_PRIME_LEN_384", 105 "P2P_PAKE_EC_TYPE", 106 "ENABLE_EC_SPEKE", 107 "ENABLE_ISO", 108 "ENABLE_AUTH_CODE_IMPORT", 109 "ENABLE_PUB_KEY_EXCHANGE", 110 "ENABLE_SAVE_TRUSTED_INFO", 111 "ENABLE_ACCOUNT_AUTH_ISO", 112 "ENABLE_ACCOUNT_AUTH_EC_SPEKE", 113 "ENABLE_P2P_BIND_ISO", 114 "ENABLE_P2P_BIND_EC_SPEKE", 115 "ENABLE_P2P_AUTH_ISO", 116 "ENABLE_P2P_AUTH_EC_SPEKE", 117 "DEV_AUTH_FUNC_TEST", 118 "ENABLE_PSEUDONYM", 119 ] 120 121 sources += identity_manager_files 122 include_dirs += identity_manager_inc 123 sources += [ "devauthfunc_fuzzer.cpp" ] 124 125 cflags = [ "-DHILOG_ENABLE" ] 126 cflags += [ 127 "-DDEV_AUTH_WORK_THREAD_STACK_SIZE=102400", 128 "-DMAX_AUTH_SESSION_COUNT=${max_auth_session_count}", 129 ] 130 131 external_deps = [ 132 "cJSON:cjson", 133 "c_utils:utils", 134 "hilog:libhilog", 135 "huks:libhukssdk", 136 "mbedtls:mbedtls_shared", 137 "openssl:libcrypto_static", 138 ] 139} 140 141############################################################################### 142group("fuzztest") { 143 testonly = true 144 deps = [] 145 deps += [ 146 # deps file 147 ":DevAuthFuncFuzzTest", 148 ] 149} 150############################################################################### 151