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("//build/ohos.gni") 15import("//test/xts/device_attest/build/devattestconfig.gni") 16import("attestsource.gni") 17 18sources_common = sources_notmock 19sources_common += sources_mock 20 21if (enable_attest_debug_memory_leak) { 22 sources_common += [ "utils/attest_utils_memleak.c" ] 23} 24 25if (enable_attest_debug_dfx) { 26 sources_common += [ "dfx/attest_dfx.c" ] 27} 28 29config("devattest_core_config") { 30 visibility = [ ":*" ] 31 cflags = [ "-Wall" ] 32 include_dirs = include_core_dirs 33 34 if (enable_attest_common_debug) { 35 defines = [ "ATTEST_HILOG_LEVEL = 0" ] 36 } else { 37 defines = [ "ATTEST_HILOG_LEVEL = 1" ] 38 } 39 40 if (enable_attest_test_mock_network) { 41 defines += [ "__ATTEST_MOCK_NETWORK_STUB__" ] 42 } 43 if (enable_attest_test_mock_device) { 44 defines += [ "__ATTEST_MOCK_DEVICE_STUB__" ] 45 } 46 if (enable_attest_debug_memory_leak) { 47 defines += [ "__ATTEST_DEBUG_MEMORY_LEAK__" ] 48 } 49 if (enable_attest_network_debug_log) { 50 defines += [ "__ATTEST_NETWORK_DEBUG_LOG__" ] 51 } 52 if (disable_attest_active_site) { 53 defines += [ "__ATTEST_DISABLE_SITE__" ] 54 } 55 if (enable_attest_preset_token) { 56 defines += [ "__ATTEST_ENABLE_PRESET_TOKEN__" ] 57 } 58 59 defines += [ "MBEDTLS_ALLOW_PRIVATE_ACCESS" ] 60 defines += [ "OPENSSL_SUPPRESS_DEPRECATED" ] 61} 62 63ohos_shared_library("devattest_core") { 64 version_script = "libdevattest_core.map" 65 66 sanitize = { 67 cfi = true 68 cfi_cross_dso = true 69 debug = false 70 } 71 72 branch_protector_ret = "pac_ret" 73 74 sources = sources_common 75 76 configs = [ ":devattest_core_config" ] 77 78 deps = core_deps 79 80 external_deps = core_external_deps 81 82 subsystem_name = "xts" 83 part_name = "device_attest" 84} 85