1526fd984Sopenharmony_ci# Copyright (C) 2021-2023 Huawei Device Co., Ltd.
2526fd984Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License");
3526fd984Sopenharmony_ci# you may not use this file except in compliance with the License.
4526fd984Sopenharmony_ci# You may obtain a copy of the License at
5526fd984Sopenharmony_ci#
6526fd984Sopenharmony_ci#     http://www.apache.org/licenses/LICENSE-2.0
7526fd984Sopenharmony_ci#
8526fd984Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software
9526fd984Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS,
10526fd984Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11526fd984Sopenharmony_ci# See the License for the specific language governing permissions and
12526fd984Sopenharmony_ci# limitations under the License.
13526fd984Sopenharmony_ci
14526fd984Sopenharmony_ciimport("//base/security/huks/build/config.gni")
15526fd984Sopenharmony_ciimport("//build/ohos.gni")
16526fd984Sopenharmony_ci
17526fd984Sopenharmony_ciif (os_level == "standard") {
18526fd984Sopenharmony_ci  ohos_static_library("libhuks_service_standard_static") {
19526fd984Sopenharmony_ci    subsystem_name = "security"
20526fd984Sopenharmony_ci    part_name = "huks"
21526fd984Sopenharmony_ci
22526fd984Sopenharmony_ci    public_deps = [
23526fd984Sopenharmony_ci      "//base/security/huks/services/huks_standard/huks_service/main/core:libhuks_service_core_standard_static",
24526fd984Sopenharmony_ci      "//base/security/huks/services/huks_standard/huks_service/main/os_dependency:libhuks_service_os_dependency_standard_static",
25526fd984Sopenharmony_ci    ]
26526fd984Sopenharmony_ci
27526fd984Sopenharmony_ci    complete_static_lib = true
28526fd984Sopenharmony_ci
29526fd984Sopenharmony_ci    branch_protector_ret = "pac_ret"
30526fd984Sopenharmony_ci
31526fd984Sopenharmony_ci    sanitize = {
32526fd984Sopenharmony_ci      integer_overflow = true
33526fd984Sopenharmony_ci      cfi = true
34526fd984Sopenharmony_ci      debug = false
35526fd984Sopenharmony_ci      cfi_cross_dso = true
36526fd984Sopenharmony_ci      boundary_sanitize = true
37526fd984Sopenharmony_ci      ubsan = true
38526fd984Sopenharmony_ci    }
39526fd984Sopenharmony_ci
40526fd984Sopenharmony_ci    configs = [
41526fd984Sopenharmony_ci      "//base/security/huks/frameworks/config/build:l2_standard_common_config",
42526fd984Sopenharmony_ci    ]
43526fd984Sopenharmony_ci    external_deps = [ "hilog:libhilog" ]
44526fd984Sopenharmony_ci  }
45526fd984Sopenharmony_ci
46526fd984Sopenharmony_ci  ohos_executable("hks_compatibility_bin") {
47526fd984Sopenharmony_ci    subsystem_name = "security"
48526fd984Sopenharmony_ci    part_name = "huks"
49526fd984Sopenharmony_ci    sanitize = {
50526fd984Sopenharmony_ci      integer_overflow = true
51526fd984Sopenharmony_ci      cfi = true
52526fd984Sopenharmony_ci      debug = false
53526fd984Sopenharmony_ci      cfi_cross_dso = true
54526fd984Sopenharmony_ci      boundary_sanitize = true
55526fd984Sopenharmony_ci      ubsan = true
56526fd984Sopenharmony_ci    }
57526fd984Sopenharmony_ci    branch_protector_ret = "pac_ret"
58526fd984Sopenharmony_ci    sources = [ "//base/security/huks/utils/compatibility_bin/compatibility_standard_bin.c" ]
59526fd984Sopenharmony_ci
60526fd984Sopenharmony_ci    cflags =
61526fd984Sopenharmony_ci        [ "-DHKS_CONFIG_RKC_STORE_PATH=\"${huks_use_rkc_in_standard_path}\"" ]
62526fd984Sopenharmony_ci    external_deps = [
63526fd984Sopenharmony_ci      "bounds_checking_function:libsec_static",
64526fd984Sopenharmony_ci      "hilog:libhilog",
65526fd984Sopenharmony_ci    ]
66526fd984Sopenharmony_ci    install_enable = true
67526fd984Sopenharmony_ci  }
68526fd984Sopenharmony_ci} else {
69526fd984Sopenharmony_ci  ohos_static_library("libhuks_service_small_static") {
70526fd984Sopenharmony_ci    public_deps = [
71526fd984Sopenharmony_ci      "//base/security/huks/services/huks_standard/huks_service/main/core:libhuks_service_core_small_static",
72526fd984Sopenharmony_ci
73526fd984Sopenharmony_ci      # "//base/security/huks/services/huks_standard/huks_service/main/os_dependency:libhuks_service_os_dependency_small_static",
74526fd984Sopenharmony_ci      "//base/security/huks/services/huks_standard/huks_service/main/os_dependency/idl:libhuks_service_idl_small_static",
75526fd984Sopenharmony_ci    ]
76526fd984Sopenharmony_ci    configs = [
77526fd984Sopenharmony_ci      "//base/security/huks/frameworks/config/build:l1_small_common_config",
78526fd984Sopenharmony_ci    ]
79526fd984Sopenharmony_ci
80526fd984Sopenharmony_ci    complete_static_lib = true
81526fd984Sopenharmony_ci
82526fd984Sopenharmony_ci    cflags = []
83526fd984Sopenharmony_ci
84526fd984Sopenharmony_ci    external_deps = [ "hilog_lite:hilog_shared" ]
85526fd984Sopenharmony_ci  }
86526fd984Sopenharmony_ci}
87