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
14#####################hydra-fuzz###################
15import("//build/config/features.gni")
16import("//build/ohos.gni")
17import("//build/test.gni")
18import("//foundation/communication/netstack/netstack_config.gni")
19
20##############################fuzztest##########################################
21
22utils_include = [
23  "$SUBSYSTEM_DIR/netstack/utils/common_utils/include",
24  "$SUBSYSTEM_DIR/netstack/utils/log/include",
25  "$SUBSYSTEM_DIR/netstack/utils/napi_utils/include",
26]
27
28common_external_deps = [
29  "c_utils:utils",
30  "eventhandler:libeventhandler",
31  "hilog:libhilog",
32  "ipc:ipc_core",
33  "netmanager_base:net_conn_manager_if",
34  "openssl:libcrypto_shared",
35  "openssl:libssl_shared",
36]
37
38ohos_fuzztest("NetsslInnerFuzzTest") {
39  module_out_path = fuzz_test_path
40  fuzz_config_file = "$NETSTACK_DIR/test/fuzztest/netsslinner_fuzzer"
41  include_dirs = [
42    "$NETSTACK_DIR/utils/napi_utils/include",
43    "$NETSTACK_DIR/interfaces/kits/c/net_ssl/include",
44    "$NETSTACK_DIR/frameworks/native/net_ssl/include",
45  ]
46  include_dirs += utils_include
47
48  cflags = [
49    "-g",
50    "-O0",
51    "-Wno-unused-variable",
52    "-fno-omit-frame-pointer",
53  ]
54
55  sources = [
56    "$NETSTACK_DIR/frameworks/native/net_ssl/net_ssl_verify_cert.cpp",
57    "$NETSTACK_DIR/interfaces/kits/c/net_ssl/src/net_ssl_c.cpp",
58    "$SUBSYSTEM_DIR/netstack/utils/common_utils/src/netstack_common_utils.cpp",
59    "netssl_inner_fuzzer.cpp",
60  ]
61
62  deps = [
63    "$NETSTACK_DIR/interfaces/kits/c/net_ssl:net_ssl_ndk",
64    "$NETSTACK_DIR/utils/napi_utils:napi_utils",
65    "$NETSTACK_INNERKITS_DIR/net_ssl:net_ssl",
66  ]
67
68  external_deps = common_external_deps
69}
70
71###############################################################################
72group("fuzztest") {
73  testonly = true
74
75  deps = [ ":NetsslInnerFuzzTest" ]
76}
77###############################################################################
78