1# Copyright 2020 The Chromium Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5import("//services/network/public/cpp/features.gni")
6import("//testing/libfuzzer/fuzzer_test.gni")
7import("//third_party/protobuf/proto_library.gni")
8
9source_set("trust_tokens") {
10  visibility = [
11    ":*",
12    "//services/network:network_service",
13    "//services/network:tests",
14  ]
15
16  defines = [ "IS_NETWORK_SERVICE_IMPL" ]
17
18  sources = [
19    "boringssl_trust_token_issuance_cryptographer.cc",
20    "boringssl_trust_token_issuance_cryptographer.h",
21    "boringssl_trust_token_redemption_cryptographer.cc",
22    "boringssl_trust_token_redemption_cryptographer.h",
23    "ed25519_key_pair_generator.cc",
24    "ed25519_key_pair_generator.h",
25    "ed25519_trust_token_request_signer.cc",
26    "ed25519_trust_token_request_signer.h",
27    "expiry_inspecting_record_expiry_delegate.cc",
28    "expiry_inspecting_record_expiry_delegate.h",
29    "has_trust_tokens_answerer.cc",
30    "has_trust_tokens_answerer.h",
31    "in_memory_trust_token_persister.cc",
32    "in_memory_trust_token_persister.h",
33    "local_trust_token_operation_delegate.h",
34    "local_trust_token_operation_delegate_impl.cc",
35    "local_trust_token_operation_delegate_impl.h",
36    "operating_system_matching.cc",
37    "operating_system_matching.h",
38    "operation_timing_request_helper_wrapper.cc",
39    "operation_timing_request_helper_wrapper.h",
40    "pending_trust_token_store.cc",
41    "pending_trust_token_store.h",
42    "scoped_boringssl_bytes.h",
43    "sqlite_trust_token_persister.cc",
44    "sqlite_trust_token_persister.h",
45    "suitable_trust_token_origin.cc",
46    "suitable_trust_token_origin.h",
47    "trust_token_client_data_canonicalization.cc",
48    "trust_token_client_data_canonicalization.h",
49    "trust_token_database_owner.cc",
50    "trust_token_database_owner.h",
51    "trust_token_key_commitment_controller.cc",
52    "trust_token_key_commitment_controller.h",
53    "trust_token_key_commitment_getter.h",
54    "trust_token_key_commitment_parser.cc",
55    "trust_token_key_commitment_parser.h",
56    "trust_token_key_commitments.cc",
57    "trust_token_key_commitments.h",
58    "trust_token_key_filtering.cc",
59    "trust_token_key_filtering.h",
60    "trust_token_operation_metrics_recorder.cc",
61    "trust_token_operation_metrics_recorder.h",
62    "trust_token_parameterization.cc",
63    "trust_token_parameterization.h",
64    "trust_token_persister.h",
65    "trust_token_request_canonicalizer.cc",
66    "trust_token_request_canonicalizer.h",
67    "trust_token_request_helper.h",
68    "trust_token_request_helper_factory.cc",
69    "trust_token_request_helper_factory.h",
70    "trust_token_request_issuance_helper.cc",
71    "trust_token_request_issuance_helper.h",
72    "trust_token_request_redemption_helper.cc",
73    "trust_token_request_redemption_helper.h",
74    "trust_token_request_signing_helper.cc",
75    "trust_token_request_signing_helper.h",
76    "trust_token_store.cc",
77    "trust_token_store.h",
78    "types.cc",
79    "types.h",
80  ]
81
82  deps = [
83    ":storage_proto",
84    "//base",
85    "//base/util/values:values_util",
86    "//components/cbor",
87    "//components/sqlite_proto",
88    "//services/network/public/cpp",
89    "//services/network/public/mojom",
90    "//sql",
91    "//url",
92  ]
93
94  public_deps = [ ":public_proto" ]
95}
96
97source_set("test_support") {
98  testonly = true
99
100  defines = [ "IS_NETWORK_SERVICE_IMPL" ]
101
102  sources = [
103    "test/signed_request_verification_util.cc",
104    "test/signed_request_verification_util.h",
105    "test/test_server_handler_registration.cc",
106    "test/test_server_handler_registration.h",
107    "test/trust_token_request_handler.cc",
108    "test/trust_token_request_handler.h",
109    "test/trust_token_test_util.cc",
110    "test/trust_token_test_util.h",
111  ]
112
113  deps = [
114    ":trust_tokens",
115    "//base",
116    "//base/test:test_support",
117    "//components/cbor",
118    "//net",
119    "//net:test_support",
120    "//net/traffic_annotation:test_support",
121    "//services/network/public/cpp",
122    "//services/network/public/mojom",
123    "//testing/gtest",
124    "//url",
125  ]
126}
127
128source_set("tests") {
129  testonly = true
130
131  defines = [ "IS_NETWORK_SERVICE_IMPL" ]
132
133  sources = [
134    "boringssl_trust_token_issuance_cryptographer_unittest.cc",
135    "ed25519_key_pair_generator_unittest.cc",
136    "ed25519_trust_token_request_signer_unittest.cc",
137    "expiry_inspecting_record_expiry_delegate_unittest.cc",
138    "has_trust_tokens_answerer_unittest.cc",
139    "local_trust_token_operation_delegate_impl_unittest.cc",
140    "pending_trust_token_store_unittest.cc",
141    "sqlite_trust_token_persister_unittest.cc",
142    "suitable_trust_token_origin_unittest.cc",
143    "trust_token_client_data_canonicalization_unittest.cc",
144    "trust_token_cryptographers_test.cc",
145    "trust_token_database_owner_unittest.cc",
146    "trust_token_key_commitment_controller_unittest.cc",
147    "trust_token_key_commitment_parser_unittest.cc",
148    "trust_token_key_commitments_unittest.cc",
149    "trust_token_key_filtering_unittest.cc",
150    "trust_token_operation_metrics_recorder_unittest.cc",
151    "trust_token_persister_unittest.cc",
152    "trust_token_request_canonicalizer_unittest.cc",
153    "trust_token_request_helper_factory_unittest.cc",
154    "trust_token_request_issuance_helper_unittest.cc",
155    "trust_token_request_redemption_helper_unittest.cc",
156    "trust_token_request_signing_helper_unittest.cc",
157    "trust_token_store_unittest.cc",
158    "types_unittest.cc",
159  ]
160
161  deps = [
162    ":public_proto",
163    ":storage_proto",
164    ":test_support",
165    ":trust_tokens",
166    "//base",
167    "//base/test:test_support",
168    "//components/cbor",
169    "//components/sqlite_proto",
170    "//net",
171    "//net:test_support",
172    "//net/traffic_annotation:test_support",
173    "//services/network:test_support",
174    "//testing/gmock",
175    "//testing/gtest",
176    "//url",
177  ]
178}
179
180# public.proto contains datatypes intended
181# to be exposed to Trust Tokens consumers.
182proto_library("public_proto") {
183  sources = [ "proto/public.proto" ]
184
185  extra_configs = [ "//build/config/compiler:wexit_time_destructors" ]
186}
187
188# storage.proto contains datatypes internal
189# to the implementation of Trust Token state
190# persistent storage.
191proto_library("storage_proto") {
192  sources = [ "proto/storage.proto" ]
193  deps = [ ":public_proto" ]
194
195  extra_configs = [ "//build/config/compiler:wexit_time_destructors" ]
196}
197
198fuzzer_test("trust_token_key_commitment_parser_fuzzer") {
199  sources = [ "test/trust_token_key_commitment_parser_fuzzer.cc" ]
200  deps = [
201    ":trust_tokens",
202    "//base",
203    "//net:net_fuzzer_test_support",
204    "//services/network/public/mojom",
205  ]
206  dict = "test/trust_token_key_commitment_parser_fuzzer.dict"
207  seed_corpus = "//third_party/grpc/src/test/core/json/corpus/"
208}
209