11e934351Sopenharmony_ci# Copyright (c) 2023-2024 Huawei Device Co., Ltd.
21e934351Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License");
31e934351Sopenharmony_ci# you may not use this file except in compliance with the License.
41e934351Sopenharmony_ci# You may obtain a copy of the License at
51e934351Sopenharmony_ci#
61e934351Sopenharmony_ci#     http://www.apache.org/licenses/LICENSE-2.0
71e934351Sopenharmony_ci#
81e934351Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software
91e934351Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS,
101e934351Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
111e934351Sopenharmony_ci# See the License for the specific language governing permissions and
121e934351Sopenharmony_ci# limitations under the License.
131e934351Sopenharmony_ci
141e934351Sopenharmony_ciimport("//build/ohos.gni")
151e934351Sopenharmony_ciimport("//foundation/communication/netstack/netstack_config.gni")
161e934351Sopenharmony_ci
171e934351Sopenharmony_ciconfig("net_ssl_config") {
181e934351Sopenharmony_ci  include_dirs = [ "$NETSTACK_DIR/interfaces/innerkits/net_ssl/include" ]
191e934351Sopenharmony_ci
201e934351Sopenharmony_ci  cflags = []
211e934351Sopenharmony_ci  if (is_double_framework) {
221e934351Sopenharmony_ci    cflags += [ "-DCONFIG_DUAL_FRAMEWORK" ]
231e934351Sopenharmony_ci  }
241e934351Sopenharmony_ci  if (target_cpu == "arm") {
251e934351Sopenharmony_ci    cflags += [ "-DBINDER_IPC_32BIT" ]
261e934351Sopenharmony_ci  }
271e934351Sopenharmony_ci  if (is_standard_system) {
281e934351Sopenharmony_ci    cflags += [ "-DCONFIG_STANDARD_SYSTEM" ]
291e934351Sopenharmony_ci  }
301e934351Sopenharmony_ci  if (defined(build_public_version) && build_public_version) {
311e934351Sopenharmony_ci    cflags += [ "-DBUILD_PUBLIC_VERSION" ]
321e934351Sopenharmony_ci  }
331e934351Sopenharmony_ci
341e934351Sopenharmony_ci  if (is_mingw) {
351e934351Sopenharmony_ci    defines = [ "WINDOWS_PLATFORM" ]
361e934351Sopenharmony_ci  } else if (is_mac) {
371e934351Sopenharmony_ci    defines = [ "MAC_PLATFORM" ]
381e934351Sopenharmony_ci  }
391e934351Sopenharmony_ci}
401e934351Sopenharmony_ci
411e934351Sopenharmony_ciohos_shared_library("net_ssl") {
421e934351Sopenharmony_ci  sanitize = {
431e934351Sopenharmony_ci    cfi = true
441e934351Sopenharmony_ci    cfi_cross_dso = true
451e934351Sopenharmony_ci    debug = false
461e934351Sopenharmony_ci  }
471e934351Sopenharmony_ci
481e934351Sopenharmony_ci  branch_protector_ret = "pac_ret"
491e934351Sopenharmony_ci
501e934351Sopenharmony_ci  sources = [
511e934351Sopenharmony_ci    "$NETSTACK_NATIVE_ROOT/net_ssl/net_ssl.cpp",
521e934351Sopenharmony_ci    "$NETSTACK_NATIVE_ROOT/net_ssl/net_ssl_verify_cert.cpp",
531e934351Sopenharmony_ci  ]
541e934351Sopenharmony_ci
551e934351Sopenharmony_ci  include_dirs = [
561e934351Sopenharmony_ci    "$SUBSYSTEM_DIR/ipc/interfaces/innerkits/ipc_core/include",
571e934351Sopenharmony_ci    "$THIRD_PARTY_ROOT/openssl/include",
581e934351Sopenharmony_ci    "$NETSTACK_NATIVE_ROOT/net_ssl/include",
591e934351Sopenharmony_ci    "$NETSTACK_DIR/utils/log/include",
601e934351Sopenharmony_ci  ]
611e934351Sopenharmony_ci  cflags = [
621e934351Sopenharmony_ci    "-fstack-protector-strong",
631e934351Sopenharmony_ci    "-D_FORTIFY_SOURCE=2",
641e934351Sopenharmony_ci    "-O2",
651e934351Sopenharmony_ci  ]
661e934351Sopenharmony_ci  cflags_cc = [
671e934351Sopenharmony_ci    "-fstack-protector-strong",
681e934351Sopenharmony_ci    "-D_FORTIFY_SOURCE=2",
691e934351Sopenharmony_ci    "-O2",
701e934351Sopenharmony_ci  ]
711e934351Sopenharmony_ci
721e934351Sopenharmony_ci  version_script = "libnet_ssl.map"
731e934351Sopenharmony_ci
741e934351Sopenharmony_ci  public_configs = [ ":net_ssl_config" ]
751e934351Sopenharmony_ci
761e934351Sopenharmony_ci  external_deps = [
771e934351Sopenharmony_ci    "bounds_checking_function:libsec_shared",
781e934351Sopenharmony_ci    "hilog:libhilog",
791e934351Sopenharmony_ci    "ipc:ipc_core",
801e934351Sopenharmony_ci    "openssl:libcrypto_shared",
811e934351Sopenharmony_ci    "openssl:libssl_shared",
821e934351Sopenharmony_ci  ]
831e934351Sopenharmony_ci
841e934351Sopenharmony_ci  innerapi_tags = [ "platformsdk" ]
851e934351Sopenharmony_ci  part_name = "netstack"
861e934351Sopenharmony_ci  subsystem_name = "communication"
871e934351Sopenharmony_ci}
88