• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#
2# Copyright (c) 2020-2021 Huawei Device Co., Ltd.
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#     http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14#
15import("//build/ohos.gni")
16
17hichian_sources = [
18  "auth_info/auth_info.c",
19  "auth_info/exchange_auth_info_client.c",
20  "auth_info/remove_auth_info_client.c",
21  "hichain.c",
22  "huks_adapter/huks_adapter.c",
23  "json/commonutil.c",
24  "json/jsonutil.c",
25  "key_agreement/key_agreement.c",
26  "key_agreement/key_agreement_client.c",
27  "key_agreement/key_agreement_server.c",
28  "key_agreement/pake_client.c",
29  "key_agreement/pake_server.c",
30  "key_agreement/sec_clone_server.c",
31  "key_agreement/sts_client.c",
32  "key_agreement/sts_server.c",
33  "log/log.c",
34  "schedule/build_object.c",
35  "schedule/distribution.c",
36  "struct/add_auth_info_data.c",
37  "struct/auth_ack_request.c",
38  "struct/auth_ack_response.c",
39  "struct/auth_start_request.c",
40  "struct/auth_start_response.c",
41  "struct/exchange_auth_data.c",
42  "struct/exchange_request.c",
43  "struct/exchange_response.c",
44  "struct/inform_message.c",
45  "struct/key_agreement_version.c",
46  "struct/key_agreement_version.h",
47  "struct/pake_client_confirm.c",
48  "struct/pake_request.c",
49  "struct/pake_response.c",
50  "struct/pake_server_confirm.c",
51  "struct/parsedata.c",
52  "struct/rmv_auth_info_data.c",
53  "struct/rmv_auth_info_request.c",
54  "struct/rmv_auth_info_response.c",
55  "struct/sec_clone_data.c",
56]
57
58config("hichain_config") {
59  include_dirs = [
60    "//third_party/bounds_checking_function/include",
61    "//base/security/device_auth/interfaces/inner_api/deviceauth_lite",
62    "//third_party/cJSON",
63    "base",
64    "huks_adapter",
65    "json",
66    "key_agreement",
67    "log",
68    "schedule",
69    "struct",
70    "auth_info",
71  ]
72
73  defines = [
74    "_SCANTY_MEMORY_",
75    "_CUT_STS_CLIENT_",
76    "_CUT_REMOVE_",
77    "_CUT_ADD_",
78    "_CUT_LOG_",
79  ]
80}
81
82config("hichain_standard_config") {
83  include_dirs = [
84    "//third_party/bounds_checking_function/include",
85    "//base/security/device_auth/interfaces/inner_api/deviceauth_lite",
86    "//base/security/huks/interfaces/inner_api/huks_standard/main/include",
87    "//third_party/cJSON",
88    "base",
89    "huks_adapter",
90    "json",
91    "key_agreement",
92    "log",
93    "schedule",
94    "struct",
95    "auth_info",
96  ]
97
98  defines = [
99    #    "_SCANTY_MEMORY_",
100    #    "_CUT_STS_CLIENT_",
101    "_CUT_REMOVE_",
102    #    "_CUT_ADD_",
103    #    "_CUT_LOG_",
104  ]
105}
106
107if (os_level == "standard") {
108  ohos_shared_library("hichainsdk") {
109    subsystem_name = "security"
110    part_name = "device_auth"
111    sources = hichian_sources
112    public_configs = [ ":hichain_standard_config" ]
113    deps = [
114      "//third_party/bounds_checking_function:libsec_shared",
115      "//third_party/cJSON:cjson",
116    ]
117    external_deps = [ "huks:libhukssdk" ]
118    cflags = [
119      "-flto",
120      "-Wall",
121      "-fvisibility=hidden",
122    ]
123  }
124  ohos_static_library("hichainsdk_static") {
125    subsystem_name = "security"
126    part_name = "device_auth"
127    sources = hichian_sources
128    public_configs = [ ":hichain_standard_config" ]
129    deps = [
130      "//third_party/bounds_checking_function:libsec_shared",
131      "//third_party/cJSON:cjson",
132    ]
133    external_deps = [ "huks:libhukssdk" ]
134    cflags = [
135      "-flto",
136      "-Wall",
137      "-fvisibility=hidden",
138      "--coverage",
139    ]
140    ldflags = [ "--coverage" ]
141  }
142} else {
143  if (ohos_kernel_type == "liteos_m") {
144    static_library("hichainsdk") {
145      sources = hichian_sources
146      public_configs = [ ":hichain_config" ]
147      deps =
148          [ "//base/security/huks/interfaces/inner_api/huks_lite:huks_3.0_sdk" ]
149      if (board_toolchain_type == "iccarm") {
150        cflags = [
151          "--diag_suppress",
152          "Pe1097,Pe546,Pe188,Pe111",
153        ]
154      }
155    }
156  } else {
157    shared_library("hichainsdk") {
158      sources = hichian_sources
159      public_configs = [ ":hichain_config" ]
160      deps = [
161        "//base/security/huks/interfaces/inner_api/huks_lite:huks_3.0_sdk",
162        "//build/lite/config/component/cJSON:cjson_shared",
163        "//third_party/bounds_checking_function:libsec_shared",
164      ]
165      cflags = [
166        "-flto",
167        "-Wall",
168        "-fvisibility=hidden",
169      ]
170    }
171  }
172}
173