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    "${start_init_services_path}/log",
23    "${storage_service_common_path}/include",
24  ]
25
26  cflags = [
27    "-g3",
28    "-Wall",
29  ]
30}
31
32config("fscrypt_utils_public_config") {
33  visibility = [ ":*" ]
34
35  include_dirs = [ "../include/libfscrypt" ]
36
37  cflags = [
38    "-g3",
39    "-Wall",
40  ]
41}
42
43ohos_static_library("libfscryptutils") {
44  branch_protector_ret = "pac_ret"
45  sanitize = {
46    integer_overflow = true
47    ubsan = true
48    boundary_sanitize = true
49    cfi = true
50    cfi_cross_dso = true
51    debug = false
52  }
53
54  output_name = "libfscryptutils"
55  sources = [
56    "src/fscrypt_control.c",
57    "src/fscrypt_utils.c",
58    "src/init_utils.c",
59    "src/key_control.c",
60    "src/sysparam_dynamic.c",
61  ]
62
63  if (storage_service_user_crypto_manager) {
64    defines = [ "USER_CRYPTO_MANAGER" ]
65  }
66
67  configs = [ ":fscrypt_utils_config" ]
68
69  external_deps = [
70    "c_utils:utils",
71    "init:libbegetutil",
72  ]
73
74  subsystem_name = "filemanagement"
75  part_name = "storage_service"
76}
77
78ohos_static_library("libfscryptutils_static") {
79  branch_protector_ret = "pac_ret"
80  sanitize = {
81    integer_overflow = true
82    ubsan = true
83    boundary_sanitize = true
84    cfi = true
85    cfi_cross_dso = true
86    debug = false
87  }
88
89  output_name = "libfscryptutils_static"
90  sources = [
91    "src/fscrypt_control.c",
92    "src/fscrypt_utils.c",
93    "src/key_control.c",
94    "src/sysparam_static.c",
95  ]
96
97  if (storage_service_user_crypto_manager) {
98    defines = [ "USER_CRYPTO_MANAGER" ]
99  }
100
101  configs = [ ":fscrypt_utils_config" ]
102  public_configs = [ ":fscrypt_utils_public_config" ]
103
104  external_deps = [
105    "bounds_checking_function:libsec_static",
106    "c_utils:utils",
107    "init:libbegetutil",
108  ]
109
110  subsystem_name = "filemanagement"
111  part_name = "storage_service"
112}
113