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_ciconfig("huks_config") {
18526fd984Sopenharmony_ci  include_dirs = [ "include" ]
19526fd984Sopenharmony_ci}
20526fd984Sopenharmony_ci
21526fd984Sopenharmony_ciif (os_level == "standard") {
22526fd984Sopenharmony_ci  ohos_shared_library("libhukssdk") {
23526fd984Sopenharmony_ci    branch_protector_ret = "pac_ret"
24526fd984Sopenharmony_ci
25526fd984Sopenharmony_ci    sanitize = {
26526fd984Sopenharmony_ci      integer_overflow = true
27526fd984Sopenharmony_ci      cfi = true
28526fd984Sopenharmony_ci      debug = false
29526fd984Sopenharmony_ci      cfi_cross_dso = true
30526fd984Sopenharmony_ci      boundary_sanitize = true
31526fd984Sopenharmony_ci      ubsan = true
32526fd984Sopenharmony_ci    }
33526fd984Sopenharmony_ci    subsystem_name = "security"
34526fd984Sopenharmony_ci    part_name = "huks"
35526fd984Sopenharmony_ci    innerapi_tags = [
36526fd984Sopenharmony_ci      "platformsdk",
37526fd984Sopenharmony_ci      "sasdk",
38526fd984Sopenharmony_ci    ]
39526fd984Sopenharmony_ci    version_script = "libhukssdk.map"
40526fd984Sopenharmony_ci    public_configs = [ ":huks_config" ]
41526fd984Sopenharmony_ci    configs = [
42526fd984Sopenharmony_ci      "//base/security/huks/frameworks/config/build:l2_standard_common_config",
43526fd984Sopenharmony_ci    ]
44526fd984Sopenharmony_ci
45526fd984Sopenharmony_ci    include_dirs = [
46526fd984Sopenharmony_ci      "//base/security/huks/utils/crypto_adapter",
47526fd984Sopenharmony_ci      "../source",
48526fd984Sopenharmony_ci    ]
49526fd984Sopenharmony_ci    if (huks_security_level == "software") {
50526fd984Sopenharmony_ci      defines = [ "HKS_UNTRUSTED_RUNNING_ENV" ]
51526fd984Sopenharmony_ci    }
52526fd984Sopenharmony_ci    sources = [
53526fd984Sopenharmony_ci      "../source/hks_api.c",
54526fd984Sopenharmony_ci      "../source/hks_api_adapter.c",
55526fd984Sopenharmony_ci    ]
56526fd984Sopenharmony_ci
57526fd984Sopenharmony_ci    deps = [
58526fd984Sopenharmony_ci      "//base/security/huks/frameworks/huks_standard/main:huks_standard_frameworks",
59526fd984Sopenharmony_ci      "//base/security/huks/utils/crypto_adapter:libhuks_utils_client_service_adapter_static",
60526fd984Sopenharmony_ci    ]
61526fd984Sopenharmony_ci    external_deps = [
62526fd984Sopenharmony_ci      "c_utils:utils",
63526fd984Sopenharmony_ci      "hilog:libhilog",
64526fd984Sopenharmony_ci    ]
65526fd984Sopenharmony_ci  }
66526fd984Sopenharmony_ci}
67526fd984Sopenharmony_ci
68526fd984Sopenharmony_ciif (os_level == "small" || os_level == "mini") {
69526fd984Sopenharmony_ci  group("libhukssdk") {
70526fd984Sopenharmony_ci  }
71526fd984Sopenharmony_ci}
72