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 "//base/security/huks/interfaces/inner_api/huks_standard/main/include", 21 ] 22} 23 24if (os_level == "standard") { 25 ohos_static_library("libhuks_common_standard_static") { 26 defines = [ "L2_STANDARD" ] 27 subsystem_name = "security" 28 part_name = "huks" 29 30 public_configs = 31 [ ":huks_config" ] # Share include files for other gn when deps. 32 33 include_dirs = [ 34 "//base/security/huks/frameworks/huks_standard/main/crypto_engine/openssl/include", 35 "//base/security/huks/interfaces/inner_api/huks_standard/main/include", 36 ] 37 38 sources = [ 39 "src/hks_ability.c", 40 "src/hks_base_check.c", 41 "src/hks_check_paramset.c", 42 "src/hks_common_check.c", 43 "src/hks_crypto_adapter.c", 44 "src/hks_param.c", 45 "src/hks_tags_type_manager.c", 46 ] 47 48 complete_static_lib = true 49 50 branch_protector_ret = "pac_ret" 51 52 sanitize = { 53 integer_overflow = true 54 cfi = true 55 debug = false 56 cfi_cross_dso = true 57 boundary_sanitize = true 58 ubsan = true 59 } 60 configs = [ 61 "//base/security/huks/frameworks/config/build:l2_standard_common_config", 62 ] 63 sources += [ "src/hks_errcode_adapter.c" ] 64 external_deps = [ 65 "c_utils:utils", 66 "hilog:libhilog", 67 ] 68 } 69} else { 70 ohos_static_library("libhuks_common_small_static") { 71 defines = [ "_HUKS_LOG_ENABLE_" ] 72 public_configs = 73 [ ":huks_config" ] # Share include files for other gn when deps. 74 75 include_dirs = [ 76 "//base/security/huks/interfaces/inner_api/huks_standard/main/include", 77 ] 78 79 sources = [ 80 "src/hks_ability.c", 81 "src/hks_base_check.c", 82 "src/hks_check_paramset.c", 83 "src/hks_common_check.c", 84 "src/hks_crypto_adapter.c", 85 "src/hks_param.c", 86 "src/hks_tags_type_manager.c", 87 ] 88 89 cflags = [] 90 91 complete_static_lib = true 92 cflags += [ "-DHUKS_UID_TRUST_LIST=${huks_uid_trust_list_define}" ] 93 94 external_deps = [ "hilog_lite:hilog_shared" ] 95 96 configs = [ 97 "//base/security/huks/frameworks/config/build:l1_small_common_config", 98 ] 99 100 if (huks_enable_upgrade_small_to_service) { 101 sources += [ "src/hks_check_trust_list.c" ] 102 } 103 } 104} 105