• 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 = [ "hilog:libhilog" ]
70    deps += [
71      "../../../frameworks/huks_standard/main:huks_standard_frameworks",
72      "../../../services/huks_standard/huks_engine/main/core_dependency:libhuks_core_hal_api_static",
73      "../../../services/huks_standard/huks_service/main:libhuks_service_standard_static",
74      "../../../utils/crypto_adapter:libhuks_utils_client_service_adapter_static",
75      "../../../utils/file_operator:libhuks_utils_file_operator_static",
76      "../../../utils/list:libhuks_utils_list_static",
77      "../../../utils/mutex:libhuks_utils_mutex_static",
78    ]
79
80    if (enable_hks_mock) {
81      deps += [ "../../../services/huks_standard/huks_service/main/systemapi_mock:libhuks_service_systemapi_mock_static" ]
82    } else {
83      deps += [ "../../../services/huks_standard/huks_service/main/systemapi_wrap/useridm:libhuks_service_systemapi_wrap_static" ]
84    }
85
86    sources += [
87      "../../../services/huks_standard/huks_engine/main/device_cert_manager/src/dcm_asn1.c",
88      "../../../services/huks_standard/huks_engine/main/device_cert_manager/src/dcm_attest.c",
89      "../../../services/huks_standard/huks_engine/main/device_cert_manager/src/dcm_attest_utils.c",
90    ]
91
92    cflags += [ "-D_HARDWARE_ROOT_KEY_" ]
93  } else {
94    deps += [
95      "../../../frameworks/huks_standard/main:huks_small_frameworks",
96      "../../../services/huks_standard/huks_service/main:libhuks_service_small_static",
97      "../../../utils/crypto_adapter:libhuks_utils_client_service_adapter_static",
98      "../../../utils/file_operator:libhuks_utils_file_operator_static",
99      "../../../utils/list:libhuks_utils_list_static",
100      "../../../utils/mutex:libhuks_utils_mutex_static",
101    ]
102    external_deps = [ "hilog_lite:hilog_shared" ]
103
104    if (huks_use_hardware_root_key == true) {
105      cflags += [ "-D_HARDWARE_ROOT_KEY_" ]
106    }
107  }
108
109  include_dirs += [
110    "../../../services/huks_standard/huks_engine/main/core/include",
111    "../../../services/huks_standard/huks_engine/main/device_cert_manager/include",
112    "../../../utils/crypto_adapter",
113    "../../../utils/file_operator",
114    "../../../utils/list",
115    "../../../utils/mutex",
116  ]
117
118  defines = []
119
120  if (huks_use_mbedtls) {
121    defines += [ "HKS_USE_MBEDTLS" ]
122  }
123
124  cflags += [ "-DHKS_KEY_VERSION=1" ]
125
126  cflags += [ "-flto" ]
127
128  cflags += [ "-D_BSD_SOURCE" ]
129  cflags += [ "-D_HUKS_LOG_ENABLE_" ]
130  cflags += [ "-DGET_DEV_UDID_ENABLE" ]
131
132  if (huks_config_file != "") {
133    print(huks_config_file)
134    cflags += [ "-DHKS_CONFIG_FILE=\"${huks_config_file}\"" ]
135  }
136}
137