# Copyright (C) 2025-2025 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/config/components/ets_frontend/ets2abc_config.gni") import("//build/ohos.gni") import("//build/ohos/taihe_idl/taihe.gni") subsystem_name = "security" part_name = "crypto_framework" taihe_generated_file_path = "$taihe_file_path/out/$subsystem_name/$part_name" copy_taihe_idl("copy_taihe") { sources = [ "${framework_path}/js/ani/idl/ohos.security.cryptoFramework.cryptoFramework.taihe" ] } ohos_taihe("run_taihe") { taihe_generated_file_path = "$taihe_generated_file_path" deps = [ ":copy_taihe" ] outputs = [ "$taihe_generated_file_path/src/ohos.security.cryptoFramework.cryptoFramework.ani.cpp", "$taihe_generated_file_path/src/ohos.security.cryptoFramework.cryptoFramework.abi.c", ] } taihe_shared_library("crypto_framework_ani") { taihe_generated_file_path = "$taihe_generated_file_path" subsystem_name = "$subsystem_name" part_name = "$part_name" include_dirs = framework_inc_path include_dirs += [ "${framework_path}/js/ani/inc" ] sources = get_target_outputs(":run_taihe") sources += [ "${framework_path}/js/ani/src/ani_constructor.cpp", "${framework_path}/js/ani/src/ani_key.cpp", "${framework_path}/js/ani/src/ani_mac.cpp", "${framework_path}/js/ani/src/ani_md.cpp", "${framework_path}/js/ani/src/ani_rand.cpp", "${framework_path}/js/ani/src/ani_sym_key.cpp", "${framework_path}/js/ani/src/ani_sym_key_generator.cpp", ] deps = [ ":run_taihe", "${framework_path}:crypto_framework_lib", ] if (os_level == "standard") { sanitize = { cfi = true cfi_cross_dso = true debug = false } } cflags = [ "-DHILOG_ENABLE", "-fPIC", "-g3", ] external_deps = [ "bounds_checking_function:libsec_shared", "c_utils:utils", "hilog:libhilog", "openssl:libcrypto_shared", "runtime_core:ani", ] } generate_static_abc("crypto_framework_ets") { base_url = "$taihe_generated_file_path" files = [ "$taihe_generated_file_path/@ohos.security.cryptoFramework.ets" ] is_boot_abc = "True" device_dst_file = "/system/framework/crypto_framework_ets.abc" dependencies = [ ":run_taihe" ] } generate_static_abc("crypto_framework_test") { base_url = "${framework_path}/js/ani/test" files = [ "${framework_path}/js/ani/test/test_main.ets", "${framework_path}/js/ani/test/test_md.ets", "${framework_path}/js/ani/test/test_mac.ets", "${framework_path}/js/ani/test/test_rand.ets", "${framework_path}/js/ani/test/test_utils.ets", ] is_boot_abc = "True" device_dst_file = "/system/framework/crypto_framework_test.abc" } ohos_prebuilt_etc("crypto_framework_etc") { source = "$target_out_dir/crypto_framework_ets.abc" module_install_dir = "framework" part_name = "$part_name" subsystem_name = "$subsystem_name" deps = [ ":crypto_framework_ets", # ":crypto_framework_test", ] } group("cryptoframework_ani") { deps = [ ":crypto_framework_ani", ":crypto_framework_etc", ] }