# 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. import("//base/security/device_auth/deviceauth_env.gni") group_auth_path = "${services_path}/group_auth" authenticators_path = "${services_path}/authenticators" protocol_path = "${services_path}/protocol" cred_manager_path = "${services_path}/cred_manager" data_manager_path = "${services_path}/data_manager" privacy_enhancement_path = "${services_path}/privacy_enhancement" dev_frameworks_path = "${services_path}/frameworks" group_manager_path = "${services_path}/group_manager" session_manager_path = "${services_path}/session_manager" creds_manager_path = "${services_path}/creds_manager" mk_agree_path = "${services_path}/mk_agree" enable_broadcast = true declare_args() { deviceauth_hichain_thread_stack_size = 8192 } deviceauth_defines = [] inc_path = [ "${inner_api_path}", "${frameworks_path}/inc", "${cred_manager_path}/inc", "${cred_manager_path}/inc/account_related", "${data_manager_path}/inc", "${privacy_enhancement_path}/inc", "${group_auth_path}/inc", "${group_auth_path}/inc/account_unrelated_group_auth", "${group_auth_path}/inc/account_related_group_auth", "${group_manager_path}/inc", "${group_manager_path}/inc/broadcast_manager", "${group_manager_path}/inc/callback_manager", "${group_manager_path}/inc/channel_manager", "${group_manager_path}/inc/channel_manager/soft_bus_channel", "${dev_frameworks_path}/inc/", "${dev_frameworks_path}/inc/module", "${dev_frameworks_path}/inc/session", "${dev_frameworks_path}/inc/os_account_adapter", "${dev_frameworks_path}/inc/plugin_adapter", "${dev_frameworks_path}/inc/task_manager", "${authenticators_path}/inc/account_related", "${authenticators_path}/inc/account_unrelated", "${authenticators_path}/inc/account_unrelated/iso_task", "${authenticators_path}/inc/account_unrelated/iso_task/iso_protocol_task", "${authenticators_path}/inc/account_unrelated/iso_task/lite_exchange_task", "${authenticators_path}/inc/account_unrelated/pake_task", "${authenticators_path}/inc/account_unrelated/pake_task/pake_v1_task", "${authenticators_path}/inc/account_unrelated/pake_task/pake_v2_task", "${protocol_path}/inc", "${protocol_path}/inc/pake_protocol", "${protocol_path}/inc/pake_protocol/pake_v1_protocol", "${protocol_path}/inc/pake_protocol/pake_v2_protocol", "${protocol_path}/inc/pake_protocol/pake_protocol_dl_common", "${protocol_path}/inc/pake_protocol/pake_protocol_ec_common", "${protocol_path}/inc/iso_protocol", "${session_manager_path}/inc", "${session_manager_path}/inc/session", "${session_manager_path}/inc/session/v1", "${session_manager_path}/inc/session/v1/compatible_bind_sub_session", "${session_manager_path}/inc/session/v1/compatible_auth_sub_session", "${session_manager_path}/inc/session/v2", "${session_manager_path}/inc/session/v2/auth_sub_session", "${session_manager_path}/inc/session/v2/auth_sub_session/protocol_lib", "${session_manager_path}/inc/session/v2/expand_sub_session", "${session_manager_path}/inc/session/v2/expand_sub_session/expand_process_lib", "${creds_manager_path}/inc", "${creds_manager_path}/inc/account_related", "${mk_agree_path}/inc", ] deviceauth_common_files = [ "${services_path}/device_auth.c", "${group_manager_path}/src/group_manager_common.c", "${group_manager_path}/src/group_manager.c", "${group_manager_path}/src/channel_manager/channel_manager.c", "${group_manager_path}/src/callback_manager/callback_manager.c", "${protocol_path}/src/protocol_common.c", "${protocol_path}/src/iso_protocol/iso_protocol_common.c", "${protocol_path}/src/pake_protocol/pake_common.c", "${protocol_path}/src/pake_protocol/pake_v1_protocol/pake_v1_protocol_common.c", "${protocol_path}/src/pake_protocol/pake_protocol_dl_common/pake_protocol_dl_common.c", "${protocol_path}/src/pake_protocol/pake_protocol_ec_common/pake_protocol_ec_common.c", "${protocol_path}/src/pake_protocol/pake_v2_protocol/pake_v2_protocol_common.c", ] dev_frameworks_files = [ "${dev_frameworks_path}/src/module/dev_auth_module_manager.c", "${dev_frameworks_path}/src/module/version_util.c", "${dev_frameworks_path}/src/task_manager/task_manager.c", ] os_account_adapter_files = [ "${dev_frameworks_path}/src/os_account_adapter/os_account_adapter.cpp" ] os_account_adapter_lite_files = [ "${dev_frameworks_path}/src/os_account_adapter_mock/os_account_adapter_mock.cpp" ] permission_adapter_files = [ "${dev_frameworks_path}/src/permission_adapter/permission_adapter.cpp" ] hiview_adapter_files = [ "${dev_frameworks_path}/src/hiview_adapter/hidump_adapter.c", "${dev_frameworks_path}/src/hiview_adapter/hisysevent_adapter.cpp", "${dev_frameworks_path}/src/hiview_adapter/hitrace_adapter.cpp", ] group_auth_files = [ "${group_auth_path}/src/group_auth_manager/group_auth_data_operation.c" ] group_auth_account_unrelated_files = [ "${group_auth_path}/src/group_auth_manager/account_unrelated_group_auth/account_unrelated_group_auth.c" ] group_auth_account_unrelated_mock_files = [ "${group_auth_path}/src/group_auth_manager/account_unrelated_group_auth_mock/account_unrelated_group_auth_mock.c" ] group_auth_account_related_mock_files = [ "${group_auth_path}/src/group_auth_manager/account_related_group_auth_mock/account_related_group_auth_mock.c" ] account_related_cred_plugin_mock_files = [ "${cred_manager_path}/src/account_related_mock/account_related_cred_plugin_mock.c" ] cred_manager_files = [ "${cred_manager_path}/src/cred_manager.c" ] database_manager_files = [ "${data_manager_path}/src/data_manager.c" ] privacy_enhancement_files = [ "${privacy_enhancement_path}/src/pseudonym_manager.c" ] privacy_enhancement_mock_files = [ "${privacy_enhancement_path}/src/mock/pseudonym_manager_mock.c" ] mk_agree_files = [ "${session_manager_path}/src/session/v2/expand_sub_session/expand_process_lib/mk_agree.c", "${mk_agree_path}/src/key_manager.c", "${mk_agree_path}/src/mk_agree_task.c", ] mk_agree_mock_files = [ "${mk_agree_path}/src/mock/key_manager_mock.c", "${mk_agree_path}/src/mock/mk_agree_task_mock.c", ] group_manager_files = [ "${group_manager_path}/src/group_operation/group_operation.c", "${group_manager_path}/src/group_operation/group_operation_common.c", ] session_manager_files = [ "${session_manager_path}/src/dev_session_mgr.c", "${session_manager_path}/src/session/dev_session_fwk.c", ] session_v1_files = [ "${session_manager_path}/src/session/v1/compatible_sub_session.c", "${session_manager_path}/src/session/v1/compatible_bind_sub_session/compatible_bind_sub_session.c", "${session_manager_path}/src/session/v1/compatible_bind_sub_session/compatible_bind_sub_session_common.c", "${session_manager_path}/src/session/v1/compatible_bind_sub_session/compatible_bind_sub_session_util.c", "${session_manager_path}/src/session/v1/compatible_auth_sub_session/compatible_auth_sub_session.c", "${session_manager_path}/src/session/v1/compatible_auth_sub_session/compatible_auth_sub_session_common.c", "${session_manager_path}/src/session/v1/compatible_auth_sub_session/compatible_auth_sub_session_util.c", ] session_v2_files = [ "${session_manager_path}/src/session/v2/dev_session_v2.c", "${session_manager_path}/src/session/v2/dev_session_util.c", "${session_manager_path}/src/session/v2/auth_sub_session/auth_sub_session.c", "${session_manager_path}/src/session/v2/expand_sub_session/expand_sub_session.c", ] session_v2_mock_files = [ "${session_manager_path}/src/session/v2_mock/dev_session_v2_mock.c" ] iso_protocol_files = [ "${session_manager_path}/src/session/v2/auth_sub_session/protocol_lib/iso_protocol.c" ] ec_speke_protocol_files = [ "${session_manager_path}/src/session/v2/auth_sub_session/protocol_lib/ec_speke_protocol.c" ] auth_code_import_files = [ "${session_manager_path}/src/session/v2/expand_sub_session/expand_process_lib/auth_code_import.c" ] pub_key_exchange_files = [ "${session_manager_path}/src/session/v2/expand_sub_session/expand_process_lib/pub_key_exchange.c" ] save_trusted_info_files = [ "${session_manager_path}/src/session/v2/expand_sub_session/expand_process_lib/save_trusted_info.c" ] creds_manager_files = [ "${creds_manager_path}/src/creds_manager.c", "${creds_manager_path}/src/creds_operation_utils.c", ] account_related_creds_manager_mock_files = [ "${creds_manager_path}/src/account_related_mock/account_related_creds_manager_mock.c" ] group_manager_peer_to_peer_files = [ "${group_manager_path}/src/group_operation/peer_to_peer_group/peer_to_peer_group.c" ] group_manager_peer_to_peer_mock_files = [ "${group_manager_path}/src/group_operation/peer_to_peer_group_mock/peer_to_peer_group_mock.c" ] group_manager_identical_account_mock_files = [ "${group_manager_path}/src/group_operation/identical_account_group_mock/identical_account_group_mock.c" ] group_manager_across_account_mock_files = [ "${group_manager_path}/src/group_operation/across_account_group_mock/across_account_group_mock.c" ] authenticators_p2p_files = [ "${authenticators_path}/src/account_unrelated/das_task_common.c", "${authenticators_path}/src/account_unrelated/das_module.c", "${authenticators_path}/src/account_unrelated/das_version_util.c", "${authenticators_path}/src/account_unrelated/das_task_main.c", "${authenticators_path}/src/account_unrelated/pake_task/pake_task_common.c", "${authenticators_path}/src/account_unrelated/pake_task/pake_message_util.c", ] authenticators_p2p_mock_files = [ "${authenticators_path}/src/account_unrelated_mock/das_module_mock.c" ] authenticators_account_related_mock_files = [ "${authenticators_path}/src/account_related_mock/account_module_mock.c" ] authenticators_p2p_iso_files = [ "${authenticators_path}/src/account_unrelated/iso_task/iso_client_task.c", "${authenticators_path}/src/account_unrelated/iso_task/iso_server_task.c", "${authenticators_path}/src/account_unrelated/iso_task/iso_task_common.c", "${authenticators_path}/src/account_unrelated/iso_task/iso_task_main.c", "${authenticators_path}/src/account_unrelated/iso_task/iso_protocol_task/iso_client_protocol_task.c", "${authenticators_path}/src/account_unrelated/iso_task/iso_protocol_task/iso_server_protocol_task.c", "${authenticators_path}/src/account_unrelated/iso_task/lite_exchange_task/das_lite_token_manager.c", "${authenticators_path}/src/account_unrelated/iso_task/lite_exchange_task/iso_client_bind_exchange_task.c", "${authenticators_path}/src/account_unrelated/iso_task/lite_exchange_task/iso_server_bind_exchange_task.c", ] authenticators_p2p_iso_mock_files = [ "${authenticators_path}/src/account_unrelated/iso_task_mock/iso_task_main_mock.c" ] authenticators_p2p_pake_files = [ "${authenticators_path}/src/account_unrelated/pake_task/pake_v1_task/pake_v1_task_main.c", "${authenticators_path}/src/account_unrelated/pake_task/pake_v1_task/pake_v1_client_task.c", "${authenticators_path}/src/account_unrelated/pake_task/pake_v1_task/pake_v1_server_task.c", "${authenticators_path}/src/account_unrelated/pake_task/pake_v1_task/pake_v1_protocol_task/pake_v1_client_protocol_task.c", "${authenticators_path}/src/account_unrelated/pake_task/pake_v1_task/pake_v1_protocol_task/pake_v1_server_protocol_task.c", "${authenticators_path}/src/account_unrelated/pake_task/pake_v1_task/pake_v1_protocol_task/pake_v1_protocol_task_common.c", "${authenticators_path}/src/account_unrelated/pake_task/pake_v2_task_mock/pake_v2_task_main_mock.c", ] authenticators_p2p_pake_mock_files = [ "${authenticators_path}/src/account_unrelated/pake_task/pake_v1_task_mock/pake_v1_task_main_mock.c", "${authenticators_path}/src/account_unrelated/pake_task/pake_v2_task_mock/pake_v2_task_main_mock.c", ] authenticators_standard_exchange_task_files = [ "${authenticators_path}/src/account_unrelated/pake_task/standard_exchange_task/common_standard_bind_exchange.c", "${authenticators_path}/src/account_unrelated/pake_task/standard_exchange_task/standard_client_bind_exchange_task.c", "${authenticators_path}/src/account_unrelated/pake_task/standard_exchange_task/standard_server_bind_exchange_task.c", "${authenticators_path}/src/account_unrelated/pake_task/standard_exchange_task/das_standard_token_manager.c", "${authenticators_path}/src/account_unrelated/pake_task/standard_exchange_task/standard_exchange_message_util.c", ] authenticators_standard_exchange_task_mock_files = [ "${authenticators_path}/src/account_unrelated/pake_task/standard_exchange_task_mock/standard_exchange_task_mock.c" ] soft_bus_channel_files = [ "${group_manager_path}/src/channel_manager/soft_bus_channel/soft_bus_channel.c" ] soft_bus_channel_mock_files = [ "${group_manager_path}/src/channel_manager/soft_bus_channel_mock/soft_bus_channel_mock.c" ] broadcast_manager_files = [ "${group_manager_path}/src/broadcast_manager/broadcast_manager.c" ] broadcast_manager_mock_files = [ "${group_manager_path}/src/broadcast_manager_mock/broadcast_manager_mock.c", ] deviceauth_files = dev_frameworks_files + deviceauth_common_files + session_manager_files + creds_manager_files if (enable_pseudonym == true) { deviceauth_defines += [ "ENABLE_PSEUDONYM" ] deviceauth_files += privacy_enhancement_files deviceauth_files += mk_agree_files } else { deviceauth_files += privacy_enhancement_mock_files deviceauth_files += mk_agree_mock_files } if (enable_session_v2 == true) { deviceauth_files += session_v2_files if (enable_account || enable_p2p_bind_lite_protocol || enable_p2p_auth_lite_protocol) { deviceauth_defines += [ "ENABLE_ISO" ] deviceauth_files += iso_protocol_files deviceauth_defines += [ "ENABLE_AUTH_CODE_IMPORT" ] deviceauth_files += auth_code_import_files } if (enable_account || enable_p2p_bind_standard_protocol || enable_p2p_auth_standard_protocol) { deviceauth_defines += [ "ENABLE_EC_SPEKE" ] deviceauth_files += ec_speke_protocol_files deviceauth_defines += [ "ENABLE_PUB_KEY_EXCHANGE" ] deviceauth_files += pub_key_exchange_files } deviceauth_defines += [ "ENABLE_SAVE_TRUSTED_INFO" ] deviceauth_files += save_trusted_info_files } else { deviceauth_files += session_v2_mock_files } if (enable_session_v1 == true) { deviceauth_files += session_v1_files } if (enable_p2p_pake_dl_prime_len_384 == true) { deviceauth_defines += [ "P2P_PAKE_DL_PRIME_LEN_384" ] } if (enable_p2p_pake_dl_prime_len_256 == true) { deviceauth_defines += [ "P2P_PAKE_DL_PRIME_LEN_256" ] } deviceauth_files += group_auth_files + group_manager_files + database_manager_files + cred_manager_files account_unrelated_deviceauth = enable_p2p_bind_lite_protocol || enable_p2p_auth_lite_protocol || enable_p2p_bind_standard_protocol || enable_p2p_auth_standard_protocol if (enable_p2p_bind_lite_protocol) { deviceauth_defines += [ "ENABLE_P2P_BIND_ISO" ] } if (enable_p2p_bind_standard_protocol) { deviceauth_defines += [ "ENABLE_P2P_BIND_EC_SPEKE" ] } if (enable_p2p_auth_lite_protocol) { deviceauth_defines += [ "ENABLE_P2P_AUTH_ISO" ] } if (enable_p2p_auth_standard_protocol) { deviceauth_defines += [ "ENABLE_P2P_AUTH_EC_SPEKE" ] } if (account_unrelated_deviceauth == true) { deviceauth_files += group_auth_account_unrelated_files + group_manager_peer_to_peer_files } else { deviceauth_files += group_auth_account_unrelated_mock_files + group_manager_peer_to_peer_mock_files } if (account_unrelated_deviceauth == true) { deviceauth_files += authenticators_p2p_files } else { deviceauth_files += authenticators_p2p_mock_files } if (enable_p2p_auth_lite_protocol == true) { deviceauth_files += authenticators_p2p_iso_files } else { deviceauth_files += authenticators_p2p_iso_mock_files } if (enable_p2p_bind_standard_protocol == true || enable_p2p_auth_standard_protocol == true) { deviceauth_defines += [ "P2P_PAKE_EC_TYPE" ] deviceauth_files += authenticators_p2p_pake_files } else { deviceauth_files += authenticators_p2p_pake_mock_files } if (enable_p2p_auth_standard_protocol == true) { deviceauth_files += authenticators_standard_exchange_task_files } else { deviceauth_files += authenticators_standard_exchange_task_mock_files } if (enable_account == true) { import("//base/security/device_auth/services/deviceauth_account.gni") deviceauth_defines += account_related_defines inc_path += account_related_inc_path deviceauth_files += account_related_files } else { deviceauth_files += group_auth_account_related_mock_files + group_manager_identical_account_mock_files + group_manager_across_account_mock_files + authenticators_account_related_mock_files + account_related_cred_plugin_mock_files + account_related_creds_manager_mock_files } if (enable_soft_bus_channel == true) { deviceauth_files += soft_bus_channel_files } else { deviceauth_files += soft_bus_channel_mock_files } if (enable_broadcast == true) { deviceauth_files += broadcast_manager_files } else { deviceauth_files += broadcast_manager_mock_files } if (defined(ohos_lite)) { deviceauth_files += os_account_adapter_lite_files } else { deviceauth_files += os_account_adapter_files } #build_flags = [ "-Wrestrict" ] build_flags = [ "-Werror" ] if (target_os == "linux") { build_flags += [ "-D__LINUX__" ] } ipc_src_suffix = "cpp" ipc_adapt_path = "standard" if (defined(ohos_lite)) { ipc_src_suffix = "c" ipc_adapt_path = "lite" } deviceauth_ipc_files = [ "${frameworks_path}/src/${ipc_adapt_path}/ipc_adapt.${ipc_src_suffix}", "${frameworks_path}/src/${ipc_adapt_path}/ipc_dev_auth_proxy.${ipc_src_suffix}", "${frameworks_path}/src/${ipc_adapt_path}/ipc_dev_auth_stub.${ipc_src_suffix}", "${frameworks_path}/src/${ipc_adapt_path}/ipc_callback_proxy.${ipc_src_suffix}", "${frameworks_path}/src/${ipc_adapt_path}/ipc_callback_stub.${ipc_src_suffix}", ]