| # Copyright 2019 The Fuchsia 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/bind/bind.gni") |
| import("//build/components.gni") |
| import("//build/drivers.gni") |
| import("//build/test.gni") |
| |
| fuchsia_driver("zxcrypt-driver") { |
| output_name = "zxcrypt" |
| configs += [ |
| "//build/config:all_source", |
| "//build/config/fuchsia:enable_zircon_asserts", |
| ] |
| |
| sources = [ |
| "device-info.cc", |
| "device-manager.cc", |
| "device.cc", |
| "extra.cc", |
| "queue.h", |
| "worker.cc", |
| ] |
| |
| configs += [ "//build/config/fuchsia:integer-paranoia" ] |
| |
| # Until library loading is fully async, dynamically linking libraries can |
| # deadlock block device drviers. All dependencies for zxcrypt should be |
| # static or already linked by the devhost. We consider libc, libzircon, and |
| # libdriver safe to depend on dynamically here. |
| deps = [ |
| ":bind", |
| "//sdk/banjo/fuchsia.hardware.block.partition:fuchsia.hardware.block.partition_banjo_cpp", |
| "//sdk/banjo/fuchsia.hardware.block.volume:fuchsia.hardware.block.volume_banjo_cpp", |
| "//sdk/fidl/fuchsia.hardware.block.driver:fuchsia.hardware.block.driver_banjo_cpp", |
| "//sdk/fidl/fuchsia.hardware.block.encrypted:fuchsia.hardware.block.encrypted_cpp", |
| "//src/devices/lib/driver", |
| "//src/lib/ddk", |
| "//src/lib/ddktl", |
| "//src/lib/uuid", |
| "//src/security/lib/fcrypto", |
| "//src/security/lib/zxcrypt:zxcrypt-dev", |
| "//zircon/system/ulib/bitmap", |
| "//zircon/system/ulib/fbl", |
| "//zircon/system/ulib/inspect", |
| "//zircon/system/ulib/pretty", |
| "//zircon/system/ulib/sync", |
| "//zircon/system/ulib/trace", |
| "//zircon/system/ulib/zx", |
| "//zircon/third_party/ulib/safemath", |
| ] |
| |
| # Make sure we don't accidentally pull in a couple of easily-added dynamic |
| # library dependencies. |
| assert_no_deps = [ |
| # This seems to get pulled in by //src/devices/lib/driver, which is |
| # needed by //src/security/lib/zxcrypt:zxcrypt-dev. But happily it doesn't show |
| # up in our dynamically-linked shared libraries, so we're okay. |
| #"//zircon/system/ulib/trace-engine", |
| |
| # Some day, we'd also like to be able to assert we don't pull in fdio here, |
| # but it is pulled in transitively by //src/devices/lib/driver, which is |
| # needed by //src/security/lib/zxcrypt:zxcrypt-dev for the symbol |
| # |device_get_protocol|. |
| #"//sdk/lib/fdio", |
| "//src/security/lib/zxcrypt:zxcrypt-client", |
| "//src/security/lib/zxcrypt:zxcrypt-fdio", |
| ] |
| |
| # TODO(https://fxbug.dev/42085293): delete the below and fix compiler warnings |
| configs += [ "//build/config:Wno-vla-cxx-extension" ] |
| } |
| |
| fuchsia_driver_component("zxcrypt") { |
| visibility = [ ":*" ] |
| component_name = "zxcrypt" |
| deps = [ ":zxcrypt-driver" ] |
| info = "zxcrypt-info.json" |
| manifest = "meta/zxcrypt.cml" |
| } |
| |
| fuchsia_driver_package("package") { |
| package_name = "zxcrypt" |
| driver_components = [ ":zxcrypt" ] |
| } |
| |
| driver_bind_rules("bind") { |
| rules = "zxcrypt.bind" |
| bind_output = "zxcrypt.bindbc" |
| deps = [ "//src/devices/bind/fuchsia.block" ] |
| } |
| |
| bind_test("zxcrypt-bind-test") { |
| rules = "zxcrypt.bind" |
| tests = "bind-tests.json" |
| deps = [ "//src/devices/bind/fuchsia.block" ] |
| } |
| |
| test("device-manager-test-bin") { |
| configs += [ |
| "//build/config:all_source", |
| "//build/config/fuchsia:enable_zircon_asserts", |
| ] |
| output_name = "device-manager-test" |
| sources = [ "device-manager-test.cc" ] |
| deps = [ |
| "//sdk/lib/diagnostics/reader/cpp", |
| "//sdk/lib/inspect/testing/cpp", |
| "//src/devices/block/drivers/ramdisk", |
| "//src/devices/block/drivers/zxcrypt", |
| "//src/devices/testing/driver-integration-test-shim", |
| "//src/lib/fxl", |
| "//src/lib/fxl/test:gtest_main", |
| "//src/lib/testing/loop_fixture", |
| "//src/lib/uuid", |
| "//src/security/lib/fcrypto", |
| "//src/security/lib/zxcrypt:zxcrypt-client", |
| "//src/security/lib/zxcrypt:zxcrypt-dev", |
| "//src/storage/lib/ramdevice_client/cpp", |
| "//zircon/system/ulib/inspect", |
| ] |
| } |
| |
| fuchsia_unittest_package("device-manager-test") { |
| manifest = "meta/device-manager-test.cml" |
| deps = [ |
| ":device-manager-test-bin", |
| "//src/devices/block/drivers/core", |
| "//src/devices/block/drivers/ramdisk", |
| "//src/devices/block/drivers/zxcrypt", |
| "//src/devices/bus/drivers/platform", |
| ] |
| test_specs = { |
| log_settings = { |
| max_severity = "ERROR" |
| } |
| } |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ |
| ":device-manager-test", |
| ":zxcrypt-bind-test", |
| ] |
| } |