# Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import("//base/security/certificate_manager/cert_manager.gni")
import("//build/ohos.gni")

config("cert_manager_config") {
  include_dirs = [ "include" ]
}

ohos_static_library("libcert_manager_common_standard_static") {
  subsystem_name = "security"
  part_name = "certificate_manager"
  branch_protector_ret = "pac_ret"
  sanitize = {
    cfi = true
    cfi_cross_dso = true
    boundary_sanitize = true
    debug = false
    integer_overflow = true
    ubsan = true
    stack_protector_ret = true
  }

  public_configs =
      [ ":cert_manager_config" ]  # Share include files for other gn when deps.

  include_dirs = [ "${cert_manager_root_dir}/interfaces/innerkits/cert_manager_standard/main/include" ]
  sources = [
    "src/cm_advsecmode_check.c",
    "src/cm_param.c",
    "src/cm_pfx.c",
    "src/cm_util.c",
    "src/cm_x509.c",
    "src/cm_type_free.c",
    "src/cm_ipc_response_type.cpp",
    "src/cm_data_parcel_processor.cpp",
    "src/cm_ukey_data_parcel_strategy.cpp",
  ]

  external_deps = [
    "c_utils:utils",
    "init:libbegetutil",
    "openssl:libcrypto_shared",
    "bounds_checking_function:libsec_shared",
    "ipc:ipc_single",
  ]
  cflags = [
    "-Wall",
    "-Werror",
  ]
  complete_static_lib = true
}