# Copyright 2023 The Pigweed 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 # # https://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/pigweed.gni") import("$dir_pw_fuzzer/fuzzer.gni") import("$dir_pw_unit_test/test.gni") config("public_include_path") { include_dirs = [ "public" ] } pw_source_set("definitions") { sources = [ "error.cc", "packet.cc", "types.cc", ] public = [ "public/pw_bluetooth_sapphire/internal/host/sm/delegate.h", "public/pw_bluetooth_sapphire/internal/host/sm/error.h", "public/pw_bluetooth_sapphire/internal/host/sm/packet.h", "public/pw_bluetooth_sapphire/internal/host/sm/smp.h", "public/pw_bluetooth_sapphire/internal/host/sm/types.h", ] public_configs = [ ":public_include_path" ] public_deps = [ "$dir_pw_bluetooth_sapphire/host/common", "$dir_pw_bluetooth_sapphire/host/hci-spec", # hci_spec::LinkKey "$dir_pw_chrono:system_clock", "$dir_pw_third_party/fuchsia:fit", ] deps = [ "$dir_pw_bluetooth_sapphire/lib/cpp-string", dir_pw_preprocessor, dir_pw_string, ] } pw_source_set("sm") { sources = [ "ecdh_key.cc", "pairing_channel.cc", "pairing_phase.cc", "phase_1.cc", "phase_2_legacy.cc", "phase_2_secure_connections.cc", "phase_3.cc", "sc_stage_1_just_works_numeric_comparison.cc", "sc_stage_1_passkey.cc", "security_manager.cc", "security_request_phase.cc", "util.cc", ] public = [ "public/pw_bluetooth_sapphire/internal/host/sm/ecdh_key.h", "public/pw_bluetooth_sapphire/internal/host/sm/pairing_channel.h", "public/pw_bluetooth_sapphire/internal/host/sm/pairing_phase.h", "public/pw_bluetooth_sapphire/internal/host/sm/phase_1.h", "public/pw_bluetooth_sapphire/internal/host/sm/phase_2_legacy.h", "public/pw_bluetooth_sapphire/internal/host/sm/phase_2_secure_connections.h", "public/pw_bluetooth_sapphire/internal/host/sm/phase_3.h", "public/pw_bluetooth_sapphire/internal/host/sm/sc_stage_1.h", "public/pw_bluetooth_sapphire/internal/host/sm/sc_stage_1_just_works_numeric_comparison.h", "public/pw_bluetooth_sapphire/internal/host/sm/sc_stage_1_passkey.h", "public/pw_bluetooth_sapphire/internal/host/sm/security_manager.h", "public/pw_bluetooth_sapphire/internal/host/sm/security_request_phase.h", "public/pw_bluetooth_sapphire/internal/host/sm/util.h", ] public_configs = [ ":public_include_path" ] public_deps = [ ":definitions", "$dir_pw_bluetooth_sapphire:config", "$dir_pw_bluetooth_sapphire/host/gap:definitions", "$dir_pw_bluetooth_sapphire/host/gap:peer", "$dir_pw_bluetooth_sapphire/host/hci", "$dir_pw_bluetooth_sapphire/host/l2cap", "$dir_pw_crypto:aes", "$dir_pw_crypto:aes_cmac", "$dir_pw_third_party/boringssl", "$dir_pw_third_party/fuchsia:fit", dir_pw_string, ] } pw_source_set("testing") { sources = [ "test_security_manager.cc" ] public = [ "public/pw_bluetooth_sapphire/internal/host/sm/fake_phase_listener.h", "public/pw_bluetooth_sapphire/internal/host/sm/test_security_manager.h", ] public_configs = [ ":public_include_path" ] deps = [ ":definitions", ":sm", "$dir_pw_bluetooth_sapphire/host/common", "$dir_pw_bluetooth_sapphire/host/gap:definitions", "$dir_pw_bluetooth_sapphire/host/hci", "$dir_pw_bluetooth_sapphire/host/hci-spec", "$dir_pw_bluetooth_sapphire/host/l2cap", ] } pw_test("sm_tests") { enable_if = pw_unit_test_BACKEND == "$dir_pw_unit_test:googletest" sources = [ "ecdh_key_test.cc", "error_test.cc", "packet_test.cc", "pairing_channel_test.cc", "pairing_phase_test.cc", "phase_1_test.cc", "phase_2_legacy_test.cc", "phase_2_secure_connections_test.cc", "phase_3_test.cc", "sc_stage_1_just_works_numeric_comparison_test.cc", "sc_stage_1_passkey_test.cc", "security_manager_test.cc", "security_request_phase_test.cc", "types_test.cc", "util_test.cc", ] test_main = "$dir_pw_bluetooth_sapphire/host/testing:gtest_main" deps = [ ":sm", ":testing", "$dir_pw_bluetooth_sapphire/host/hci:testing", "$dir_pw_bluetooth_sapphire/host/l2cap:testing", "$dir_pw_bluetooth_sapphire/host/testing", "$dir_pw_bluetooth_sapphire/host/testing:mock_controller", "$dir_pw_bluetooth_sapphire/host/testing:test_helpers", ] } pw_fuzzer("valid_packet_reader_fuzzer") { sources = [ "valid_packet_reader_parse_sdu_fuzztest.cc" ] deps = [ ":definitions" ] } pw_test_group("tests") { tests = [ ":sm_tests", ":valid_packet_reader_fuzzer_test", ] }