# 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("//build/ohos.gni") ohos_shared_library("cj_cryptoframework_ffi") { branch_protector_ret = "pac_ret" include_dirs = [ "include" ] include_dirs += framework_inc_path if (os_level == "standard") { sanitize = { cfi = true cfi_cross_dso = true debug = false } } cflags = [ "-DHILOG_ENABLE", "-fPIC", "-g3", ] if (!defined(defines)) { defines = [] } if (!ohos_indep_compiler_enable && !build_ohos_sdk && product_name != "qemu-arm-linux-min" && product_name != "rk3568_mini_system") { deps = [ "${framework_path}:crypto_framework_lib" ] external_deps = [ "bounds_checking_function:libsec_shared", "hilog:libhilog", "napi:ace_napi", "napi:cj_bind_ffi", "napi:cj_bind_native", ] sources = [ "src/asy_key_generator_impl.cpp", "src/asy_key_spec_generator_impl.cpp", "src/cipher_impl.cpp", "src/crypto_ffi.cpp", "src/dh_key_util_impl.cpp", "src/ecc_key_util_impl.cpp", "src/kdf_impl.cpp", "src/key_agreement_impl.cpp", "src/key_impl.cpp", "src/key_pair_impl.cpp", "src/mac_impl.cpp", "src/md_impl.cpp", "src/pri_key_impl.cpp", "src/pub_key_impl.cpp", "src/random_impl.cpp", "src/sign_impl.cpp", "src/sm2_crypto_util_impl.cpp", "src/sym_key_generator_impl.cpp", "src/sym_key_impl.cpp", "src/verify_impl.cpp", ] } else { defines += [ "PREVIEWER" ] sources = [ "src/crypto_mock.cpp" ] external_deps = [ "napi:cj_bind_ffi" ] } if (is_ohos) { defines += [ "OHOS_PLATFORM" ] } if (is_mingw) { defines += [ "WINDOWS_PLATFORM" ] } innerapi_tags = [ "platformsdk" ] subsystem_name = "security" part_name = "crypto_framework" }