1# Copyright (C) 2021 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. 13 14if (defined(ohos_lite)) { 15 import("//build/lite/config/component/lite_component.gni") 16} else { 17 import("//build/ohos.gni") 18} 19import("deviceauth_hals.gni") 20 21if (defined(ohos_lite)) { 22 if (ohos_kernel_type == "liteos_m") { 23 static_library("deviceauth_hal_liteos") { 24 include_dirs = hals_inc_path 25 include_dirs += [ 26 "//base/security/deviceauth/interfaces/innerkits", 27 "//third_party/cJSON", 28 "//utils/native/lite/include", 29 "//base/hiviewdfx/hilog_lite/interfaces/native/kits/hilog_lite", 30 "//utils/native/lite/memory/include", 31 "//base/startup/syspara_lite/interfaces/kits/", 32 ] 33 34 sources = hal_common_files 35 sources += [ 36 "${key_management_adapter_path}/impl/src/mini/huks_adapter.c", 37 "${os_adapter_path}/impl/src/liteos/hc_condition.c", 38 "${os_adapter_path}/impl/src/liteos/hc_dev_info.c", 39 "${os_adapter_path}/impl/src/liteos/hc_thread.c", 40 "${os_adapter_path}/impl/src/liteos/hc_types.c", 41 "${os_adapter_path}/impl/src/liteos/mini/hc_file.c", 42 "${os_adapter_path}/impl/src/liteos/mini/hc_init_protection.c", 43 ] 44 45 cflags = [ "-DHILOG_ENABLE" ] 46 cflags += [ "-DAUTH_STORAGE_PATH = \"${deviceauth_storage_path}\"" ] 47 deps = [ 48 "//base/hiviewdfx/hilog_lite/frameworks/mini:hilog_lite", 49 "//base/security/huks/interfaces/innerkits/huks_lite:huks_3.0_sdk", 50 "//base/startup/syspara_lite/frameworks/parameter/src:sysparam", 51 "//build/lite/config/component/cJSON:cjson_shared", 52 "//utils/native/lite:utils", 53 ] 54 } 55 } else { 56 static_library("deviceauth_hal_linux") { 57 include_dirs = hals_inc_path 58 include_dirs += [ 59 "//base/security/deviceauth/interfaces/innerkits", 60 "//third_party/cJSON", 61 "//utils/native/lite/include", 62 "//base/security/huks/interfaces/innerkits/huks_standard/main/include", 63 "//base/hiviewdfx/hilog_lite/interfaces/native/innerkits/hilog", 64 "//third_party/bounds_checking_function/include", 65 "//base/startup/syspara_lite/interfaces/kits/", 66 ] 67 68 sources = hal_common_files 69 sources += [ 70 "${key_management_adapter_path}/impl/src/small/huks_adapter.c", 71 "${key_management_adapter_path}/impl/src/small/mbedtls_hash_to_point.c", 72 "${os_adapter_path}/impl/src/linux/hc_condition.c", 73 "${os_adapter_path}/impl/src/linux/hc_dev_info.c", 74 "${os_adapter_path}/impl/src/linux/hc_file.c", 75 "${os_adapter_path}/impl/src/linux/hc_init_protection.c", 76 "${os_adapter_path}/impl/src/linux/hc_thread.c", 77 "${os_adapter_path}/impl/src/linux/hc_types.c", 78 ] 79 80 cflags = [ "-DHILOG_ENABLE" ] 81 defines = [ "LITE_DEVICE" ] 82 83 deps = [ 84 "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared", 85 "//base/security/huks/interfaces/innerkits/huks_lite:huks_3.0_sdk", 86 "//base/startup/syspara_lite/frameworks/parameter/src:sysparam", 87 "//build/lite/config/component/cJSON:cjson_shared", 88 "//build/lite/config/component/openssl:openssl_shared", 89 "//third_party/bounds_checking_function:libsec_shared", 90 "//third_party/mbedtls:mbedtls_shared", 91 "//utils/native/lite:utils", 92 ] 93 } 94 } 95} else { 96 ohos_static_library("deviceauth_hal_linux") { 97 subsystem_name = "security" 98 include_dirs = hals_inc_path 99 include_dirs += [ 100 "//third_party/cJSON", 101 "//utils/native/base/include", 102 "//third_party/openssl/include/", 103 "//base/security/huks/interfaces/innerkits/huks_standard/main/include", 104 "//base/startup/syspara_lite/interfaces/innerkits/native/syspara/include", 105 ] 106 107 sources = hal_common_files 108 sources += [ 109 "${key_management_adapter_path}/impl/src/standard/crypto_hash_to_point.c", 110 "${key_management_adapter_path}/impl/src/standard/huks_adapter.c", 111 "${os_adapter_path}/impl/src/linux/hc_condition.c", 112 "${os_adapter_path}/impl/src/linux/hc_dev_info.c", 113 "${os_adapter_path}/impl/src/linux/hc_file.c", 114 "${os_adapter_path}/impl/src/linux/hc_init_protection.c", 115 "${os_adapter_path}/impl/src/linux/hc_thread.c", 116 "${os_adapter_path}/impl/src/linux/hc_types.c", 117 ] 118 cflags = [ "-DHILOG_ENABLE" ] 119 deps = [ 120 "//base/security/huks/interfaces/innerkits/huks_standard/main:libhukssdk", 121 "//base/startup/syspara_lite/interfaces/innerkits/native/syspara:syspara", 122 "//third_party/cJSON:cjson_static", 123 "//third_party/openssl:libcrypto_static", 124 "//utils/native/base:utils", 125 ] 126 external_deps = [ "hiviewdfx_hilog_native:libhilog" ] 127 } 128} 129