1# Copyright (C) 2021-2023 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("//base/security/huks/build/config.gni") 15import("//build/ohos.gni") 16 17config("huks_config") { 18 include_dirs = [ 19 "include", 20 "ipc/include", 21 "sysinfo/include", 22 ] 23} 24 25if (os_level == "standard") { 26 ohos_static_library("libhuks_mem_standard_static") { 27 subsystem_name = "security" 28 part_name = "huks" 29 public_configs = [ ":huks_config" ] 30 include_dirs = [ "../common/include" ] 31 sources = [ "./posix/hks_mem.c" ] 32 33 complete_static_lib = true 34 35 branch_protector_ret = "pac_ret" 36 37 sanitize = { 38 integer_overflow = true 39 cfi = true 40 debug = false 41 cfi_cross_dso = true 42 boundary_sanitize = true 43 ubsan = true 44 } 45 46 external_deps = [ 47 "bounds_checking_function:libsec_shared", 48 "c_utils:utils", 49 ] 50 51 configs = [ 52 "//base/security/huks/frameworks/config/build:l2_standard_common_config", 53 ] 54 } 55 56 ohos_static_library("libhuks_util_standard_static") { 57 subsystem_name = "security" 58 part_name = "huks" 59 public_configs = [ ":huks_config" ] 60 include_dirs = [ "../common/include" ] 61 sources = [ "./posix/hks_util.c" ] 62 63 complete_static_lib = true 64 65 branch_protector_ret = "pac_ret" 66 67 sanitize = { 68 integer_overflow = true 69 cfi = true 70 debug = false 71 cfi_cross_dso = true 72 boundary_sanitize = true 73 ubsan = true 74 } 75 76 configs = [ 77 "//base/security/huks/frameworks/config/build:l2_standard_common_config", 78 ] 79 } 80 81 ohos_static_library("libhuks_os_dependency_standard_static") { 82 subsystem_name = "security" 83 part_name = "huks" 84 public_configs = [ ":huks_config" ] 85 86 sources = [ 87 "./ipc/src/hks_client_ipc_serialization.c", 88 "./ipc/src/hks_ipc_check.c", 89 "./ipc/src/hks_ipc_slice.c", 90 "./ipc/src/hks_request.cpp", 91 92 # both client side and server side will include hks_sa_interface.cpp 93 "../../../../services/huks_standard/huks_service/main/os_dependency/sa/hks_sa_interface.cpp", 94 ] 95 96 if (huks_security_level == "software") { 97 defines = [ "HKS_UNTRUSTED_RUNNING_ENV" ] 98 } 99 100 include_dirs = [ 101 # hks_sa_interface.cpp will include hks_sa_interface.h which is in the following directory. 102 "../../../../services/huks_standard/huks_service/main/os_dependency/sa", 103 ] 104 105 if (huks_use_rkc_in_standard) { 106 sources += [ 107 "./sysinfo/src/hks_get_process_info_passthrough.c", 108 "./sysinfo/src/hks_get_udid.c", 109 ] 110 } 111 112 deps = [ "//base/security/huks/frameworks/huks_standard/main/common:libhuks_common_standard_static" ] 113 114 complete_static_lib = true 115 116 branch_protector_ret = "pac_ret" 117 118 sanitize = { 119 integer_overflow = true 120 cfi = true 121 debug = false 122 cfi_cross_dso = true 123 boundary_sanitize = true 124 ubsan = true 125 } 126 127 sources += [ "./ipc/src/hks_client_service_ipc.c" ] 128 configs = [ 129 "//base/security/huks/frameworks/config/build:l2_standard_common_config", 130 ] 131 external_deps = [ 132 "c_utils:utils", 133 "hilog:libhilog", 134 "ipc:ipc_single", 135 "samgr:samgr_proxy", 136 ] 137 } 138} else { 139 ohos_static_library("libhuks_os_dependency_small_static") { 140 public_configs = [ ":huks_config" ] 141 142 sources = [ 143 "./posix/hks_mem.c", 144 "./posix/hks_util.c", 145 ] 146 147 deps = [ "//base/security/huks/frameworks/huks_standard/main/common:libhuks_common_small_static" ] 148 149 complete_static_lib = true 150 151 sources += [ 152 "./sysinfo/src/hks_get_process_info_passthrough.c", 153 "./sysinfo/src/hks_get_udid.c", 154 ] 155 configs = [ 156 "//base/security/huks/frameworks/config/build:l1_small_common_config", 157 ] 158 external_deps = [ 159 "hilog_lite:hilog_shared", 160 "init:libbegetutil", 161 ] 162 } 163} 164