1// Copyright 2024 The ChromiumOS Authors 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5// A library for generating TPM commands and parsing TPM responses. Derived from 6// the Chromium OS trunks daemon's TPM code. 7 8rust_library { 9 name: "libtpmclient", 10 crate_name: "tpmclient", 11 host_supported: true, 12 srcs: ["lib.rs"], 13 rustlibs: ["libcxx"], 14 shared_libs: ["libtpmgenerated"], 15} 16 17// cxxbridge generates C++ code that is included in libtpmgenerated. 18genrule { 19 name: "libtpmclient_bridge", 20 tools: ["cxxbridge"], 21 cmd: "$(location cxxbridge) $(in) > $(out)", 22 srcs: ["lib.rs"], 23 out: ["libtpmclient_cxx_generated.cc"], 24} 25 26cc_library { 27 name: "libtpmgenerated", 28 host_supported: true, 29 shared_libs: [ 30 "libbase", 31 "libcrypto", 32 ], 33 srcs: [ 34 "ffi.cc", 35 "hex.cc", 36 "multiple_authorization_delegate.cc", 37 "password_authorization_delegate.cc", 38 "secure_hash.cc", 39 "tpm_generated.cc", 40 ], 41 generated_headers: ["cxx-bridge-header"], 42 generated_sources: ["libtpmclient_bridge"], 43} 44 45cc_test_host { 46 name: "libtpmgenerated_test", 47 srcs: [ 48 "mock_authorization_delegate.cc", 49 "mock_command_transceiver.cc", 50 "tpm_generated_test.cc", 51 ], 52 shared_libs: [ 53 "libtpmgenerated", 54 ], 55 static_libs: [ 56 "libgmock", 57 ], 58} 59