• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (C) 2021-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
14if (defined(ohos_lite)) {
15  import("//build/lite/config/component/lite_component.gni")
16} else {
17  import("//build/ohos.gni")
18}
19import("deviceauth_hals.gni")
20
21if (defined(ohos_lite)) {
22  if (ohos_kernel_type == "liteos_m") {
23    static_library("deviceauth_hal_liteos") {
24      include_dirs = hals_inc_path
25      include_dirs += [
26        "//base/security/device_auth/interfaces/innerkits",
27        "//third_party/cJSON",
28        "//commonlibrary/utils_lite/include",
29        "//base/hiviewdfx/hilog_lite/interfaces/native/kits/hilog_lite",
30        "//commonlibrary/utils_lite/memory/include",
31        "//base/startup/init/interfaces/innerkits/include/syspara",
32      ]
33
34      sources = hal_common_files
35      sources += [
36        "${key_management_adapter_path}/impl/src/mini/huks_adapter.c",
37        "${os_adapter_path}/impl/src/liteos/hc_condition.c",
38        "${os_adapter_path}/impl/src/liteos/hc_dev_info.c",
39        "${os_adapter_path}/impl/src/liteos/hc_thread.c",
40        "${os_adapter_path}/impl/src/liteos/hc_types.c",
41        "${os_adapter_path}/impl/src/liteos/mini/hc_init_protection.c",
42      ]
43
44      if (enable_posix_interface) {
45        sources += [ "${os_adapter_path}/impl/src/liteos/mini/hc_file_posix.c" ]
46      } else {
47        sources += [ "${os_adapter_path}/impl/src/liteos/mini/hc_file.c" ]
48      }
49
50      cflags = [ "-DHILOG_ENABLE" ]
51      cflags += [ "-DAUTH_STORAGE_PATH=\"${deviceauth_storage_path}\"" ]
52      if (board_toolchain_type == "iccarm") {
53        cflags += [
54          "--diag_suppress",
55          "Pe223,Pe226",
56        ]
57      }
58      deps = [
59        "//base/security/huks/interfaces/innerkits/huks_lite:huks_3.0_sdk",
60        "//base/startup/init/interfaces/innerkits:libbegetutil",
61        "//build/lite/config/component/cJSON:cjson_shared",
62        "//commonlibrary/utils_lite:utils",
63      ]
64    }
65  } else {
66    static_library("deviceauth_hal_linux") {
67      include_dirs = hals_inc_path
68      include_dirs += [
69        "//base/security/device_auth/interfaces/innerkits",
70        "//third_party/cJSON",
71        "//commonlibrary/utils_lite/include",
72        "//base/security/huks/interfaces/innerkits/huks_standard/main/include",
73        "//base/hiviewdfx/hilog_lite/interfaces/native/innerkits/hilog",
74        "//third_party/bounds_checking_function/include",
75        "//base/startup/init/interfaces/innerkits/include/syspara",
76        "//third_party/mbedtls/include",
77      ]
78
79      sources = hal_common_files
80      sources += [
81        "${key_management_adapter_path}/impl/src/small/huks_adapter.c",
82        "${key_management_adapter_path}/impl/src/small/mbedtls_ec_adapter.c",
83        "${os_adapter_path}/impl/src/hc_log.c",
84        "${os_adapter_path}/impl/src/linux/hc_condition.c",
85        "${os_adapter_path}/impl/src/linux/hc_dev_info.c",
86        "${os_adapter_path}/impl/src/linux/hc_file.c",
87        "${os_adapter_path}/impl/src/linux/hc_init_protection.c",
88        "${os_adapter_path}/impl/src/linux/hc_thread.c",
89        "${os_adapter_path}/impl/src/linux/hc_types.c",
90      ]
91
92      cflags = [ "-DHILOG_ENABLE" ]
93      defines = [ "LITE_DEVICE" ]
94      deps = [
95        "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared",
96        "//base/security/huks/interfaces/innerkits/huks_lite:huks_3.0_sdk",
97        "//base/startup/init/interfaces/innerkits:libbegetutil",
98        "//build/lite/config/component/cJSON:cjson_shared",
99        "//build/lite/config/component/openssl:openssl_shared",
100        "//commonlibrary/utils_lite:utils",
101        "//third_party/bounds_checking_function:libsec_shared",
102        "//third_party/mbedtls:mbedtls_shared",
103      ]
104    }
105  }
106} else {
107  ohos_static_library("deviceauth_hal_linux") {
108    subsystem_name = "security"
109    include_dirs = hals_inc_path
110    include_dirs += [
111      "//third_party/cJSON",
112      "//commonlibrary/c_utils/base/include",
113      "//third_party/openssl/include/",
114      "//base/security/huks/interfaces/innerkits/huks_standard/main/include",
115      "//third_party/mbedtls/include",
116      "//third_party/mbedtls/include/mbedtls",
117    ]
118
119    sources = hal_common_files
120    sources += [
121      "${key_management_adapter_path}/impl/src/standard/crypto_hash_to_point.c",
122      "${key_management_adapter_path}/impl/src/standard/huks_adapter.c",
123      "${key_management_adapter_path}/impl/src/standard/mbedtls_ec_adapter.c",
124      "${os_adapter_path}/impl/src/hc_log.c",
125      "${os_adapter_path}/impl/src/linux/hc_condition.c",
126      "${os_adapter_path}/impl/src/linux/hc_dev_info.c",
127      "${os_adapter_path}/impl/src/linux/hc_file.c",
128      "${os_adapter_path}/impl/src/linux/hc_init_protection.c",
129      "${os_adapter_path}/impl/src/linux/hc_thread.c",
130      "${os_adapter_path}/impl/src/linux/hc_types.c",
131    ]
132    cflags = [ "-DHILOG_ENABLE" ]
133    deps = [
134      "//base/security/huks/interfaces/innerkits/huks_standard/main:libhukssdk",
135      "//third_party/cJSON:cjson",
136      "//third_party/mbedtls:mbedtls_shared",
137      "//third_party/openssl:libcrypto_shared",
138    ]
139    external_deps = [
140      "c_utils:utils",
141      "hiviewdfx_hilog_native:libhilog",
142      "init:libbegetutil",
143    ]
144  }
145}
146