405 lines
		
	
	
		
			13 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			405 lines
		
	
	
		
			13 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| # 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/deps_adapter/deviceauth_hals.gni")
 | |
| import("//base/security/device_auth/services/deviceauth.gni")
 | |
| import("//base/security/device_auth/services/key_agree_sdk/key_agree_sdk.gni")
 | |
| import("//base/security/huks/build/config.gni")
 | |
| import("//build/test.gni")
 | |
| 
 | |
| module_output_path = "device_auth/deviceauth_test"
 | |
| 
 | |
| ohos_unittest("deviceauth_llt") {
 | |
|   module_out_path = module_output_path
 | |
| 
 | |
|   include_dirs = inc_path
 | |
|   include_dirs += hals_inc_path
 | |
| 
 | |
|   include_dirs += [
 | |
|     "./include",
 | |
|     "./unit_test/include",
 | |
|     "${dev_frameworks_path}/inc/hiview_adapter",
 | |
|   ]
 | |
| 
 | |
|   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 -= [ "${common_lib_path}/impl/src/json_utils.c" ]
 | |
|   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_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",
 | |
|     "source/hc_dev_info_mock.c",
 | |
|     "source/json_utils_mock.c",
 | |
|   ]
 | |
| 
 | |
|   sources += dev_frameworks_files
 | |
|   sources += deviceauth_common_files
 | |
|   sources += database_manager_files
 | |
|   sources += cred_manager_files
 | |
|   sources += session_manager_files
 | |
|   sources += session_v1_files
 | |
|   sources += session_v2_mock_files
 | |
|   sources += creds_manager_files
 | |
|   sources += broadcast_manager_files
 | |
|   sources += soft_bus_channel_mock_files
 | |
| 
 | |
|   sources += group_auth_files
 | |
|   sources += group_auth_account_unrelated_files
 | |
| 
 | |
|   sources += group_manager_files
 | |
|   sources += group_manager_peer_to_peer_files
 | |
| 
 | |
|   sources += authenticators_p2p_files
 | |
|   sources += authenticators_p2p_iso_files
 | |
|   sources += authenticators_p2p_pake_files
 | |
|   sources += authenticators_standard_exchange_task_files
 | |
| 
 | |
|   sources += account_related_files
 | |
| 
 | |
|   sources += privacy_enhancement_files
 | |
|   sources += mk_agree_files
 | |
| 
 | |
|   sources -= [
 | |
|     "${authenticators_path}/src/account_unrelated/iso_task/iso_task_main.c",
 | |
|     "${authenticators_path}/src/account_unrelated/pake_task/pake_v1_task/pake_v1_task_main.c",
 | |
|   ]
 | |
| 
 | |
|   sources += [
 | |
|     "${dev_frameworks_path}/src/plugin_adapter_mock/account_auth_plugin_proxy_mock.c",
 | |
|     "source/creds_manager_test.cpp",
 | |
|     "source/device_auth_ext_mock.c",
 | |
|     "source/deviceauth_standard_test.cpp",
 | |
|     "source/group_operation_common_test.cpp",
 | |
|     "source/iso_auth_task_test.cpp",
 | |
|     "source/os_account_adapter_mock.c",
 | |
|     "source/protocol_task_main_mock.c",
 | |
|     "source/standard_exchange_task_test.cpp",
 | |
|     "unit_test/source/account_related_group_auth_dir_test.cpp",
 | |
|     "unit_test/source/pake_v2_auth_task_test.cpp",
 | |
|   ]
 | |
|   defines = [
 | |
|     "P2P_PAKE_DL_PRIME_LEN_384",
 | |
|     "P2P_PAKE_EC_TYPE",
 | |
|     "ENABLE_ACCOUNT_AUTH_ISO",
 | |
|     "ENABLE_ACCOUNT_AUTH_EC_SPEKE",
 | |
|     "ENABLE_P2P_BIND_ISO",
 | |
|     "ENABLE_P2P_BIND_EC_SPEKE",
 | |
|     "ENABLE_P2P_AUTH_ISO",
 | |
|     "ENABLE_P2P_AUTH_EC_SPEKE",
 | |
|     "DEV_AUTH_FUNC_TEST",
 | |
|     "ENABLE_PSEUDONYM",
 | |
|   ]
 | |
