1# Copyright 2021 The Pigweed Authors 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); you may not 4# use this file except in compliance with the License. You may obtain a copy of 5# the License at 6# 7# https://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, WITHOUT 11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12# License for the specific language governing permissions and limitations under 13# the License. 14 15import("//build_overrides/pigweed.gni") 16import("$dir_pw_build/facade.gni") 17import("$dir_pw_build/target_types.gni") 18import("$dir_pw_docgen/docs.gni") 19import("$dir_pw_third_party/boringssl/boringssl.gni") 20import("$dir_pw_tls_client/configs.gni") 21import("$dir_pw_unit_test/test.gni") 22 23config("public_includes") { 24 include_dirs = [ "public" ] 25} 26 27pw_facade("pw_tls_client") { 28 backend = pw_tls_client_BACKEND 29 public_configs = [ ":public_includes" ] 30 public = [ 31 "public/pw_tls_client/options.h", 32 "public/pw_tls_client/session.h", 33 "public/pw_tls_client/status.h", 34 ] 35 public_deps = [ 36 "$dir_pw_assert", 37 "$dir_pw_bytes", 38 "$dir_pw_result", 39 "$dir_pw_status", 40 "$dir_pw_stream", 41 "$dir_pw_string", 42 ] 43} 44 45pw_facade("tls_entropy") { 46 backend = pw_tls_client_ENTROPY_BACKEND 47 public_configs = [ ":public_includes" ] 48 public = [ "public/pw_tls_client/entropy.h" ] 49 public_deps = [ 50 "$dir_pw_bytes", 51 "$dir_pw_status", 52 ] 53} 54 55# A fake entropy source that does nothing. It should only be used for 56# demo and test purpose only. Production code shall not use it. 57pw_source_set("fake_entropy") { 58 public_deps = [ ":tls_entropy.facade" ] 59 sources = [ "fake_entropy.cc" ] 60 deps = [ "$dir_pw_log" ] 61} 62 63pw_facade("time") { 64 backend = pw_tls_client_TIME_BACKEND 65 public = [] 66 67 # The target should only be used by TLS libraries to obtain date time 68 visibility = [ 69 ":*", 70 "$dir_pw_third_party/boringssl", 71 "$dir_pw_third_party/mbedtls", 72 "$dir_pw_third_party/mbedtls:mbedtls_v3", 73 ] 74} 75 76# TODO: b/235290724 - Add a python target to generate source file from the 77# specified CRLSet file in `pw_tls_client_CRLSET_FILE` 78 79pw_source_set("crlset") { 80 public_configs = [ ":public_includes" ] 81 public = [ "public/pw_tls_client/crlset.h" ] 82 public_deps = [ dir_pw_bytes ] 83 84 # TODO: b/235290724 - Add sources generated from a CRLSet file to build. 85} 86 87pw_source_set("test_server") { 88 sources = [ "test_server.cc" ] 89 public_configs = [ ":public_includes" ] 90 public = [ "public/pw_tls_client/test/test_server.h" ] 91 public_deps = [ 92 "$dir_pw_bytes", 93 "$dir_pw_log", 94 "$dir_pw_stream", 95 "$dir_pw_third_party/boringssl", 96 ] 97} 98 99pw_test("test_server_test") { 100 enable_if = dir_pw_third_party_boringssl != "" 101 public_deps = [ 102 ":test_data", 103 ":test_server", 104 ] 105 sources = [ "test_server_test.cc" ] 106} 107 108pw_python_action("generate_test_data") { 109 header_output = "$target_gen_dir/$target_name/test_certs_and_keys.h" 110 script = "py/pw_tls_client/generate_test_data.py" 111 python_deps = [ "py" ] 112 outputs = [ header_output ] 113 args = [ rebase_path(header_output) ] 114} 115 116config("test_data_includes") { 117 test_header_out = get_target_outputs(":generate_test_data") 118 include_dirs = [ get_path_info(test_header_out[0], "dir") ] 119} 120 121group("test_data") { 122 public_deps = [ ":generate_test_data" ] 123 public_configs = [ ":test_data_includes" ] 124} 125 126pw_test_group("tests") { 127 tests = [ ":test_server_test" ] 128} 129 130pw_doc_group("docs") { 131 sources = [ 132 "backends.rst", 133 "docs.rst", 134 ] 135} 136