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 "src/recover_manager.cpp", 58 ] 59 60 defines = [ 61 "STORAGE_LOG_TAG = \"StorageDaemon\"", 62 "LOG_DOMAIN = 0xD004301", 63 "OPENSSL_SUPPRESS_DEPRECATED", 64 "USER_CRYPTO_MIGRATE_KEY", 65 "KMSG_LOG", 66 ] 67 68 configs = [ ":storage_daemon_crypto_config" ] 69 70 deps = [ 71 "${storage_daemon_path}:storage_common_utils", 72 "${storage_daemon_path}/libfscrypt:libfscryptutils", 73 ] 74 75 external_deps = [ 76 "c_utils:utils", 77 "eventhandler:libeventhandler", 78 "hilog:libhilog", 79 "huks:libhukssdk", 80 "init:libbegetutil", 81 "ipc:ipc_single", 82 "openssl:libcrypto_shared", 83 "os_account:os_account_innerkits", 84 "samgr:samgr_proxy", 85 ] 86 87 if (storage_service_el5_filekey_manager) { 88 defines += [ "EL5_FILEKEY_MANAGER" ] 89 external_deps += [ "access_token:el5_filekey_manager_sdk" ] 90 } 91 92 if (enable_user_auth_framework) { 93 defines += [ "USER_AUTH_FRAMEWORK" ] 94 external_deps += [ "user_auth_framework:userauth_client" ] 95 } 96 97 if (enable_tee_client) { 98 defines += [ "RECOVER_KEY_TEE_ENVIRONMENT" ] 99 external_deps += [ "tee_client:libteec" ] 100 } 101 102 if (enable_screenlock_manager) { 103 defines += [ "ENABLE_SCREENLOCK_MANAGER" ] 104 external_deps += [ "screenlock_mgr:screenlock_client" ] 105 } 106 107 subsystem_name = "filemanagement" 108 part_name = "storage_service" 109} 110