1# Copyright (c) 2021-2025 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 "${storage_daemon_path}/include", 22 "${storage_daemon_path}/include/crypto", 23 "${storage_service_common_path}/include", 24 "${storage_interface_path}/innerkits/storage_manager/native", 25 ] 26 27 cflags = [ 28 "-g3", 29 "-Wall", 30 "-O2", 31 ] 32} 33 34ohos_static_library("libsdcrypto") { 35 branch_protector_ret = "pac_ret" 36 sanitize = { 37 integer_overflow = true 38 ubsan = true 39 boundary_sanitize = true 40 cfi = true 41 cfi_cross_dso = true 42 debug = false 43 } 44 45 sources = [ 46 "src/app_clone_key_manager.cpp", 47 "src/base_key.cpp", 48 "src/crypto_delay_handler.cpp", 49 "src/fbex.cpp", 50 "src/fscrypt_key_v1.cpp", 51 "src/fscrypt_key_v1_ext.cpp", 52 "src/fscrypt_key_v2.cpp", 53 "src/huks_master.cpp", 54 "src/iam_client.cpp", 55 "src/key_backup.cpp", 56 "src/key_crypto_utils.cpp", 57 "src/key_manager.cpp", 58 "src/key_manager_ext.cpp", 59 "src/openssl_crypto.cpp", 60 "src/recover_manager.cpp", 61 ] 62 63 defines = [ 64 "STORAGE_LOG_TAG = \"StorageDaemon\"", 65 "LOG_DOMAIN = 0xD004301", 66 "OPENSSL_SUPPRESS_DEPRECATED", 67 "USER_CRYPTO_MIGRATE_KEY", 68 "KMSG_LOG", 69 ] 70 71 configs = [ ":storage_daemon_crypto_config" ] 72 73 deps = [ 74 "${storage_daemon_path}:storage_common_utils", 75 "${storage_daemon_path}:storage_daemon_header", 76 "${storage_daemon_path}/libfscrypt:libfscryptutils", 77 ] 78 79 external_deps = [ 80 "c_utils:utils", 81 "eventhandler:libeventhandler", 82 "hilog:libhilog", 83 "huks:libhukssdk", 84 "init:libbegetutil", 85 "ipc:ipc_single", 86 "openssl:libcrypto_shared", 87 "os_account:os_account_innerkits", 88 "samgr:samgr_proxy", 89 ] 90 91 if (storage_service_el5_filekey_manager) { 92 defines += [ "EL5_FILEKEY_MANAGER" ] 93 external_deps += [ "access_token:el5_filekey_manager_sdk" ] 94 } 95 96 if (enable_user_auth_framework) { 97 defines += [ "USER_AUTH_FRAMEWORK" ] 98 external_deps += [ "user_auth_framework:userauth_client" ] 99 } 100 101 if (enable_screenlock_manager) { 102 defines += [ "ENABLE_SCREENLOCK_MANAGER" ] 103 external_deps += [ "screenlock_mgr:screenlock_client" ] 104 } 105 106 if (enable_tee_client) { 107 defines += [ "RECOVER_KEY_TEE_ENVIRONMENT" ] 108 external_deps += [ "tee_client:libteec" ] 109 } 110 111 if (storage_service_external_storage_qos_trans) { 112 defines += [ "SUPPORT_RECOVERY_KEY_SERVICE" ] 113 } 114 115 if (enable_huks_hdi) { 116 defines += [ "HUKS_IDL_ENVIRONMENT" ] 117 external_deps += [ "drivers_interface_huks:libhuks_proxy_1.1", ] 118 } 119 120 subsystem_name = "filemanagement" 121 part_name = "storage_service" 122} 123