1#
2# Copyright (c) 2021 Huawei Device Co., Ltd.
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#     http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14#
15
16import("//build/ohos.gni")
17library = "//third_party/mbedtls/library"
18
19mbedtls_sources = []
20mbedtls_sources += [
21  "$library/aes.c",
22  "$library/aesni.c",
23  "$library/arc4.c",
24  "$library/aria.c",
25  "$library/asn1parse.c",
26  "$library/asn1write.c",
27  "$library/base64.c",
28  "$library/bignum.c",
29  "$library/blowfish.c",
30  "$library/camellia.c",
31  "$library/ccm.c",
32  "$library/chacha20.c",
33  "$library/chachapoly.c",
34  "$library/cipher.c",
35  "$library/cipher_wrap.c",
36  "$library/cmac.c",
37  "$library/ctr_drbg.c",
38  "$library/des.c",
39  "$library/dhm.c",
40  "$library/ecdh.c",
41  "$library/ecdsa.c",
42  "$library/ecjpake.c",
43  "$library/ecp.c",
44  "$library/ecp_curves.c",
45  "$library/entropy.c",
46  "$library/entropy_poll.c",
47  "$library/error.c",
48  "$library/gcm.c",
49  "$library/havege.c",
50  "$library/hkdf.c",
51  "$library/hmac_drbg.c",
52  "$library/md.c",
53  "$library/md2.c",
54  "$library/md4.c",
55  "$library/md5.c",
56  "$library/md_wrap.c",
57  "$library/memory_buffer_alloc.c",
58  "$library/net_sockets.c",
59  "$library/nist_kw.c",
60  "$library/oid.c",
61  "$library/padlock.c",
62  "$library/pem.c",
63  "$library/pk.c",
64  "$library/pk_wrap.c",
65  "$library/pkcs12.c",
66  "$library/pkcs5.c",
67  "$library/pkparse.c",
68  "$library/pkwrite.c",
69  "$library/platform.c",
70  "$library/platform_util.c",
71  "$library/poly1305.c",
72  "$library/ripemd160.c",
73  "$library/rsa.c",
74  "$library/rsa_internal.c",
75  "$library/sha1.c",
76  "$library/sha256.c",
77  "$library/sha512.c",
78  "$library/ssl_ciphersuites.c",
79  "$library/ssl_cli.c",
80  "$library/ssl_tls.c",
81  "$library/threading.c",
82  "$library/timing.c",
83  "$library/version.c",
84  "$library/version_features.c",
85  "$library/x509.c",
86  "$library/x509_crl.c",
87  "$library/x509_crt.c",
88  "$library/xtea.c",
89]
90
91config("mbedtls_config") {
92  include_dirs = [ "//third_party/mbedtls/include" ]
93}
94
95ohos_shared_library("mbedtls_shared") {
96  sanitize = {
97    cfi = true
98    cfi_cross_dso = true
99    debug = false
100  }
101  branch_protector_ret = "pac_ret"
102
103  sources = mbedtls_sources
104  output_name = "mbedtls"
105  public_configs = [ ":mbedtls_config" ]
106
107  part_name = "dsoftbus"
108  subsystem_name = "communication"
109}
110
111static_library("mbedtls_static") {
112  sources = mbedtls_sources
113  output_name = "mbedtls"
114  public_configs = [ ":mbedtls_config" ]
115}
116
117group("mbedtls") {
118  deps = [ ":mbedtls_shared" ]
119}
120