| # Copyright 2022 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/components.gni") |
| import("//build/rust/rustc_library.gni") |
| |
| # tpm is a Rust library built on top of the rust bindgen for tss2 that presents |
| # an ergonomic interface for interacting with the Trusted Platform Module 2.0 |
| # for the Fuchsia platform. This library is fit for purpose and not intended |
| # for general use across the system but instead as the foundation to |
| # implementation fucshia.tpm FIDL protocols. |
| |
| common_source = [ |
| "src/lib.rs", |
| "src/tpm.rs", |
| "src/tss/context.rs", |
| "src/tss/tcti.rs", |
| "src/tss/heap.rs", |
| "src/capability.rs", |
| "src/hierarchy.rs", |
| "src/error.rs", |
| "src/util.rs", |
| "src/session.rs", |
| "src/tss/mod.rs", |
| "src/tss/return_code.rs", |
| ] |
| |
| common_deps = [ |
| "//third_party/rust_crates:hex", |
| "//third_party/rust_crates:thiserror", |
| "//third_party/tpm2-tss/rust/tpm2-tss-sys", |
| ] |
| |
| # Library target when communicating over the fuchsia.tpm.Command interface |
| # this is almost always the interface you will want to interact with. |
| rustc_library("tpm-agent") { |
| version = "1.0.0" |
| edition = "2021" |
| with_unit_tests = true |
| deps = common_deps |
| non_rust_deps = [ |
| "//third_party/tpm2-tss:tss2-esys", |
| "//third_party/tpm2-tss:tss2-tcti-fuchsia-agent", |
| ] |
| sources = common_source |
| } |
| |
| # Library target when communicating over the fuchsia.tpm.TpmDevice interface |
| # this is exclusively used by implementors of the fuchsia.tpm.* protocol and |
| # is not for general purpose use. |
| rustc_library("tpm-device") { |
| version = "1.0.0" |
| edition = "2021" |
| with_unit_tests = true |
| deps = common_deps |
| non_rust_deps = [ |
| "//third_party/tpm2-tss:tss2-esys", |
| "//third_party/tpm2-tss:tss2-tcti-fuchsia-device", |
| ] |
| sources = common_source |
| } |
| |
| fuchsia_unittest_package("tpm-tests") { |
| deps = [ ":tpm-device_test" ] |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ ":tpm-tests" ] |
| } |