1# Copyright (C) 2022 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/huks/huks.gni") 15import("//build/ohos.gni") 16import("//build/test.gni") 17 18module_output_path = "huks_standard/huks_module_test" 19 20ohos_unittest("huks_module_test") { 21 module_out_path = module_output_path 22 23 include_dirs = [ 24 "//base/security/huks/test/unittest/huks_standard_test/three_stage_test/include", 25 "//base/security/huks/test/unittest/huks_standard_test/crypto_engine_test/include", 26 "//base/security/huks/test/unittest/huks_standard_test/interface_inner_test/sdk_test/include", 27 "//base/security/huks/test/unittest/huks_standard_test/module_test/framework_test/common_test/include", 28 "//base/security/huks/test/unittest/huks_standard_test/module_test/utils_test/include", 29 "//base/security/huks/test/unittest/huks_standard_test/module_test/interface_test/include", 30 "//base/security/huks/utils/condition", 31 "//base/security/huks/test/unittest/huks_standard_test/module_test/service_test/huks_service/core/include", 32 "//base/security/huks/test/unittest/huks_standard_test/three_stage_test/include", 33 "//base/security/huks/test/unittest/huks_standard_test/module_test/service_test/huks_service/os_dependency/idl/passthrough/core/include", 34 "//base/security/huks/test/unittest/huks_standard_test/module_test/service_test/huks_engine/core/include", 35 "//base/security/huks/test/unittest/huks_standard_test/module_test/service_test/huks_engine/core_dependency/include", 36 "//base/security/huks/test/unittest/huks_standard_test/module_test/service_test/huks_service/systemapi_mock/include", 37 "//base/security/huks/test/unittest/huks_standard_test/module_test/service_test/huks_service/os_dependency/sa/include", 38 ] 39 40 sources = [] 41 42 # interface sdk_test 43 sources += [ 44 "//base/security/huks/test/unittest/huks_standard_test/interface_inner_test/sdk_test/src/hks_aes_test.cpp", 45 "//base/security/huks/test/unittest/huks_standard_test/interface_inner_test/sdk_test/src/hks_agreement_test.cpp", 46 "//base/security/huks/test/unittest/huks_standard_test/interface_inner_test/sdk_test/src/hks_bn_exp_mod_test.cpp", 47 "//base/security/huks/test/unittest/huks_standard_test/interface_inner_test/sdk_test/src/hks_cipher_test.cpp", 48 "//base/security/huks/test/unittest/huks_standard_test/interface_inner_test/sdk_test/src/hks_curve25519_test.cpp", 49 "//base/security/huks/test/unittest/huks_standard_test/interface_inner_test/sdk_test/src/hks_delete_test.cpp", 50 "//base/security/huks/test/unittest/huks_standard_test/interface_inner_test/sdk_test/src/hks_derive_test.cpp", 51 "//base/security/huks/test/unittest/huks_standard_test/interface_inner_test/sdk_test/src/hks_exist_test.cpp", 52 "//base/security/huks/test/unittest/huks_standard_test/interface_inner_test/sdk_test/src/hks_generate_key_test.cpp", 53 "//base/security/huks/test/unittest/huks_standard_test/interface_inner_test/sdk_test/src/hks_generate_random_test.cpp", 54 "//base/security/huks/test/unittest/huks_standard_test/interface_inner_test/sdk_test/src/hks_hash_test.cpp", 55 "//base/security/huks/test/unittest/huks_standard_test/interface_inner_test/sdk_test/src/hks_mac_test.cpp", 56 "//base/security/huks/test/unittest/huks_standard_test/interface_inner_test/sdk_test/src/hks_others_test.cpp", 57 "//base/security/huks/test/unittest/huks_standard_test/interface_inner_test/sdk_test/src/hks_session_max_test.cpp", 58 "//base/security/huks/test/unittest/huks_standard_test/interface_inner_test/sdk_test/src/hks_test_aes.c", 59 "//base/security/huks/test/unittest/huks_standard_test/interface_inner_test/sdk_test/src/hks_test_api_performance.c", 60 "//base/security/huks/test/unittest/huks_standard_test/interface_inner_test/sdk_test/src/hks_test_cipher.c", 61 "//base/security/huks/test/unittest/huks_standard_test/interface_inner_test/sdk_test/src/hks_test_common.c", 62 "//base/security/huks/test/unittest/huks_standard_test/interface_inner_test/sdk_test/src/hks_test_curve25519.c", 63 "//base/security/huks/test/unittest/huks_standard_test/interface_inner_test/sdk_test/src/hks_test_mem.c", 64 ] 65 66 # interface three_stage_test 67 sources += [ 68 "//base/security/huks/test/unittest/huks_standard_test/three_stage_test/src/hks_access_control_agree_test.cpp", 69 "//base/security/huks/test/unittest/huks_standard_test/three_stage_test/src/hks_access_control_cipher_test.cpp", 70 "//base/security/huks/test/unittest/huks_standard_test/three_stage_test/src/hks_access_control_derive_test.cpp", 71 "//base/security/huks/test/unittest/huks_standard_test/three_stage_test/src/hks_access_control_mac_test.cpp", 72 "//base/security/huks/test/unittest/huks_standard_test/three_stage_test/src/hks_access_control_rsa_sign_verify_test.cpp", 73 "//base/security/huks/test/unittest/huks_standard_test/three_stage_test/src/hks_access_control_rsa_sign_verify_test_common.cpp", 74 "//base/security/huks/test/unittest/huks_standard_test/three_stage_test/src/hks_access_control_secure_sign_test.cpp", 75 "//base/security/huks/test/unittest/huks_standard_test/three_stage_test/src/hks_access_control_test_common.cpp", 76 "//base/security/huks/test/unittest/huks_standard_test/three_stage_test/src/hks_aes_cipher_part1_test.cpp", 77 "//base/security/huks/test/unittest/huks_standard_test/three_stage_test/src/hks_aes_cipher_part2_test.cpp", 78 "//base/security/huks/test/unittest/huks_standard_test/three_stage_test/src/hks_aes_cipher_part3_test.cpp", 79 "//base/security/huks/test/unittest/huks_standard_test/three_stage_test/src/hks_aes_cipher_test_common.cpp", 80 81 # "//base/security/huks/test/unittest/huks_standard_test/three_stage_test/src/hks_attest_key_nonids_test.cpp", 82 # "//base/security/huks/test/unittest/huks_standard_test/three_stage_test/src/hks_attest_key_test_common.cpp", 83 "//base/security/huks/test/unittest/huks_standard_test/three_stage_test/src/hks_check_auth_part_test.cpp", 84 "//base/security/huks/test/unittest/huks_standard_test/three_stage_test/src/hks_check_pur_part_test.cpp", 85 "//base/security/huks/test/unittest/huks_standard_test/three_stage_test/src/hks_cross_test.cpp", 86 "//base/security/huks/test/unittest/huks_standard_test/three_stage_test/src/hks_cross_test_common.cpp", 87 "//base/security/huks/test/unittest/huks_standard_test/three_stage_test/src/hks_dh_agree_test.cpp", 88 "//base/security/huks/test/unittest/huks_standard_test/three_stage_test/src/hks_ecc_sign_verify_part1_test.cpp", 89 "//base/security/huks/test/unittest/huks_standard_test/three_stage_test/src/hks_ecc_sign_verify_part2_test.cpp", 90 "//base/security/huks/test/unittest/huks_standard_test/three_stage_test/src/hks_ecc_sign_verify_part3_test.cpp", 91 "//base/security/huks/test/unittest/huks_standard_test/three_stage_test/src/hks_ecc_sign_verify_test_common.cpp", 92 "//base/security/huks/test/unittest/huks_standard_test/three_stage_test/src/hks_ecdh_agree_part1_test.cpp", 93 "//base/security/huks/test/unittest/huks_standard_test/three_stage_test/src/hks_ecdh_agree_part2_test.cpp", 94 "//base/security/huks/test/unittest/huks_standard_test/three_stage_test/src/hks_ecdh_agree_test_common.cpp", 95 "//base/security/huks/test/unittest/huks_standard_test/three_stage_test/src/hks_ed25519_sign_verify_test.cpp", 96 "//base/security/huks/test/unittest/huks_standard_test/three_stage_test/src/hks_export_test.cpp", 97 "//base/security/huks/test/unittest/huks_standard_test/three_stage_test/src/hks_export_test_mt.cpp", 98 "//base/security/huks/test/unittest/huks_standard_test/three_stage_test/src/hks_hkdf_derive_part1_test.cpp", 99 "//base/security/huks/test/unittest/huks_standard_test/three_stage_test/src/hks_hkdf_derive_part2_test.cpp", 100 "//base/security/huks/test/unittest/huks_standard_test/three_stage_test/src/hks_hkdf_derive_test_common.cpp", 101 "//base/security/huks/test/unittest/huks_standard_test/three_stage_test/src/hks_hmac_test.cpp", 102 "//base/security/huks/test/unittest/huks_standard_test/three_stage_test/src/hks_import_agree_test.cpp", 103 "//base/security/huks/test/unittest/huks_standard_test/three_stage_test/src/hks_import_key_test.cpp", 104 "//base/security/huks/test/unittest/huks_standard_test/three_stage_test/src/hks_import_rsa_test.cpp", 105 "//base/security/huks/test/unittest/huks_standard_test/three_stage_test/src/hks_import_sign_verify_test.cpp", 106 "//base/security/huks/test/unittest/huks_standard_test/three_stage_test/src/hks_import_wrapped_ecdh_suite_test.cpp", 107 "//base/security/huks/test/unittest/huks_standard_test/three_stage_test/src/hks_import_wrapped_test_common.cpp", 108 "//base/security/huks/test/unittest/huks_standard_test/three_stage_test/src/hks_import_wrapped_x25519_suite_test.cpp", 109 "//base/security/huks/test/unittest/huks_standard_test/three_stage_test/src/hks_pbkdf2_derive_part1_test.cpp", 110 "//base/security/huks/test/unittest/huks_standard_test/three_stage_test/src/hks_pbkdf2_derive_part2_test.cpp", 111 "//base/security/huks/test/unittest/huks_standard_test/three_stage_test/src/hks_pbkdf2_derive_test_common.cpp", 112 "//base/security/huks/test/unittest/huks_standard_test/three_stage_test/src/hks_rsa_cipher_part1_test.cpp", 113 "//base/security/huks/test/unittest/huks_standard_test/three_stage_test/src/hks_rsa_cipher_part2_test.cpp", 114 "//base/security/huks/test/unittest/huks_standard_test/three_stage_test/src/hks_rsa_cipher_part3_test.cpp", 115 "//base/security/huks/test/unittest/huks_standard_test/three_stage_test/src/hks_rsa_cipher_part4_test.cpp", 116 "//base/security/huks/test/unittest/huks_standard_test/three_stage_test/src/hks_rsa_cipher_part5_test.cpp", 117 "//base/security/huks/test/unittest/huks_standard_test/three_stage_test/src/hks_rsa_cipher_test_common.cpp", 118 "//base/security/huks/test/unittest/huks_standard_test/three_stage_test/src/hks_rsa_sign_verify_part1_test.cpp", 119 "//base/security/huks/test/unittest/huks_standard_test/three_stage_test/src/hks_rsa_sign_verify_part2_test.cpp", 120 "//base/security/huks/test/unittest/huks_standard_test/three_stage_test/src/hks_rsa_sign_verify_part3_test.cpp", 121 "//base/security/huks/test/unittest/huks_standard_test/three_stage_test/src/hks_rsa_sign_verify_part4_test.cpp", 122 "//base/security/huks/test/unittest/huks_standard_test/three_stage_test/src/hks_rsa_sign_verify_part5_test.cpp", 123 "//base/security/huks/test/unittest/huks_standard_test/three_stage_test/src/hks_rsa_sign_verify_part6_test.cpp", 124 "//base/security/huks/test/unittest/huks_standard_test/three_stage_test/src/hks_rsa_sign_verify_part7_test.cpp", 125 "//base/security/huks/test/unittest/huks_standard_test/three_stage_test/src/hks_rsa_sign_verify_part8_test.cpp", 126 "//base/security/huks/test/unittest/huks_standard_test/three_stage_test/src/hks_rsa_sign_verify_test_common.cpp", 127 "//base/security/huks/test/unittest/huks_standard_test/three_stage_test/src/hks_sm2_sign_verify_test.cpp", 128 "//base/security/huks/test/unittest/huks_standard_test/three_stage_test/src/hks_sm4_cipher_part_test.cpp", 129 "//base/security/huks/test/unittest/huks_standard_test/three_stage_test/src/hks_sm4_cipher_test_common.cpp", 130 "//base/security/huks/test/unittest/huks_standard_test/three_stage_test/src/hks_three_stage_test_common.c", 131 "//base/security/huks/test/unittest/huks_standard_test/three_stage_test/src/hks_x25519_agree_test.cpp", 132 ] 133 134 # framework test 135 sources += [ 136 "//base/security/huks/test/unittest/huks_standard_test/module_test/framework_test/common_test/src/hks_base_check_test.cpp", 137 "//base/security/huks/test/unittest/huks_standard_test/module_test/framework_test/common_test/src/hks_common_check_test.cpp", 138 "//base/security/huks/test/unittest/huks_standard_test/module_test/framework_test/common_test/src/hks_crypto_hal_test.cpp", 139 "//base/security/huks/test/unittest/huks_standard_test/module_test/framework_test/common_test/src/hks_errorcode_adapter_test.cpp", 140 "//base/security/huks/test/unittest/huks_standard_test/module_test/framework_test/common_test/src/hks_param_test.cpp", 141 "//base/security/huks/test/unittest/huks_standard_test/module_test/framework_test/common_test/src/hks_template_test.cpp", 142 ] 143 144 # interface test 145 sources += [ 146 "//base/security/huks/test/unittest/huks_standard_test/module_test/interface_test/src/hks_api_test.cpp", 147 "//base/security/huks/test/unittest/huks_standard_test/module_test/interface_test/src/hks_get_key_info_list_test.cpp", 148 "//base/security/huks/test/unittest/huks_standard_test/module_test/interface_test/src/hks_refresh_key_info_test.cpp", 149 ] 150 151 # utils test 152 sources += [ 153 "//base/security/huks/test/unittest/huks_standard_test/module_test/utils_test/src/hks_condition_test.cpp", 154 "//base/security/huks/test/unittest/huks_standard_test/module_test/utils_test/src/hks_file_operator_test.cpp", 155 ] 156 157 # service test 158 sources += [ 159 "//base/security/huks/test/unittest/huks_standard_test/module_test/service_test/huks_service/core/src/hks_client_service_test.cpp", 160 "//base/security/huks/test/unittest/huks_standard_test/module_test/service_test/huks_service/os_dependency/idl/passthrough/core/src/huks_core_dynamic_hal_test.cpp", 161 "//base/security/huks/test/unittest/huks_standard_test/module_test/service_test/huks_service/systemapi_mock/src/useridm_mock_test.cpp", 162 ] 163 164 # engine test 165 sources += [ 166 "//base/security/huks/test/unittest/huks_standard_test/module_test/service_test/huks_engine/core/src/hks_core_service_test.cpp", 167 "//base/security/huks/test/unittest/huks_standard_test/module_test/service_test/huks_engine/core/src/hks_keynode_test.cpp", 168 "//base/security/huks/test/unittest/huks_standard_test/module_test/service_test/huks_engine/core/src/hks_secure_access_test.cpp", 169 "//base/security/huks/test/unittest/huks_standard_test/module_test/service_test/huks_engine/core_dependency/src/hks_core_hal_api_test.cpp", 170 ] 171 172 defines = [ 173 "L2_STANDARD", 174 "_HUKS_LOG_ENABLE_", 175 ] 176 177 if (use_crypto_lib == "openssl") { 178 defines += [ "_USE_OPENSSL_" ] 179 } 180 181 include_dirs += [ 182 "//commonlibrary/c_utils/base/include", 183 "//test/xts/acts/security_lite/huks/common/include", 184 ] 185 configs = [ "//base/security/huks/frameworks/config/build:coverage_flag" ] 186 sources += [ 187 "//base/security/huks/test/unittest/huks_standard_test/three_stage_test/src/hks_attest_key_test_common.cpp", 188 "//base/security/huks/utils/condition/hks_condition.c", 189 ] 190 191 deps = [ 192 "//base/security/access_token/interfaces/innerkits/nativetoken:libnativetoken", 193 "//base/security/access_token/interfaces/innerkits/token_setproc:libtoken_setproc", 194 "//base/security/huks/test/unittest/huks_standard_test/module_test/inner_kits_passthrough:libhukssdk_static", 195 ] 196 external_deps = [ "hiviewdfx_hilog_native:libhilog" ] 197 if (support_jsapi) { 198 sources += [ "//base/security/huks/test/unittest/huks_standard_test/module_test/service_test/huks_service/os_dependency/sa/src/huks_event_observer_test.cpp" ] 199 external_deps += [ 200 "ability_base:want", 201 "common_event_service:cesfwk_innerkits", 202 ] 203 } 204} 205