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") 16 17sources_common = [ 18 "attest_entry.c", 19 "adapter/attest_adapter.c", 20 "adapter/attest_adapter_os.c", 21 "adapter/attest_adapter_oem.c", 22 "adapter/attest_adapter_mock.c", 23 "attest/attest_service.c", 24 "attest/attest_service_auth.c", 25 "attest/attest_service_active.c", 26 "attest/attest_service_challenge.c", 27 "attest/attest_service_reset.c", 28 "attest/attest_service_device.c", 29 "network/attest_network.c", 30 "security/attest_security.c", 31 "security/attest_security_token.c", 32 "security/attest_security_ticket.c", 33 "utils/attest_utils_file.c", 34 "utils/attest_utils_json.c", 35 "utils/attest_utils_log.c", 36 "utils/attest_utils_timer.c", 37 "utils/attest_utils_list.c", 38 "utils/attest_utils.c", 39] 40 41if (enable_attest_debug_memory_leak) { 42 sources_common += [ "utils/attest_utils_memleak.c" ] 43} 44 45if (enable_attest_debug_dfx) { 46 sources_common += [ "dfx/attest_dfx.c" ] 47} 48 49config("devattest_core_config") { 50 visibility = [ ":*" ] 51 cflags = [ "-Wall" ] 52 include_dirs = [ 53 "include", 54 "${devattest_path}/services/core/include/adapter", 55 "${devattest_path}/services/core/include/attest", 56 "${devattest_path}/services/core/include/dfx", 57 "${devattest_path}/services/core/include/security", 58 "${devattest_path}/services/core/include/network", 59 "${devattest_path}/services/core/include/utils", 60 ] 61 62 defines = [ "ATTEST_HILOG_LEVEL = 1" ] 63 64 if (enable_attest_test_mock_network) { 65 defines += [ "__ATTEST_MOCK_NETWORK_STUB__" ] 66 } 67 if (enable_attest_test_mock_device) { 68 defines += [ "__ATTEST_MOCK_DEVICE_STUB__" ] 69 } 70 if (enable_attest_debug_memory_leak) { 71 defines += [ "__ATTEST_DEBUG_MEMORY_LEAK__" ] 72 } 73 if (enable_attest_network_debug_log) { 74 defines += [ "__ATTEST_NETWORK_DEBUG_LOG__" ] 75 } 76 77 defines += [ "MBEDTLS_ALLOW_PRIVATE_ACCESS" ] 78} 79 80ohos_prebuilt_etc("network_config.json") { 81 source = "network_config.json" 82 relative_install_dir = "device_attest" 83 subsystem_name = "xts" 84 part_name = "device_attest" 85} 86 87ohos_shared_library("devattest_core") { 88 sources = sources_common 89 90 configs = [ ":devattest_core_config" ] 91 92 deps = [ 93 "${devattest_path}/services/oem_adapter:device_attest_oem_adapter", 94 "//third_party/cJSON:cjson", 95 "//third_party/mbedtls:mbedtls_shared", 96 "//third_party/openssl:libcrypto_shared", 97 "//third_party/openssl:libssl_shared", 98 ] 99 100 deps += [ ":network_config.json" ] 101 102 external_deps = [ 103 "c_utils:utils", 104 "hiviewdfx_hilog_native:libhilog", 105 "init:libbegetutil", 106 "syscap_codec:syscap_interface_shared", 107 ] 108 109 subsystem_name = "xts" 110 part_name = "device_attest" 111} 112