| 
 | |
|   cflags = [ "-DHILOG_ENABLE" ]
 | |
| 
 | |
|   cflags +=
 | |
|       [ "-DDEVICE_AUTH_TEST_HKS_DATA_PATH=\"${huks_key_store_standard_path}\"" ]
 | |
| 
 | |
|   deps = [
 | |
|     "//third_party/cJSON:cjson",
 | |
|     "//third_party/googletest:gmock_main",
 | |
|     "//third_party/googletest:gtest_main",
 | |
|     "//third_party/mbedtls:mbedtls_shared",
 | |
|     "//third_party/openssl:libcrypto_static",
 | |
|   ]
 | |
| 
 | |
|   external_deps = [
 | |
|     "c_utils:utils",
 | |
|     "hilog:libhilog",
 | |
|     "huks:libhukssdk",
 | |
|   ]
 | |
| }
 | |
| 
 | |
| ohos_unittest("device_auth_func_test") {
 | |
|   module_out_path = module_output_path
 | |
| 
 | |
|   include_dirs = inc_path
 | |
|   include_dirs += hals_inc_path
 | |
| 
 | |
|   include_dirs += [
 | |
|     "./include",
 | |
|     "./unit_test/include",
 | |
|     "${dev_frameworks_path}/inc/hiview_adapter",
 | |
|   ]
 | |
| 
 | |
|   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 -= [ "${common_lib_path}/impl/src/json_utils.c" ]
 | |
|   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_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",
 | |
|     "source/hc_dev_info_mock.c",
 | |
|     "source/json_utils_mock.c",
 | |
|   ]
 | |
| 
 | |
|   sources += dev_frameworks_files
 | |
|   sources += deviceauth_common_files
 | |
|   sources += database_manager_files
 | |
|   sources += cred_manager_files
 | |
|   sources += session_manager_files
 | |
|   sources += session_v1_files
 | |
|   sources += session_v2_files
 | |
|   sources += iso_protocol_files
 | |
|   sources += ec_speke_protocol_files
 | |
|   sources += auth_code_import_files
 | |
|   sources += pub_key_exchange_files
 | |
|   sources += save_trusted_info_files
 | |
|   sources += creds_manager_files
 | |
|   sources += broadcast_manager_files
 | |
|   sources += soft_bus_channel_mock_files
 | |
| 
 | |
|   sources += group_auth_files
 | |
|   sources += group_auth_account_unrelated_files
 | |
| 
 | |
|   sources += group_manager_files
 | |
|   sources += group_manager_peer_to_peer_files
 | |
| 
 | |
|   sources += authenticators_p2p_files
 | |
|   sources += authenticators_p2p_iso_files
 | |
|   sources += authenticators_p2p_pake_files
 | |
|   sources += authenticators_standard_exchange_task_files
 | |
| 
 | |
|   sources += account_related_files
 | |
| 
 | |
|   sources += privacy_enhancement_files
 | |
|   sources += mk_agree_files
 | |
| 
 | |
|   sources -= [
 | |
|     "${authenticators_path}/src/account_unrelated/iso_task/iso_task_main.c",
 | |
|     "${authenticators_path}/src/account_unrelated/pake_task/pake_v1_task/pake_v1_task_main.c",
 | |
|   ]
 | |
| 
 | |
|   sources += [
 | |
|     "${dev_frameworks_path}/src/plugin_adapter_mock/account_auth_plugin_proxy_mock.c",
 | |
|     "source/creds_manager_test.cpp",
 | |
|     "source/device_auth_ext_mock.c",
 | |
|     "source/deviceauth_standard_test.cpp",
 | |
|     "source/group_operation_common_test.cpp",
 | |
|     "source/iso_auth_task_test.cpp",
 | |
|     "source/os_account_adapter_mock.c",
 | |
|     "source/protocol_task_main_mock.c",
 | |
|     "source/standard_exchange_task_test.cpp",
 | |
|     "unit_test/source/account_related_group_auth_dir_test.cpp",
 | |
|     "unit_test/source/pake_v2_auth_task_test.cpp",
 | |
|   ]
 | |
