• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (C) 2021-2025 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
14import("//base/security/device_auth/deps_adapter/deviceauth_hals.gni")
15import("//base/security/device_auth/services/deviceauth.gni")
16import("//base/security/device_auth/services/key_agree_sdk/key_agree_sdk.gni")
17import("//build/test.gni")
18
19module_output_path = "device_auth/device_auth"
20
21ohos_unittest("deviceauth_llt") {
22  module_out_path = module_output_path
23
24  include_dirs = inc_path
25  include_dirs += hals_inc_path
26
27  include_dirs += [
28    "./include",
29    "./unit_test/include",
30    "${dev_frameworks_path}/inc/permission_adapter",
31    "${dev_frameworks_path}/inc/hiview_adapter",
32  ]
33
34  include_dirs += []
35
36  sources = hal_common_files
37  sources -= [ "${common_lib_path}/impl/src/json_utils.c" ]
38  sources += [
39    "${key_management_adapter_path}/impl/src/common/mbedtls_ec_adapter.c",
40    "${key_management_adapter_path}/impl/src/huks_adapter.c",
41    "${key_management_adapter_path}/impl/src/huks_adapter_utils.c",
42    "${key_management_adapter_path}/impl/src/standard/crypto_hash_to_point.c",
43    "${key_management_adapter_path}/impl/src/standard/huks_adapter_diff_impl.c",
44    "${os_adapter_path}/impl/src/hc_log.c",
45    "${os_adapter_path}/impl/src/linux/hc_condition.c",
46    "${os_adapter_path}/impl/src/linux/hc_file.c",
47    "${os_adapter_path}/impl/src/linux/hc_init_protection.c",
48    "${os_adapter_path}/impl/src/linux/hc_thread.c",
49    "${os_adapter_path}/impl/src/linux/hc_types.c",
50    "source/hc_dev_info_mock.c",
51    "source/json_utils_mock.c",
52  ]
53
54  sources += dev_frameworks_files
55  sources += identity_service_mock_files
56  sources += deviceauth_common_files
57  sources += sa_load_on_demand_mock_files
58  sources += group_database_manager_files
59  sources += ext_plugin_manager_files
60  sources += session_manager_files
61  sources += session_mini_files
62  sources += session_v1_files
63  sources += session_v2_mock_files
64  sources += creds_manager_files
65  sources += broadcast_manager_files
66  sources += soft_bus_channel_mock_files
67
68  sources += group_auth_files
69  sources += group_auth_account_unrelated_files
70
71  sources += group_manager_files
72  sources += group_manager_peer_to_peer_files
73
74  sources += authenticators_p2p_files
75  sources += authenticators_p2p_iso_files
76  sources += authenticators_p2p_pake_files
77  sources += authenticators_standard_exchange_task_files
78
79  sources += account_related_files
80
81  sources += privacy_enhancement_files
82  sources += mk_agree_files
83
84  sources += security_label_adapter_files
85
86  include_dirs += identity_manager_inc
87  sources += identity_manager_files
88
89  sources -= [
90    "${authenticators_path}/src/account_unrelated/iso_task/iso_task_main.c",
91    "${authenticators_path}/src/account_unrelated/pake_task/pake_v1_task/pake_v1_task_main.c",
92    "${deviceauth_account_group_auth_path}/src/group_auth_manager/account_related_group_auth/account_related_group_auth.c",
93    "${identity_manager_path}/src/identity_cred.c",
94  ]
95
96  sources += [
97    "${dev_frameworks_path}/src/account_task_manager_mock/account_task_manager_mock.c",
98    "${dev_frameworks_path}/src/plugin_adapter_mock/account_auth_plugin_proxy_mock.c",
99    "source/creds_manager_test.cpp",
100    "source/device_auth_ext_mock.c",
101    "source/deviceauth_standard_auth_test.cpp",
102    "source/deviceauth_standard_member_test.cpp",
103    "source/deviceauth_standard_test.cpp",
104    "source/group_operation_common_test.cpp",
105    "source/identity_manager_test.cpp",
106    "source/mk_agree_test.cpp",
107    "source/os_account_adapter_mock.c",
108    "source/privacy_enhancement_test.cpp",
109    "source/protocol_task_main_mock.c",
110    "source/standard_exchange_task_test.cpp",
111    "unit_test/source/account_related_group_auth_dir_test.cpp",
112    "unit_test/source/pake_v2_auth_task_test.cpp",
113  ]
114  defines = [
115    "P2P_PAKE_DL_PRIME_LEN_384",
116    "P2P_PAKE_EC_TYPE",
117    "ENABLE_ACCOUNT_AUTH_ISO",
118    "ENABLE_ACCOUNT_AUTH_EC_SPEKE",
119    "ENABLE_P2P_BIND_ISO",
120    "ENABLE_P2P_BIND_EC_SPEKE",
121    "ENABLE_P2P_AUTH_ISO",
122    "ENABLE_P2P_AUTH_EC_SPEKE",
123    "DEV_AUTH_FUNC_TEST",
124    "ENABLE_PSEUDONYM",
125    "DEFAULT_V2_NOT_SUPPORT",
126  ]
127
128  cflags = [ "-DHILOG_ENABLE" ]
129  cflags += [
130    "-DDEV_AUTH_WORK_THREAD_STACK_SIZE=${device_auth_hichain_thread_stack_size}",
131    "-DMAX_AUTH_SESSION_COUNT=${max_auth_session_count}",
132  ]
133
134  deps = []
135
136  external_deps = [
137    "cJSON:cjson",
138    "c_utils:utils",
139    "googletest:gmock_main",
140    "googletest:gtest_main",
141    "hilog:libhilog",
142    "huks:libhukssdk",
143    "mbedtls:mbedtls_shared",
144    "openssl:libcrypto_static",
145  ]
146}
147
148ohos_unittest("device_auth_func_test") {
149  module_out_path = module_output_path
150
151  include_dirs = inc_path
152  include_dirs += hals_inc_path
153
154  include_dirs += [
155    "./include",
156    "./unit_test/include",
157    "${dev_frameworks_path}/inc/permission_adapter",
158    "${dev_frameworks_path}/inc/hiview_adapter",
159  ]
160
161  sources = hal_common_files
162  sources -= [ "${common_lib_path}/impl/src/json_utils.c" ]
163  sources += [
164    "${key_management_adapter_path}/impl/src/common/mbedtls_ec_adapter.c",
165    "${key_management_adapter_path}/impl/src/huks_adapter.c",
166    "${key_management_adapter_path}/impl/src/huks_adapter_utils.c",
167    "${key_management_adapter_path}/impl/src/standard/crypto_hash_to_point.c",
168    "${key_management_adapter_path}/impl/src/standard/huks_adapter_diff_impl.c",
169    "${os_adapter_path}/impl/src/hc_log.c",
170    "${os_adapter_path}/impl/src/linux/hc_condition.c",
171    "${os_adapter_path}/impl/src/linux/hc_file.c",
172    "${os_adapter_path}/impl/src/linux/hc_init_protection.c",
173    "${os_adapter_path}/impl/src/linux/hc_thread.c",
174    "${os_adapter_path}/impl/src/linux/hc_types.c",
175    "source/hc_dev_info_mock.c",
176    "source/json_utils_mock.c",
177  ]
178
179  sources += dev_frameworks_files
180  sources += identity_service_mock_files
181  sources += deviceauth_common_files
182  sources += sa_load_on_demand_mock_files
183  sources += group_database_manager_files
184  sources += ext_plugin_manager_files
185  sources += session_manager_files
186  sources += session_mini_files
187  sources += session_v1_files
188  sources += session_v2_files
189  sources += iso_protocol_files
190  sources += ec_speke_protocol_files
191  sources += auth_code_import_files
192  sources += pub_key_exchange_files
193  sources += save_trusted_info_files
194  sources += creds_manager_files
195  sources += broadcast_manager_files
196  sources += soft_bus_channel_mock_files
197
198  sources += group_auth_files
199  sources += group_auth_account_unrelated_files
200
201  sources += group_manager_files
202  sources += group_manager_peer_to_peer_files
203
204  sources += authenticators_p2p_files
205  sources += authenticators_p2p_iso_files
206  sources += authenticators_p2p_pake_files
207  sources += authenticators_standard_exchange_task_files
208
209  sources += account_related_files
210
211  sources += privacy_enhancement_files
212  sources += mk_agree_files
213
214  sources += security_label_adapter_files
215
216  sources += hiview_adapter_files
217
218  sources -= [
219    "${authenticators_path}/src/account_unrelated/iso_task/iso_task_main.c",
220    "${authenticators_path}/src/account_unrelated/pake_task/pake_v1_task/pake_v1_task_main.c",
221  ]
222
223  sources += [
224    "${dev_frameworks_path}/src/account_task_manager_mock/account_task_manager_mock.c",
225    "${dev_frameworks_path}/src/plugin_adapter_mock/account_auth_plugin_proxy_mock.c",
226    "source/creds_manager_test.cpp",
227    "source/device_auth_ext_mock.c",
228    "source/deviceauth_standard_auth_test.cpp",
229    "source/deviceauth_standard_member_test.cpp",
230    "source/deviceauth_standard_test.cpp",
231    "source/group_operation_common_test.cpp",
232    "source/iso_auth_task_test.cpp",
233    "source/os_account_adapter_mock.c",
234    "source/protocol_task_main_mock.c",
235    "source/standard_exchange_task_test.cpp",
236  ]
237  defines = [
238    "P2P_PAKE_DL_PRIME_LEN_384",
239    "P2P_PAKE_EC_TYPE",
240    "ENABLE_EC_SPEKE",
241    "ENABLE_ISO",
242    "ENABLE_AUTH_CODE_IMPORT",
243    "ENABLE_PUB_KEY_EXCHANGE",
244    "ENABLE_SAVE_TRUSTED_INFO",
245    "ENABLE_ACCOUNT_AUTH_ISO",
246    "ENABLE_ACCOUNT_AUTH_EC_SPEKE",
247    "ENABLE_P2P_BIND_ISO",
248    "ENABLE_P2P_BIND_EC_SPEKE",
249    "ENABLE_P2P_AUTH_ISO",
250    "ENABLE_P2P_AUTH_EC_SPEKE",
251    "DEV_AUTH_FUNC_TEST",
252    "ENABLE_PSEUDONYM",
253    "DEV_AUTH_HIVIEW_ENABLE",
254  ]
255
256  sources += identity_manager_files
257  include_dirs += identity_manager_inc
258  sources += [ "source/deviceauth_func_test.cpp" ]
259
260  cflags = [ "-DHILOG_ENABLE" ]
261  cflags += [
262    "-DDEV_AUTH_WORK_THREAD_STACK_SIZE=${device_auth_hichain_thread_stack_size}",
263    "-DMAX_AUTH_SESSION_COUNT=${max_auth_session_count}",
264  ]
265
266  deps = []
267
268  external_deps = [
269    "cJSON:cjson",
270    "c_utils:utils",
271    "googletest:gmock_main",
272    "googletest:gtest_main",
273    "hilog:libhilog",
274    "hisysevent:libhisysevent",
275    "hitrace:hitrace_meter",
276    "huks:libhukssdk",
277    "mbedtls:mbedtls_shared",
278    "openssl:libcrypto_static",
279  ]
280}
281
282ohos_unittest("device_auth_identity_service_test") {
283  module_out_path = module_output_path
284
285  include_dirs = inc_path
286  include_dirs += hals_inc_path
287
288  include_dirs += [
289    "./include",
290    "./unit_test/include",
291    "${dev_frameworks_path}/inc/permission_adapter",
292    "${dev_frameworks_path}/inc/hiview_adapter",
293  ]
294
295  sources = hal_common_files
296  sources -= [ "${common_lib_path}/impl/src/json_utils.c" ]
297  sources += [
298    "${key_management_adapter_path}/impl/src/common/mbedtls_ec_adapter.c",
299    "${key_management_adapter_path}/impl/src/huks_adapter.c",
300    "${key_management_adapter_path}/impl/src/huks_adapter_utils.c",
301    "${key_management_adapter_path}/impl/src/standard/crypto_hash_to_point.c",
302    "${key_management_adapter_path}/impl/src/standard/huks_adapter_diff_impl.c",
303    "${os_adapter_path}/impl/src/hc_log.c",
304    "${os_adapter_path}/impl/src/linux/hc_condition.c",
305    "${os_adapter_path}/impl/src/linux/hc_file.c",
306    "${os_adapter_path}/impl/src/linux/hc_init_protection.c",
307    "${os_adapter_path}/impl/src/linux/hc_thread.c",
308    "${os_adapter_path}/impl/src/linux/hc_types.c",
309    "source/hc_dev_info_mock.c",
310    "source/json_utils_mock.c",
311  ]
312
313  sources += dev_frameworks_files
314  sources += deviceauth_common_files
315  sources += group_database_manager_files
316  sources += ext_plugin_manager_files
317  sources += session_manager_files
318  sources += identity_service_files
319  sources += session_mini_files
320  sources += session_v1_files
321  sources += session_v2_files
322  sources += iso_protocol_files
323  sources += ec_speke_protocol_files
324  sources += auth_code_import_files
325  sources += pub_key_exchange_files
326  sources += save_trusted_info_files
327  sources += creds_manager_files
328  sources += broadcast_manager_files
329  sources += soft_bus_channel_mock_files
330  sources += permission_adapter_files
331  sources += sa_load_on_demand_mock_files
332
333  sources += group_auth_files
334  sources += group_auth_account_unrelated_files
335
336  sources += group_manager_files
337  sources += group_manager_peer_to_peer_files
338
339  sources += authenticators_p2p_files
340  sources += authenticators_p2p_iso_files
341  sources += authenticators_p2p_pake_files
342  sources += authenticators_standard_exchange_task_files
343
344  sources += account_related_files
345
346  sources += privacy_enhancement_files
347  sources += mk_agree_files
348
349  sources += security_label_adapter_files
350
351  sources += hiview_adapter_files
352
353  sources -= [
354    "${authenticators_path}/src/account_unrelated/iso_task/iso_task_main.c",
355    "${authenticators_path}/src/account_unrelated/pake_task/pake_v1_task/pake_v1_task_main.c",
356    "${identity_service_path}/session/src/cred_session_util.c",
357    "${identity_service_path}/src/identity_operation.c",
358    "${cred_data_manager_path}/src/credential_data_manager.c",
359  ]
360
361  sources += [
362    "${dev_frameworks_path}/src/account_task_manager_mock/account_task_manager_mock.c",
363    "${dev_frameworks_path}/src/plugin_adapter_mock/account_auth_plugin_proxy_mock.c",
364    "source/device_auth_ext_mock.c",
365    "source/deviceauth_identity_service_test.cpp",
366    "source/os_account_adapter_mock.c",
367    "source/protocol_task_main_mock.c",
368  ]
369
370  defines = [
371    "P2P_PAKE_DL_PRIME_LEN_384",
372    "P2P_PAKE_EC_TYPE",
373    "ENABLE_EC_SPEKE",
374    "ENABLE_ISO",
375    "ENABLE_AUTH_CODE_IMPORT",
376    "ENABLE_PUB_KEY_EXCHANGE",
377    "ENABLE_SAVE_TRUSTED_INFO",
378    "ENABLE_ACCOUNT_AUTH_ISO",
379    "ENABLE_ACCOUNT_AUTH_EC_SPEKE",
380    "ENABLE_P2P_BIND_ISO",
381    "ENABLE_P2P_BIND_EC_SPEKE",
382    "ENABLE_P2P_AUTH_ISO",
383    "ENABLE_P2P_AUTH_EC_SPEKE",
384    "DEV_AUTH_FUNC_TEST",
385    "ENABLE_PSEUDONYM",
386    "DEV_AUTH_HIVIEW_ENABLE",
387    "DEV_AUTH_IS_ENABLE",
388  ]
389
390  sources += identity_manager_files
391  include_dirs += identity_manager_inc
392
393  cflags = [ "-DHILOG_ENABLE" ]
394  cflags += [
395    "-DDEV_AUTH_WORK_THREAD_STACK_SIZE=${device_auth_hichain_thread_stack_size}",
396    "-DMAX_AUTH_SESSION_COUNT=${max_auth_session_count}",
397  ]
398
399  deps = []
400
401  external_deps = [
402    "access_token:libaccesstoken_sdk",
403    "cJSON:cjson",
404    "c_utils:utils",
405    "googletest:gmock_main",
406    "googletest:gtest_main",
407    "hilog:libhilog",
408    "hisysevent:libhisysevent",
409    "hitrace:hitrace_meter",
410    "huks:libhukssdk",
411    "ipc:ipc_single",
412    "mbedtls:mbedtls_shared",
413    "openssl:libcrypto_static",
414  ]
415}
416
417ohos_unittest("device_auth_interface_test") {
418  module_out_path = module_output_path
419
420  include_dirs = inc_path
421  include_dirs += hals_inc_path
422
423  include_dirs += [
424    "./include",
425    "./unit_test/include",
426    "${dev_frameworks_path}/inc/hiview_adapter",
427    "${frameworks_path}/inc/standard",
428    "${dev_frameworks_path}/inc/permission_adapter",
429    "${frameworks_path}/sdk/sa_load_on_demand/inc",
430  ]
431
432  sources = hal_common_files
433  sources -= [ "${common_lib_path}/impl/src/json_utils.c" ]
434  sources += [
435    "${key_management_adapter_path}/impl/src/common/mbedtls_ec_adapter.c",
436    "${key_management_adapter_path}/impl/src/huks_adapter.c",
437    "${key_management_adapter_path}/impl/src/huks_adapter_utils.c",
438    "${key_management_adapter_path}/impl/src/standard/crypto_hash_to_point.c",
439    "${key_management_adapter_path}/impl/src/standard/huks_adapter_diff_impl.c",
440    "${os_adapter_path}/impl/src/hc_log.c",
441    "${os_adapter_path}/impl/src/linux/hc_condition.c",
442    "${os_adapter_path}/impl/src/linux/hc_file.c",
443    "${os_adapter_path}/impl/src/linux/hc_init_protection.c",
444    "${os_adapter_path}/impl/src/linux/hc_thread.c",
445    "${os_adapter_path}/impl/src/linux/hc_types.c",
446    "source/hc_dev_info_mock.c",
447    "source/json_utils_mock.c",
448  ]
449
450  sources += dev_frameworks_files
451  sources += identity_service_mock_files
452  sources += deviceauth_common_files
453  sources += group_database_manager_files
454  sources += ext_plugin_manager_files
455  sources += session_manager_files
456  sources += session_mini_files
457  sources += session_v1_files
458  sources += session_v2_files
459  sources += iso_protocol_files
460  sources += ec_speke_protocol_files
461  sources += auth_code_import_files
462  sources += pub_key_exchange_files
463  sources += save_trusted_info_files
464  sources += creds_manager_files
465  sources += broadcast_manager_files
466  sources += soft_bus_channel_files
467  sources += deviceauth_ipc_files
468  sources += permission_adapter_files
469  sources += critical_handler_mock_files
470  sources += sdk_load_on_demand_mock_files
471
472  sources += group_auth_files
473  sources += group_auth_account_unrelated_files
474
475  sources += group_manager_files
476  sources += group_manager_peer_to_peer_files
477
478  sources += authenticators_p2p_files
479  sources += authenticators_p2p_iso_files
480  sources += authenticators_p2p_pake_files
481  sources += authenticators_standard_exchange_task_files
482
483  sources += account_related_files
484
485  sources += privacy_enhancement_files
486  sources += mk_agree_files
487
488  sources += security_label_adapter_files
489
490  sources += hiview_adapter_files
491
492  sources += [
493    "${dev_frameworks_path}/src/account_task_manager/account_task_manager.c",
494    "${dev_frameworks_path}/src/plugin_adapter/ext_part/account_auth_plugin/account_auth_plugin_proxy.c",
495    "source/device_auth_ext_mock.c",
496    "source/os_account_adapter_mock.c",
497  ]
498  sources -= [
499    "${authenticators_path}/src/account_unrelated/pake_task/pake_v1_task/pake_v1_protocol_task/pake_v1_protocol_task_common.c",
500    "${deviceauth_account_group_manager_path}/src/group_operation/identical_account_group/identical_account_group.c",
501    "${session_manager_path}/src/session/v2/dev_session_util.c",
502  ]
503  defines = [
504    "P2P_PAKE_DL_PRIME_LEN_384",
505    "P2P_PAKE_EC_TYPE",
506    "ENABLE_EC_SPEKE",
507    "ENABLE_ISO",
508    "ENABLE_AUTH_CODE_IMPORT",
509    "ENABLE_PUB_KEY_EXCHANGE",
510    "ENABLE_SAVE_TRUSTED_INFO",
511    "ENABLE_ACCOUNT_AUTH_ISO",
512    "ENABLE_ACCOUNT_AUTH_EC_SPEKE",
513    "ENABLE_P2P_BIND_ISO",
514    "ENABLE_P2P_BIND_EC_SPEKE",
515    "ENABLE_P2P_AUTH_ISO",
516    "ENABLE_P2P_AUTH_EC_SPEKE",
517    "ENABLE_PSEUDONYM",
518    "DEV_AUTH_HIVIEW_ENABLE",
519  ]
520  sources += identity_manager_files
521  include_dirs += identity_manager_inc
522  sources += [ "source/deviceauth_interface_test.cpp" ]
523
524  cflags = [ "-DHILOG_ENABLE" ]
525  cflags += [
526    "-DDEV_AUTH_WORK_THREAD_STACK_SIZE=${device_auth_hichain_thread_stack_size}",
527    "-DMAX_AUTH_SESSION_COUNT=${max_auth_session_count}",
528  ]
529
530  deps = []
531
532  external_deps = [
533    "access_token:libaccesstoken_sdk",
534    "bounds_checking_function:libsec_shared",
535    "cJSON:cjson",
536    "c_utils:utils",
537    "dsoftbus:softbus_client",
538    "googletest:gmock_main",
539    "googletest:gtest_main",
540    "hilog:libhilog",
541    "hisysevent:libhisysevent",
542    "hitrace:hitrace_meter",
543    "huks:libhukssdk",
544    "init:libbegetutil",
545    "ipc:ipc_single",
546    "mbedtls:mbedtls_shared",
547    "openssl:libcrypto_static",
548    "samgr:samgr_proxy",
549    "common_event_service:cesfwk_innerkits",
550    "safwk:system_ability_fwk",
551  ]
552}
553
554ohos_unittest("deviceauth_unit_test") {
555  module_out_path = module_output_path
556
557  include_dirs = inc_path
558  include_dirs += hals_inc_path
559
560  include_dirs += [
561    "./include",
562    "./unit_test/include",
563    "${dev_frameworks_path}/inc/permission_adapter",
564    "${dev_frameworks_path}/inc/hiview_adapter",
565  ]
566
567  sources = hal_common_files
568  sources -= [ "${common_lib_path}/impl/src/hc_parcel.c" ]
569  sources += [
570    "${key_management_adapter_path}/impl/src/common/mbedtls_ec_adapter.c",
571    "${key_management_adapter_path}/impl/src/huks_adapter.c",
572    "${key_management_adapter_path}/impl/src/huks_adapter_utils.c",
573    "${key_management_adapter_path}/impl/src/standard/crypto_hash_to_point.c",
574    "${key_management_adapter_path}/impl/src/standard/huks_adapter_diff_impl.c",
575    "${os_adapter_path}/impl/src/hc_log.c",
576    "${os_adapter_path}/impl/src/linux/hc_condition.c",
577    "${os_adapter_path}/impl/src/linux/hc_file.c",
578    "${os_adapter_path}/impl/src/linux/hc_init_protection.c",
579    "${os_adapter_path}/impl/src/linux/hc_thread.c",
580    "${os_adapter_path}/impl/src/linux/hc_types.c",
581    "source/hc_dev_info_mock.c",
582  ]
583
584  include_dirs += identity_manager_inc
585  sources += identity_manager_files
586  sources += identity_service_mock_files
587  sources += dev_frameworks_files
588  sources += deviceauth_common_files
589  sources += sa_load_on_demand_mock_files
590  sources += group_database_manager_files
591  sources += ext_plugin_manager_files
592  sources += session_manager_files
593  sources += session_mini_files
594  sources += session_v1_files
595  sources += session_v2_files
596  sources += iso_protocol_files
597  sources += ec_speke_protocol_files
598  sources += auth_code_import_files
599  sources += pub_key_exchange_files
600  sources += save_trusted_info_files
601  sources += creds_manager_files
602  sources += broadcast_manager_files
603  sources += soft_bus_channel_mock_files
604
605  sources += group_auth_files
606  sources += group_auth_account_unrelated_files
607
608  sources += group_manager_files
609  sources += group_manager_peer_to_peer_files
610
611  sources += authenticators_p2p_files
612  sources += authenticators_p2p_iso_files
613  sources += authenticators_p2p_pake_files
614  sources += authenticators_standard_exchange_task_files
615
616  sources += account_related_files
617
618  sources += privacy_enhancement_files
619  sources += mk_agree_files
620
621  sources += security_label_adapter_files
622
623  sources -= [
624    "${authenticators_path}/src/account_unrelated/iso_task/iso_task_main.c",
625    "${authenticators_path}/src/account_unrelated/pake_task/pake_v1_task/pake_v1_task_main.c",
626  ]
627
628  sources += [
629    "${dev_frameworks_path}/src/account_task_manager_mock/account_task_manager_mock.c",
630    "${dev_frameworks_path}/src/plugin_adapter_mock/account_auth_plugin_proxy_mock.c",
631    "source/os_account_adapter_mock.c",
632    "source/protocol_task_main_mock.c",
633    "unit_test/source/account_related_creds_manager_dir_test.cpp",
634    "unit_test/source/common_lib_test.cpp",
635    "unit_test/source/key_management_test.cpp",
636    "unit_test/source/group_data_manager_test.cpp",
637  ]
638
639  defines = [
640    "P2P_PAKE_DL_PRIME_LEN_384",
641    "P2P_PAKE_EC_TYPE",
642    "ENABLE_EC_SPEKE",
643    "ENABLE_ISO",
644    "ENABLE_AUTH_CODE_IMPORT",
645    "ENABLE_PUB_KEY_EXCHANGE",
646    "ENABLE_SAVE_TRUSTED_INFO",
647    "ENABLE_PSEUDONYM",
648    "DEV_AUTH_FUNC_TEST",
649  ]
650
651  cflags = [ "-DHILOG_ENABLE" ]
652  cflags += [
653    "-DDEV_AUTH_WORK_THREAD_STACK_SIZE=${device_auth_hichain_thread_stack_size}",
654    "-DMAX_AUTH_SESSION_COUNT=${max_auth_session_count}",
655  ]
656
657  deps = []
658
659  external_deps = [
660    "access_token:libaccesstoken_sdk",
661    "cJSON:cjson",
662    "c_utils:utils",
663    "googletest:gmock_main",
664    "googletest:gtest_main",
665    "hilog:libhilog",
666    "huks:libhukssdk",
667    "mbedtls:mbedtls_shared",
668    "openssl:libcrypto_static",
669  ]
670}
671
672ohos_unittest("device_auth_ipc_test") {
673  module_out_path = module_output_path
674
675  include_dirs = hals_inc_path
676  include_dirs += []
677
678  sources = [
679    "source/device_auth_ipc_test.cpp",
680    "source/p2p_bind_ipc_test.cpp",
681  ]
682
683  deps = [ "${deps_adapter_path}:${hal_module_test_name}" ]
684
685  cflags = [ "-DHILOG_ENABLE" ]
686
687  external_deps = [
688    "access_token:libnativetoken",
689    "access_token:libtoken_setproc",
690    "selinux_adapter:librestorecon",
691    "cJSON:cjson",
692    "c_utils:utils",
693    "device_auth:deviceauth_sdk",
694    "googletest:gmock_main",
695    "googletest:gtest_main",
696    "hilog:libhilog",
697  ]
698}
699
700ohos_unittest("light_auth_test") {
701  module_out_path = module_output_path
702
703  include_dirs = inc_path
704  include_dirs += hals_inc_path
705  include_dirs += [
706    "./include",
707    "./unit_test/include",
708    "${dev_frameworks_path}/inc/hiview_adapter",
709    "${frameworks_path}/inc/standard",
710    "${dev_frameworks_path}/inc/permission_adapter",
711    "${frameworks_path}/sdk/sa_load_on_demand/inc",
712  ]
713
714  sources = hal_common_files
715  sources -= ["${common_lib_path}/impl/src/json_utils.c"]
716  sources += [
717    "${key_management_adapter_path}/impl/src/common/mbedtls_ec_adapter.c",
718    "${key_management_adapter_path}/impl/src/huks_adapter.c",
719    "${key_management_adapter_path}/impl/src/huks_adapter_utils.c",
720    "${key_management_adapter_path}/impl/src/standard/crypto_hash_to_point.c",
721    "${key_management_adapter_path}/impl/src/standard/huks_adapter_diff_impl.c",
722    "${os_adapter_path}/impl/src/hc_log.c",
723    "${os_adapter_path}/impl/src/linux/hc_condition.c",
724    "${os_adapter_path}/impl/src/linux/hc_file.c",
725    "${os_adapter_path}/impl/src/linux/hc_init_protection.c",
726    "${os_adapter_path}/impl/src/linux/hc_thread.c",
727    "${os_adapter_path}/impl/src/linux/hc_types.c",
728    "source/hc_dev_info_mock.c",
729    "source/json_utils_mock.c",
730  ]
731
732  sources += dev_frameworks_files
733  sources += identity_service_mock_files
734  sources += deviceauth_common_files
735  sources += group_database_manager_files
736  sources += ext_plugin_manager_files
737  sources += session_manager_files
738  sources += session_mini_files
739  sources += session_v1_files
740  sources += session_v2_files
741  sources += iso_protocol_files
742  sources += ec_speke_protocol_files
743  sources += auth_code_import_files
744  sources += pub_key_exchange_files
745  sources += save_trusted_info_files
746  sources += creds_manager_files
747  sources += broadcast_manager_files
748  sources += soft_bus_channel_files
749  sources += deviceauth_ipc_files
750  sources += permission_adapter_files
751  sources += critical_handler_mock_files
752
753  sources += group_auth_files
754  sources += group_auth_account_unrelated_files
755
756  sources += group_manager_files
757  sources += group_manager_peer_to_peer_files
758
759  sources += authenticators_p2p_files
760  sources += authenticators_p2p_iso_files
761  sources += authenticators_p2p_pake_files
762  sources += authenticators_standard_exchange_task_files
763
764  sources += account_related_files
765
766  sources += privacy_enhancement_files
767  sources += mk_agree_files
768
769  sources += security_label_adapter_files
770
771  sources += hiview_adapter_files
772
773  sources += [
774    "${dev_frameworks_path}/src/account_task_manager/account_task_manager.c",
775    "${dev_frameworks_path}/src/plugin_adapter/ext_part/account_auth_plugin/account_auth_plugin_proxy.c",
776    "source/device_auth_ext_mock.c",
777    "source/os_account_adapter_mock.c",
778    "${services_path}/sa/src/cache_common_event_handler/cache_common_event_handler.cpp",
779  ]
780
781  sources -= ["${services_path}/device_auth.c",]
782
783  defines = [
784    "P2P_PAKE_DL_PRIME_LEN_384",
785    "P2P_PAKE_EC_TYPE",
786    "ENABLE_EC_SPEKE",
787    "ENABLE_ISO",
788    "ENABLE_AUTH_CODE_IMPORT",
789    "ENABLE_PUB_KEY_EXCHANGE",
790    "ENABLE_SAVE_TRUSTED_INFO",
791    "ENABLE_ACCOUNT_AUTH_ISO",
792    "ENABLE_ACCOUNT_AUTH_EC_SPEKE",
793    "ENABLE_P2P_BIND_ISO",
794    "ENABLE_P2P_BIND_EC_SPEKE",
795    "ENABLE_P2P_AUTH_ISO",
796    "ENABLE_P2P_AUTH_EC_SPEKE",
797    "ENABLE_PSEUDONYM",
798    "DEV_AUTH_HIVIEW_ENABLE",
799  ]
800
801  sources += identity_manager_files
802  include_dirs += identity_manager_inc
803
804  sources += [
805    "source/light_auth_test.cpp",
806  ]
807
808  deps = [ "${deps_adapter_path}:${hal_module_test_name}" ]
809
810  cflags = [ "-DHILOG_ENABLE" ]
811  cflags += [
812    "-DDEV_AUTH_WORK_THREAD_STACK_SIZE=${device_auth_hichain_thread_stack_size}",
813    "-DMAX_AUTH_SESSION_COUNT=${max_auth_session_count}",
814  ]
815
816  external_deps = [
817    "access_token:libaccesstoken_sdk",
818    "bounds_checking_function:libsec_shared",
819    "cJSON:cjson",
820    "c_utils:utils",
821    "dsoftbus:softbus_client",
822    "googletest:gmock_main",
823    "googletest:gtest_main",
824    "hilog:libhilog",
825    "hisysevent:libhisysevent",
826    "hitrace:hitrace_meter",
827    "huks:libhukssdk",
828    "init:libbegetutil",
829    "ipc:ipc_single",
830    "mbedtls:mbedtls_shared",
831    "openssl:libcrypto_static",
832    "samgr:samgr_proxy",
833    "common_event_service:cesfwk_innerkits",
834    "safwk:system_ability_fwk",
835    "access_token:libnativetoken",
836    "access_token:libtoken_setproc",
837    "selinux_adapter:librestorecon",
838    "device_auth:deviceauth_sdk",
839    "googletest:gmock_main",
840    "googletest:gtest_main",
841    "hilog:libhilog",
842  ]
843}
844
845ohos_unittest("identity_service_ipc_test") {
846  module_out_path = module_output_path
847
848  include_dirs = hals_inc_path
849  include_dirs += []
850
851  sources = [ "source/identity_service_ipc_test.cpp" ]
852
853  deps = [ "${deps_adapter_path}:${hal_module_test_name}" ]
854
855  defines = [ "DEV_AUTH_IS_ENABLE" ]
856
857  cflags = [ "-DHILOG_ENABLE" ]
858  external_deps = [
859    "access_token:libaccesstoken_sdk",
860    "access_token:libnativetoken",
861    "access_token:libtoken_setproc",
862    "selinux_adapter:librestorecon",
863    "cJSON:cjson",
864    "c_utils:utils",
865    "device_auth:deviceauth_sdk",
866    "googletest:gmock_main",
867    "googletest:gtest_main",
868    "hilog:libhilog",
869  ]
870}
871