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 14import("//build/ohos.gni") 15import("//foundation/communication/netstack/netstack_config.gni") 16 17config("net_ssl_config") { 18 include_dirs = [ "$NETSTACK_DIR/interfaces/innerkits/net_ssl/include" ] 19 20 cflags = [] 21 if (is_double_framework) { 22 cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ] 23 } 24 if (target_cpu == "arm") { 25 cflags += [ "-DBINDER_IPC_32BIT" ] 26 } 27 if (is_standard_system) { 28 cflags += [ "-DCONFIG_STANDARD_SYSTEM" ] 29 } 30 if (defined(build_public_version) && build_public_version) { 31 cflags += [ "-DBUILD_PUBLIC_VERSION" ] 32 } 33 34 if (is_mingw) { 35 defines = [ "WINDOWS_PLATFORM" ] 36 } else if (is_mac) { 37 defines = [ "MAC_PLATFORM" ] 38 } 39} 40 41ohos_shared_library("net_ssl") { 42 sanitize = { 43 cfi = true 44 cfi_cross_dso = true 45 debug = false 46 } 47 48 branch_protector_ret = "pac_ret" 49 50 sources = [ 51 "$NETSTACK_NATIVE_ROOT/net_ssl/net_ssl.cpp", 52 "$NETSTACK_NATIVE_ROOT/net_ssl/net_ssl_verify_cert.cpp", 53 ] 54 55 include_dirs = [ 56 "$SUBSYSTEM_DIR/ipc/interfaces/innerkits/ipc_core/include", 57 "$THIRD_PARTY_ROOT/openssl/include", 58 "$NETSTACK_NATIVE_ROOT/net_ssl/include", 59 "$NETSTACK_DIR/utils/log/include", 60 ] 61 cflags = [ 62 "-fstack-protector-strong", 63 "-D_FORTIFY_SOURCE=2", 64 "-O2", 65 ] 66 cflags_cc = [ 67 "-fstack-protector-strong", 68 "-D_FORTIFY_SOURCE=2", 69 "-O2", 70 ] 71 72 version_script = "libnet_ssl.map" 73 74 public_configs = [ ":net_ssl_config" ] 75 76 external_deps = [ 77 "bounds_checking_function:libsec_shared", 78 "hilog:libhilog", 79 "ipc:ipc_core", 80 "openssl:libcrypto_shared", 81 "openssl:libssl_shared", 82 ] 83 84 innerapi_tags = [ "platformsdk" ] 85 part_name = "netstack" 86 subsystem_name = "communication" 87} 88