mirror of
https://github.com/openharmony/security_deviceauth.git
synced 2026-07-22 11:55:46 -04:00
031a240600
Signed-off-by: heyinshen <heyinshen1@huawei.com>
343 lines
16 KiB
Plaintext
343 lines
16 KiB
Plaintext
# Copyright (C) 2021-2022 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/deviceauth/deviceauth_env.gni")
|
|
|
|
group_auth_path = "${services_path}/group_auth"
|
|
authenticators_path = "${services_path}/authenticators"
|
|
protocol_path = "${services_path}/protocol"
|
|
data_manager_path = "${services_path}/data_manager"
|
|
dev_frameworks_path = "${services_path}/frameworks"
|
|
group_manager_path = "${services_path}/group_manager"
|
|
|
|
enable_broadcast = true
|
|
declare_args() {
|
|
deviceauth_hichain_thread_stack_size = 4096
|
|
}
|
|
deviceauth_defines = []
|
|
|
|
inc_path = [
|
|
"${innerkits_path}",
|
|
"${frameworks_path}/inc",
|
|
"${data_manager_path}/inc",
|
|
"${group_auth_path}/inc",
|
|
"${group_auth_path}/inc/account_unrelated_group_auth",
|
|
"${group_auth_path}/inc/account_related_group_auth",
|
|
"${group_auth_path}/inc/session",
|
|
"${group_auth_path}/inc/session/auth_session",
|
|
"${group_auth_path}/inc/session/auth_session_lite",
|
|
"${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",
|
|
"${group_manager_path}/inc/lcm_adapter",
|
|
"${group_manager_path}/inc/session",
|
|
"${group_manager_path}/inc/session/bind_session",
|
|
"${group_manager_path}/inc/session/bind_session_lite",
|
|
"${group_manager_path}/inc/session/key_agree_session",
|
|
"${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/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",
|
|
]
|
|
|
|
deviceauth_common_files = [
|
|
"${services_path}/device_auth.c",
|
|
"${group_auth_path}/src/session/auth_session_common_util.c",
|
|
"${group_manager_path}/src/group_manager_common.c",
|
|
"${group_manager_path}/src/group_manager.c",
|
|
"${group_manager_path}/src/session/bind_session_common_util.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",
|
|
]
|
|
|
|
dev_frameworks_files = [
|
|
"${dev_frameworks_path}/src/session/session_common.c",
|
|
"${dev_frameworks_path}/src/session/session_manager.c",
|
|
"${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" ]
|
|
|
|
group_auth_files = [
|
|
"${group_auth_path}/src/group_auth_manager/group_auth_data_operation.c",
|
|
"${group_auth_path}/src/group_auth_manager/group_auth_manager.c",
|
|
"${group_auth_path}/src/session/auth_session/auth_session_client.c",
|
|
"${group_auth_path}/src/session/auth_session/auth_session_common.c",
|
|
"${group_auth_path}/src/session/auth_session/auth_session_server.c",
|
|
"${group_auth_path}/src/session/auth_session/auth_session_util.c",
|
|
"${group_auth_path}/src/session/auth_session_lite_mock/auth_session_client_lite_mock.c",
|
|
"${group_auth_path}/src/session/auth_session_lite_mock/auth_session_server_lite_mock.c",
|
|
]
|
|
group_auth_lite_files = [
|
|
"${group_auth_path}/src/group_auth_manager_lite/group_auth_manager_lite.c",
|
|
"${group_auth_path}/src/session/auth_session_lite/auth_session_client_lite.c",
|
|
"${group_auth_path}/src/session/auth_session_lite/auth_session_server_lite.c",
|
|
"${group_auth_path}/src/session/auth_session_lite/auth_session_common_lite.c",
|
|
"${group_auth_path}/src/session/auth_session_mock/auth_session_client_mock.c",
|
|
"${group_auth_path}/src/session/auth_session_mock/auth_session_server_mock.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" ]
|
|
|
|
database_manager_files = [ "${data_manager_path}/src/data_manager.c" ]
|
|
database_manager_lite_files = []
|
|
|
|
group_manager_files = [
|
|
"${group_manager_path}/src/group_operation/group_operation.c",
|
|
"${group_manager_path}/src/group_operation/group_operation_common.c",
|
|
"${group_manager_path}/src/session/bind_session/bind_session_client.c",
|
|
"${group_manager_path}/src/session/bind_session/bind_session_common.c",
|
|
"${group_manager_path}/src/session/bind_session/bind_session_server.c",
|
|
]
|
|
group_manager_lite_files = [
|
|
"${group_manager_path}/src/group_operation_mock/group_operation_mock.c",
|
|
"${group_manager_path}/src/session/bind_session_mock/bind_session_client_mock.c",
|
|
"${group_manager_path}/src/session/bind_session_mock/bind_session_server_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" ]
|
|
|
|
key_agree_files =
|
|
[ "${group_manager_path}/src/channel_manager/key_agree/key_agree.c" ]
|
|
key_agree_mock_files = [
|
|
"${group_manager_path}/src/key_agree_mock/key_agree_mock.c",
|
|
"${group_manager_path}/src/session/key_agree_session_mock/key_agree_session_client_mock.c",
|
|
"${group_manager_path}/src/session/key_agree_session_mock/key_agree_session_server_mock.c",
|
|
]
|
|
bind_peer_files = [
|
|
"${group_manager_path}/src/bind_peer/bind_peer.c",
|
|
"${group_manager_path}/src/session/bind_session_lite/bind_session_client_lite.c",
|
|
"${group_manager_path}/src/session/bind_session_lite/bind_session_common_lite.c",
|
|
"${group_manager_path}/src/session/bind_session_lite/bind_session_server_lite.c",
|
|
]
|
|
bind_peer_mock_files = [
|
|
"${group_manager_path}/src/bind_peer_mock/bind_peer_mock.c",
|
|
"${group_manager_path}/src/session/bind_session_lite_mock/bind_session_client_lite_mock.c",
|
|
"${group_manager_path}/src/session/bind_session_lite_mock/bind_session_server_lite_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_client_unbind_exchange_task.c",
|
|
"${authenticators_path}/src/account_unrelated/iso_task/lite_exchange_task/iso_server_bind_exchange_task.c",
|
|
"${authenticators_path}/src/account_unrelated/iso_task/lite_exchange_task/iso_server_unbind_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/common_standard_unbind_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_client_unbind_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/standard_server_unbind_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/broadcast_manager_mock.c" ]
|
|
|
|
lcm_adapter_mock_files =
|
|
[ "${group_manager_path}/src/lcm_adapter_mock/lcm_adapter_mock.c" ]
|
|
|
|
deviceauth_files =
|
|
dev_frameworks_files + deviceauth_common_files + key_agree_mock_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" ]
|
|
}
|
|
|
|
if (enable_group == true) {
|
|
deviceauth_files +=
|
|
group_auth_files + group_manager_files + database_manager_files
|
|
} else {
|
|
deviceauth_files += group_auth_lite_files + group_manager_lite_files +
|
|
database_manager_lite_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_group == true && 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_group == true && enable_account == true) {
|
|
import("//base/security/deviceauth_account/deviceauth_account.gni")
|
|
deviceauth_defines += account_related_defines
|
|
inc_path += account_related_inc_path
|
|
deviceauth_files += account_related_files + bind_peer_files
|
|
} else if (enable_group == false && enable_account == true) {
|
|
import("//base/security/deviceauth_account/deviceauth_account.gni")
|
|
deviceauth_defines += account_related_defines
|
|
inc_path += account_related_inc_path
|
|
deviceauth_files +=
|
|
account_related_files + group_manager_identical_account_mock_files +
|
|
group_manager_across_account_mock_files + bind_peer_mock_files
|
|
} else {
|
|
deviceauth_files +=
|
|
group_auth_account_related_mock_files +
|
|
group_manager_identical_account_mock_files +
|
|
group_manager_across_account_mock_files + bind_peer_mock_files +
|
|
lcm_adapter_mock_files + authenticators_account_related_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}",
|
|
]
|