1# Copyright (c) 2023-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 14#####################hydra-fuzz################### 15import("//build/config/features.gni") 16import("//build/test.gni") 17import("//foundation/communication/netmanager_ext/netmanager_ext_config.gni") 18##############################fuzztest########################################## 19EXT_SECURITY_PATH = "../../.." 20 21ohos_fuzztest("VpnClientFuzzTest") { 22 module_out_path = fuzz_test_path 23 fuzz_config_file = 24 "$NETMANAGER_EXT_ROOT/test/vpnmanager/fuzztest/vpnclient_fuzzer" 25 _cfi_blocklist_path = "$NETMANAGER_EXT_ROOT/test/vpnmanager/fuzztest/vpnclient_fuzzer/cfi_blocklist.txt" 26 27 include_dirs = [ 28 "$EXT_INNERKITS_ROOT/netvpnclient/include", 29 "$EXT_INNERKITS_ROOT/netvpnclient/include/ipc", 30 "$EXT_SECURITY_PATH/security", 31 "$NETMANAGER_EXT_ROOT/utils/log/include", 32 "$NETMANAGER_EXT_ROOT/utils/event_report/include", 33 "$VPNMANAGER_SOURCE_DIR/include", 34 "$VPNMANAGER_SOURCE_DIR/include/ipc", 35 "$BASE_INNERKITS_ROOT/netconnclient/include", 36 "$BASE_INNERKITS_ROOT/netconnclient/include/proxy", 37 ] 38 39 cflags = [ 40 "-g", 41 "-O0", 42 "-Wno-unused-variable", 43 "-fno-omit-frame-pointer", 44 "-flto", 45 "-fsanitize=cfi", 46 "-fsanitize-cfi-cross-dso", 47 "-fvisibility=hidden", 48 "-fsanitize-blacklist=" + rebase_path(_cfi_blocklist_path, root_build_dir), 49 ] 50 ldflags = [ 51 "-flto", 52 "-fsanitize=cfi", 53 "-fsanitize-cfi-cross-dso", 54 ] 55 56 sources = [ 57 "$EXT_SECURITY_PATH/security/netmanager_ext_test_security.cpp", 58 "vpnclient_fuzzer.cpp", 59 ] 60 61 deps = [ 62 "$EXT_INNERKITS_ROOT/netvpnclient:net_vpn_manager_if", 63 "$NETMANAGER_EXT_ROOT/services/vpnmanager:net_vpn_manager_static", 64 ] 65 66 external_deps = [ 67 "ability_runtime:app_manager", 68 "access_token:libaccesstoken_sdk", 69 "access_token:libnativetoken", 70 "access_token:libtoken_setproc", 71 "bundle_framework:appexecfwk_core", 72 "cJSON:cjson", 73 "c_utils:utils", 74 "ffrt:libffrt", 75 "hilog:libhilog", 76 "ipc:ipc_core", 77 "netmanager_base:net_manager_common", 78 "netmanager_base:netsys_controller", 79 "os_account:os_account_innerkits", 80 "safwk:system_ability_fwk", 81 ] 82 83 defines = [ 84 "NETMGR_LOG_TAG = \"NetVpnManager\"", 85 "LOG_DOMAIN = 0xD0015B0", 86 ] 87} 88 89group("fuzztest") { 90 testonly = true 91 deps = [ ":VpnClientFuzzTest" ] 92} 93