|   defines = [
 | |
|     "P2P_PAKE_DL_PRIME_LEN_384",
 | |
|     "P2P_PAKE_EC_TYPE",
 | |
|     "ENABLE_EC_SPEKE",
 | |
|     "ENABLE_ISO",
 | |
|     "ENABLE_AUTH_CODE_IMPORT",
 | |
|     "ENABLE_PUB_KEY_EXCHANGE",
 | |
|     "ENABLE_SAVE_TRUSTED_INFO",
 | |
|     "ENABLE_ACCOUNT_AUTH_ISO",
 | |
|     "ENABLE_ACCOUNT_AUTH_EC_SPEKE",
 | |
|     "ENABLE_P2P_BIND_ISO",
 | |
|     "ENABLE_P2P_BIND_EC_SPEKE",
 | |
|     "ENABLE_P2P_AUTH_ISO",
 | |
|     "ENABLE_P2P_AUTH_EC_SPEKE",
 | |
|     "DEV_AUTH_FUNC_TEST",
 | |
|     "ENABLE_PSEUDONYM",
 | |
|   ]
 | |
| 
 | |
|   cflags = [ "-DHILOG_ENABLE" ]
 | |
| 
 | |
|   cflags +=
 | |
|       [ "-DDEVICE_AUTH_TEST_HKS_DATA_PATH=\"${huks_key_store_standard_path}\"" ]
 | |
| 
 | |
|   deps = [
 | |
|     "//third_party/cJSON:cjson",
 | |
|     "//third_party/googletest:gmock_main",
 | |
|     "//third_party/googletest:gtest_main",
 | |
|     "//third_party/mbedtls:mbedtls_shared",
 | |
|     "//third_party/openssl:libcrypto_static",
 | |
|   ]
 | |
| 
 | |
|   external_deps = [
 | |
|     "c_utils:utils",
 | |
|     "hilog:libhilog",
 | |
|     "huks:libhukssdk",
 | |
|   ]
 | |
| }
 | |
| 
 | |
| ohos_unittest("deviceauth_unit_test") {
 | |
|   module_out_path = module_output_path
 | |
| 
 | |
|   include_dirs = inc_path
 | |
|   include_dirs += hals_inc_path
 | |
| 
 | |
|   include_dirs += [
 | |
|     "./include",
 | |
|     "./unit_test/include",
 | |
|     "${dev_frameworks_path}/inc/hiview_adapter",
 | |
|   ]
 | |
| 
 | |
|   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_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",
 | |
|     "source/hc_dev_info_mock.c",
 | |
|   ]
 | |
| 
 | |
|   sources += dev_frameworks_files
 | |
|   sources += deviceauth_common_files
 | |
|   sources += database_manager_files
 | |
|   sources += cred_manager_files
 | |
|   sources += session_manager_files
 | |
|   sources += session_v1_files
 | |
|   sources += session_v2_files
 | |
|   sources += iso_protocol_files
 | |
|   sources += ec_speke_protocol_files
 | |
|   sources += auth_code_import_files
 | |
|   sources += pub_key_exchange_files
 | |
|   sources += save_trusted_info_files
 | |
|   sources += creds_manager_files
 | |
|   sources += broadcast_manager_files
 | |
|   sources += soft_bus_channel_mock_files
 | |
| 
 | |
|   sources += group_auth_files
 | |
|   sources += group_auth_account_unrelated_files
 | |
| 
 | |
|   sources += group_manager_files
 | |
|   sources += group_manager_peer_to_peer_files
 | |
| 
 | |
|   sources += authenticators_p2p_files
 | |
|   sources += authenticators_p2p_iso_files
 | |
|   sources += authenticators_p2p_pake_files
 | |
|   sources += authenticators_standard_exchange_task_files
 | |
| 
 | |
|   sources += account_related_files
 | |
| 
 | |
|   sources += privacy_enhancement_files
 | |
|   sources += mk_agree_files
 | |
| 
 | |
