| # Copyright 2018 The Chromium OS Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| import("//common-mk/pkg_config.gni") |
| import("//common-mk/proto_library.gni") |
| |
| group("all") { |
| deps = [ |
| ":g2ftool", |
| ":u2fd", |
| ":webauthntool", |
| ] |
| if (use.test) { |
| deps += [ |
| ":g2f_client_test", |
| ":u2fd_test_runner", |
| ] |
| } |
| if (use.fuzzer) { |
| deps += [ ":u2f_adpu_fuzzer" ] |
| } |
| } |
| |
| pkg_config("target_defaults") { |
| pkg_deps = [ |
| "libbrillo", |
| "libchrome", |
| "libsession_manager-client", |
| ] |
| } |
| |
| pkg_config("u2fd_config") { |
| # NOSORT |
| pkg_deps = [ |
| "libattestation-client", |
| "libcryptohome-client", |
| "libmetrics", |
| "libpower_manager-client", |
| "libtrunks", |
| "openssl", |
| |
| # system_api depends on protobuf (or protobuf-lite). It must appear |
| # before protobuf here or the linker flags won't be in the right |
| # order. |
| "system_api", |
| ] |
| if (use.fuzzer) { |
| pkg_deps += [ "protobuf" ] |
| } else { |
| pkg_deps += [ "protobuf-lite" ] |
| } |
| } |
| |
| static_library("libu2fd") { |
| configs += [ |
| ":target_defaults", |
| ":u2fd_config", |
| ] |
| sources = [ |
| "allowlisting_util.cc", |
| "tpm_vendor_cmd.cc", |
| "u2f_adpu.cc", |
| "u2f_daemon.cc", |
| "u2f_msg_handler.cc", |
| "u2fhid.cc", |
| "uhid_device.cc", |
| "user_state.cc", |
| "util.cc", |
| "webauthn_handler.cc", |
| "webauthn_storage.cc", |
| ] |
| libs = [ |
| "policy", |
| "cbor", |
| ] |
| deps = [ |
| ":user_state_proto", |
| "//common-mk/external_dependencies:policy-protos", |
| ] |
| } |
| |
| executable("u2fd") { |
| configs += [ ":target_defaults" ] |
| sources = [ "main.cc" ] |
| libs = [ "policy" ] |
| deps = [ ":libu2fd" ] |
| } |
| |
| proto_library("user_state_proto") { |
| proto_in_dir = "." |
| proto_out_dir = "include/u2fd" |
| sources = [ "user_state.proto" ] |
| } |
| |
| executable("g2ftool") { |
| configs += [ ":target_defaults" ] |
| sources = [ "g2f_tools/g2ftool.cc" ] |
| deps = [ ":libg2fclient" ] |
| } |
| |
| pkg_config("webauthntool_config") { |
| # NOSORT |
| pkg_deps = [ |
| # system_api depends on protobuf (or protobuf-lite). It must appear |
| # before protobuf here or the linker flags won't be in the right |
| # order. |
| "system_api", |
| ] |
| if (use.fuzzer) { |
| pkg_deps += [ "protobuf" ] |
| } else { |
| pkg_deps += [ "protobuf-lite" ] |
| } |
| } |
| |
| executable("webauthntool") { |
| configs += [ |
| ":target_defaults", |
| ":webauthntool_config", |
| ] |
| sources = [ "g2f_tools/webauthntool.cc" ] |
| } |
| |
| static_library("libg2fclient") { |
| configs += [ ":target_defaults" ] |
| sources = [ "g2f_tools/g2f_client.cc" ] |
| libs = [ "hidapi-hidraw" ] |
| } |
| |
| if (use.test) { |
| pkg_config("g2f_client_test_config") { |
| pkg_deps = [ "libchrome-test" ] |
| } |
| |
| executable("g2f_client_test") { |
| configs += [ |
| "//common-mk:test", |
| ":target_defaults", |
| ":g2f_client_test_config", |
| ] |
| sources = [ |
| "g2f_tools/g2f_client.cc", |
| "g2f_tools/g2f_client_test.cc", |
| ] |
| deps = [ "//common-mk/testrunner" ] |
| } |
| |
| pkg_config("u2fd_test_config") { |
| pkg_deps = [ |
| "libbrillo-test", |
| "libchrome-test", |
| ] |
| } |
| |
| executable("u2fd_test_runner") { |
| configs += [ |
| "//common-mk:test", |
| ":target_defaults", |
| ":u2fd_config", |
| ":u2fd_test_config", |
| ] |
| sources = [ |
| "allowlisting_util_test.cc", |
| "u2f_msg_handler_test.cc", |
| "webauthn_handler_test.cc", |
| "webauthn_storage_test.cc", |
| ] |
| deps = [ |
| ":libu2fd", |
| "//common-mk/testrunner", |
| ] |
| } |
| } |
| |
| if (use.fuzzer) { |
| executable("u2f_adpu_fuzzer") { |
| configs += [ |
| "//common-mk/common_fuzzer:common_fuzzer", |
| ":target_defaults", |
| ] |
| pkg_deps = [ |
| "libtrunks", |
| "openssl", |
| ] |
| sources = [ |
| "tpm_vendor_cmd.cc", |
| "u2f_adpu.cc", |
| "u2f_adpu_fuzzer.cc", |
| "util.cc", |
| ] |
| } |
| } |