# Copyright 2016 The Chromium 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("//build/config/features.gni") import("//testing/libfuzzer/fuzzer_test.gni") component("fido") { sources = [ "attestation_object.cc", "attestation_object.h", "attestation_statement.cc", "attestation_statement.h", "attestation_statement_formats.cc", "attestation_statement_formats.h", "attested_credential_data.cc", "attested_credential_data.h", "authenticator_data.cc", "authenticator_data.h", "authenticator_get_assertion_response.cc", "authenticator_get_assertion_response.h", "authenticator_get_info_response.cc", "authenticator_get_info_response.h", "authenticator_make_credential_response.cc", "authenticator_make_credential_response.h", "authenticator_selection_criteria.cc", "authenticator_selection_criteria.h", "authenticator_supported_options.cc", "authenticator_supported_options.h", "ble/fido_ble_connection.cc", "ble/fido_ble_connection.h", "ble/fido_ble_device.cc", "ble/fido_ble_device.h", "ble/fido_ble_discovery.cc", "ble/fido_ble_discovery.h", "ble/fido_ble_discovery_base.cc", "ble/fido_ble_discovery_base.h", "ble/fido_ble_frames.cc", "ble/fido_ble_frames.h", "ble/fido_ble_transaction.cc", "ble/fido_ble_transaction.h", "ble/fido_ble_uuids.cc", "ble/fido_ble_uuids.h", "cable/fido_cable_device.cc", "cable/fido_cable_device.h", "cable/fido_cable_discovery.cc", "cable/fido_cable_discovery.h", "cable/fido_cable_handshake_handler.cc", "cable/fido_cable_handshake_handler.h", "ctap2_device_operation.h", "ctap_empty_authenticator_request.cc", "ctap_empty_authenticator_request.h", "ctap_get_assertion_request.cc", "ctap_get_assertion_request.h", "ctap_make_credential_request.cc", "ctap_make_credential_request.h", "device_operation.h", "device_response_converter.cc", "device_response_converter.h", "ec_public_key.cc", "ec_public_key.h", "fido_authenticator.h", "fido_constants.cc", "fido_constants.h", "fido_device.cc", "fido_device.h", "fido_device_authenticator.cc", "fido_device_authenticator.h", "fido_discovery.cc", "fido_discovery.h", "fido_parsing_utils.cc", "fido_parsing_utils.h", "fido_request_handler.h", "fido_request_handler_base.cc", "fido_request_handler_base.h", "fido_task.cc", "fido_task.h", "fido_transport_protocol.cc", "fido_transport_protocol.h", "get_assertion_request_handler.cc", "get_assertion_request_handler.h", "get_assertion_task.cc", "get_assertion_task.h", "hid/fido_hid_message.cc", "hid/fido_hid_message.h", "hid/fido_hid_packet.cc", "hid/fido_hid_packet.h", "make_credential_request_handler.cc", "make_credential_request_handler.h", "make_credential_task.cc", "make_credential_task.h", "opaque_attestation_statement.cc", "opaque_attestation_statement.h", "opaque_public_key.cc", "opaque_public_key.h", "public_key.cc", "public_key.h", "public_key_credential_descriptor.cc", "public_key_credential_descriptor.h", "public_key_credential_params.cc", "public_key_credential_params.h", "public_key_credential_rp_entity.cc", "public_key_credential_rp_entity.h", "public_key_credential_user_entity.cc", "public_key_credential_user_entity.h", "response_data.cc", "response_data.h", "u2f_command_constructor.cc", "u2f_command_constructor.h", "u2f_register_operation.cc", "u2f_register_operation.h", "u2f_sign_operation.cc", "u2f_sign_operation.h", "virtual_ctap2_device.cc", "virtual_ctap2_device.h", "virtual_fido_device.cc", "virtual_fido_device.h", "virtual_u2f_device.cc", "virtual_u2f_device.h", ] defines = [ "IS_DEVICE_FIDO_IMPL" ] deps = [ "//components/apdu", "//components/cbor", "//crypto", "//device/base", "//services/service_manager/public/cpp", "//services/service_manager/public/mojom", "//third_party/boringssl", ] public_deps = [ "//base", "//device/bluetooth", "//services/device/public/mojom", ] libs = [] # Extended for mac. # HID is not supported on Android. if (!is_android) { sources += [ "hid/fido_hid_device.cc", "hid/fido_hid_device.h", "hid/fido_hid_discovery.cc", "hid/fido_hid_discovery.h", ] deps += [ "//services/device/public/cpp/hid", "//services/device/public/mojom", ] } if (is_mac) { sources += [ "mac/authenticator.h", "mac/authenticator.mm", "mac/browsing_data_deletion.h", "mac/browsing_data_deletion.mm", "mac/credential_metadata.cc", "mac/credential_metadata.h", "mac/get_assertion_operation.h", "mac/get_assertion_operation.mm", "mac/keychain.h", "mac/keychain.mm", "mac/make_credential_operation.h", "mac/make_credential_operation.mm", "mac/operation.h", "mac/operation_base.h", "mac/touch_id_context.h", "mac/touch_id_context.mm", "mac/util.h", "mac/util.mm", ] libs += [ "Foundation.framework", "LocalAuthentication.framework", "Security.framework", ] } } source_set("mocks") { testonly = true sources = [ "ble/mock_fido_ble_connection.cc", "ble/mock_fido_ble_connection.h", "mock_fido_device.cc", "mock_fido_device.h", "mock_fido_discovery_observer.cc", "mock_fido_discovery_observer.h", ] deps = [ ":fido", "//base", "//components/apdu", "//testing/gmock", ] } fuzzer_test("fido_hid_message_fuzzer") { sources = [ "hid/fido_hid_message_fuzzer.cc", ] deps = [ ":fido", "//base", ] libfuzzer_options = [ "max_len=2048" ] } fuzzer_test("fido_ble_frames_fuzzer") { sources = [ "ble/fido_ble_frames_fuzzer.cc", ] deps = [ ":fido", ] libfuzzer_options = [ "max_len=65535" ] } fuzzer_test("ctap_response_fuzzer") { sources = [ "ctap_response_fuzzer.cc", ] deps = [ ":fido", "//base", "//base:i18n", ] seed_corpus = "response_data_fuzzer_corpus/" libfuzzer_options = [ "max_len=65537" ] } fuzzer_test("fido_cable_handshake_handler_fuzzer") { sources = [ "cable/fido_cable_handshake_handler_fuzzer.cc", ] deps = [ ":fido", "//base", "//device/bluetooth:mocks", "//testing/gmock", "//testing/gtest", ] libfuzzer_options = [ "max_len=2048" ] } is_linux_without_udev = is_linux && !use_udev source_set("test_support") { testonly = true sources = [ "fake_fido_discovery.cc", "fake_fido_discovery.h", "scoped_virtual_fido_device.cc", "scoped_virtual_fido_device.h", "test_callback_receiver.h", ] deps = [ "//base", "//components/apdu", "//device/fido", "//mojo/public/cpp/bindings", "//services/device/public/mojom", "//testing/gmock", "//testing/gtest", ] # Android doesn't compile. Linux requires udev. if (!is_linux_without_udev && !is_android) { sources += [ "hid/fake_hid_impl_for_testing.cc", "hid/fake_hid_impl_for_testing.h", ] } if (is_mac) { sources += [ "mac/fake_keychain.h", "mac/fake_keychain.mm", "mac/fake_touch_id_context.h", "mac/fake_touch_id_context.mm", "mac/scoped_touch_id_test_environment.h", "mac/scoped_touch_id_test_environment.mm", ] } }