• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (C) 2022-2024 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/crypto_framework/common/common.gni")
15import("//base/security/crypto_framework/frameworks/frameworks.gni")
16import("//base/security/crypto_framework/plugin/plugin.gni")
17import("//build/test.gni")
18
19module_output_path = "crypto_framework/crypto_framework_test"
20
21ohos_unittest("crypto_framework_test") {
22  testonly = true
23  module_out_path = module_output_path
24
25  include_dirs = [ "./include" ]
26  include_dirs += [
27    "../../plugin/openssl_plugin/key/asy_key_generator/src",
28    "../../plugin/openssl_plugin/crypto_operation/signature/src",
29    "../../interfaces/innerkits/key/",
30  ]
31  include_dirs +=
32      framework_inc_path + plugin_inc_path + crypto_framwork_common_inc_path
33
34  sources = [
35    "src/aes_cipher/aes_common.cpp",
36    "src/aes_cipher/crypto_aes_cbc_cipher_test.cpp",
37    "src/aes_cipher/crypto_aes_ccm_cipher_test.cpp",
38    "src/aes_cipher/crypto_aes_cfb_cipher_test.cpp",
39    "src/aes_cipher/crypto_aes_cipher_test.cpp",
40    "src/aes_cipher/crypto_aes_ctr_cipher_test.cpp",
41    "src/aes_cipher/crypto_aes_ecb_cipher_test.cpp",
42    "src/aes_cipher/crypto_aes_gcm_cipher_test.cpp",
43    "src/aes_cipher/crypto_aes_ofb_cipher_test.cpp",
44    "src/crypto_3des_cipher_test.cpp",
45    "src/crypto_asy_key_generator_cov_test.cpp",
46    "src/crypto_brainpool_asy_key_generator_test.cpp",
47    "src/crypto_brainpool_key_agreement_test.cpp",
48    "src/crypto_brainpool_no_length_sign_test.cpp",
49    "src/crypto_brainpool_no_length_verify_test.cpp",
50    "src/crypto_common_cov_test.cpp",
51    "src/crypto_dh_asy_key_generator_by_spec_test.cpp",
52    "src/crypto_dh_asy_key_generator_test.cpp",
53    "src/crypto_dh_key_agreement_test.cpp",
54    "src/crypto_dsa_asy_key_generator_by_spec_test.cpp",
55    "src/crypto_dsa_asy_key_generator_test.cpp",
56    "src/crypto_dsa_exception_test.cpp",
57    "src/crypto_dsa_sign_test.cpp",
58    "src/crypto_dsa_verify_test.cpp",
59    "src/crypto_ecc_asy_key_generator_test.cpp",
60    "src/crypto_ecc_key_agreement_by_spec_test.cpp",
61    "src/crypto_ecc_key_agreement_test.cpp",
62    "src/crypto_ecc_key_util_test.cpp",
63    "src/crypto_ed25519_asy_key_generator_by_spec_test.cpp",
64    "src/crypto_ed25519_asy_key_generator_test.cpp",
65    "src/crypto_ed25519_sign_test.cpp",
66    "src/crypto_ed25519_verify_test.cpp",
67    "src/crypto_hkdf_test.cpp",
68    "src/crypto_mac_test.cpp",
69    "src/crypto_md_sm3_test.cpp",
70    "src/crypto_md_test.cpp",
71    "src/crypto_pbkdf2_test.cpp",
72    "src/crypto_rand_test.cpp",
73    "src/crypto_rsa1024_asy_key_generator_by_spec_test.cpp",
74    "src/crypto_rsa2048_asy_key_generator_by_spec_test.cpp",
75    "src/crypto_rsa3072_asy_key_generator_by_spec_test.cpp",
76    "src/crypto_rsa4096_asy_key_generator_by_spec_test.cpp",
77    "src/crypto_rsa512_asy_key_generator_by_spec_test.cpp",
78    "src/crypto_rsa768_asy_key_generator_by_spec_test.cpp",
79    "src/crypto_rsa8192_asy_key_generator_by_spec_test.cpp",
80    "src/crypto_rsa_asy_key_generator_by_spec_cov_test.cpp",
81    "src/crypto_rsa_asy_key_generator_test.cpp",
82    "src/crypto_rsa_asy_key_pem_test.cpp",
83    "src/crypto_rsa_cipher_sub_test.cpp",
84    "src/crypto_rsa_cipher_test.cpp",
85    "src/crypto_rsa_only_sign_and_verify_recover_test.cpp",
86    "src/crypto_rsa_sign_test.cpp",
87    "src/crypto_rsa_verify_test.cpp",
88    "src/crypto_signature_exception_test.cpp",
89    "src/crypto_sm2_asy_key_generator_test.cpp",
90    "src/crypto_sm2_cipher_test.cpp",
91    "src/crypto_sm2_sign_test.cpp",
92    "src/crypto_sm2_verify_test.cpp",
93    "src/crypto_sm3_mac_test.cpp",
94    "src/crypto_sm4_cfb_cipher_test.cpp",
95    "src/crypto_sm4_cipher_test.cpp",
96    "src/crypto_sm4_ecb_cipher_test.cpp",
97    "src/crypto_sm4_generator_test.cpp",
98    "src/crypto_x25519_asy_key_generator_by_spec_test.cpp",
99    "src/crypto_x25519_asy_key_generator_test.cpp",
100    "src/crypto_x25519_key_agreement_test.cpp",
101    "src/ecc/crypto_ecc_asy_key_generator_by_spec_sub_four_test.cpp",
102    "src/ecc/crypto_ecc_asy_key_generator_by_spec_sub_one_test.cpp",
103    "src/ecc/crypto_ecc_asy_key_generator_by_spec_sub_three_test.cpp",
104    "src/ecc/crypto_ecc_asy_key_generator_by_spec_sub_two_test.cpp",
105    "src/ecc/crypto_ecc_asy_key_generator_by_spec_test.cpp",
106    "src/ecc/crypto_ecc_ecdh_pub_test.cpp",
107    "src/ecc/crypto_ecc_no_length_sign_sub_test.cpp",
108    "src/ecc/crypto_ecc_no_length_sign_test.cpp",
109    "src/ecc/crypto_ecc_no_length_verify_sub_test.cpp",
110    "src/ecc/crypto_ecc_no_length_verify_test.cpp",
111    "src/ecc/crypto_ecc_sign_sub_test.cpp",
112    "src/ecc/crypto_ecc_sign_test.cpp",
113    "src/ecc/crypto_ecc_verify_sub_test.cpp",
114    "src/ecc/crypto_ecc_verify_test.cpp",
115    "src/sm2/crypto_sm2_asy_key_generator_by_spec_sub_test.cpp",
116    "src/sm2/crypto_sm2_asy_key_generator_by_spec_test.cpp",
117    "src/sm2/crypto_sm2_util_test.cpp",
118  ]
119
120  sources += framework_files + plugin_files
121  sources -= [ "//base/security/crypto_framework/plugin/openssl_plugin/common/src/openssl_adapter.c" ]
122  sources -= [ "//base/security/crypto_framework/plugin/openssl_plugin/key/asy_key_generator/src/dsa_asy_key_generator_openssl.c" ]
123  sources -= [ "//base/security/crypto_framework/plugin/openssl_plugin/crypto_operation/signature/src/dsa_openssl.c" ]
124  sources -= [ "//base/security/crypto_framework/plugin/openssl_plugin/crypto_operation/signature/src/signature_rsa_openssl.c" ]
125  sources += [
126    "//base/security/crypto_framework/common/src/asy_key_params.c",
127    "//base/security/crypto_framework/common/src/blob.c",
128    "//base/security/crypto_framework/common/src/hcf_parcel.c",
129    "//base/security/crypto_framework/common/src/hcf_string.c",
130    "//base/security/crypto_framework/common/src/log.c",
131    "//base/security/crypto_framework/common/src/object_base.c",
132    "//base/security/crypto_framework/common/src/params_parser.c",
133    "//base/security/crypto_framework/common/src/utils.c",
134    "src/alg_25519_common_param_spec.c",
135    "src/ecc/ecc_asy_key_common.cpp",
136    "src/ecc_common_param_spec.c",
137    "src/memory_mock.c",
138    "src/openssl_adapter_mock.c",
139    "src/rsa_common_param_spec.cpp",
140    "src/sm4_common.cpp",
141  ]
142  cflags = [ "-DHILOG_ENABLE" ]
143  if (target_cpu == "arm") {
144    cflags += [ "-DBINDER_IPC_32BIT" ]
145  }
146
147  deps = [ "../../plugin:crypto_openssl_plugin_lib" ]
148
149  defines = [
150    "HILOG_ENABLE",
151    "OPENSSL_SUPPRESS_DEPRECATED",
152  ]
153
154  external_deps = [
155    "bounds_checking_function:libsec_shared",
156    "c_utils:utils",
157    "hilog:libhilog",
158    "openssl:libcrypto_shared",
159  ]
160}
161