# Copyright (C) 2022-2024 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/crypto_framework/common/common.gni") import("//base/security/crypto_framework/frameworks/frameworks.gni") import("//base/security/crypto_framework/plugin/plugin.gni") import("//build/test.gni") module_output_path = "crypto_framework/crypto_framework_test" ohos_unittest("crypto_framework_test") { testonly = true module_out_path = module_output_path include_dirs = [ "./include" ] include_dirs += [ "../../plugin/openssl_plugin/key/asy_key_generator/src", "../../plugin/openssl_plugin/crypto_operation/signature/src", "../../interfaces/innerkits/key/", "../../interfaces/kits/native/include/", ] include_dirs += framework_inc_path + plugin_inc_path + crypto_framwork_common_inc_path sources = [ "src/aes_cipher/aes_common.cpp", "src/aes_cipher/crypto_aes_cbc_cipher_test.cpp", "src/aes_cipher/crypto_aes_ccm_cipher_test.cpp", "src/aes_cipher/crypto_aes_cfb_cipher_test.cpp", "src/aes_cipher/crypto_aes_cipher_test.cpp", "src/aes_cipher/crypto_aes_ctr_cipher_test.cpp", "src/aes_cipher/crypto_aes_ecb_cipher_test.cpp", "src/aes_cipher/crypto_aes_gcm_cipher_test.cpp", "src/aes_cipher/crypto_aes_ofb_cipher_test.cpp", "src/crypto_3des_cipher_test.cpp", "src/crypto_asy_key_generator_cov_test.cpp", "src/crypto_brainpool_asy_key_generator_test.cpp", "src/crypto_brainpool_key_agreement_test.cpp", "src/crypto_brainpool_no_length_sign_test.cpp", "src/crypto_brainpool_no_length_verify_test.cpp", "src/crypto_common_cov_test.cpp", "src/crypto_dh_asy_key_generator_by_spec_test.cpp", "src/crypto_dh_asy_key_generator_test.cpp", "src/crypto_dh_key_agreement_test.cpp", "src/crypto_dsa_asy_key_generator_by_spec_test.cpp", "src/crypto_dsa_asy_key_generator_test.cpp", "src/crypto_dsa_exception_test.cpp", "src/crypto_dsa_sign_test.cpp", "src/crypto_dsa_verify_test.cpp", "src/crypto_ecc_asy_key_generator_test.cpp", "src/crypto_ecc_key_agreement_by_spec_test.cpp", "src/crypto_ecc_key_agreement_test.cpp", "src/crypto_ecc_key_util_test.cpp", "src/crypto_ed25519_asy_key_generator_by_spec_test.cpp", "src/crypto_ed25519_asy_key_generator_test.cpp", "src/crypto_ed25519_sign_test.cpp", "src/crypto_ed25519_verify_test.cpp", "src/crypto_hkdf_test.cpp", "src/crypto_key_utils_test.cpp", "src/crypto_mac_test.cpp", "src/crypto_md_sm3_test.cpp", "src/crypto_md_test.cpp", "src/crypto_openssl_common_test.cpp", "src/crypto_pbkdf2_test.cpp", "src/crypto_rand_test.cpp", "src/crypto_rsa1024_asy_key_generator_by_spec_test.cpp", "src/crypto_rsa2048_asy_key_generator_by_spec_test.cpp", "src/crypto_rsa3072_asy_key_generator_by_spec_test.cpp", "src/crypto_rsa4096_asy_key_generator_by_spec_test.cpp", "src/crypto_rsa512_asy_key_generator_by_spec_test.cpp", "src/crypto_rsa768_asy_key_generator_by_spec_test.cpp", "src/crypto_rsa8192_asy_key_generator_by_spec_test.cpp", "src/crypto_rsa_asy_key_generator_by_spec_cov_test.cpp", "src/crypto_rsa_asy_key_generator_test.cpp", "src/crypto_rsa_asy_key_pem_test.cpp", "src/crypto_rsa_cipher_sub_test.cpp", "src/crypto_rsa_cipher_test.cpp", "src/crypto_rsa_only_sign_and_verify_recover_test.cpp", "src/crypto_rsa_sign_test.cpp", "src/crypto_rsa_verify_test.cpp", "src/crypto_signature_exception_test.cpp", "src/crypto_sm2_asy_key_generator_test.cpp", "src/crypto_sm2_cipher_test.cpp", "src/crypto_sm2_sign_test.cpp", "src/crypto_sm2_verify_test.cpp", "src/crypto_sm3_mac_test.cpp", "src/crypto_sm4_cfb_cipher_test.cpp", "src/crypto_sm4_cipher_test.cpp", "src/crypto_sm4_ecb_cipher_test.cpp", "src/crypto_sm4_gcm_cipher_test.cpp", "src/crypto_sm4_generator_test.cpp", "src/crypto_x25519_asy_key_generator_by_spec_test.cpp", "src/crypto_x25519_asy_key_generator_test.cpp", "src/crypto_x25519_key_agreement_test.cpp", "src/ecc/crypto_ecc_asy_key_generator_by_spec_sub_four_test.cpp", "src/ecc/crypto_ecc_asy_key_generator_by_spec_sub_one_test.cpp", "src/ecc/crypto_ecc_asy_key_generator_by_spec_sub_three_test.cpp", "src/ecc/crypto_ecc_asy_key_generator_by_spec_sub_two_test.cpp", "src/ecc/crypto_ecc_asy_key_generator_by_spec_test.cpp", "src/ecc/crypto_ecc_ecdh_pub_test.cpp", "src/ecc/crypto_ecc_no_length_sign_sub_test.cpp", "src/ecc/crypto_ecc_no_length_sign_test.cpp", "src/ecc/crypto_ecc_no_length_verify_sub_test.cpp", "src/ecc/crypto_ecc_no_length_verify_test.cpp", "src/ecc/crypto_ecc_sign_sub_test.cpp", "src/ecc/crypto_ecc_sign_test.cpp", "src/ecc/crypto_ecc_verify_sub_test.cpp", "src/ecc/crypto_ecc_verify_test.cpp", "src/native/native_asym_key_test.cpp", "src/native/native_digest_test.cpp", "src/native/native_signature_test.cpp", "src/native/native_sym_cipher_test.cpp", "src/native/native_sym_key_test.cpp", "src/sm2/crypto_sm2_asy_key_generator_by_spec_sub_test.cpp", "src/sm2/crypto_sm2_asy_key_generator_by_spec_test.cpp", "src/sm2/crypto_sm2_util_test.cpp", ] sources += framework_files + plugin_files sources -= [ "//base/security/crypto_framework/plugin/openssl_plugin/common/src/openssl_adapter.c" ] sources -= [ "//base/security/crypto_framework/plugin/openssl_plugin/key/asy_key_generator/src/dsa_asy_key_generator_openssl.c" ] sources -= [ "//base/security/crypto_framework/plugin/openssl_plugin/crypto_operation/signature/src/dsa_openssl.c" ] sources -= [ "//base/security/crypto_framework/plugin/openssl_plugin/crypto_operation/signature/src/signature_rsa_openssl.c" ] sources += [ "//base/security/crypto_framework/common/src/asy_key_params.c", "//base/security/crypto_framework/common/src/blob.c", "//base/security/crypto_framework/common/src/hcf_parcel.c", "//base/security/crypto_framework/common/src/hcf_string.c", "//base/security/crypto_framework/common/src/log.c", "//base/security/crypto_framework/common/src/object_base.c", "//base/security/crypto_framework/common/src/params_parser.c", "//base/security/crypto_framework/common/src/utils.c", "src/alg_25519_common_param_spec.c", "src/ecc/ecc_asy_key_common.cpp", "src/ecc_common_param_spec.c", "src/memory_mock.c", "src/openssl_adapter_mock.c", "src/rsa_common_param_spec.cpp", "src/sm4_common.cpp", ] cflags = [ "-DHILOG_ENABLE" ] if (target_cpu == "arm") { cflags += [ "-DBINDER_IPC_32BIT" ] } deps = [ "../../frameworks/native:ohcrypto", "../../plugin:crypto_openssl_plugin_lib", ] defines = [ "HILOG_ENABLE", "OPENSSL_SUPPRESS_DEPRECATED", ] external_deps = [ "bounds_checking_function:libsec_shared", "c_utils:utils", "hilog:libhilog", "openssl:libcrypto_shared", ] }