• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#
2# Copyright (c) 2023-2023 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#
15
16import("//base/security/huks/build/config.gni")
17import("//base/security/huks/huks.gni")
18import("//build/ohos.gni")
19
20config("public_huks_config") {
21  include_dirs = [
22    ".",
23    "../../../services/huks_standard/huks_service/main/core/include",
24  ]
25}
26
27ohos_static_library("huks_modify_old_version_key_util") {
28  sources = []
29
30  sources += [ "./hks_test_modify_old_key.c" ]
31
32  subsystem_name = "security"
33  part_name = "huks"
34
35  include_dirs = [
36    "../../../interfaces/inner_api/huks_standard/main/include",
37    "../../../frameworks/huks_standard/main/common/include",
38    "../../../services/huks_standard/huks_service/main/core/include",
39  ]
40
41  include_dirs += [ "." ]
42
43  public_configs = [ ":public_huks_config" ]
44
45  deps = []
46
47  cflags = [
48    "-Wall",
49    "-Werror",
50  ]
51
52  sources += [
53    "../../../services/huks_standard/huks_engine/main/core/src/hks_auth.c",
54    "../../../services/huks_standard/huks_engine/main/core/src/hks_core_interfaces.c",
55    "../../../services/huks_standard/huks_engine/main/core/src/hks_core_service_key_attest.c",
56    "../../../services/huks_standard/huks_engine/main/core/src/hks_core_service_key_generate.c",
57    "../../../services/huks_standard/huks_engine/main/core/src/hks_core_service_key_operate_one_stage.c",
58    "../../../services/huks_standard/huks_engine/main/core/src/hks_core_service_key_operate_three_stage.c",
59    "../../../services/huks_standard/huks_engine/main/core/src/hks_core_service_key_other.c",
60    "../../../services/huks_standard/huks_engine/main/core/src/hks_core_service_three_stage.c",
61    "../../../services/huks_standard/huks_engine/main/core/src/hks_keyblob.c",
62    "../../../services/huks_standard/huks_engine/main/core/src/hks_keynode.c",
63    "../../../services/huks_standard/huks_engine/main/core/src/hks_secure_access.c",
64    "../../../services/huks_standard/huks_engine/main/core/src/hks_sm_import_wrap_key.c",
65    "../../../services/huks_standard/huks_engine/main/core/src/hks_upgrade_key.c",
66  ]
67
68  if (os_level == "standard") {
69    external_deps = [
70      "c_utils:utils",
71      "hilog:libhilog",
72    ]
73    deps += [
74      "../../../frameworks/huks_standard/main:huks_standard_frameworks",
75      "../../../services/huks_standard/huks_engine/main/core_dependency:libhuks_core_hal_api_static",
76      "../../../services/huks_standard/huks_service/main:libhuks_service_standard_static",
77      "../../../utils/crypto_adapter:libhuks_utils_client_service_adapter_static",
78      "../../../utils/file_operator:libhuks_utils_file_operator_static",
79      "../../../utils/list:libhuks_utils_list_static",
80      "../../../utils/mutex:libhuks_utils_mutex_static",
81    ]
82
83    if (enable_hks_mock) {
84      deps += [ "../../../services/huks_standard/huks_service/main/systemapi_mock:libhuks_service_systemapi_mock_static" ]
85    } else {
86      deps += [ "../../../services/huks_standard/huks_service/main/systemapi_wrap/useridm:libhuks_service_systemapi_wrap_static" ]
87    }
88
89    sources += [
90      "../../../services/huks_standard/huks_engine/main/device_cert_manager/src/dcm_asn1.c",
91      "../../../services/huks_standard/huks_engine/main/device_cert_manager/src/dcm_attest.c",
92      "../../../services/huks_standard/huks_engine/main/device_cert_manager/src/dcm_attest_utils.c",
93    ]
94
95    cflags += [ "-D_HARDWARE_ROOT_KEY_" ]
96  } else {
97    deps += [
98      "../../../frameworks/huks_standard/main:huks_small_frameworks",
99      "../../../services/huks_standard/huks_service/main:libhuks_service_small_static",
100      "../../../utils/crypto_adapter:libhuks_utils_client_service_adapter_static",
101      "../../../utils/file_operator:libhuks_utils_file_operator_static",
102      "../../../utils/list:libhuks_utils_list_static",
103      "../../../utils/mutex:libhuks_utils_mutex_static",
104    ]
105    external_deps = [ "hilog_lite:hilog_shared" ]
106
107    if (huks_use_hardware_root_key == true) {
108      cflags += [ "-D_HARDWARE_ROOT_KEY_" ]
109    }
110  }
111
112  include_dirs += [
113    "../../../services/huks_standard/huks_engine/main/core/include",
114    "../../../services/huks_standard/huks_engine/main/device_cert_manager/include",
115    "../../../utils/crypto_adapter",
116    "../../../utils/file_operator",
117    "../../../utils/list",
118    "../../../utils/mutex",
119  ]
120
121  defines = []
122
123  if (huks_use_mbedtls) {
124    defines += [ "HKS_USE_MBEDTLS" ]
125  }
126
127  cflags += [ "-DHKS_KEY_VERSION=1" ]
128
129  cflags += [ "-flto" ]
130
131  cflags += [ "-D_BSD_SOURCE" ]
132  cflags += [ "-D_HUKS_LOG_ENABLE_" ]
133  cflags += [ "-DGET_DEV_UDID_ENABLE" ]
134
135  if (huks_config_file != "") {
136    print(huks_config_file)
137    cflags += [ "-DHKS_CONFIG_FILE=\"${huks_config_file}\"" ]
138  }
139}
140