# Copyright (C) 2021-2023 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/huks/build/config.gni") import("//build/ohos.gni") config("huks_config") { include_dirs = [ "include", "ipc/include", "sysinfo/include", ] } if (os_level == "standard") { ohos_static_library("libhuks_mem_standard_static") { subsystem_name = "security" part_name = "huks" public_configs = [ ":huks_config" ] include_dirs = [ "../common/include" ] sources = [ "./posix/hks_mem.c" ] complete_static_lib = true branch_protector_ret = "pac_ret" sanitize = { integer_overflow = true cfi = true debug = false cfi_cross_dso = true boundary_sanitize = true ubsan = true } external_deps = [ "bounds_checking_function:libsec_shared", "c_utils:utils", ] configs = [ "//base/security/huks/frameworks/config/build:l2_standard_common_config", ] } ohos_static_library("libhuks_util_standard_static") { subsystem_name = "security" part_name = "huks" public_configs = [ ":huks_config" ] include_dirs = [ "../common/include" ] sources = [ "./posix/hks_util.c" ] complete_static_lib = true branch_protector_ret = "pac_ret" sanitize = { integer_overflow = true cfi = true debug = false cfi_cross_dso = true boundary_sanitize = true ubsan = true } configs = [ "//base/security/huks/frameworks/config/build:l2_standard_common_config", ] } ohos_static_library("libhuks_os_dependency_standard_static") { subsystem_name = "security" part_name = "huks" public_configs = [ ":huks_config" ] sources = [ "./ipc/src/hks_client_ipc_serialization.c", "./ipc/src/hks_ipc_check.c", "./ipc/src/hks_ipc_slice.c", "./ipc/src/hks_request.cpp", # both client side and server side will include hks_sa_interface.cpp "../../../../services/huks_standard/huks_service/main/os_dependency/sa/hks_sa_interface.cpp", ] if (huks_security_level == "software") { defines = [ "HKS_UNTRUSTED_RUNNING_ENV" ] } include_dirs = [ # hks_sa_interface.cpp will include hks_sa_interface.h which is in the following directory. "../../../../services/huks_standard/huks_service/main/os_dependency/sa", ] if (huks_use_rkc_in_standard) { sources += [ "./sysinfo/src/hks_get_process_info_passthrough.c", "./sysinfo/src/hks_get_udid.c", ] } deps = [ "//base/security/huks/frameworks/huks_standard/main/common:libhuks_common_standard_static" ] complete_static_lib = true branch_protector_ret = "pac_ret" sanitize = { integer_overflow = true cfi = true debug = false cfi_cross_dso = true boundary_sanitize = true ubsan = true } sources += [ "./ipc/src/hks_client_service_ipc.c" ] configs = [ "//base/security/huks/frameworks/config/build:l2_standard_common_config", ] external_deps = [ "c_utils:utils", "hilog:libhilog", "ipc:ipc_single", "samgr:samgr_proxy", ] } } else { ohos_static_library("libhuks_os_dependency_small_static") { public_configs = [ ":huks_config" ] sources = [ "./posix/hks_mem.c", "./posix/hks_util.c", ] deps = [ "//base/security/huks/frameworks/huks_standard/main/common:libhuks_common_small_static" ] complete_static_lib = true sources += [ "./sysinfo/src/hks_get_process_info_passthrough.c", "./sysinfo/src/hks_get_udid.c", ] configs = [ "//base/security/huks/frameworks/config/build:l1_small_common_config", ] external_deps = [ "hilog_lite:hilog_shared", "init:libbegetutil", ] } }