| # Copyright (c) 2020 Project CHIP Authors |
| # |
| # Licensed under the Apache License, Version 2.0 (the "License"); |
| # you may not use this file except in compliance with the License. |
| # You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| # See the License for the specific language governing permissions and |
| # limitations under the License. |
| |
| import("//build_overrides/mbedtls.gni") |
| |
| import("//build_overrides/build.gni") |
| import("${build_root}/config/compiler/compiler.gni") |
| |
| template("mbedtls_target") { |
| mbedtls_target_name = target_name |
| |
| _mbedtls_root = "${mbedtls_repo}/repo" |
| |
| config("${mbedtls_target_name}_warnings") { |
| cflags = [ |
| "-Wno-maybe-uninitialized", |
| "-Wno-string-concatenation", |
| "-Wno-unused-but-set-parameter", |
| "-Wno-format-nonliteral", # Because of mbedtls_debug_print_msg |
| ] |
| |
| if (is_clang) { |
| cflags += [ |
| "-Wno-shorten-64-to-32", |
| "-Wno-unused-but-set-variable", # bignum.c: variable 't' set but not |
| # used |
| ] |
| } |
| } |
| |
| config("${mbedtls_target_name}_config") { |
| include_dirs = [ "${_mbedtls_root}/include" ] |
| } |
| |
| static_library(mbedtls_target_name) { |
| forward_variables_from(invoker, "*") |
| |
| if (!defined(sources)) { |
| sources = [] |
| } |
| |
| sources += [ |
| "${_mbedtls_root}/library/aes.c", |
| "${_mbedtls_root}/library/aesni.c", |
| "${_mbedtls_root}/library/arc4.c", |
| "${_mbedtls_root}/library/aria.c", |
| "${_mbedtls_root}/library/asn1parse.c", |
| "${_mbedtls_root}/library/asn1write.c", |
| "${_mbedtls_root}/library/base64.c", |
| "${_mbedtls_root}/library/bignum.c", |
| "${_mbedtls_root}/library/blowfish.c", |
| "${_mbedtls_root}/library/camellia.c", |
| "${_mbedtls_root}/library/ccm.c", |
| "${_mbedtls_root}/library/certs.c", |
| "${_mbedtls_root}/library/chacha20.c", |
| "${_mbedtls_root}/library/chachapoly.c", |
| "${_mbedtls_root}/library/cipher.c", |
| "${_mbedtls_root}/library/cipher_wrap.c", |
| "${_mbedtls_root}/library/cmac.c", |
| "${_mbedtls_root}/library/constant_time.c", |
| "${_mbedtls_root}/library/ctr_drbg.c", |
| "${_mbedtls_root}/library/debug.c", |
| "${_mbedtls_root}/library/des.c", |
| "${_mbedtls_root}/library/dhm.c", |
| "${_mbedtls_root}/library/ecdh.c", |
| "${_mbedtls_root}/library/ecdsa.c", |
| "${_mbedtls_root}/library/ecjpake.c", |
| "${_mbedtls_root}/library/ecp.c", |
| "${_mbedtls_root}/library/ecp_curves.c", |
| "${_mbedtls_root}/library/entropy.c", |
| "${_mbedtls_root}/library/entropy_poll.c", |
| "${_mbedtls_root}/library/error.c", |
| "${_mbedtls_root}/library/gcm.c", |
| "${_mbedtls_root}/library/havege.c", |
| "${_mbedtls_root}/library/hkdf.c", |
| "${_mbedtls_root}/library/hmac_drbg.c", |
| "${_mbedtls_root}/library/md.c", |
| "${_mbedtls_root}/library/md2.c", |
| "${_mbedtls_root}/library/md4.c", |
| "${_mbedtls_root}/library/md5.c", |
| "${_mbedtls_root}/library/memory_buffer_alloc.c", |
| "${_mbedtls_root}/library/net_sockets.c", |
| "${_mbedtls_root}/library/nist_kw.c", |
| "${_mbedtls_root}/library/oid.c", |
| "${_mbedtls_root}/library/padlock.c", |
| "${_mbedtls_root}/library/pem.c", |
| "${_mbedtls_root}/library/pk.c", |
| "${_mbedtls_root}/library/pk_wrap.c", |
| "${_mbedtls_root}/library/pkcs11.c", |
| "${_mbedtls_root}/library/pkcs12.c", |
| "${_mbedtls_root}/library/pkcs5.c", |
| "${_mbedtls_root}/library/pkparse.c", |
| "${_mbedtls_root}/library/pkwrite.c", |
| "${_mbedtls_root}/library/platform.c", |
| "${_mbedtls_root}/library/platform_util.c", |
| "${_mbedtls_root}/library/poly1305.c", |
| "${_mbedtls_root}/library/psa_crypto.c", |
| "${_mbedtls_root}/library/psa_crypto_driver_wrappers.c", |
| "${_mbedtls_root}/library/psa_crypto_se.c", |
| "${_mbedtls_root}/library/psa_crypto_slot_management.c", |
| "${_mbedtls_root}/library/psa_crypto_storage.c", |
| "${_mbedtls_root}/library/psa_its_file.c", |
| "${_mbedtls_root}/library/ripemd160.c", |
| "${_mbedtls_root}/library/rsa.c", |
| "${_mbedtls_root}/library/rsa_internal.c", |
| "${_mbedtls_root}/library/sha1.c", |
| "${_mbedtls_root}/library/sha256.c", |
| "${_mbedtls_root}/library/sha512.c", |
| "${_mbedtls_root}/library/ssl_cache.c", |
| "${_mbedtls_root}/library/ssl_ciphersuites.c", |
| "${_mbedtls_root}/library/ssl_cli.c", |
| "${_mbedtls_root}/library/ssl_cookie.c", |
| "${_mbedtls_root}/library/ssl_msg.c", |
| "${_mbedtls_root}/library/ssl_srv.c", |
| "${_mbedtls_root}/library/ssl_ticket.c", |
| "${_mbedtls_root}/library/ssl_tls.c", |
| "${_mbedtls_root}/library/ssl_tls13_keys.c", |
| "${_mbedtls_root}/library/threading.c", |
| "${_mbedtls_root}/library/timing.c", |
| "${_mbedtls_root}/library/version.c", |
| "${_mbedtls_root}/library/version_features.c", |
| "${_mbedtls_root}/library/x509.c", |
| "${_mbedtls_root}/library/x509_create.c", |
| "${_mbedtls_root}/library/x509_crl.c", |
| "${_mbedtls_root}/library/x509_crt.c", |
| "${_mbedtls_root}/library/x509_csr.c", |
| "${_mbedtls_root}/library/x509write_crt.c", |
| "${_mbedtls_root}/library/x509write_csr.c", |
| "${_mbedtls_root}/library/xtea.c", |
| ] |
| |
| if (!defined(configs)) { |
| configs = [] |
| } |
| |
| # Relax warnings for third_party code. |
| configs += [ ":${mbedtls_target_name}_warnings" ] |
| |
| if (!defined(public_configs)) { |
| public_configs = [] |
| } |
| |
| public_configs += [ ":mbedtls_config" ] |
| |
| output_name = "libmbedtls" |
| output_dir = "${root_out_dir}/lib" |
| } |
| } |