1# Copyright (c) 2021-2023 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("storage_daemon_crypto_config") {
18  visibility = [ ":*" ]
19
20  include_dirs = [
21    "../include",
22    "../include/crypto",
23    "${storage_service_common_path}/include",
24  ]
25
26  cflags = [
27    "-g3",
28    "-Wall",
29  ]
30}
31
32ohos_static_library("libsdcrypto") {
33  branch_protector_ret = "pac_ret"
34  sanitize = {
35    integer_overflow = true
36    ubsan = true
37    boundary_sanitize = true
38    cfi = true
39    cfi_cross_dso = true
40    debug = false
41  }
42
43  sources = [
44    "src/app_clone_key_manager.cpp",
45    "src/base_key.cpp",
46    "src/crypto_delay_handler.cpp",
47    "src/fbex.cpp",
48    "src/fscrypt_key_v1.cpp",
49    "src/fscrypt_key_v1_ext.cpp",
50    "src/fscrypt_key_v2.cpp",
51    "src/huks_master.cpp",
52    "src/iam_client.cpp",
53    "src/key_backup.cpp",
54    "src/key_crypto_utils.cpp",
55    "src/key_manager.cpp",
56    "src/openssl_crypto.cpp",
57  ]
58
59  defines = [
60    "STORAGE_LOG_TAG = \"StorageDaemon\"",
61    "LOG_DOMAIN = 0xD004301",
62    "OPENSSL_SUPPRESS_DEPRECATED",
63    "USER_CRYPTO_MIGRATE_KEY",
64    "KMSG_LOG",
65  ]
66
67  configs = [ ":storage_daemon_crypto_config" ]
68
69  deps = [
70    "${storage_daemon_path}:storage_common_utils",
71    "${storage_daemon_path}/libfscrypt:libfscryptutils",
72  ]
73
74  external_deps = [
75    "c_utils:utils",
76    "eventhandler:libeventhandler",
77    "hilog:libhilog",
78    "huks:libhukssdk",
79    "init:libbegetutil",
80    "ipc:ipc_single",
81    "openssl:libcrypto_shared",
82    "os_account:os_account_innerkits",
83    "samgr:samgr_proxy",
84  ]
85
86  if (storage_service_el5_filekey_manager) {
87    defines += [ "EL5_FILEKEY_MANAGER" ]
88    external_deps += [ "access_token:el5_filekey_manager_sdk" ]
89  }
90
91  if (enable_user_auth_framework) {
92    defines += [ "USER_AUTH_FRAMEWORK" ]
93    external_deps += [ "user_auth_framework:userauth_client" ]
94  }
95
96  subsystem_name = "filemanagement"
97  part_name = "storage_service"
98}
99