1# Copyright (c) 2022 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("//build/ohos.gni")
15
16# sa lib
17ohos_source_set("dslm_ohos_cred_obj") {
18  sanitize = {
19    integer_overflow = true
20    ubsan = true
21    boundary_sanitize = true
22    cfi = true
23    cfi_cross_dso = true
24    blocklist = "../../../cfi_blocklist.txt"
25  }
26  branch_protector_ret = "pac_ret"
27
28  sources = [
29    "../common/dslm_ohos_request.c",
30    "../common/dslm_ohos_verify.c",
31    "../common/external_interface_adapter.c",
32    "../common/hks_adapter.c",
33    "impl/dslm_ohos_init.c",
34  ]
35
36  include_dirs = [
37    "impl",
38    "../common",
39    "../../common",
40    "../../include",
41    "../../../common/include",
42    "../../../interfaces/inner_api/include",
43    "../../../services/include",
44  ]
45
46  deps = [
47    "../../../baselib/utils:utils_static",
48    "../../common:oem_common_obj",
49  ]
50
51  configs = [ "../../../common:common_configs" ]
52
53  external_deps = [
54    "c_utils:utils",
55    "device_auth:deviceauth_sdk",
56    "hilog:libhilog",
57    "huks:libhukssdk",
58  ]
59
60  part_name = "device_security_level"
61  subsystem_name = "security"
62}
63
64declare_args() {
65  device_security_level_feature_cred_level = 1
66}
67
68ohos_prebuilt_etc("dslm_ohos_cred_file") {
69  if (device_security_level_feature_cred_level == 5) {
70    source = "dslm_finger_sl5.cfg"
71  } else if (device_security_level_feature_cred_level == 4) {
72    source = "dslm_finger_sl4.cfg"
73  } else if (device_security_level_feature_cred_level == 3) {
74    source = "dslm_finger_sl3.cfg"
75  } else if (device_security_level_feature_cred_level == 2) {
76    source = "dslm_finger_sl2.cfg"
77  } else {
78    source = "dslm_finger.cfg"
79  }
80
81  output = "dslm_finger.cfg"
82  part_name = "device_security_level"
83  subsystem_name = "security"
84}
85