# Copyright (C) 2022-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/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 += [ "//commonlibrary/c_utils/base/include", "//third_party/openssl/include/", "../../plugin/openssl_plugin/key/asy_key_generator/src", "../../plugin/openssl_plugin/crypto_operation/signature/src", ] include_dirs += framework_inc_path + plugin_inc_path + crypto_framwork_common_inc_path sources = [ "src/crypto_3des_cipher_test.cpp", "src/crypto_aes_cipher_test.cpp", "src/crypto_asy_key_generator_cov_test.cpp", "src/crypto_common_cov_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_by_spec_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_no_length_sign_test.cpp", "src/crypto_ecc_no_length_verify_test.cpp", "src/crypto_ecc_sign_test.cpp", "src/crypto_ecc_verify_test.cpp", "src/crypto_mac_test.cpp", "src/crypto_md_sm3_test.cpp", "src/crypto_md_test.cpp", "src/crypto_rand_test.cpp", "src/crypto_rsa_asy_key_generator_by_spec_cov_test.cpp", "src/crypto_rsa_asy_key_generator_by_spec_test.cpp", "src/crypto_rsa_asy_key_generator_test.cpp", "src/crypto_rsa_cipher_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_cipher_test.cpp", "src/crypto_sm4_generator_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/memory_mock.c", "src/openssl_adapter_mock.c", ] cflags = [ "-DHILOG_ENABLE" ] if (target_cpu == "arm") { cflags += [ "-DBINDER_IPC_32BIT" ] } deps = [ "../../plugin:crypto_openssl_plugin_lib", "//third_party/bounds_checking_function:libsec_shared", "//third_party/openssl:libcrypto_shared", ] defines = [ "HILOG_ENABLE", "OPENSSL_SUPPRESS_DEPRECATED", ] external_deps = [ "c_utils:utils", "hilog:libhilog", ] }