• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2023 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_fuzzer/fuzzer.gni")
17import("$dir_pw_unit_test/test.gni")
18
19dir_public_sm = "../../public/pw_bluetooth_sapphire/internal/host/sm"
20
21pw_source_set("definitions") {
22  public = [
23    "$dir_public_sm/error.h",
24    "$dir_public_sm/packet.h",
25    "$dir_public_sm/smp.h",
26    "$dir_public_sm/types.h",
27  ]
28
29  sources = [
30    "error.cc",
31    "packet.cc",
32    "types.cc",
33  ]
34
35  public_deps = [
36    "$dir_pw_bluetooth_sapphire/host/common",
37    "$dir_pw_bluetooth_sapphire/host/hci-spec",  # hci_spec::LinkKey
38  ]
39}
40
41pw_source_set("sm") {
42  public = [
43    "$dir_public_sm/ecdh_key.h",
44    "$dir_public_sm/pairing_channel.h",
45    "$dir_public_sm/pairing_phase.h",
46    "$dir_public_sm/phase_1.h",
47    "$dir_public_sm/phase_2_legacy.h",
48    "$dir_public_sm/phase_2_secure_connections.h",
49    "$dir_public_sm/phase_3.h",
50    "$dir_public_sm/sc_stage_1.h",
51    "$dir_public_sm/sc_stage_1_just_works_numeric_comparison.h",
52    "$dir_public_sm/sc_stage_1_passkey.h",
53    "$dir_public_sm/security_manager.h",
54    "$dir_public_sm/security_request_phase.h",
55    "$dir_public_sm/util.h",
56  ]
57
58  sources = [
59    "ecdh_key.cc",
60    "pairing_channel.cc",
61    "pairing_phase.cc",
62    "phase_1.cc",
63    "phase_2_legacy.cc",
64    "phase_2_secure_connections.cc",
65    "phase_3.cc",
66    "sc_stage_1_just_works_numeric_comparison.cc",
67    "sc_stage_1_passkey.cc",
68    "security_manager.cc",
69    "security_request_phase.cc",
70    "util.cc",
71  ]
72
73  public_deps = [
74    ":definitions",
75    "$dir_pw_bluetooth_sapphire:config",
76    "$dir_pw_bluetooth_sapphire/host/gap:definitions",
77    "$dir_pw_bluetooth_sapphire/host/hci",
78    "$dir_pw_bluetooth_sapphire/host/l2cap",
79    "$dir_pw_string",
80    "$dir_pw_third_party/boringssl",
81    "$dir_pw_third_party/fuchsia:fit",
82  ]
83}
84
85pw_source_set("testing") {
86  public = [
87    "$dir_public_sm/fake_phase_listener.h",
88    "$dir_public_sm/test_security_manager.h",
89  ]
90
91  sources = [ "test_security_manager.cc" ]
92
93  deps = [ ":sm" ]
94}
95
96pw_test("sm_tests") {
97  sources = [
98    "ecdh_key_test.cc",
99    "error_test.cc",
100    "packet_test.cc",
101    "pairing_channel_test.cc",
102    "pairing_phase_test.cc",
103    "phase_1_test.cc",
104    "phase_2_legacy_test.cc",
105    "phase_2_secure_connections_test.cc",
106    "phase_3_test.cc",
107    "sc_stage_1_just_works_numeric_comparison_test.cc",
108    "sc_stage_1_passkey_test.cc",
109    "security_manager_test.cc",
110    "security_request_phase_test.cc",
111    "types_test.cc",
112    "util_test.cc",
113  ]
114
115  deps = [
116    ":sm",
117    ":testing",
118    "$dir_pw_bluetooth_sapphire/host/hci:testing",
119    "$dir_pw_bluetooth_sapphire/host/l2cap:testing",
120    "$dir_pw_bluetooth_sapphire/host/testing",
121  ]
122
123  test_main = "$dir_pw_bluetooth_sapphire/host/testing:gtest_main"
124}
125
126pw_fuzzer("valid_packet_reader_fuzzer") {
127  sources = [ "valid_packet_reader_parse_sdu_fuzztest.cc" ]
128  deps = [ ":definitions" ]
129}
130
131pw_test_group("tests") {
132  tests = [
133    ":sm_tests",
134    ":valid_packet_reader_fuzzer_test",
135  ]
136}
137