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.
13import("//build/ohos.gni")
14import("//foundation/filemanagement/storage_service/storage_service_aafwk.gni")
15
16## build sm execute bin file
17config("fscrypt_utils_config") {
18  visibility = [ ":*" ]
19
20  include_dirs = [
21    "../include/libfscrypt",
22    "${storage_service_common_path}/include",
23  ]
24
25  cflags = [
26    "-g3",
27    "-Wall",
28  ]
29}
30
31config("fscrypt_utils_public_config") {
32  visibility = [ ":*" ]
33
34  include_dirs = [ "../include/libfscrypt" ]
35
36  cflags = [
37    "-g3",
38    "-Wall",
39  ]
40}
41
42ohos_static_library("libfscryptutils") {
43  branch_protector_ret = "pac_ret"
44  sanitize = {
45    integer_overflow = true
46    ubsan = true
47    boundary_sanitize = true
48    cfi = true
49    cfi_cross_dso = true
50    debug = false
51  }
52
53  output_name = "libfscryptutils"
54  sources = [
55    "src/fscrypt_control.c",
56    "src/fscrypt_utils.c",
57    "src/init_utils.c",
58    "src/key_control.c",
59    "src/sysparam_dynamic.c",
60  ]
61
62  if (storage_service_user_crypto_manager) {
63    defines = [ "USER_CRYPTO_MANAGER" ]
64  }
65
66  configs = [ ":fscrypt_utils_config" ]
67
68  defines += [
69    "STORAGE_LOG_TAG = \"StorageDaemon\"",
70    "LOG_DOMAIN = 0xD004301",
71  ]
72
73  external_deps = [
74    "c_utils:utils",
75    "hilog:libhilog",
76    "init:libbegetutil",
77  ]
78
79  subsystem_name = "filemanagement"
80  part_name = "storage_service"
81}
82
83ohos_static_library("libfscryptutils_static") {
84  branch_protector_ret = "pac_ret"
85  sanitize = {
86    integer_overflow = true
87    ubsan = true
88    boundary_sanitize = true
89    cfi = true
90    cfi_cross_dso = true
91    debug = false
92  }
93
94  output_name = "libfscryptutils_static"
95  sources = [
96    "src/fscrypt_control.c",
97    "src/fscrypt_utils.c",
98    "src/key_control.c",
99    "src/sysparam_static.c",
100  ]
101
102  if (storage_service_user_crypto_manager) {
103    defines = [ "USER_CRYPTO_MANAGER" ]
104  }
105
106  configs = [ ":fscrypt_utils_config" ]
107  public_configs = [ ":fscrypt_utils_public_config" ]
108
109  defines += [
110    "STORAGE_LOG_TAG = \"StorageDaemon\"",
111    "LOG_DOMAIN = 0xD004301",
112  ]
113
114  external_deps = [
115    "bounds_checking_function:libsec_static",
116    "c_utils:utils",
117    "hilog:libhilog",
118    "init:libbegetutil",
119  ]
120
121  subsystem_name = "filemanagement"
122  part_name = "storage_service"
123}
124