1 # Copyright (c) 2020 Project CHIP Authors
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
7 # http://www.apache.org/licenses/LICENSE-2.0
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.
15 import("//build_overrides/mbedtls.gni")
17 template("mbedtls_target") {
18 mbedtls_target_name = target_name
20 _mbedtls_root = "${mbedtls_root}/repo"
22 config("${mbedtls_target_name}_warnings") {
24 "-Wno-maybe-uninitialized",
25 "-Wno-string-concatenation",
29 config("${mbedtls_target_name}_config") {
30 include_dirs = [ "${_mbedtls_root}/include" ]
33 static_library(mbedtls_target_name) {
34 forward_variables_from(invoker, "*")
36 if (!defined(sources)) {
41 "${_mbedtls_root}/library/aes.c",
42 "${_mbedtls_root}/library/aesni.c",
43 "${_mbedtls_root}/library/arc4.c",
44 "${_mbedtls_root}/library/asn1parse.c",
45 "${_mbedtls_root}/library/asn1write.c",
46 "${_mbedtls_root}/library/base64.c",
47 "${_mbedtls_root}/library/bignum.c",
48 "${_mbedtls_root}/library/blowfish.c",
49 "${_mbedtls_root}/library/camellia.c",
50 "${_mbedtls_root}/library/ccm.c",
51 "${_mbedtls_root}/library/certs.c",
52 "${_mbedtls_root}/library/chacha20.c",
53 "${_mbedtls_root}/library/chachapoly.c",
54 "${_mbedtls_root}/library/cipher.c",
55 "${_mbedtls_root}/library/cipher_wrap.c",
56 "${_mbedtls_root}/library/cmac.c",
57 "${_mbedtls_root}/library/ctr_drbg.c",
58 "${_mbedtls_root}/library/debug.c",
59 "${_mbedtls_root}/library/des.c",
60 "${_mbedtls_root}/library/dhm.c",
61 "${_mbedtls_root}/library/ecdh.c",
62 "${_mbedtls_root}/library/ecdsa.c",
63 "${_mbedtls_root}/library/ecjpake.c",
64 "${_mbedtls_root}/library/ecp.c",
65 "${_mbedtls_root}/library/ecp_curves.c",
66 "${_mbedtls_root}/library/entropy.c",
67 "${_mbedtls_root}/library/entropy_poll.c",
68 "${_mbedtls_root}/library/error.c",
69 "${_mbedtls_root}/library/gcm.c",
70 "${_mbedtls_root}/library/hkdf.c",
71 "${_mbedtls_root}/library/hmac_drbg.c",
72 "${_mbedtls_root}/library/md.c",
73 "${_mbedtls_root}/library/md5.c",
74 "${_mbedtls_root}/library/md_wrap.c",
75 "${_mbedtls_root}/library/oid.c",
76 "${_mbedtls_root}/library/padlock.c",
77 "${_mbedtls_root}/library/pem.c",
78 "${_mbedtls_root}/library/pk.c",
79 "${_mbedtls_root}/library/pk_wrap.c",
80 "${_mbedtls_root}/library/pkcs12.c",
81 "${_mbedtls_root}/library/pkcs5.c",
82 "${_mbedtls_root}/library/pkparse.c",
83 "${_mbedtls_root}/library/pkwrite.c",
84 "${_mbedtls_root}/library/platform.c",
85 "${_mbedtls_root}/library/platform_util.c",
86 "${_mbedtls_root}/library/poly1305.c",
87 "${_mbedtls_root}/library/ripemd160.c",
88 "${_mbedtls_root}/library/rsa.c",
89 "${_mbedtls_root}/library/rsa_internal.c",
90 "${_mbedtls_root}/library/sha1.c",
91 "${_mbedtls_root}/library/sha256.c",
92 "${_mbedtls_root}/library/sha512.c",
93 "${_mbedtls_root}/library/ssl_cache.c",
94 "${_mbedtls_root}/library/ssl_ciphersuites.c",
95 "${_mbedtls_root}/library/ssl_cli.c",
96 "${_mbedtls_root}/library/ssl_cookie.c",
97 "${_mbedtls_root}/library/ssl_srv.c",
98 "${_mbedtls_root}/library/ssl_ticket.c",
99 "${_mbedtls_root}/library/ssl_tls.c",
100 "${_mbedtls_root}/library/threading.c",
101 "${_mbedtls_root}/library/version.c",
102 "${_mbedtls_root}/library/version_features.c",
103 "${_mbedtls_root}/library/x509.c",
104 "${_mbedtls_root}/library/x509_create.c",
105 "${_mbedtls_root}/library/x509_crl.c",
106 "${_mbedtls_root}/library/x509_crt.c",
107 "${_mbedtls_root}/library/x509_csr.c",
108 "${_mbedtls_root}/library/x509write_crt.c",
109 "${_mbedtls_root}/library/x509write_csr.c",
110 "${_mbedtls_root}/library/xtea.c",
113 if (current_os != "freertos") {
114 sources += [ "${_mbedtls_root}/library/timing.c" ]
117 if (!defined(configs)) {
121 # Relax warnings for third_party code.
122 configs += [ ":${mbedtls_target_name}_warnings" ]
124 if (!defined(public_configs)) {
128 public_configs += [ ":mbedtls_config" ]
130 output_name = "libmbedtls"
131 output_dir = "${root_out_dir}/lib"