blob: fb0e4dd8437fa41d30c61a0effaf71d55752d5cd [file] [log] [blame]
# 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:fuchsia.hardware.block_banjo_cpp",
"//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.encrypted:fuchsia.hardware.block.encrypted_llcpp",
"//sdk/lib/sys/inspect/cpp",
"//src/devices/lib/driver",
"//src/lib/ddk",
"//src/lib/ddktl",
"//src/lib/uuid",
"//src/security/fcrypto",
"//src/security/zxcrypt:zxcrypt-dev",
"//zircon/system/ulib/bitmap",
"//zircon/system/ulib/fbl",
"//zircon/system/ulib/pretty",
"//zircon/system/ulib/sync",
"//zircon/system/ulib/trace:trace-driver",
"//zircon/system/ulib/zx",
]
# 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 //zircon/public/lib/driver, which is
# needed by //src/security/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 //zircon/public/lib/driver, which is
# needed by //src/security/zxcrypt:zxcrypt-dev for the symbol
# |device_get_protocol|.
#"//sdk/lib/fdio",
"//src/security/zxcrypt:zxcrypt-client",
"//src/security/zxcrypt:zxcrypt-fdio",
]
}
fuchsia_driver_component("zxcrypt") {
component_name = "zxcrypt"
deps = [ ":zxcrypt-driver" ]
info = "zxcrypt-info.json"
}
driver_bind_rules("bind") {
disable_autobind = true
rules = "zxcrypt.bind"
header_output = "zxcrypt-bind.h"
bind_output = "zxcrypt.bindbc"
deps = [ "//src/devices/bind/fuchsia.hardware.block" ]
}
bind_test("zxcrypt-bind-test") {
rules = "zxcrypt.bind"
tests = "bind-tests.json"
deps = [ "//src/devices/bind/fuchsia.hardware.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/sys/inspect/cpp",
"//src/devices/block/drivers/ramdisk",
"//src/devices/block/drivers/zxcrypt",
"//src/devices/testing/driver-integration-test-shim",
"//src/lib/fxl",
"//src/lib/storage/ramdevice_client/cpp",
"//src/lib/uuid",
"//src/security/fcrypto",
"//src/security/zxcrypt:zxcrypt-client",
"//src/security/zxcrypt:zxcrypt-dev",
"//zircon/system/ulib/zxtest",
]
}
fuchsia_unittest_package("device-manager-test") {
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",
]
}