• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (C) 2025-2025 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/config/components/ets_frontend/ets2abc_config.gni")
18import("//build/ohos.gni")
19import("//build/ohos/taihe_idl/taihe.gni")
20
21subsystem_name = "security"
22part_name = "crypto_framework"
23taihe_generated_file_path = "$taihe_file_path/out/$subsystem_name/$part_name"
24
25copy_taihe_idl("copy_taihe") {
26  sources = [ "${framework_path}/js/ani/idl/ohos.security.cryptoFramework.cryptoFramework.taihe" ]
27}
28
29ohos_taihe("run_taihe") {
30  taihe_generated_file_path = "$taihe_generated_file_path"
31  deps = [ ":copy_taihe" ]
32  outputs = [
33    "$taihe_generated_file_path/src/ohos.security.cryptoFramework.cryptoFramework.ani.cpp",
34    "$taihe_generated_file_path/src/ohos.security.cryptoFramework.cryptoFramework.abi.c",
35  ]
36}
37
38taihe_shared_library("crypto_framework_ani") {
39  taihe_generated_file_path = "$taihe_generated_file_path"
40  subsystem_name = "$subsystem_name"
41  part_name = "$part_name"
42  include_dirs = framework_inc_path
43  include_dirs += [ "${framework_path}/js/ani/inc" ]
44  sources = get_target_outputs(":run_taihe")
45  sources += [
46    "${framework_path}/js/ani/src/ani_constructor.cpp",
47    "${framework_path}/js/ani/src/ani_key.cpp",
48    "${framework_path}/js/ani/src/ani_mac.cpp",
49    "${framework_path}/js/ani/src/ani_md.cpp",
50    "${framework_path}/js/ani/src/ani_rand.cpp",
51    "${framework_path}/js/ani/src/ani_sym_key.cpp",
52    "${framework_path}/js/ani/src/ani_sym_key_generator.cpp",
53  ]
54  deps = [
55    ":run_taihe",
56    "${framework_path}:crypto_framework_lib",
57  ]
58  if (os_level == "standard") {
59    sanitize = {
60      cfi = true
61      cfi_cross_dso = true
62      debug = false
63    }
64  }
65  cflags = [
66    "-DHILOG_ENABLE",
67    "-fPIC",
68    "-g3",
69  ]
70  external_deps = [
71    "bounds_checking_function:libsec_shared",
72    "c_utils:utils",
73    "hilog:libhilog",
74    "openssl:libcrypto_shared",
75    "runtime_core:ani",
76  ]
77}
78
79generate_static_abc("crypto_framework_ets") {
80  base_url = "$taihe_generated_file_path"
81  files = [ "$taihe_generated_file_path/@ohos.security.cryptoFramework.ets" ]
82  is_boot_abc = "True"
83  device_dst_file = "/system/framework/crypto_framework_ets.abc"
84  dependencies = [ ":run_taihe" ]
85}
86
87generate_static_abc("crypto_framework_test") {
88  base_url = "${framework_path}/js/ani/test"
89  files = [
90    "${framework_path}/js/ani/test/test_main.ets",
91    "${framework_path}/js/ani/test/test_md.ets",
92    "${framework_path}/js/ani/test/test_mac.ets",
93    "${framework_path}/js/ani/test/test_rand.ets",
94    "${framework_path}/js/ani/test/test_utils.ets",
95  ]
96  is_boot_abc = "True"
97  device_dst_file = "/system/framework/crypto_framework_test.abc"
98}
99
100ohos_prebuilt_etc("crypto_framework_etc") {
101  source = "$target_out_dir/crypto_framework_ets.abc"
102  module_install_dir = "framework"
103  part_name = "$part_name"
104  subsystem_name = "$subsystem_name"
105  deps = [
106    ":crypto_framework_ets",
107    # ":crypto_framework_test",
108  ]
109}
110
111group("cryptoframework_ani") {
112  deps = [
113    ":crypto_framework_ani",
114    ":crypto_framework_etc",
115  ]
116}
117