1# Copyright (c) 2022 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/device_security_level/common/dslm.gni") 15import("//build/ohos.gni") 16 17config("device_security_level_sdk_config") { 18 include_dirs = [ "include" ] 19} 20 21group("fwk_group") { 22 if (os_level == "standard") { 23 deps = [ ":dslm_sdk" ] 24 } else if (os_level == "small") { 25 deps = [ ":dslm_sdk_small" ] 26 } else if (os_level == "mini") { 27 deps = [ ":dslm_sdk_mini" ] 28 } 29} 30 31if (defined(ohos_lite)) { 32 if (ohos_kernel_type == "linux" || ohos_kernel_type == "liteos_a") { 33 ohos_shared_library("dslm_sdk_small") { 34 sources = [ 35 "src/lite/device_security_info.c", 36 "src/lite/small/device_security_level_proxy.c", 37 ] 38 39 include_dirs = [ 40 "src/lite/include", 41 "src/lite/small", 42 "../../services/include", 43 "../../common/include", 44 ] 45 46 configs = [ 47 "../../common:common_configs", 48 "../../common:common_lite_configs", 49 ] 50 51 public_configs = [ ":device_security_level_sdk_config" ] 52 53 deps = [ 54 "$dslm_hilog_path/featured:hilog_shared", 55 "$dslm_ipc_path/interfaces/innerkits/c/ipc:ipc_single", 56 "$dslm_samgr_path/samgr_lite/samgr:samgr", 57 "../../baselib/utils:utils_static", 58 ] 59 60 part_name = "device_security_level" 61 subsystem_name = "security" 62 } 63 group("dslm_sdk") { 64 } 65 } else if (ohos_kernel_type == "liteos_m") { 66 ohos_static_library("dslm_sdk_mini") { 67 sources = [ 68 "src/lite/device_security_info.c", 69 "src/lite/mini/device_security_level_inner.c", 70 ] 71 72 include_dirs = [ 73 "src/lite/include", 74 "src/lite/mini", 75 "../../common/include", 76 "../../interfaces/inner_api/src/lite", 77 "../../services/include", 78 "../../services/sa/lite/mini", 79 ] 80 81 configs = [ 82 "../../common:common_configs", 83 "../../common:common_lite_configs", 84 ] 85 86 public_configs = [ ":device_security_level_sdk_config" ] 87 88 deps = [ 89 "$dslm_hilog_path/featured:hilog_static", 90 "$dslm_samgr_path/samgr_lite/samgr:samgr", 91 "../../baselib/utils:utils_static", 92 ] 93 94 part_name = "device_security_level" 95 subsystem_name = "security" 96 } 97 group("dslm_sdk") { 98 } 99 } 100} else { 101 ohos_shared_library("dslm_sdk") { 102 sanitize = { 103 integer_overflow = true 104 ubsan = true 105 boundary_sanitize = true 106 cfi = true 107 cfi_cross_dso = true 108 blocklist = "../../cfi_blocklist.txt" 109 } 110 branch_protector_ret = "pac_ret" 111 112 sources = [ 113 "src/standard/device_security_info.cpp", 114 "src/standard/device_security_level_callback_helper.cpp", 115 "src/standard/device_security_level_callback_stub.cpp", 116 "src/standard/device_security_level_loader.cpp", 117 "src/standard/device_security_level_proxy.cpp", 118 ] 119 120 include_dirs = [ 121 "../../services/include", 122 "../../common/include", 123 ] 124 125 configs = [ "../../common:common_configs" ] 126 127 public_configs = [ ":device_security_level_sdk_config" ] 128 129 external_deps = [ 130 "c_utils:utils", 131 "hilog:libhilog", 132 "ipc:ipc_core", 133 "samgr:samgr_proxy", 134 ] 135 136 part_name = "device_security_level" 137 subsystem_name = "security" 138 } 139} 140