• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (C) 2021-2023 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("//base/security/huks/build/config.gni")
15import("//build/ohos.gni")
16
17config("huks_config") {
18  include_dirs = [
19    "include",
20    "//base/security/huks/interfaces/inner_api/huks_standard/main/include",
21  ]
22}
23
24if (os_level == "standard") {
25  ohos_static_library("libhuks_common_standard_static") {
26    defines = [ "L2_STANDARD" ]
27    subsystem_name = "security"
28    part_name = "huks"
29
30    public_configs =
31        [ ":huks_config" ]  # Share include files for other gn when deps.
32
33    include_dirs = [
34      "//base/security/huks/frameworks/huks_standard/main/crypto_engine/openssl/include",
35      "//base/security/huks/interfaces/inner_api/huks_standard/main/include",
36    ]
37
38    sources = [
39      "src/hks_ability.c",
40      "src/hks_base_check.c",
41      "src/hks_check_paramset.c",
42      "src/hks_common_check.c",
43      "src/hks_crypto_adapter.c",
44      "src/hks_error_msg.c",
45      "src/hks_param.c",
46      "src/hks_tags_type_manager.c",
47    ]
48
49    complete_static_lib = true
50
51    branch_protector_ret = "pac_ret"
52
53    sanitize = {
54      integer_overflow = true
55      cfi = true
56      debug = false
57      cfi_cross_dso = true
58      boundary_sanitize = true
59      ubsan = true
60    }
61    configs = [
62      "//base/security/huks/frameworks/config/build:l2_standard_common_config",
63    ]
64    sources += [ "src/hks_errcode_adapter.c" ]
65    external_deps = [
66      "c_utils:utils",
67      "hilog:libhilog",
68    ]
69  }
70} else {
71  ohos_static_library("libhuks_common_small_static") {
72    defines = [ "_HUKS_LOG_ENABLE_" ]
73    public_configs =
74        [ ":huks_config" ]  # Share include files for other gn when deps.
75
76    include_dirs = [
77      "//base/security/huks/interfaces/inner_api/huks_standard/main/include",
78    ]
79
80    sources = [
81      "src/hks_ability.c",
82      "src/hks_base_check.c",
83      "src/hks_check_paramset.c",
84      "src/hks_common_check.c",
85      "src/hks_crypto_adapter.c",
86      "src/hks_error_msg.c",
87      "src/hks_param.c",
88      "src/hks_tags_type_manager.c",
89    ]
90
91    cflags = []
92
93    complete_static_lib = true
94    cflags += [ "-DHUKS_UID_TRUST_LIST=${huks_uid_trust_list_define}" ]
95
96    external_deps = [ "hilog_lite:hilog_shared" ]
97
98    configs = [
99      "//base/security/huks/frameworks/config/build:l1_small_common_config",
100    ]
101
102    if (huks_enable_upgrade_small_to_service) {
103      sources += [ "src/hks_check_trust_list.c" ]
104    }
105  }
106}
107