# Copyright (C) 2021-2023 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. if (defined(ohos_lite)) { import("//build/lite/config/component/lite_component.gni") } else { import("//build/ohos.gni") } import("deviceauth_hals.gni") if (defined(ohos_lite)) { if (ohos_kernel_type == "liteos_m") { static_library("deviceauth_hal_liteos") { include_dirs = hals_inc_path include_dirs += [ "//base/security/device_auth/interfaces/inner_api", "//third_party/cJSON", "//commonlibrary/utils_lite/include", "//base/hiviewdfx/hilog_lite/interfaces/native/kits/hilog_lite", "//commonlibrary/utils_lite/memory/include", "//base/startup/init/interfaces/innerkits/include/syspara", ] sources = hal_common_files sources += [ "${key_management_adapter_path}/impl/src/mini/huks_adapter.c", "${os_adapter_path}/impl/src/liteos/hc_condition.c", "${os_adapter_path}/impl/src/liteos/hc_dev_info.c", "${os_adapter_path}/impl/src/liteos/hc_thread.c", "${os_adapter_path}/impl/src/liteos/hc_types.c", "${os_adapter_path}/impl/src/liteos/mini/hc_init_protection.c", ] if (enable_posix_interface) { sources += [ "${os_adapter_path}/impl/src/liteos/mini/hc_file_posix.c" ] } else { sources += [ "${os_adapter_path}/impl/src/liteos/mini/hc_file.c" ] } cflags = [ "-DHILOG_ENABLE" ] cflags += [ "-DAUTH_STORAGE_PATH=\"${deviceauth_storage_path}\"" ] if (board_toolchain_type == "iccarm") { cflags += [ "--diag_suppress", "Pe223,Pe226", "-DOHOS_MEM", ] } deps = [ "//base/security/huks/interfaces/inner_api/huks_lite:huks_3.0_sdk", "//base/startup/init/interfaces/innerkits:libbegetutil", "//build/lite/config/component/cJSON:cjson_shared", "//commonlibrary/utils_lite:utils", ] } } else { static_library("deviceauth_hal_linux") { include_dirs = hals_inc_path include_dirs += [ "//base/security/device_auth/interfaces/inner_api", "//third_party/cJSON", "//commonlibrary/utils_lite/include", "//base/hiviewdfx/hilog_lite/interfaces/native/innerkits/hilog", "//third_party/bounds_checking_function/include", "//base/startup/init/interfaces/innerkits/include/syspara", "//third_party/mbedtls/include", ] sources = hal_common_files sources += [ "${key_management_adapter_path}/impl/src/small/huks_adapter.c", "${key_management_adapter_path}/impl/src/small/mbedtls_ec_adapter.c", "${os_adapter_path}/impl/src/hc_log.c", "${os_adapter_path}/impl/src/linux/hc_condition.c", "${os_adapter_path}/impl/src/linux/hc_dev_info.c", "${os_adapter_path}/impl/src/linux/hc_file.c", "${os_adapter_path}/impl/src/linux/hc_init_protection.c", "${os_adapter_path}/impl/src/linux/hc_thread.c", "${os_adapter_path}/impl/src/linux/hc_types.c", ] defines = [] if (enable_extend_plugin) { defines += [ "DEV_AUTH_PLUGIN_ENABLE" ] sources += [ "${os_adapter_path}/impl/src/liteos/small/dev_auth_dynamic_load.c", ] } cflags = [ "-DHILOG_ENABLE" ] defines += [ "LITE_DEVICE" ] deps = [ "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared", "//base/security/huks/interfaces/inner_api/huks_lite:huks_3.0_sdk", "//base/startup/init/interfaces/innerkits:libbegetutil", "//build/lite/config/component/cJSON:cjson_shared", "//commonlibrary/utils_lite:utils", "//third_party/bounds_checking_function:libsec_shared", "//third_party/mbedtls:mbedtls_shared", "//third_party/openssl/ohos_lite:openssl_shared", ] } } } else { ohos_static_library("deviceauth_hal_linux") { subsystem_name = "security" part_name = "device_auth" include_dirs = hals_inc_path include_dirs += [ "//third_party/cJSON", "//commonlibrary/c_utils/base/include", "//third_party/openssl/include/", "//third_party/mbedtls/include", "//third_party/mbedtls/include/mbedtls", ] sources = hal_common_files sources += [ "${key_management_adapter_path}/impl/src/standard/crypto_hash_to_point.c", "${key_management_adapter_path}/impl/src/standard/huks_adapter.c", "${key_management_adapter_path}/impl/src/standard/mbedtls_ec_adapter.c", "${os_adapter_path}/impl/src/hc_log.c", "${os_adapter_path}/impl/src/linux/hc_condition.c", "${os_adapter_path}/impl/src/linux/hc_dev_info.c", "${os_adapter_path}/impl/src/linux/hc_file.c", "${os_adapter_path}/impl/src/linux/hc_init_protection.c", "${os_adapter_path}/impl/src/linux/hc_thread.c", "${os_adapter_path}/impl/src/linux/hc_types.c", ] defines = [] if (enable_extend_plugin) { defines += [ "DEV_AUTH_PLUGIN_ENABLE" ] sources += [ "${os_adapter_path}/impl/src/linux/dev_auth_dynamic_load.c" ] } cflags = [ "-DHILOG_ENABLE" ] deps = [ "//third_party/cJSON:cjson", "//third_party/mbedtls:mbedtls_shared", "//third_party/openssl:libcrypto_shared", ] external_deps = [ "c_utils:utils", "hilog:libhilog", "huks:libhukssdk", "init:libbegetutil", ] } }