1# Copyright (C) 2022-2023 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("//build/ohos.gni")
17
18config("framework_config") {
19  include_dirs = [
20    "//base/security/crypto_framework/interfaces/inner_api/algorithm_parameter",
21    "//base/security/crypto_framework/interfaces/inner_api/common",
22    "//base/security/crypto_framework/interfaces/inner_api/crypto_operation",
23    "//base/security/crypto_framework/interfaces/inner_api/key",
24  ]
25}
26
27if (os_level == "standard") {
28  ohos_shared_library("crypto_framework_lib") {
29    branch_protector_ret = "pac_ret"
30    subsystem_name = "security"
31    innerapi_tags = [ "platformsdk" ]
32    part_name = "crypto_framework"
33    public_configs = [ ":framework_config" ]
34    include_dirs = framework_inc_path + crypto_framwork_common_inc_path
35
36    sources = framework_files
37
38    if (os_level == "standard") {
39      sanitize = {
40        cfi = true
41        cfi_cross_dso = true
42        debug = false
43      }
44    }
45
46    cflags = [
47      "-DHILOG_ENABLE",
48      "-fPIC",
49      "-Wall",
50    ]
51
52    deps = [
53      "../common:crypto_plugin_common",
54      "../plugin:crypto_openssl_plugin_lib",
55    ]
56
57    external_deps = [
58      "c_utils:utils",
59      "hilog:libhilog",
60    ]
61  }
62} else if (os_level == "mini") {
63  ohos_static_library("crypto_framework_lib") {
64    subsystem_name = "security"
65    part_name = "crypto_framework"
66    public_configs = [ ":framework_config" ]
67    include_dirs = framework_inc_lite_path + crypto_framwork_common_inc_path
68    include_dirs +=
69        [ "//base/hiviewdfx/hilog_lite/interfaces/native/kits/hilog_lite" ]
70
71    sources = framework_lite_files
72
73    defines = [
74      "CRYPTO_MBEDTLS",
75      "MINI_HILOG_ENABLE",
76    ]
77
78    deps = [
79      "../common:crypto_common_lite",
80      "../plugin:crypto_mbedtls_plugin_lib",
81    ]
82
83    configs = [ "${product_path}:product_public_configs" ]
84
85    cflags = [
86      "--diag_suppress",
87      "Pe188,Pe186",
88    ]
89  }
90}
91