• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
53  defines += [ "MBEDTLS_ALLOW_PRIVATE_ACCESS" ]
54  defines += [ "OPENSSL_SUPPRESS_DEPRECATED" ]
55}
56
57ohos_prebuilt_etc("network_config.json") {
58  source = "network_config.json"
59  relative_install_dir = "device_attest"
60  subsystem_name = "xts"
61  part_name = "device_attest"
62}
63
64ohos_shared_library("devattest_core") {
65  version_script = "libdevattest_core.map"
66
67  sanitize = {
68    cfi = true
69    cfi_cross_dso = true
70    debug = false
71  }
72
73  branch_protector_ret = "pac_ret"
74
75  sources = sources_common
76
77  configs = [ ":devattest_core_config" ]
78
79  deps = core_deps
80
81  deps += [ ":network_config.json" ]
82
83  external_deps = core_external_deps
84
85  subsystem_name = "xts"
86  part_name = "device_attest"
87}
88