1# Copyright (C) 2021-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/huks/build/config.gni") 15import("//build/ohos.gni") 16 17config("huks_config") { 18 include_dirs = [ "include" ] 19 defines = [ "OPENSSL_SUPPRESS_DEPRECATED" ] 20} 21 22if (os_level == "standard") { 23 ohos_static_library("libhuks_openssl_standard_static") { 24 subsystem_name = "security" 25 part_name = "huks" 26 public_configs = [ ":huks_config" ] 27 28 sources = [ 29 "src/hks_openssl_ability.c", 30 "src/hks_openssl_aes.c", 31 "src/hks_openssl_bn.c", 32 "src/hks_openssl_common.c", 33 "src/hks_openssl_curve25519.c", 34 "src/hks_openssl_dh.c", 35 "src/hks_openssl_dsa.c", 36 "src/hks_openssl_ecc.c", 37 "src/hks_openssl_ed25519tox25519.c", 38 "src/hks_openssl_engine.c", 39 "src/hks_openssl_get_main_key.c", 40 "src/hks_openssl_hash.c", 41 "src/hks_openssl_hmac.c", 42 "src/hks_openssl_kdf.c", 43 "src/hks_openssl_rsa.c", 44 "src/hks_openssl_sm2.c", 45 "src/hks_openssl_sm3.c", 46 "src/hks_openssl_sm4.c", 47 ] 48 49 deps = [ "//base/security/huks/frameworks/huks_standard/main/common:libhuks_common_standard_static" ] 50 51 complete_static_lib = true 52 53 sanitize = { 54 integer_overflow = true 55 cfi = true 56 debug = false 57 cfi_cross_dso = true 58 } 59 if (huks_dependency_openssl_path != "") { 60 deps += [ huks_dependency_openssl_path ] 61 } else { 62 deps += [ "//third_party/openssl:libcrypto_shared" ] 63 } 64 external_deps = [ 65 "c_utils:utils", 66 "hilog:libhilog", 67 ] 68 configs = [ 69 "//base/security/huks/frameworks/config/build:l2_standard_common_config", 70 ] 71 } 72} else { 73 ohos_static_library("libhuks_openssl_small_static") { 74 sources = [ 75 "src/hks_openssl_ability.c", 76 "src/hks_openssl_aes.c", 77 "src/hks_openssl_bn.c", 78 "src/hks_openssl_common.c", 79 "src/hks_openssl_curve25519.c", 80 "src/hks_openssl_dh.c", 81 "src/hks_openssl_dsa.c", 82 "src/hks_openssl_ecc.c", 83 "src/hks_openssl_ed25519tox25519.c", 84 "src/hks_openssl_engine.c", 85 "src/hks_openssl_get_main_key.c", 86 "src/hks_openssl_hash.c", 87 "src/hks_openssl_hmac.c", 88 "src/hks_openssl_kdf.c", 89 "src/hks_openssl_rsa.c", 90 "src/hks_openssl_sm2.c", 91 "src/hks_openssl_sm3.c", 92 "src/hks_openssl_sm4.c", 93 ] 94 95 deps = [ "//base/security/huks/frameworks/huks_standard/main/common:libhuks_common_small_static" ] 96 97 complete_static_lib = true 98 99 external_deps = [ "hilog_featured_lite:hilog_shared" ] 100 if (huks_dependency_openssl_path != "") { 101 deps += [ huks_dependency_openssl_path ] 102 } else { 103 deps += [ "//build/lite/config/component/openssl:openssl_shared" ] 104 } 105 configs = [ 106 "//base/security/huks/frameworks/config/build:l1_small_common_config", 107 ] 108 } 109} 110