|   sources -= [
 | |
|     "${authenticators_path}/src/account_unrelated/iso_task/iso_task_main.c",
 | |
|     "${authenticators_path}/src/account_unrelated/pake_task/pake_v1_task/pake_v1_task_main.c",
 | |
|   ]
 | |
| 
 | |
|   sources -= [
 | |
|     "//base/security/device_auth/services/authenticators/src/account_related/creds_manager/asy_token_manager.c",
 | |
|     "//base/security/device_auth/services/group_manager/src/group_operation/across_account_group/across_account_group.c",
 | |
|     "//base/security/device_auth/services/group_manager/src/group_operation/identical_account_group/identical_account_group.c",
 | |
|     "//base/security/device_auth/services/group_manager/src/group_operation/peer_to_peer_group/peer_to_peer_group.c",
 | |
|   ]
 | |
| 
 | |
|   sources += [
 | |
|     "${dev_frameworks_path}/src/plugin_adapter_mock/account_auth_plugin_proxy_mock.c",
 | |
|     "source/os_account_adapter_mock.c",
 | |
|     "source/protocol_task_main_mock.c",
 | |
|     "unit_test/source/account_related_creds_manager_dir_test.cpp",
 | |
|     "unit_test/source/across_account_group_test.cpp",
 | |
|     "unit_test/source/common_lib_test.cpp",
 | |
|     "unit_test/source/identical_account_group_test.cpp",
 | |
|     "unit_test/source/key_management_test.cpp",
 | |
|     "unit_test/source/peer_to_peer_group_test.cpp",
 | |
|   ]
 | |
| 
 | |
|   defines = [
 | |
|     "P2P_PAKE_DL_PRIME_LEN_384",
 | |
|     "P2P_PAKE_EC_TYPE",
 | |
|     "ENABLE_EC_SPEKE",
 | |
|     "ENABLE_ISO",
 | |
|     "ENABLE_AUTH_CODE_IMPORT",
 | |
|     "ENABLE_PUB_KEY_EXCHANGE",
 | |
|     "ENABLE_SAVE_TRUSTED_INFO",
 | |
|     "ENABLE_PSEUDONYM",
 | |
|   ]
 | |
| 
 | |
|   cflags = [ "-DHILOG_ENABLE" ]
 | |
| 
 | |
|   deps = [
 | |
|     "//third_party/cJSON:cjson",
 | |
|     "//third_party/googletest:gmock_main",
 | |
|     "//third_party/googletest:gtest_main",
 | |
|     "//third_party/mbedtls:mbedtls_shared",
 | |
|     "//third_party/openssl:libcrypto_static",
 | |
|   ]
 | |
| 
 | |
|   external_deps = [
 | |
|     "c_utils:utils",
 | |
|     "hilog:libhilog",
 | |
|     "huks:libhukssdk",
 | |
|   ]
 | |
| }
 | |
| 
 | |
| ohos_unittest("device_auth_ipc_test") {
 | |
|   module_out_path = module_output_path
 | |
| 
 | |
|   include_dirs = hals_inc_path
 | |
|   include_dirs += [
 | |
|     "//base/security/device_auth/interfaces/inner_api",
 | |
|     "//base/security/access_token/interfaces/innerkits/nativetoken/include",
 | |
|     "//base/security/access_token/interfaces/innerkits/token_setproc/include",
 | |
|   ]
 | |
| 
 | |
|   sources = [ "source/device_auth_ipc_test.cpp" ]
 | |
| 
 | |
|   deps = [
 | |
|     "${deps_adapter_path}:${hal_module_name}",
 | |
|     "//base/security/access_token/interfaces/innerkits/nativetoken:libnativetoken",
 | |
|     "//base/security/access_token/interfaces/innerkits/token_setproc:libtoken_setproc",
 | |
|     "//third_party/cJSON:cjson",
 | |
|     "//third_party/googletest:gmock_main",
 | |
|     "//third_party/googletest:gtest_main",
 | |
|   ]
 | |
| 
 | |
|   external_deps = [
 | |
|     "c_utils:utils",
 | |
|     "device_auth:deviceauth_sdk",
 | |
|     "hilog:libhilog",
 | |
|   ]
 | |
| }
 |